Saturday, January 26, 2008

How to search in google from any windows application easily

How often do you find yourself wanting to search in Google when the active application is not your browser? If you too find that copying the text, switching to browser and searching is tedious, read on.

AutoHotKeyI use FeedReader a lot and found myself always doing Google searches of text in it a lot by manually copying word(s) and pasting them in the search box of Firefox. So I thought about a way to quickly perform Google searches by simply pressing a hot key (keyboard shortcut) with text selected in whichever windows program it is in. It’s just 4 lines of code using AutoHotKey.

  1. #s::
  2. Send, ^c
  3. Run, http://www.google.com/search?q=%ClipBoard%
  4. Return

To make use of the above, install AutoHotKey first, paste the above in notepad, give it any file name w/ .ahk extension.Close the file and double click on it. You should see a ‘H’ shaped icon in the system tray. From now on, whenever you wanted to search for a word or bunch of words in any program, simply select that text w/ your mouse and hit ‘S’ key w/ Windows key pressed i.e., Win+S. It will copy the text to clipboard, launch your default browser and present you w/ the results page.

I’ve also set Win+G to do the same like so (append the following to the .ahk file you created above):

  1. #s::
  2. Send, ^c
  3. Run, http://www.google.com/search?q=%ClipBoard%
  4. Return

Similarly, I use the following to visit a website by selecting the link to it (when the URL is in plain text editors like notepad) by pressing Win+U:

  1. #u::
  2. Send, ^c
  3. Run, %ClipBoard%
  4. Return

If you are not interested in installing AutoHotKey for whatever reason, you can acheive the same using the also free HoeKey or by having .exe file of the above code (to convert a .ahk to .exe, you again need AutoHotKey).

How to download from Rapidshare and Megaupload to your web space

RapidLeech is a PHP script using which you input a RapidShare or MegaUpload link to have the file downloaded to your web hosting space. It will essentially give you one additional virtual computer to which you can download from major file sharing services. This is useful since RapidShare limits the number of files (based on file size) that you can download in a given time (This limit also applies to your RapidLeech installation - meaning, you can’t keep downloading for ever, the usual limit still applies).

Rapid Leech is a free server transfer script for use on various popular upload/download sites such as megaupload.com - The script transfers files from rapid share (for example) via your fast servers connection speed and dumps the file on your server.

RapidLeech works with Rapidshare, MegaUpload, MyTempDir, getfile.biz, webfile.ru. Once set up, you can not only download from these file sharing services, but also from any other direct HTTP URL.

RapidLeech

The current latest vesion of RapidLeech is v2.3_build_23_08_2007. Below are the steps to set it up on your hosting space:

  1. Download RapidLeech from here and extract the contents.
  2. Edit config.php in configs folder.
    • It’s theoretically possible to set a username and password to limit the access to your RapidLeech page, but it didn’t work for us. You can try it by changing $login to false and changing the $users value.
    • Set $download_dir_is_changeable to false.
    • Save and close the file.
  3. Upload all the folders and index.php to where you want to install RapidLeech. For security reason, it’s better to name this directory to something other than rapidleech.
  4. CHMOD files directory to 777.
  5. If you haven’t set a access username and password, use your hosting panel to do so. Else, others might mis(over)use your installation.

Visit the RapidLeech installation page. To download, paste the download link and press Download file button (you may leave the Referrer value blank). The downloaded files might not be visible when you click the Server Files tab. Simply click the Show Everything link. From here, you can download, rename and delete the files.

How to redirect visitors from all the pages of your site to a new site

If you want to redirect all the visitors including search engine robots from your existing (old) web site (all the pages, not just the index page) to a new address, simply place the following at the end of .htaccess file in the root directory of your old web space:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.yournewsite.com/$1 [R=301,L]

Replace yournewsite.com with your new site address.

You can double check the redirection using this tool.

How to redirect your feedburner feed subscribers from one site to another

I have (or should I say, had) 199 subscribers to my RSS feed (burned by feedburner) of SridhaReena site. I found out that it is possible to redirect these subscribers to the RSS feed of my new site (this one, howtotuts.com). Note that the redirection works only for 30 days. Here are the steps to follow:
  1. Log into your feedburner.com account, go to your feeds list and click on the feed you want to redirect (let’s refer this as old feed)
  2. Click Edit Feed Details… link at the top
  3. Paste the feed URL of your new feed in the Original Feed field
  4. Click Save Feed Details button

  1. Click Delete Feed… link at the top
  2. Tick Use 30 day redirection. You may want to click on the Learn more…. link to see a note that subscribers to your old feed are going to be redirected to the new one
  3. Press Delete Feed button
  4. [Optional] If your old feed was in the FAN, and you wish to transfer its impressions/clicks/payment stats over to the new feed, send an email to feedback@feedburner.com requesting them to do the needful. Here is a sample email that you could use:

    Hello Feedburner,

    I’ve deleted my old feed (w/ a temporary 30-day redirection to my new feed). The old feed was in the FAN program and I would like to transfer it to the new feed.

    Old Feed URL: http://feeds.feedburner.com/sridhar
    New Feed URL: http://feeds.feedburner.com/howtotuts

    Please let me know if any other info is needed from my end.

    Thanks,
    Sridhar.

Below is a video of the process. If you would like to watch a higher resolution (clearer) video, click here.



How to place an ad below first post only in WordPress

Google limits the number of ads that you can place in your blog per page. When you place the adsense code by modifying index.php so that the ad appears below a post, the ad is going to appear beneath all the posts on your blog’s homepage. This is not what we want.

For the ad to only appear under the first post and nowhere else,

The Quick Way

Edit index.php and place the following code wherever you want the ad to appear:

  1. if ($wp_query->current_post <>
  2. adsense_deluxe_ads('above_posts');
  3. } ?>

Replace adsense_deluxe_ads(’above_posts’); with your adsense code. If you want the ad to appear below the post, you would paste the above before

Ad appearing below first post only

Source.

We’ve similarly placed 3 link units at the top of first three posts on our home page using this code:


  1. f ($wp_query->current_post <>
  2. {
  3. include('adsense_indexpage_firstthreeposts_linkunit.php');
  4. }
  5. gt;

3 Link Units in first three posts

The Long Way (We are no longer using this method, now that we’ve discovered the quick way)

  1. Open your theme’s index.php, and find this line:

    1. if (have_posts()) : while (have_posts()) : the_post(); ?>
  2. Immediately above that, paste this:


    1. $postnum = 1;
    2. $showadsense1 = 1;
    3. ?>
  3. Staying in index.php, scroll down to this part:
    1. class="postmetadata">Posted in ', ') ?> | 'Edit', '', ' | '); ?> 'No Comments »', '1 Comment »', '% Comments »'); ?>


  4. endwhile; ?>
  • Above , paste this:
    1. if ($postnum == $showadsense1) {
    2. echo '
    3. Your adsense code goes here
    4. ';
    5. } ?>

    6. $postnum++; ?>

    Paste the adsense code where it says Your adsense code goes here.
    If you are using Adsense-Deluxe plugin, you can replace

    1. echo '
    2. Your adsense code goes here
    3. '

    with the plugin provided code like

    1. 'adsense_below_first_post'); ?>

    This can similarly be extended to archives and search page by editing archive.php and search.php respectively.

    Source.

    How to install Ajax contact form

    Dustin’s Ajax Contact Form is an unobtrusive (meaning, works even with JavaScript disabled) contact form done in PHP using which your site visitors can get in touch with you. It provides basic and most common form fields in a contact form.

    Curent latest version: 0.9

    Below are the instructions on how to set up on your site:

    1. Decide where you want the contact form to reside in your website structure. In this tutorial, we are going to install it at http://www.howtotuts.com/demos/ajaxcontactform/.
    2. Download the zip file from here and extract the contents to your local disk.
    3. Open scripts/contact.php in a text editor like notepad and edit the following four lines
      1. $yourName = 'John Doe';
      2. $yourEmail = 'user@example.com';
      3. $yourSubject = 'testJax';
      4. $referringPage = 'http://www.example.com/testJax/index.php';

      $yourSubject is the subject of the e-mail that you will be receiving when a visitor fills the form.
      $yourEmail is where you want the filled form data to be sent to.

      $referringPage is the URL of index.php of your contact form. In our example, it will be http://www.howtotuts.com/demos/ajaxcontactform/index.php

    4. Save the file and close it.
    5. Edit scripts/xmlHttpRequest.php similarly. Save and close the file.
    6. Edit index.php to remove/edit the text below the form.
    7. Using a FTP client, upload all the content of the contact form script (i.e., ‘img’, ‘js’, ’scripts’ folders and index.php) to the directory where you decided to install the form.

    Done. Your visitors should now be able to contact you through your new shiny Ajax form. Here is our working form: http://www.howtotuts.com/demos/ajaxcontactform/

    Note: This contact form script is not ideal (worth the effort to modify) if you want to include some custom fields (like a dropdown). For that, we’ll provide detailed coverage of another solution (the form that’s used on this site) soon.

    How to quickly launch programs and remove windows start menu button

    There are software programs like Launchy using which you can launch applications by typing the first few letters of the program name and hitting the return key. Once you start using these, you’ll realize that we can save the space that start menu takes up. So we started looking for a small program that will hide the start menu button yet makes menu itself available upon pressing the windows key. A free program called Start Killer by Tordex does the job.

    Here’s how we hide the start menu and yet easily launch any desired program:

    1. Set up FARR
    2. Run Start Killer

    Find And Run Robot

    Find And Run Robot or FARR in its short form is a free program by DonationCoder that will display a small floating text box in which you type the name of the program you want to launch and press a number on your keyboard or use your arrow keys to move up/down and press the return key. We find it better compared to other similar solutions like Launchy because:

    • We can press a number from the results list to launch a program
    • It makes available a newly installed program much faster
    • It has more advanced features

    To get started with FARR,

    1. FARR is a donationware (don’t let this mislead you, the program is free but will keep displaying reminders to register at their forum till you complete the free sign up and type in a license key in the program). So create a free account by registering at DC
    2. You will get instructions in email about how you can access your life-time license key
    3. Download FARR and install it
    4. Start FARR. This will probably be the last time you will launch a program by either clicking on its desktop icon, or navigating to it from the start menu or going to the program folder. Press Pause/Break key to show FARR input box. Then change the settings as we have in the video below.




      For a bigger resolution and crisper video, click here.

    So from now on, whenever you want to launch a program, let’s say Firefox, press Alt+Space to bring up FARR, then start typing ‘f i r e..’ and FARR will dynamically list and move Firefox up the list. You can click on the item or press the corresponding number on your keyboard.

    Find And Run Robot

    Note: To launch the first program in the list, you don’t need to even press its number or click on it, simply press the return key and FARR launches it in a jiffy!

    Start Killer

    Start Killer hides the start button on the windows taskbar. You can still open Start Menu using CTRL+ESC or WIN key. Download it from here and install it. Launch Start Killer (using FARR of course). Right click on its icon in the system tray and set it to auto start with windows. As long as Start Killer is running, the start button is hidden. To restore the start button, simply exit Start Killer.

    Before:

    Before running Start Killer

    After:

    After running Start Killer