Friday, November 29, 2013

Setting textarea height adjusted to the contents

I have a page I would like to print out having <textarea> printed as well.
I would like to have this <textarea> having maximum width, and minimum height, so where there is no data it is only one line, but in case the data spans to, let's say, 10 rows, it expands <textarea> to 10 rows, and no scrollbar appears.

This is what I have found that works for me:

        $(this).height(0) ;
        $(this).height($(this).prop("scrollHeight") + "px") ;
     }) ;

- or similar using pure javascript:;'px';

This way, I can define my textarea (using class tarows) without cols or rows, and say in css to make it 100% width:

.tarows {
    width: 100%; 

<textarea class="tarows">multiline text which will be shown on the whole width of the page, and as many rows as needed.</textarea>

Wednesday, June 5, 2013


logrotate -f /etc/logrotate.conf
Nothing more to say.

Wednesday, January 4, 2012

mediawiki: There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again

If you see:

There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again

Then the problem is with your file system.

Check the status of the file system that holds your /tmp directory.

I bet it is full.

Clean the /tmp directory or delete unneeded files/directories in the file system and you will be good to go.

Saturday, November 26, 2011

Life is Worth Living, CD 11 order of mp3

Something out of the ordinary of this blog...
The "Life is Worth Living, CD 11" has incorrect mp3 order (sequence.)
Just in case someone decided to look for proper here is the correct one:

  1. Life is worth livingk (0).mp3
  2. Life is worth livingk (2).mp3
  3. Life is worth livingk (b14).mp3
  4. Life is worth livingk (3).mp3
  5. Life is worth livingk (b12).mp3
  6. Life is worth livingk (b13).mp3
  7. Life is worth livingk (4).mp3
  8. Life is worth livingk (5).mp3
  9. Life is worth livingk (6).mp3
  10. Life is worth livingk (7).mp3
  11. Life is worth livingk (1).mp3
  12. Life is worth livingk (8).mp3
  13. Life is worth livingk (9).mp3
  14. Life is worth livingk (b10).mp3
  15. Life is worth livingk (b11).mp3

Friday, September 16, 2011

GDB - Accessing deque and queue

In O1 mode some of the functions are optimized out and it is impossible to call them.
In case of deque and queue (which is build over deque) it is a bummer for the size() method is calculated.

After finding some examples on the Internet we found nothing usable (I guess because our gcc was using different deque memory structure.)

So we created a new version.

pdequeue_info variable
- Shows size, first, and last element

pdequeue variable [firstidx [lastidx]]
- Shows contents or a range.

define pdequeue_info
 set $var=($arg0)
 set $sizeof=sizeof( **$var._M_impl._M_start._M_node )
 set $size=$sizeof < 512 ? ( 512 / $sizeof ) : 1
 set $i=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] == 0
  set $i++
 set $rv = 0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] != $var._M_impl._M_finish._M_first
  set $rv += $size
  set $i++
 if $var._M_impl._M_map[ $i ] != 0
  set $rv += $var._M_impl._M_finish._M_cur - $var._M_impl._M_finish._M_first
 printf "size  : "
 p $rv
 if $rv > 0
  printf "first : "
  p *$var._M_impl._M_start._M_cur
  if $rv > 1
   printf "last  : "
   p *( $var._M_impl._M_finish._M_cur - 1 )

define __pdeque_show_group
 set $cur=($arg0)
 set $size=($arg1)
 set $f=($arg2)
 set $l=($arg3)
 set $j=0
 while $j < $size && $n <= $l
  if $n >= $f
    printf "[%i] : ", $n
    p *$cur
  set $cur++
  set $j++
  set $n++
define pdequeue
 set $var=($arg0)
 set $f=-1
 set $l=9999999999
 if $argc == 2
  set $f=($arg1)
  set $l=$f
 if $argc == 3
  set $f=($arg1)
  set $l=($arg2)
 set $sizeof=sizeof( **$var._M_impl._M_start._M_node )
 set $size=$sizeof < 512 ? ( 512 / $sizeof ) : 1
 set $i=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] == 0
  set $i++
 set $n=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] != $var._M_impl._M_finish._M_first && $n <= $l
  __pdeque_show_group $var._M_impl._M_map[$i] $size $f $l
  set $i++
 if $var._M_impl._M_map[ $i ] != 0 && $n <= $l
  __pdeque_show_group $var._M_impl._M_map[$i] $var._M_impl._M_finish._M_cur-$var._M_impl._M_finish._M_first $f $l

Wednesday, June 15, 2011

valgrind - dowloading, building and installing

First, I need to post all the links that will allow you to get to the creators information:

* WWW:
* Manual:
* Source:
* Building Instruction:

* Download the source and put into your home account. Let's assume it is the valgrind-3.6.1 version.
Run these commands:

tar xf $vver.tar.bz2
cd $vver
ulimit -u 100 # ./configure has a bug ...
./configure --prefix=$HOME/valgrind # You need that in order to run make install without root privileges
make install
cd $HOME/valgrind/bin
./valgrind ls -l # see if it bombs out. If it does not you are good to go

Now, what you have is a $HOME/valgrind directory. If this is place where you want to use it then you are ready. The only one thing you need to do is set your path: export PATH=$HOME/valgrind/bin:$PATH

Ok... and what about if you need this valgrind now on a machine that does not have gcc?
The only thing you need to do is to pack the whole $HOME/valgrind directory, and copy it over to the destination machine.
The only caveat is that it has to be put into exactly the same directory as it was built in or else you will see this nice message:
valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory

Solution - ln -s $HOME/valgrind path-to-valgrind-on-the-build-machine
Example: ln -s $HOME/valgrind /home/myhome/valgrind

Sunday, May 16, 2010

Internal Server Error when password protecting directory

Do you see something like that:???

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@blahblah and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

There is a very simple explanation but it took me lots of time to discover the reason. Well, I'm not as good as I would like to be ;)

The reason -> FILE PERMISSION!!!

All directories have to have +xr access for the web server. You may have to make o+xr them.
Also the .htpasswd and .htaccess have to be accessible for the web browser.

Here is my .htaccess in the directory I want to have password protected:

AuthUserFile /home/myhome/.htpasswds/.htpasswd
AuthName "Login Area"
AuthType Basic
require valid-user

Since the web server is 'hosted', so the best thing to do is to run the phpinfo() on the web browser (create p.php file and put <?php phpinfo(); ?> in it) and look for DOCUMENT_ROOT to see where really are your web files located.
Make sure that all the directories leading to .htpasswd and .htaccess are having proper 'read/execute' attributes (644)