Monday, January 31, 2011

A simple Google Search Gadget


  For designing a new-homepage for myself(yeah I do that a lot!), I wanted a google search gadget.So, as usual I decided to make one for myself.Just a simple tweak to one of the online tutorial javascripts and I had a javascript that could be used for google search!
Here's the script that I came up with.

<script type="text/javascript">
function search()
{
var searchkey = getElementById('mytext');
if(myTextField.value != "")
window.location="http://www.google.com/search?q="+myTextField.value;
else
alert("Would you please enter some text?");
}
</script>

To complete the gadget, You need a text-box and a button.Also you need to use 'mytext' as the text-box's id and 'search()' as the onclick event for the button.
So the remaining code is:

<input type='text' id='mytext' /><br>
<input type='button' value='search' onclick='search()' />


This simple script doesn't pass all the parameters that Google does,but I am not Google, am I? This thing does the job so whats the problem? You can make the same thing for Bing by just replacing google.com with bing.com . Also you can make it site specific by using this line:

window.location="http://www.google.com/search?q="+myTextField.value+"site:www.example.com";


Enjoy scripting!

Saturday, January 22, 2011

Innovative Idea: URL shortener



   Its been a long time since i posted about an innovative idea.But in my defense something is better than nothing! Lame isn't it? Anyways, getting started on the topic, this time it is the idea of URL shorteners.
  Many of us would have at some point on the web, encountered a shortened URL. It would be like bit.ly/something or goo.gl/something. Twitter users find this idea as a boon considering the fact that we can tweet only 140 characters at a time.Well for others it is a tool to reduce the address of the website to a calm to eyes length. For eg the address of www.dude-says.blogspot.com can be shortened to goo.gl/hl5VI


  How depressing do the websites with looong addresses look!Imagine being forced to remember one of them. Some god-sent developer came up with a solution of URL shortening. It started with TinyURLin 2002. Though the idea became widely used with launch of twitter, it came to rage when was started being used by other famous websites in 2009.
   Some common URL shortening services are TinyURL , bit.ly and goo.gl. The URL shorteners donot show the entire web address but redirect us to the actual website. Though novel this idea has been used for sending worms also. Read this article
  Well, the article may petrify you but don't worry, just go to shortened URLs given on standard web-sites or if you are still worried you can use tweet-deck or a service like google safe browsing.Well like all great technologies, URL shortener is quite useful but should be used wisely and the surfers should beware of the malicious use of the service and hence should take proper care while using them.

Thursday, January 6, 2011

Battleship for Windows Mobile

    Addiction may cause you to do several things.It makes the some steal from or hurt someone. Well, in my case it made me write more than thousand lines of code. My addiction is to the game of Battleship.
  In case you are wondering what it is, well in this game you are supposed to search for the enemy's fleet of battleships before he finds yours.You have to keep hitting till you completely destroy the fleet. Its quite a fun to play the game.
  When I formatted the hard-drive of my computer I foolishly forgot to backup the game.Hence I had no choice but to search for it. But I got a PC version of the game.So, being overcome by the addiction I just thought of making my own version for the Windows phone(coz it's the easiest to code!).
 So after an evening of coding the basic version of the game was ready. Then all that was left was some improvisation in interface but that could wait. First I had my game-lust to be satisfied. Well as it turns out even after 7 days I still haven't improved the interface but I am able to play the game so no complains!
  Anyways now I am planning to make a multiplayer version of the game and will need some time to make that happen but I am on it. In case anyone wants to try it out just mail me.