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

    How to install phpESP

    This tutorial explains the steps using which you can install phpESP on your site. It is a free PHP/MySQL script for survey management. The installation document that comes with it gives more info than is needed, is aimed at those who have shell access and kind of makes it unnecessarily complicated for those of us who know FTPing, what a MySQL database is and how to use phpMyAdmin.

    phpESP lets non-technical users create surveys, administer surveys, gather results, view statistics. All managed online after database initialization.

    phpESP Management Interface

    Official Demo: http://phpesp.sourceforge.net/demo/admin/manage.php

    Current latest version: 2.0.2

    Below are the installation instructions for phpESP:
    1. Download phpESP. Extract the contents of the archive.

    2. Open admin/phpESP.ini.php in a text editor like EditPlus.

    a. Edit line 26 to specify Base URL for phpESP, i.e., the URL of your installation. So if we were to install phpESP at http://www.howtotuts.com/demos/phpesp, we edited the line to this:
    view plaincopy to clipboardprint?

    1. $ESPCONFIG['base_url'] = $ESPCONFIG['proto'] . $server['HTTP_HOST'] . '/demos/phpesp/';

    $ESPCONFIG['base_url'] = $ESPCONFIG['proto'] . $server['HTTP_HOST'] . '/demos/phpesp/';


    b. Edit Database connection information (below line 40) by entering your MySQL DataBase name, DB username, DB user’s password and hostname (this is usually localhost). Use your cPanel for getting/setting these four parameters if you haven’t already. Save and close the file.

    3. Open up phpMyAdmin. Select your phpESP DB. Click SQL tab. Paste all the content of scripts/db/mysql_populate.sql (open this in a text editor) and press Go.

    4. [Optional] If you aren’t going to use any language other than english, space can be saved by deleting all the content except en_US folder and map file within locale folder.

    5. Upload all the files to your site using a (s)FTP client at the location where you want to install. phpESP installation is complete.

    6. Log in administrator by visiting your_phpESP_installation_URL/admin/. Default admin Username is root and password is esp. Change your password and you are ready to create and manage surveys.

    How to install SMF - A Video Tutorial

    If you are reading this, chances are that you already know what SMF is. If not, here you go. Quoting from their homepage:

    Simple Machines Forum — SMF in short — is a free, professional grade software package that allows you to set up your own online community within minutes.

    Its powerful custom made template engine puts you in full control of the lay-out of your message board and with our unique SSI - or Server Side Includes - function you can let your forum and your website interact with each other.

    SMF is written in the popular language PHP and uses a MySQL database. It is designed to provide you with all the features you need from a bulletin board while having an absolute minimal impact on the resources of the server. SMF is the next generation of forum software - and best of all it is and will always remain completely free!

    SMF is the best free forum script in our opinion.

    Script Install 4 Free has a video tutorial on how to install SMF v1.1 on your shared hosting web space via FTP upload. The current latest version of SMF is 1.1.4 and the instructions still hold good. The official instructions page that the screencast refers to is http://docs.simplemachines.org/index.php?topic=5.

    You can also watch this screencast by clicking on the image below:

    SMF Install Screencast

    How to chat in IRC from your browser

    IRCatWork.com (was using CGI::IRC) has been purchased by Mibbit, a web based IRC client that uses Ajax. Mibbit allows us to connect to multiple IRC servers and multiple channels (in a server), has tabbed layout, nick completion on tab key press, input history (up down arrows), PM support. In short, everything that a stand-alone IRC client like mIRC provides except the logging facility (understandably) and the channel flashing upon nick mention.

    Mibbit - Online IRC client

    Mibbit provides these servers by default (the most commonly used ones are bolded): Mibbit, Freenode, irc.icq.com, irc.slashnet.org, irc.oftc.net, blitzed.org, efnet.net, Chatterbox UK, Foonetic, WyldRyde, Justin.tv, bitlbee

    You can also connect to any other IRC server not in the list by selecting ‘Other server…’ and specifying the server name along with port, like so: irc.ircsuper.net:6667

    Here are the most commonly used commands in IRC that will work at Mibbit:

    • To join a channel, type: /join #channelname
    • To register your nickname in a server, type: /msg nickserv register yourdesiredpassword
    • To identify to your nickname in a server, type: /msg nickserv identify yourpassword
    • To change your nickname, type: /nick newnick

    You can join multiple channels at once once you are connected to a server like this: /join #wordpress,#gallery,#help

    Mibbit also has a very useful feature in that you can include server name, channel name, nickname and password that gets pre-filled into the connect form. For example http://www.mibbit.com/?server=irc.freenode.net&nick=YourNick&pass=YourPasswordchannel=%23gallery. You can create a desktop shortcut to this webpage and whenever you want to join #gallery IRC channel, just execute this shortcut, fill in your nickname and password (if your nick is registered) and hit the return key.

    An embedded version might be released next week and we are certain it will prove to be a great online chat solution for website owners (you don’t need to worry about spam since you can always kick and ban users, provided you are the IRC channel owner).

    So, next time you want help with or want to discuss on any open source project, use Mibbit to get connected to your favorite IRC channel in irc.freenode.net.

    How to set up a Knowledgebase on your site by installing KnowledgebasePublisher

    This is a step-by-step tutorial on installation of KnowledgebasePublisher, an opensource PHP/MySQL knowledge base, FAQ script that you can install on your web site.

    click to enlarge

    KnowledgebasePublisher is an opensource knowledge base software, FAQ software, or just content manager about any other type of article that you want to publish on your website. It’s so easy to use that you can be managing knowledgebase on your website right from your own web browser.

    Official Demo | DonationCoder.com Demo (as a visitor)

    Features:

    • Unlimited Categories
    • Glossary Terms
    • Powerful WYSIWYG
    • Instant Response
    • Searching
    • Add attachments
    • Five different admin role
    • Protect categories
    • Commenting / Rating / Send to friend
    • Users can ask questions
    • Related Articles
    • RSS
    Download version 2.0.1 (2.6 MB)

    Click to Download KnowledgebasePublisher

    While the instructions that comes with the script are better than most others’, it still leaves some to be desired. So here are the installation instructions:

    1. If you have SSH access, you may want to wget followed by unzip http://nchc.dl.sourceforge.net/sourceforge/kbpublisher/kbpublisher_2.0.1.zip to obtain and extract the contents directly on the server. If you have FTP-only access, download the .zip file from the above link to your local drive, extract the contents.

    The subsequent instructions assume that you want to install the script inside a directory named kb. If you change it to something else, make the changes accordingly.

    Upload the kb folder to your web space. For example, to install KnowledgebasePublisher at http://www.scriptful.com/sri-addons/scripts/kb/, we uploaded the kb folder under ’scripts’ directory, which is under ‘/sri-addons’.

    2. Create a directory called kb_file one level above your publicly accessible root directory. i.e., above /.