Posts

Showing posts from June, 2010

Configure mod_rewrite in Apache2 on Ubuntu

To configure mod_rewite in ubuntu apache system Goto your terminal and type sudo a2enmod rewrite Then open 000-default from /etc/apache2/sites-enabled in your favourite text editor gedit /etc/apache2/sites-enabled/000-default go and find AllowOverride none replace 'none' with All, like AllowOverride All and restart your apache /etc/initd/apache2 restart thats all

How to find Wine's Directory on Ubuntu - Linux

WINE directory is at ~/.wine the 'fake c:' is at ~/.wine/drive_c

Count the number of Execution of a view before it executes - Drupal

it will count the nuber of execution of a view file in drupal, before it goes on execution. <?php $view = views_get_current_view(); $view->execute(); print $count = count( $view->result ); ?>

Using Module invoke function that works like ‘Include()’:

<?php  $block = module_invoke('views', 'block', 'view', 'testing_lab_type-block_2'); print $block['content']; ?> Notice that the middle two terms ('block', 'view') always stay the same. You're simply updating the first and last term.

Reguler Expression for finding “href’s” value:

Lets take a string $content = "Test <a href=\"http://www.testone.com\">Test Link</a> Tedst <a href=\"http://www.testdone.com\">Testd Link</a> "; We will use follwing reguler expression to find href's values $regex_pattern = "/<a href=\"(.*)\">(.*)<\/a>/"; Matching the string with reguler expression, we get it on $matches[1] place. So complete code is...  <?php  $content = "Test <a href=\"http://www.testone.com\">Test Link</a> Tedst <a href=\"http://www.testdone.com\">Testd Link</a> "; $regex_pattern = "/<a href=\"(.*)\">(.*)<\/a>/"; preg_match_all($regex_pattern,$content,$matches); print $matches[1]; ?>

Change Linux Resolution

xrandr   To change the resolution (monitor display) from the command line ( using a terminal window ) do this: ( when x is running -- don't exit Xwindows just use a terminal window. This is done from the command line. ) [ xrandr ] this command will bring up information like this: SZ: Pixels Physical Refresh 0 1024 x 768 ( 271mm x 201mm ) This will show the resolutions possible on your monitor. The star indicates what is currently being used. To change resolution use a command like this: [ xrandr -s 1024x760 ]