Tuesday, March 9, 2010

Implicit Declaration of function in C - Segmentation fault

This warning is very common in C programs. Usually we can neglect it but it can cost you dear if you have it without notice. I learned it the hard way that warnings should be debugged from a code. I now always compile my programs with -Wall flag to see each and every warning.

There are two main reasons for this warning.
1) Header file not included
    Try writing a program that uses malloc function and do not include stdlib.h in your code. You will see this warning. The solution is simple, just add
#include <stdlib.h >
in your code and you are good to go.

2) Prototype mismatch
This one is a tricky one. I remember when I was working on my research project I had a bunch of these errors for the functions I created myself. I knew there was nothing else needed as those were my functions. Moreover, I had the prototypes there at the top. The issue was that these functions were declared in a different file called util.c, that file resided at the same path though. I had a different way of writing prototypes and declarations. For example look at this function:

void *myfunc(para1, para2)
int  para1;
char *para2;
{

body

}
This is a valid way of writing a function and it is fine to use a prototype like:
extern void *myfunc();
at the top of this file. However, if this function is declared in some other file then this will cause you a warning. Instead of explaining the details I would say just change the prototype to something like this:
extern void *myfunc(int para1, int para2);
and you will see why your program was throwing segmentation faults.

Sunday, March 7, 2010

Blue Screen of death on Windows PC

"Blue Screen of Death" is a very common problem on Windows PC? That name might be a bit over dramatic, but it has become well known through the years of the Windows operating system. All of a sudden while you were working your screen disappears and a blue one pops up in its place with a cryptic message saying windows has encounter an error and must shut down. Then it gives a lot of numbers in the form of hexadecimal bits and tells that it is dumping to memory. Sometimes this happens when you restart your pc.

This could be because of a bad driver that you installed knowingly or unknowingly. Usually, the Lan Card, Modem or Gaming cards. If you know what you installed recently try uninstalling that driver. If you installed a new hardware just detach it and it should be fine. If that does not fix this it means your OS has been corrupted by that system/card/driver. Try restarting your pc and it might work if you are lucky. But if that was the case you would not be reading this post.

A quick option is to open your computer, take your RAM out and wipe it with alcohol/spirit, usually Petrol, After Shave or nail polish remover will do this job.

If this doesn't work or you are unsure of how to open your pc you need to either repair windows or reinstall it. Make sure you back up your data such as pics and documents etc before doing any of these two operations.

If reinstalling fixes this issue you are good to go. restore all file from our backup source and be happy. If nothing has fixed it yet you need to see a hardware guy.

Tuesday, February 23, 2010

Internet is very slow

Suddenly your internet has become slow. This could be true in case of Windows based computer as well as Mac or Linux based computers. It is primarily due to your browser's capacity. When there is a lot of data to store the browser performs significantly badly.

I had the same issue with my Mac. Here is how I fixed my problem and also solution for those who have this issue with different browsers:

Internet Explorer 8

  1. From the Safety menu in the upper right, click Delete Browsing History... .

  2. Deselect (i.e., uncheck) Preserve Favorites website data, and select (i.e., check) Temporary Internet files, Cookies, and History.
  3. Click Delete.

Internet Explorer 7

  1. From the Tools menu in the upper right, select Delete Browsing History.
  2. Next to "Temporary Internet Files", click Delete files... . To delete your cookies, click Delete Cookies.
  3. Click Close, and then click OK to exit.

Firefox 3.5 for Windows

  1. From the Tools menu, select Clear Recent History... .
  2. From the Time range to clear: drop-down menu, select the desired range; to clear your entire cache, select Everything.
  3. Click the down arrow next to "Details" to choose what history elements to clear (e.g., check Cookies to clear cookies). Click Clear Now.

Firefox 3 for Windows

From the Tools menu, select Clear Private Data... , and then check Cache and Cookies. Click Clear Private Data Now.

Safari

  1. From the Safari menu, select Reset Safari... .
  2. From the menu, only select Empty the cache and Remove all cookies, then press Reset.

Firefox 3.5 for Mac OS X

  1. From the Tools menu, select Clear Recent History... .
  2. From the Time range to clear: drop-down menu, select the desired range; to clear your entire cache, select Everything.
  3. Click the down arrow next to "Details" to choose what history elements to clear. Click Clear Now.

Firefox 3 for Mac OS X

  1. In Firefox, from the Tools menu, select Clear Private Data.
  2. Make sure Cache and Cookies are checked, and then click Clear Private Data Now.

Monday, February 22, 2010

How to unlock your Cellphone for Free

What are Unlocked Cellphones? and Why anybody would want to Unlock it?
An Unlocked Cellphone is one that can be used on all networks operating on the frequency the phone is designed for. For example, in the UK there are four main networks, Vodafone, BT Cellnet, Orange and One2One. Vodafone and BT Cellnet operate on GSM900, while Orange and One2One operate on GSM1800. A UK dual band phone can operate on GSM900 and GSM1800, therefore being capable of working on all the networks.

However, as the networks don’t want to lose you as a customer, when they supply the phone (on contract or pay as you go) it can be locked to only accept SIM cards from their network.
If you wish to use a SIM from a different network, the phone needs to be unlocked.


How do I know if my phone is locked or unlocked?
There are two ways to check if your phone is locked/unlocked. Firstly, if you have a working SIM from a different network, try putting that into the phone and switching it on. If the phone works and you can make calls on that network, congratulations, your phone is already unlocked. If a message appears, saying “SIM card not accepted” or similar, the phone is probably locked.

How to Unlock your Cellphone?

It is very simple procedure.
  1. Download & Install ” Unlock Code Calculator”
  2. Start the software and Select your Cellphone Manufacturer and Cellphone Model
  3. Enter the 15 Digit IMEI Number of your Cellphone. You can get IMEI number for your Cellphone by entering *#06# in your Cellphone and press Enter.
  4. For Nokia Users you also need to select the Country and the Operator of your Cellphone.
  5. Press Calculate and it will generate a Code similar to #pw+CODE+n#.
  6. Now Press the Help button. Select your Cellphone Manufacturer and you will find the Steps of to use the above generated Code to unlock your phone.
Note (For Nokia Users): You might be confused by the DCT-2, 3 and 4. Here I have categorized different Nokia models into DCT 2, 3 or 4. If your Cellphone is not listed below it might be possible that it use Nokia DCT1 or 5. The List below is not exhaustive. I have prepared it by collecting it from internet.
Nokia DCT2: 3110, 8110, 8110i, 8146, 8148, 8148i, 9110, 9110i
Nokia DCT3: 2100, 2190, 3210, 3285, 3310, 3315, 3320, 3330, 3350, 3390, 3395, 3410, 3610, 3810, nk402, nk503, nk702, 5110, 5110i, 5120, 5125, 5130, 5148, 5160, 5170, 5180, 5185, 5190, 5210, 5510, 6090, 6110, 6110i, 6120, 6130, 6138, 6150, 6150e, 6160, 6161, 6162, 6185, 6190, 6210, 6250, 6290, 7110, 7160, 7190, 7290, 8210, 8250, 8260, 8270, 8290, 8810, 8850, 8855, 8860, 8890, 9000, 9000i, 9110, 9110i, 9210 y 9290
Nokia DCT4: N-GAGE, N-GAGE QD, 1100, 2110, 2300, 2600,2650, [NEM-2] (United states), 3108, 3100, 3120, 3200, 3220, 3300, 3510, 3510i, 3530, 3550, 3585, 3590, 3595, 3600, 3610, 3650, 5100, 5140, 6100,6170, 6200, 6220, 6230, 6260, 6310, 6310i, 6340, 6390, 6500, 6510, 6590, 6600, 6610, 6610i, 6630, 6650, 6800,[NSB-9] (United States),7200, 7210, 7210i, 7250, 7600, 7610, 7650, 7700, 8310, 8310i, 8350, 8390, 8910, 8910i, 9210, 9210i, 9290, 9500

Wednesday, February 10, 2010

SETTING UP WIRELESS SECURITY ON YOUR ROUTER

1> connect your laptop with the WRT54G at port no. it is very important to hardwire your computer, that is connect it to your laptop with Ethernet cable and not through wireless, also check for the light status of the router to ensure that it is connected.
2> access the router setup from a web browser (may be using 192.168.1.1, the default address of your router, and admin as username and admin as the password too.). You can also go to kb.linksys.com if you need more help to access your linksys router setup. If you have other router let me know and I will update this.

3> at the top click on wireless on the BLACK bar at the top.
4> under wireless click on wireless security on the blue bar.
5> select the security mode as WPA-PERSONAL (best encryption and supported by all devices).
6> select WPA ALGORITHUM as TKIP.
7> in WPA Shared Key type your password or any thing else but it should be at least 8 characters long. and you should remember it as this will be your wireless password.
8> the Group Renewal key should be 3600.
9> Click on save settings at the bottom.

PERSONALIZING YOUR WIRELESS NETWORK NAME
1> Under Wireless, click on Basic wireless settings.
2> MODE: mixed
3> NAME: CHANGE IT to your desired name, mine is nirvana> Channel: 11
5> SSID BROADCAST: ENABLED

NOW YOUR ROUTER IS CONFIGURED.