Wednesday, January 28, 2009

Reset XP Password

Forgot your Windows XP Password??? Or, got your hands on someone else's system but can't enter because you don't have the password. Ok, here are the simplest tricks you can use.
Trick 1
On the welcome screen press CTRL+ALT+DEL twice. Type username as Adminstrator and leave the password blank and press enter. If you're lucky then you'll enter the system. Lucky in the sense that, if the system owner didn't enter an adminstrator password while installing windows then you're lucky.
Trick 2
If you're'nt lucky according to the previous trick then this trick will forcefully let you enter inside! It works for sure. You need another computer with internet connection, a cd writer and a blank cd off course.
1. Download this file
2. Extract the zip file to get an iso image.
3. Burn the iso image on a blank cd.
4. Boot the target computer with this CD. Follow the steps on screen and reset the password as you wish!!!
This trick works for resetting Vista too!
Trick 3
If you've access to the target computer with an account with administrator privilleges then you may use this command on command prompt to reset any user's pass
net user <username> <new password>

net user administrator newpass

Saturday, January 24, 2009

Log your blog visitors

So, you've got a shiny new blog out there on blogger and getting pretty many hits as well but want to keep a record of all people visiting your blog? Well, I do! Ever noticed the 'lens image with "Logged" written' here in the right panel of this blog? Yes, thats my own visitor logger. Although there are lots of third party loggers out there like the Wowzio widget but having your own is fun when you call yourself a techno-savvy! Ok, so here I go about it how to do it on your own.
Note: I'm assuming that you know how to use FTP, what is PHP and some other simple stuff etc... If you don't know these and don't understand the post, that means you're a n00b. I'm not going to explain everything in ultimate detail.
First things first
Here we're going to use PHP to track the visitors. So, you need a PHP capable server. Freehostia is cool for this task. Just register an account there.
1. Create an account on freehostia. Setup a subdomain like "" or something you wish there.
2. Create the image in mspaint or anything, that you wanna display to the user. Or if you're lazy then use the one from my blog. Name the image something like "img.jpg"
3. Create a PHP file with the following code and name it something like "logger.php":

$logged.="Time=".date("j/n/Y h:i:s a", time())."
foreach($_ENV as $key_name => $key_value) {
$logged.= $key_name . " = " . $key_value . "
$log2.="UA: ".getenv("HTTP_USER_AGENT")."
$log2.="IP: ".getenv("REMOTE_ADDR")."
$log2.="REFERRER: ".getenv("HTTP_REFERER")."
$blah=fopen("logdetails.htm", "a+");
fwrite($blah, $logged);

$blah2=fopen("log.htm", "a+");
fwrite($blah2, $log2);

$blah3=fopen("img.jpg", "rb+");
header("Content-type: image/jpg");
echo fread($blah3, 128);

4. Create two blank text files in notepad and rename them to "log.htm" and "logdetails.htm".
5. Now upload all these four files in the same directory in your freehostia account through FTP. chmod both the .htm files to 777.
6. Now in your blogger account, go to layout and add a new custom HTML/JS gadget. Add this code in it and place it where you wish on your blog
<img src="" alt="Logged"/>

Over!!! Yeah, it was that simple!!!
What happens under the hood???
If you've experience of coding, you might have already understood whats going on. But for those who are too lazy to want to understand I'm explaining briefly.
You've a PHP file on your freehostia which when accessed performs two things:
1. Shows the user an image i.e. the logged image
2. Records all environment variables and the values and writes to the file logdetails.htm and the file log.htm is to store Time, UA and IP only for your quick viewing.

Whenever anyone visits your blog, his/her browser requests for the image. The request reaches your freehostia account alongwith headers sent by the browser. The headers are trapped by the PHP script which shows an image to the user. Thats it! As simple as that!!!

Saturday, January 17, 2009

File Fetcher in PHP

My net connection is too slow and inconsistent to download large files from a non-resume capable server. So I thought of creating a PHP file fetcher program, that I could upload on a fast PHP capable web server and it would download the file itself within a minute and then I could download from there in many sessions by resuming broken downloads. Here's what I coded:

$blah=fopen("dload", "a+");
$fp = fsockopen("", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
} else {
$out = "GET /filepath.ext HTTP/1.1\r\n";
$out .= "Host:\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$temp=fgets($fp, 128);
fwrite($blah, $temp);

In the above code is the hostname or IP of the server I'm trying to fetch the file from, and filepath.ext is the path and filename with extension of the file to be downloaded from there.
It works fine for files upto around 50MB on my server but for larger size it doesn't work. After thinking for a while I figured out that it may be due to the maximum execution time setting of 30 seconds in php.ini file. The server I used has practical speeds around 1.5MB/s and so it downloads a 45-50MB file in 30 seconds and then stops.
The only obvious way is to edit the php.ini file and increase the maximum execution time to something like 300 seconds. But I don't have access to php.ini on my server. What should I do now???? Well, if you've any solution then do post a comment here please.

Thursday, January 15, 2009

Linux, Bluetooth, GPRS and Internet

The other day I was messing up with my brand new Dell notebook under Linux(Ubuntu), I needed to get online quickly. I looked for my phone's data cable but couldn't locate it in the room. And in this freezing cold weather prevailing here I can't afford to get outta the quilt!! So, I thought about connecting using bluetooth. A little bit fiddling, and I figured out how do I hook myself to the Internet!! Ok, so here goes the tutorial. It should work perfectly on Ubuntu 8.10 and 8.04 and also on several other latest linux distributions, but I haven't tested it on anything except Ubuntu 8.04 Hardy Heron and Ubuntu 8.10 Intrepid Ibex.

1. Hit Alt+F2, type
and press enter.
2. Then jump into root mode by typing
sudo -s
and entering the root password when prompted.
3. Turn on the bluetooth on your phone and the notebook/PC and type
hcitool scan
and hit the enter.
4. Your notebook will search for bluetooth devices in range. And it will respond with your phone's MAC address and name. Now use this command to search the Dial Up Networking channel on your phone
sdptool search --bdaddr <your phone's MAC address here> DUN

sdptool search --bdaddr 00:1B:3C:4D:5E:6F DUN
5. You'll get a response of around 10 lines. Search for the channel number in it. For my SE P1i it was channel 7. On a Nokia6681 it was on channel 3.
6. Now use this command to create a bluetooth modem
rfcomm bind /dev/rfcomm0 <phone's MAC address> <DUN channel>

rfcomm bind /dev/rfcomm0 00:1B:3C:4D:5E:6F 7
You may be prompted by the PC to pair device. Do so by entering same BT pin in ur PC and phone.
7. Now configure your wvdial.conf file as follows.
gedit /etc/wvdial.conf

Append the following text below any existing settings in the file that opens up.
[Dialer bt]
Modem = /dev/rfcomm0
Phone = *99#
Username = 919815098150
Password = 12345
New PPPD = Yes
Init1 = AT+CGDCONT=1,"ip",""

Note that the above setting varies depending on your operator. But you just need to change the username, password and access point( to your operator specific.
8. Now to connect to net just type
wvdial bt
on terminal and press enter. Allow your phone to connect when prompted.

After a reboot, if you need to connect then perform only steps 6 and 8.

Monday, January 12, 2009


December's Digit's Linux DVD brought glint in the eyes of Linux lovers. It packed up several full Linux distribution ISOs. Yesterday, I wasn't doing anything so I thought lets try out something new. I randomly chose DreamLinux3.5RC4 for the ordeal. Its a debian based distribution with Xfce4.4 as the Window manager. The live CD detected all my hardware correctly and booted lightening fast!!! Faster than Ubuntu and XP. But it didn't mount my existing ntfs and ext3 partitions. The interface is as fast as Windows 3.1 on a latest machine!!! Kudos to Xfce! Now, after fiddling with it I liked the speed and decided to install on my HDD. The installation isn't wizard based like Ubuntu but I quickly figured out everything. Disk partitioning was easy with the GUI of GParted and I shrunk a 39GB ext3 partition owned by Ubuntu to 25GB and created a new 14GB partition for Dream Linux. The installation was fast too. In about 10-12 minutes it finished all the operations. I restarted. The Xfce desktop greeted me and thankfully, the existing partitions were mounted in /mnt. But I was puzzled about not being prompted for user-pass during login. That can be configured anyways ;) The default cool apps present were:
Since it is a Debian based distro. so it comes with Synaptic for installing apps easily. I tried to install Opera but couldn't find it in the repository even after reloading! Duh! They're new and its not a final version so forgiven!!!
The browser Iceweasel is a modded FF3.0.1 with Xfce interface. The PDF viewer is fast as Schumaker! All the codecs for all multimedia formats are pre-installed unlike Ubuntu and Totem is the default media player.
And about the modem, it easily detected my Sony Ericsson P1i without any hitches and glitches and mounted the USB modem at /dev/ttyACM1. I quickly configured wvdial and in under a minute I was hooked to the Internet. The browser is very fast. A great experience.
The screenshot taker is in Accessories menu but unlike Ubuntu it doesn't auto capture on pressing PrtScr key. You've to manually set the time, then capture.
Final verdict
Speed: Best of all, I ever used
Usability: Not as user friendly as Ubuntu
Apps: Complete set of apps that anyone requires for daily use
Who can use?: Anyone who is a bit familiar to Linux(especially Debian based distros like Mint or Ubuntu)

One thing worth pointing is the presence of a dock at the bottom of screen for launching popular apps. But it is fixed and I was unable to move it anywhere on the screen, or add/remove apps to/from it.
Overall, a great Linux distro. for a typical home user. I'm attaching a few screenshots.
DreamLinux desktop
The app dock with mouse pointer on Internet browser icon
The control panel
Google in Iceweasel
This blog post in the making, on Iceweasel

Friday, January 9, 2009

NTFS drive corrupted due to power failure!!!

I was working on my PC, when power went off. 3+ year old UPS gives a second to shutdown and even Mr. Bill Gates or Steve Balmer or whoever can't shutdown any Microsoft OS(except DOS) within 10 seconds!!! By the way, after power was back, I turned on my PC and damn!!! To my utter dismay, the Windows XP loading progress bar revolved twice and the PC restarted!!! I tried "Last known good configuration" and same happened with it as well. Finally I thought about safe mode and tried that too to find that it too hasn't any future.
They claim NTFS doesn't die on power failure? But what went wrong here???? I use NTFS especially for this feature but Microsoft cheated!
I had(have) lots of important data and I didn't want to loose anything. I slipped in the XP CD in the optical drive and went straight to Windows installation in order to repair, and there found that my Windows drive C was being recognised as Unknown Partition! Luckily other partitions were healthy.
I thought I should try Linux. I restarted the PC to find out that XP installation CD had wiped out GRUB!!! Well... That doesn't sound tough. I restored GRUB using the Good old Live CD trick. How? Just boot through Ubuntu live CD. Open terminal by pressing Alt+F2 and typing xterm. In the terminal type:
sudo grub
find /boot/grub/stage1

It'll give output similar to (hd1,1)
Then type:
root (hd1,1)
setup (hd0)

I've two hard disks. Linux calls them hd0 and hd1. Ubuntu is on hd1 and Windows on hd0. The above piece of code set up GRUB on Windows drive i.e. first hard disk i.e. hd0.
Then I booted into Ubuntu and tried to mount the Windows drive. It gave a long error message asserting to try "chkdsk /f". What to do now???? I found out the FreeDOS CD from my 500CD stack and slipped it inside and booted. And striking me again, it didn't detect NTFS drives!!!!! It supports only FAT.
Finally, the idea of using Recovery Console flashed in my mind. So, I booted through Windows XP installation CD and pressed R when prompted, to enter Recovery Console. It brought me to the C:\ prompt. I changed to D, E, F and found that all data on them was intact. Only C was refusing to enumerate the directory listing.
I typed
chkdsk /f

and it said /f switch isn't supported!
then I tried
chkdsk /r

and viola, it worked!!! It took 15 minutes and repaired the corrupt NTFS partition C:
And after a restart, I got back to my familiar desktop with all data intact!

1. Don't panick and format and reinstall Windows if you can't boot. Try alternate ways if you care for your data.
2.Spend some bucks and get a good UPS!!!

Monday, January 5, 2009

Access Linux files on Windows

As Linux is catching up, with the increasing popularity and aggressive marketing strategies of Ubuntu, many new users are trying Ubuntu on a dual boot. Those of you, who're using Windows and Linux on a dual boot might sometime need to access your Linux filesystem's stuff while working on Windows. For the n00bs its a serious problem. Here's the simplest solution. Just download Ext2IFS app and install it on Windows, and you're done! You can get it here Enjoy!

Happy New Year!!!

You might be wondering why didn't I wish you all yet? Well, this post is here for the same. Sorry for being late. Two successive papers on 1st Jan and 3rd Jan kept me busy, and another one is on 7th Jan. Fortunately, this will be the last one!!! *sigh of relief
I wish you all a very Happy New Year filled with prosperity, sparkles of joy, happiness. Your eyes will keep twinkling year long powered with fulfillment of all your wishes!!
Rest later...