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.

Friday, November 19, 2010

Think before you type!

We,all know the importance of functions in C. And any good-programmer will be using well coded functions in his program, may be including them in a loop as well.But, while using the function in a nested if else we must be careful and should keep in mind the output of the function and what exactly do we want.I am saying this because my program returned insane values due to a careless use of functions.

The problem causing bit of code is here:
if(strt < insert(strt,end,value)
 {
     //some stuff;
  }
else if(strt == insert(strt,end,value)
{
   //some stuff;
}

what happened here was that, for the 1st if statement the function insert was called. Now suppose the value is false and the other if statement is to be implemented, then it will again call the insert function which is not how it should happen because for the  new function, it will find a new value instead of the old value. So, it is better to store the value of the function and compare the stored value.
Lets hope that we don't make this mistake again. : )

Wednesday, November 17, 2010

Boosting your browsing speed in Mozilla

you may be happy with the time it takes for a webpage to load in Mozilla but getting a better browsing speed is always a welcome change isn't it? Here is a simple way to boost your speed.
->Open a new tab and in the address-bar type: about:config
->Now in the box of filer type browser.cache
->Now turn the value ofbrowser.cache.disk.enable to false. It can be done by just double clicking it.
->Similarly set browser.cache.memory.enable to true.
->Now right click on an empty space select new->integer and give it name : browser.cache.memory.capacity and in the give it value100000 or 100Mb.

Mind you this will store the cache in main memmory and may take upto 100Mb of your RAM.So just take care of not giving some superficial value as capacity.Also, the process will increase the speed of cached pages only.Anyways, any betterment is welcome isn't it?

Monday, November 15, 2010

Exploiting facebook/twitter mobile facilities

We have seen many GPRS based applications for tweeting and updating your facebook status. But what to do if you want to tweet/update status without connecting to internet? Well, facebook and twitter have facilities where you can tweet/update status by simply sending a message to a certain number. You can use that technique in your application. For this you just have to know the method for sending a message from your mobile. If you are coding in C# it is very simple to do.
You just have to writing the following code:
->Microsoft.WindowsMobile.PocketOutlook.SmsMessage sms = new SmsMessage(number,text);
->sms.Send();
In case of facebook the number will be:923223265 and for twitter it is:53000.
Another thing that needs to be kept in mind is that, you need to add
Microsoft.WindowsMobile.PocketOutlook in the references.

This is a simple way to keep your app different from others.Though C# is used for programming for windows mobile.

Wednesday, October 13, 2010

Another useful html tag!

WEll, this time I am talking about the < pre >  tag. It is used when you donot want to insert all the whitespaces individually.
Simply speaking, this tag is used when you want to have a preset text in your web-page.
Generally, the white spaces in your script are neglected by the browser. And they can be added using '&nbsp' ( meaning new blank space).Instead if you are using the 'pre' tag, it will display the text as it is written.
Despite the advantage, this tag is rarely seen in the web-pages.
This is the w3schools article on the tag.

PS: Being busy with my other work, am not able to blog regularly

Thursday, October 7, 2010

# in html!

All the C programmers tend to think of #include as soon as they see '#' symbol. But not all the people know that there is # used in html also!
Well we all have seen the wiikipedia page on one or the other thing,right? Now, there is a table of contents in every page. The elements of this table point to links in the same page. This is where a # symbol comes in handy. It is basically used to maintain an index within the web-page.
while giving the address give href="#link" instead of the entire address of the page.

and to give the target location give name="link" as a part of the 'a' attribute of the location


Here the difference from a normal href is that here we are starting the URL with # indicating that the target is in the same page. Also we have given an attribute 'name' with value=link. This is the address of the target.
(How else would the browser know where to point next?)

Hope you will find it helpfull.


Sunday, October 3, 2010

Time for some shortcuts!!

Usage of mouse all the time to navigate is not so ergonomic, is it? Today I and my friend had nothing else to do so tried out many combinations of key strokes to see what happened. Here are some that might be interesting!

For navigation purpose:
-> Well some of you may be knowing that to go to the previous directory in
your Explorer, be it your internet explorer or the file one, you can use
backspace key.
But do you know that to navigate forward you can use shift + backspace?
for e.g search anything in google and go to the first webpage. now press
backspace
and you will reach back to the search result and now press shift + backspace.
-> You may use windows + D for navigating to the desktop. And press it again to go
back to return to your application.

Notepad:
-> The function keys do have some use in notepad.
-> First is F1: for help
-> Next is F5: for date and time. (Who needs it?)
-> Next is F10: To go to the menubar. If you dont want to use the function keys you
may also use atl button followed by the underlined letter in the respective
field e.g alt + f for file menu.


More will be coming soon!