Thursday, February 10, 2011

How to check whether an element exists using jQuery :: Aaron Russell

How to check whether an element exists using jQuery :: Aaron Russell

Sunday, February 6, 2011

isset(), empty(), is_null(), == null

Despite using PHP every day, I had confusion among the above function (empty() and isset() are language constructs)
After some experience with Zend framework, I now use
isset($var)
defined(CONST)
and
null === func()
i could have replaced that with
if (func())
but none of my functions return false, 0, '' in case of an error

Monday, December 20, 2010

Speeding up torrents in uTorrent

Most common reason for slow torrents is that the number of seeds are low or the upload speed of the seeds is limited. To overcome this problem

right click the torrent in uTorrent and select copy magnet URI. The magnet URI is similar to
magnet:?xt=urn:btih:RB4BJJ65RL6OEA5STGYG4ER6WW2K5DFX
here RB4BJJ65RL6OEA5STGYG4ER6WW2K5DFX is a 32 bit hash code

go to http://darkfader.net/toolbox/convert/ and convert the 32 bit hash code into 16 bit hash code. And search for the resulting 16 bit code. The search will give alternate download locations. Download the .torrent files add them to uTorrent and allow uTorrent to add trackers from the file.

This approach will be helpful if the availability of the torrent is low or to verify the authenticity of the torrent

Thursday, November 25, 2010

Take snapshot of an web page

After some searching i found CutyCapt to suit my needs.

After successful installation it gave me the error
QPainter::begin: Paint device returned engine == 0, type: 3

After some searching i found out that that error means that QImage::__construct is failing.
The constructor is failing because i am behind a proxy and CutyCapt did not find any content to create an image

./CutyCapt --url=http://www.google.org --out=example.png --http-proxy=http://144.16.192.245:8080

worked finally

Sunday, November 21, 2010

Apache Mod Rewite

Apache Mod Rewrite is enabled and Rewrite Engine is on, yet rewrite is not working

Likely reason is that AllowOverride is set to None. Changing back to All will resolve the problem
If the problem persists try
RewriteLog logfile
RewiteLogLevel level; 0 - no log 9 - highest 
No log means mod_rewrite is not executing

Saturday, August 21, 2010

xmanager for linux

The title may seem stupid. But believe me that is what I have searched for. I wanted to run the applications of a far_away_computer on a local_computer as of they are applications of local_computer
The steps

  1. In the sshd_config if far_away_computer check for

    X11Forwarding yes
  2. On the local_computer edit ssh_config to have

    ForwardX11 yes
    or use the -X flag every time u connect to far_away_computer
  3. Once you are connected to far_away_computer from local_computer, start xterm on the far_away_computer.

Both ssh_config and sshd_config will be present in either /etc or /etc/ssh

Sunday, August 15, 2010

disable zend layout on home page

$this->_helper->layout()->disableLayout();

where $this represents the controller