Tuesday, December 29, 2009

My Life's First Interview

Part-1: The Prologue
December 28th, 2009 is a red letter day I'll always remember. This day marks my first rendezvous with the corporate world with an interview, with an L-turn from academia. On 27th, I appeared in the last written exam of B.Tech and on the very next day I went on to face an interview and cleared it in one go! Moreover, out of several candidates(I guess around 30-40 or more) I was the only one selected!!!! Thats enough to pump up my confidence manifolds! Well, so here I'm going to describe my experience with the maiden interview.
The interview was for a FREE 6-months industrial training(my ing university compells everyone to have a 6-months training in whole 7th or 8th semester). I already had got a seat booked in HCL CDC for a paid training. So, I was thinking about NM Infotech for free training. Here goes the description of the day that passed :)
Myself and Ajit reached the company office in Mohali at around 10:50AM. We were the first to reach. We were greeted by the receptionist and after formalities she instructed us to be ready for the Aptitude test. As we were waiting, another candidate(a girl) arrived with her parents. In a couple of minutes the receptionist handed us the aptitude test paper. I was presuming that it should be an math/IQ paper but it was basically a computer aptitude paper with questions ranging from the standard comment syntax in cpp, to the inventor of punched cards, the scale of KIPS and the coiner of term C++. Many of the questions seemed to be obsolete. For example: there was a question - What is the word length of a personal computer? The options were 4,8,16 and 64-bits. I said to myself: "Wtf?! There is no 32-bit." Then the obsoletion of other questions too came to my mind. And I wrote 32 myself!!! ROFl
Also, a question was asking "To measure which thing's performance do we use KIPS." I was surprised at KIPS. Now a days everything is in GIPS. Who the f will use KIPS? Frankly speaking, the aptitude test paper gave me a bad impression of the company. I thought, they aren't technically aware at all. Whatever... I finished the paper in 5 mins. and submitted in 10. Receptionist had told us that you must do it within 30 mins. After sometime we were handed over the technical paper. Some more candidates had joined. This set had good quality questions. The first one was a C question from pointers. 2nd one was about a for loop without any increment of the counter, meanwhile it also checked candidate's perception of the relation between int and char data types in C. Another one was a multi-dimensional array declaration i.e. int a[3][3][2]={5, 6, .............. etc.}. The question was what will be stored at a[2][2][0]. I pwn3d that question as I looked at it, thanks to GATE preparation! The second section was from databases. The questions were from Oracle's theory part(I guess). I guessed a few answers in this section. A person came and asked whether the paper was tough? I guess he had set the paper and was expecting some appreciation of his intellect. I replied- the previous one was pretty easy, this one is a bit tough, but not much. Meanwhile some more candidates had arrived and they too joined the bandwagon. In a cabin beside ours, an interview session of an MBA guy was going on. The HR girl (oh my god!) had excellent communication skills. My ears were on the session. I thought, if she interviews me I'll be disqualified in one go! The way, she uttered and pumelled english was brilliantly appreciable. Later, I said to myself to console myself:"Don't worry dude, she knows nothing except churning english!". Anyways, the third section had questions from networking. I knew a few beginning questions that were from the OSI model. But then some questions from CCNA courses got off my head. I skipped them and finished the paper and submitted it. After sometime, it was announced that we should be ready for the interview.

Part-2: The Interview
I was surprised when my name was called out first for the interview. That was because I had obtained the highest marks in the written test. As I entered, I saw two smart, young, energetic men sitting inside waiting for me. I was offered a seat and I said thanks and sat down on the middle chair among the three in front of them. The first one said to me, Mr. Prabhakar, your score in the written test is quite low, 13 in the first and 10 in the second. I said to myself: because the level of the question paper was too substandard and I can prove this right here right now right away that I am correct and I don't deserve such an evaluation. He asked me to introduce myself. After a formal introduction he asked for my family background. After these basics, he took out my resume and started scanning it, stopping at the Technical Skills section he asked me about PHP. I started off with an introduction to PHP and as soon as I uttered the word "Open Source" - he asked me its meaning. After explaining it, I continued my intro to PHP where I said "...it is a web scripting language used for designing dynamic pages..." He interrupted me there and asked "not static pages?" I said "yes, static ones too". He continued to scan my resume and asked for my strengths. I replied "Programming, databases and networking". He stuck at the word Linux in my resume and asked me "What is Linux?". As a recorded tape, I spoke about Linux. The next question was about the differences between Linux and Windows. I cited many of them. Then he started with FTP and asked me the port number. As I said 21, he asked me - "only 21?", probably thinking that it will get off my head. I said to myself - "not a tough one for me" and replied "21 for control communication and 20 for data connection". He was surprised! That one I guess was a great impact on him. From there on, he believed there is a lot hidden inside me. He asked about SMTP, POP, IMAP etc. and I beat them all. Then he asked me the basic difference between POP and IMAP. As I murmured two trivial ones(one of them the full forms and another the port numbers!), I recalled one which I thought he wants me to speak. And I said - "In case of POP, when we retrieve the mails, they get deleted from the server but in case of IMAP, they stay back". He said - "yes, thats what I wanted to know". Then he got back to Linux and asked me how to install software on Linux. I told him the tar -xzvf, ./configure, make, make install way. He cross questioned me about the utility of the switch "z", but I couldn't recall cuz I had read that long ago and I surrendered at that. He made me feel light by saying "No issues.". Then he asked me about rpm package installation process. Freaking hell! I couldn't recall the "rpm -ivh" command then, which I recalled as soon as I came out of the interview chamber!!!! Anyways, I told him that I haven't used red hat based distros, I have used Ubuntu which uses synaptic and I told him about the apt-get thingy. He didn't seem to be interested in Ubuntu. Anyways, this didn't give him bad impression at all. He turned back towards networking and asked me about https. Hilariously I recall, I answered - "When I see a lock icon beside my browser's URL box, I get to know https is at work!" ROTFL!!!!! Then, from his expressions I felt he is inquiring me something typical that not everyone knows. And guess what? I told him the port number 443 for https!!!!! But then, again, composing myself I started off- "https can use one of the two protocols SSL and TLS. SSL is the older one and stands for Secure Sockets Layer, TLS is the newer sibling standing for Transport Layer Security. Just for an example, consider a person A, browsing the Internet on a WiFi network and another guy - the evil one, using a packet sniffer to trap his communication. The evil guy won't be able to get anything because he is eavesdropping from the data link layer but the person A's browser is encrypting all the vital data in the transport layer itself before passing it to the lower layers!". Hearing this, he was non-plussed!!! He said to me - "You've very good knowledge of computers, I appreciate your cognition of computer science principles". I felt elated. Then he turned above towards application layer and asked me about DNS. I spoke about the need of DNS. Then he put forward the next question in front of me, thinking that this will go beyond my head. He asked - "Which record do we consult for resolving the hostname to IP address?". As soon as he had spoken the 2nd word of the question i.e. "record", I guessed non-deterministically that he is asking about the A record. As he finished the question, my non-determinism had turned into determination and I answered "A record!" He was surprised again. Then he asked me about the MX record. I spoke about the mailbox resolution thingy. Then asked me something bigger, I couldn't quite understand his question. I requested him to clarify the question. He repeated the long one again, and I didn't quite get the question again. I thought, it would be better to skip it. I said confidently "Sorry Sir, I don't know!". Then he asked me about the CNAME record. I said it stands for canonical name and is used for aliasing of domain names. Then he asked me about the record name for reverse DNS. I said "I know it but I don't have it on my tongue right now". He said PTR? I answered excitingly recalling PTR "Yes, PTR, thats it!". Finally he said, you have cleared the technical round of the interview. He told me about the courses, the company is going to train me on. He said to me, that you will get a job right here in NM Infotech after the completion of your training on RHCSS course. I kept nodding my head in affirmation. Then he told that you cleared technical round, but the HR round is left. "So, what do you know about NM Infotech?". I said, I had visited company's site last night and I needed 6-months training so I thought I should try my hand on NM Infotech and so I am here in front of you. He congratulated me on clearing the interview, and I left the chamber.

After me, many candidates went inside but none of them was able to sustain more than 5 mins. My session had been around 15-20 mins. long. I got my confirmation letter and left the premises with a smile on my successful clearance of my life's first ever interview.

Saturday, December 26, 2009

3 idiots - Review

Exactly after 365 days, he strikes again! On Dec 25th, 2008 Ghajini was released and this family movie was perfect for all audiences without any single minus point! Now, after an year, 3 idiots, recites the show! Although not perfect for all audiences, because of some comedy not fit for watching with your families, it is a must watch for all Engineering students, and other members of the species called College Students. It was hyped to be based on Chetan Bhagat's novel- 5 point someone, but I would rather say it is inspired from the bestseller novel. The story revolves round Amir Khan(Rancho), his two friends, and their college's principal and his daughter. Amir Khan, an advocate of acquiring knowledge rather than getting a degree has done it well. Some of his engineering excellences in the movie are worth loads of applause. The message spread by the movie is "Don't run after success. Go for excellence in your own subject of interest, and success will run after you." Most children, especially in North India are forced to choose either Engineering stream, or Medical(especially girl child) by their parents, thinking that these two are the only ways, a child can build a successful career in. But the movie strikes this idea hard with a hammer and preaches that build your own career in the subject of your interest. Be excellent in your field, and success will chase you. The movie also raises the issue of mental pressure(to perform) on the students of top institutions who sometimes try to end the struggle with a suicide saying "I quit". The faulty education system is training students, not educating them.
The movie never bores the audience during whole three hours. It will keep you hooked to your chair/seat throught. I will give this movie 10 on 10!!! If you haven't watched, do it now!!!!!!!!!!!

Friday, December 25, 2009

Geekbench Benchmark

Geekbench is a processor and memory performance benchmarking application which will stress test your system to give you an idea about how capable is your system in processing. Download it here.
I tested my notebook running Windows 7 ultimate, and it scored a fair 2677! Here is the result page for my benchmark.
By the way, I was surprised to see the top scorers. Data centre servers with 80GB RAMs, multi deca core processors!!!! lol Check the result browser yourself.

Wednesday, December 23, 2009

Whats new with me?

Hello readers! I've been away from my blog since quite some time. I was busy with my semester exams whole of this month. And 7th Semester was full of activities in the college, so I couldn't get time to keep posting here. And there was one more reason for me to keep myself busy. Well, I ain't going to tell that right away :P
So, the major update from my side is that I am preparing for GATE-2010 with an aim to get myself admitted to M.Tech course in Computer Science from IISc, or one of my favourite IITs(Bombay, Kanpur and Delhi). I had deep interest in Computers since Std.8th, and that was one of the reasons why I didn't pay attention to the syllabus while preparing for AIEEE/JEE and was crushed badly!!!! I didn't had any interest in AIEEE syllabi. I wanted to study computers only. lol! But now, I have a chance to study computer science only and appear in All India level competition to assess the strength of my interest. The paper is on 14th Feb -Valentine's day! :P 52 days left!!!!
I'll try to keep posting from now onwards, at least once a week.

Saturday, September 19, 2009

My New Notebook

During the last session break holidays I carried my 4 yr. old aging PC to home and after the end of the holidays I didn't bring it back with me to my college. So, I needed a computer badly. Most of my work was postponed because of lack of a PC. So, I decided to get myself a notebook. Why a notebook? Why not a PC? Ok, here are the points that forced me to prefer a notebook over a desktop computer despite the fact that the life of a notebook is far lesser than a notebook.

1. True mobility! This is the most important point to prefer a notebook. I can carry my notebook to college, to home, to delhi, to singapore, to bangalore, to bathroom, to a neighbouring girl's room(ROFL! just joking) or almost wherever I go. That means I can compute wherever I am. A desktop is restricted to the table on the other hand.
2. A desktop pc has to be shut down in 2 minutes after a power cut. If the UPS is new and good it can run for 30 mins. A notebook can run upto 3 hrs. so no hindrance in any work.
3. To use a desktop PC, I need to be in same posture for long. Its quite tiring if I need to work for long. There is no such problem in case of a notebook. I can keep it on my lap, on table, on bed while I can use it in sitting mode or lying on the bed or any position I wish any time.
4. After purchasing a PC I need to buy several addons like webcam, card reader, wi-fi card, bluetooth dongle etc etc. A notebook although costlier has all of these built in.

There are several more smaller reasons which are the consequence of first point, so I ain't gonna write them all.

On 4th September I went to buy a Dell Inspiron 14 with 320GB, 3GB and C2D 2GHz T series processor with 800MHz FSB and a rated battery backup of 3 hours. After searching a few shops in Chandigarh Sector-20C computer market and getting the price quotes I found out that the cheapest deal for that machine was at Rs.35.5K inclusive of all taxes, a mouse and a headphone. But I wasn't contented, dunno why. I needed something else. Then I stuck on a Fujitsu-Siemens Amilo Si 3655. It was small, with a 13.3 inch screen. And it was powered by a C2D P8400 running at 2.26GHz and an FSB of 1066MHz. Memory was 4GB and storage 320GB. It was available at Rs.37k for people with an student ID card. And it had a rated battery backup of 4.5 hours. I took a demo and it looked fine to me. It was real fast. It was churning the hell outta Vista. The size was small. White color I liked. And the configuration was cool. And the screen was brilliant. Also it boasted of Intel Centrino 2. I noticed that only problem with it was that it had only 2 USB ports opposed to other notebooks which generally have 3 of them. No problem for me. I performed some research on net on forums and when didn't encounter any complaints from Fujitsu, I settled for it and purchased it!
Here is the official page:
http://ts.fujitsu.com/home/products/notebooks/amilo_si_3655.html
Here are two pictures of it in action.



I am running Windows Vista Business on it. So far no problems. Working at dreamy blazing speeds. I had never before used such a fast computer. XP too wasn't this fast. The Intel GMA has a whopping 1.26GB of video memory!!!! So, I should be able to run any game on it without problems. But I haven't yet tested any game. No time for that now a days.

Friday, September 11, 2009

2 Months!

I posted here last over two months ago. The period in between, didn't let me have time/resource to post. There have been many updates in my life since then. One thing that I forgot to post here, that happened earlier than 2 months ago was the purchase of a TFT LCD monitor. It was a SAMSUNG 16'', I forgot the model number. I left it at home so can't check now. I had purchased it in 3rd week of June, for Rs.5350.
Other updates in my life include a personal one, and a few academic and some technical ones. A notable thing that happened to me was that my P1i fell several times on hard floor while I was at home and its side cover now tends to come out. Fortunately I did some extreme engineering and fixed the side covers in place by pasting them through FeviKwik!!!!! Hehehe
Another update is that I got a new notebook and purchased a Reliance Data Card for using internet. I'll post individually about them.
A yet another update is that my 6th Sem exam results have been declared and I got 76.44% marks. That is pretty much if I consider the little amount of time that I spend on studies! ROFL
So, now the bandwagon of my blog should carry on. I\ll post about my new notebook soon.

Wednesday, July 8, 2009

Transferring files over LAN - Part 2

Sorry, I had written in my previous post that I'll get back with the 2nd part of this tutorial tomorrow, but didn't actually get time. But now I'm free and here's the 2nd part that will show you the merits of client/server technology and TCP/IP protocol stack.
This one has one additional requirement and thats Apache Server Software. You may download it by clicking here.
Install it in the computer from which you want to serve the file to other one. Installation is quite easy. If you've some confusion in what values are to be filled in which boxes, then use these values:

Network Domain: localhost
Server Name: localhost
Admin Email: any email address

And check the box labelled: for All Users, on Port 80, as a Service


Ok, now you've installed Apache, lets make sure whether it is working correctly or not.
Open any browser window and type localhost in the address bar and press enter. If you see a white page with "It works!" written in large black font, that means you've done it succesfully!!!
But if not, then refer to the official documentation here or an unofficial nice one here.

Ok, so now we've finished installing the server software. Now lets proceed ahead and configure our LAN.

1. Follow the first two steps of the previous blog post i.e. http://p97.blogspot.com/2009/07/transferring-files-from-one-computer-to.html
2. Now in the server computer i.e. the one with Apache, right click your ethernet card in Network Connections, click Properties. In the box under "This connection uses following items", click Internet Protocol(TCP/IP) and click Properties command button below.
3. Now check the radio button that says "Use the following IP address" and enter 192.168.0.1 in the box, press "Tab" key on your keyboard, and the next Subnet Mask box will automatically be filled with 255.255.255.0. Now click ok and close.
4. In the client computer do the same but put the IP address as 192.168.0.2
5. Now navigate to the apache installation directory's htdocs folder and delete the index.htm or index.html files.
6. Copy the files you want to share, to this directory.
7. In the client computer open a web browser(I don't recommend IE!!!, use Opera or Firefox), and type 192.168.0.1 in the address bar and press enter. Viola!!! You can see the files that you copied to htdocs folder in the server computer. Just click any of it to start the download. You will get download speeds around 80Mbps i.e. around 10MB/s.

Here are some images to help you if you get stuck somewhere.


Sunday, July 5, 2009

Transferring files from one computer to another over LAN

Many of my friends who're not directly connected to computers have asked me ways to share files between two computers. For most of them I've done that myself physically and for others, for whom my physical presence isn't feasible, I'm posting this one.
I'm assuming you've Windows XP running on both the computers and drivers for LAN cards are installed.

Additional Requirements: A CAT-5 Ethernet Crossover Cable(thats technical name, common name is LAN wire cross waala)

I will discuss two ways to do the same. One is a primitive simple way to share files. Other one is a bit geeky, and you'll probably feel proud of yourself doing that :)

Ok, so simpler one first.

1. Insert both the ends of the cable's RJ45 connectors to both the PC's LAN ports.
2. Open "Network Connections" from Control Panel or from Start>Connect To>Show All Connections. There, in both the machines, make sure the ethernet cards under "LAN or High-Speed Internet" category are enabled. If not enabled then right click over the corresponding icon and click "Enabled"
3. Now in both the computers right click "My Computer" in start menu and click "Properties". In "Computer Name" tab, click the "Change" button. Now put different names for both computers and in the bottom below "Member of" label select the radio button labelled "Workgroup" and put any name there. But make sure this workgroup name should be same in both the computers. Now click ok. And restart both the computers.
4. After restarting, open "My Network Places". Oh, where is it??? lol if you can't find it, just open "My Computer" and in the left pane i.e. Tasks Pane you'll see "My Network Places" under "Other Places". Click that. In the tasks pane of "My Network Places" click "View workgroup computers" and you'll be able to see the other computer.
5. Ok, now they're networked. Ok? So how to transfer the files? Easy!!! In any computer right click any file/folder/drive which you want to share, click properties and in sharing tab enable sharing.m Thats it!!! You can see that file/folder/drive on the other computer when you double click this computer's name in its my network places. easily copy the files.

The other(geeky) method, I'll post tomorrow.
Here are some images.


Thats a caT-5 cable with Rj45 connectors on both ends.












For the second part of this tutorial GO HERE

Thursday, June 18, 2009

Download 2+MB through Airtel NOP

Am gettin bored lyin on da bed tryin 2 sleep but sleep is milez away 4m my eyes. Ok, so empty brain is devilz worksop! So, I think of postin sumthin 2 ma blog n an idea popped up, n thatz 2 post da 2+MB download trick 4 NOP victims!!! Yes, victims! Many peepz hav askd me dis n I've repeated 1 less than a million times da same procedure. Dis 1 is da millionth tym n aftrwards I'll always point every1 2 dis blog. Ok, so lets start! And hey, 1 more thing. I'm makin dis post 4m my bellphone, oh pardon, cellphone, so I ain't using da 4mal english. Just compressin everyfin lyk n sms. So lets get ahead. 1st thing 2 know is d requirements. U need ne opera mini mod that has d download manager. All mods above ver2 have da d'load manager. And 2nd thing u need is a fone wid Airtel NOP connection. And hey, da phone shudn't be a Nokia s40 cuz s40 bricks don't allow java apps 2 connect 2 net thru NOP. Prefer an SE phone or an s60 symbian os 8 or above phone. Apart 4m d above 2, u need an average IQ 2 understand actually what's going on. Ok, now launch opera mini mod n open da site from where u wanna d'load da file. Click the link. A Download page will popup. Press the left softkey twice 2 get da download setup page as the screenshot given here. In this page scroll down 2 da checkbox labelled 'Loading on positions beginning-end'. Check the checkbox n in da input box below enter '0-2048000' without d quotes off course.
Leave everyfin else untouched n press d left soft key twice 2 start d download.Aftr d download completes repeat same steps again but this time in the input box '2048001-4096000' and below select the radio button labelled 'Resume Interrupted' instead of 'Auto Rename'. Repeat until you've downloaded the whole file in fragments of 2MB. You've 2 repeat d steps ceil(filesize in mb/2) times. Share d trick wid ur frns n enjoy downloading large songs thru NOP. Cheers!

Tuesday, June 16, 2009

Cricketing Preamble of India

I made it up in a hurry. Suggestions or mods for improvements invited :)

We the people of India looking forward to solemnly resolve and constitute an unbeatable, unchasable, highly coveted, venerable, valorous, united, consistent Team India securing all her fans
WINS, series, tournament, trip;
CONSISTENCY to continue the triumph for eternity;
STABILITY in the team and UNITY among the inmates


Btw, for the unfortunate defeat of the team in T20WC2K9, the whole credit goes to Dhoni. I request Dhoni to die!!!! I curse you Dhoni! You will die of leprosy!

Tuesday, June 9, 2009

Computer geeks are best lovers!!!

A survey performed among IT professionals in U.K. revealed that computer geeks/fanatics/enthusiasts prove to be best lovers in their real lives!!! pmpl!
It further revealed that computer nerds are selfless and adventurous and can do things different from the world, for the person they love. 82% people in the survey accepted that they value their partner's preferences over their own. It was also brought into focus that people who are always worried about their fitness were selfish.
Well, it is just another survey and I generally don't believe in survey reports done in U.S/U.K. by a bunch of people who don't have anything else to do. But from my personal life experience, I've felt that the survey report in the above one is true to an appreciable extent. My two best friends who are computer experts, are really selfless, good natured, monogamic and passionate about their love.
Whatever be the truth, who cares? I just wrote this up because it is related to the lifestyle of computer lovers and this blog is primarily a technology blog. So some of the readers may have some interest in it.

Tuesday, May 19, 2009

Free browsing on PC through Airtel LIVE!

After the RIPping death of all free GPRS tricks, finally I discovered a trick to browse free through Airtel LIVE! This one works in any circle in which browsing through TeaShark over Airtel LIVE! is free. I tested it in Punjab circle, and it works like a charm. Ok, so here we go.

Requirements:

1. A PC with any popular OS(Win, Lin)
2. Mozilla Firefox browser
3. Following extensions for Firefox: Modify Headers, XHTML-MP, Wmlbrowser, OpenInBrowser, Mason

Procedure:

1. Connect to net on your PC through your phone over the APN airtelfun.com
If you don't know how to do that, you're perfect example of a n00b so stay away from this post unless you learn that. Use google, learn that and then come back again.
2. Now install the above said extensions in FireFox, if you haven't installed them already.
3. In FireFox, in Tools menu click Modify Headers. Click the Configuration button, in the bottom right of the Modify Headers dialog.
4. Now, check the box that says Always On: Enable Modify Headers when this window/tab is closed
5. Now create a new entry in the Modify Headers dialog with following details:

Action: Modify
Name: user-agent
Value: Mozilla/5.0 (X11; U; Linux i686; EN-US) AppleWebKit/523+ (KHTML, like Gecko)

6. Save the entry and make sure a Green lit circle ahead of it. If not, then double click the entry to turn the red signal into green.
7. Now, in Firefox in Tools menu(in Windoze) or Edit menu(in Linux), click Options or Preferences. There in Advanced tab, in Network tab configure FireFox to use the proxy 100.1.1200.99 and port 8080 for all requests.
8. Now start browsing. Viola!!! You won't be charged anything for opening any site!!!!

Ok, so now, what were the other extensions for?
1. XHTML-MP: Since Airtel Live! has Nokia WAP Gateway installed at the backend, so sometimes for some sites it serves the content-type as application/vnd.wap.xhtml+xml or simply application/xhtml+xml. If you don't have XHTML-MP extension installed, instead of viewing the page, you'll get the dialog to save the page.
2. Wmlbrowser: For browsing the WAP sites.
3. OpenInBrowser: Sometimes, some sites which haven't been programmed keeping XHTML compliance in mind, will show an XML Parsing Failed error and you won't be able to view the site. OpenInBrowser extension lets you Reparse the document as html and make the page viewable. You already might be knowing XHTML is too strict about errors, and html is lenient.
On encountering any such page, in View menu, hover to View As, there select Other and in the content-type box type text/html and hit ok.
4. Mason: This is an alternative to OpenInBrowser. Through Mason, you can create a rule for any site that gives you problems. Just create a rule for the site, such that it always is parsed with text/html as the content-type.

Limitations of the trick:
1. The proxy doesn't support secure connnections, so no orkut, no gmail, no blogger! Any site with the URL starting with https won't open. Only http ones will open.
2. Sometimes the response times are too slow.
3. You'll encounter one of these too irritating errors several times:
a)Gateway received and invalid resposne from an upstream gateway.
b)Your request for a service couldn't be fulfilled.
In each case, just reload the page.

Ok, so how did I discover this trick? Where is the magic? How does it work for free?

My free Mobile Office working from past 7 months got shutdown recently. So, I thought of using an alternative for browsing. I used the TeaShark browser on my P1i, but TeaShark has display/rendering issues with sites on my phone. So, I was thinking to figure out why does teashark work for free. I setup an experiment, just changed the user-agent of FireFox to the one used by TeaShark. And bingo!!! To my amazement, I wasn't charged a single paise for opening any site.

Enjoy the free trick, share with your friends.

Saturday, May 9, 2009

LOLCODE

LOLCODE is a funny programming language understandable to 1337 or leet people only. It uses various Internet acronyms that flourished and were heavily used in early days of the Internet, among the newsgroup members and IRC addicts. Here's a simple LOLCODE "Hello World!" program.


HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE


HAI in the first line declares the start of our LOLCODE program. HAI means Hello in Internet slang.
CAN HAS STDIO? is C equivalent of #include
VISIBLE "HAI WORLD!" is for printf("HAI WORLD!")
KTHXBYE or Ok Thanks Bye declares the end of a program.


LOLCODE uses several funny constructs. For example for looping it has:
IM IN YR LOOP to start the loop and IM OUTTA YR LOOP to end it.
Variable declaration by:
HAS A VAR eg: I HAS A VAR which in plain english means I is a variable.
To open a file:
PLZ OPEN FILE "FILENAME.TXT"?
For a true value of the above statement:
AWSUM THX
For a false value:
O NOES which in plain english is Oh No!!!

For more details visit the official site http://lolcode.com or WikiPedia page

There are more trivial things like this. Check out INTERCAL and Brain****

There are people filled in this world to carve fun inside boring things like programming. LOL enjoy the world!
KTHXBYE

Friday, May 8, 2009

PHPMyAdmin Large SQL File Dumping Problem

As I'm a web/WAP developer with PHP as the base scripting language and MySQL as the DBMS, I've to take backups of the DB at rather regular intervals to counter any catatrophic events. I noticed that dumping a large SQL file (say 8-10 MB or more) takes lots of time(around 10-12 mins. or more) through PHPMyAdmin. I used to attribute this to MySQL thinking, it to be slow at parsing the file. One sunny day, I opened task manager before starting the dump process. As I hit the submit button, I saw the processor usage shooting up to 100%. I changed to the "Processes" tab and was surprised to see that mysql process wasn't consuming any CPU power. It was Apache which was clogging up 99% of the CPU power. I tried to End the process but it refused to, and my PC finally crashed.
Taking a lesson from this, I tried an alterntaive way. I used the MySQL command line interpreter to dump the file and voila!!! The dump finished smoothly in less than 15 seconds!!!! So, that was an Apache bug. Right???
Ok, by the way here is the step by step process to carry out the same.
1. Copy your sql file to a convenient location(say root of C:\) and name it something simple (say 1.sql)
2. Now launch command prompt and change to the directory where MySQL is installed. Mine is in F:\xampplite\mysql\bin
3. Type
mysql -u root

and enter your root password if asked. You may use any other username instead of root, depending on your needs.
4. Create the database if you want to dump into a new DB
CREATE DATABASE my_db;

5. Instruct MySQL to use this new DB.
USE my_db;

6. Now use the SOURCE statement to dump the file
SOURCE C:\1.sql;


Watch out the process munching a couple of lays chips! By the time you finish two chips, mysql will finish the file :)
I'm uploading the screenshot for a 22MB SQL file dump.


This one's upto the time I pressed enter after SOURCE statement


This one is after execution

Sunday, May 3, 2009

Higher Computer Education Online

Who says higher technical education is costly in India??? lol Many say!! And it is true to a large extent. Most of the talented students never get a chance to get themselves enrolled in IITs or NITs for a reason or another. But still the talented ones have passion to study and get what they deserve, through a bypass route. Admission to private engg. institutions is pretty easy but they charge loads of money. And, barring a few, most of them have pretty low grade quality of education.
SOciety apart, let me come to the point. Ambitious and passionate create their own paths to success! I'm writing this post to help such students find appropriate targetted study stuff online. Most of the stuff pertaining to the syllabi of B.E./B.Tech is available online but scattered quite badly. On performing a few searches, I found lots of stuff online that I'm enumerating here.

0. NPTEL Online Stuff
NPTEL stands for National Programme on Technology Enhanced Learning and is an initiative from various IITs to provide IIT lecture notes and videos to non-IITians online. So, far the best congregation of online study material for engineering students.
http://nptel.iitm.ac.in/


1. Rai Foundation Open Courseware
Rai university has its lecture notes online as per its open courseware program. Here's the link to the stuff for B.E./B.Tech in CS/IT and BCA/MCA:
http://www.rocw.raifoundation.org/course-computing.htm
Almost all the subjects of most of the university syllabi are covered. AICTE already has recommended a uniform syllabus for all technical universities.

2. Springer Link
Springer link has a congreagation of high level papers related to all the fields of engineering. Here's the link to computer science section. Use the search box in the right pane to find your desired syllabus.
http://www.springerlink.com/computer-science/

3. FreeTechBooks
FreeTechBooks.Com has open source public domain books for computer science and IT branches. A really good one:
http://www.freetechbooks.com/

4. IIT Lectures on YouTube
Recently IIT launched a program according to which all the classroom lecture videos will be made online on YouTube. Follow the link and search for ur subject. Now, you don't need to be in IIT to study in IIT
http://www.youtube.com/results?search_type=&search_query=iit+lectures&aq=f

5. WikiPedia
Leaving WikiPedia in the list will be a big blunder! WikiPedia has the largest congreagation of human knowledge on the Internet. To search for a particular topic on WikiPedia, type the following query in Google Search box and hit the I'm Feeling Lucky button:
site:"en.wikipedia.org" <topic name>

Example:
site:"en.wikipedia.org" Dynamic Programming


Thats enough dose for now! Study well, and bring up a bright future for yourself and for India. Jai Hind!!!

Tuesday, April 28, 2009

Restore Ubuntu GRUB After Windows wipes it out

This is a common problem with most new Ubuntu(or any Linux) enthusiasts. You install Ubuntu with a dual boot with Windows. Due to some freaking reason, you have to perform a Windows reinstall and what the !!!! Now you can't see Ubuntu in the OS's choice while booting your computer, kore precisely you don't get an OS choice menu.
Ok, here's a simple straight forward trick to regain your lost GRUB bootloader.

1. Boot your computer using an Ubuntu Live CD.
2. Press Alt+F2, type xterm and hit enter.
3. Now enter following commands:

sudo grub

find /boot/grub/stage1


4. The output of previous commands will be like (hd0,0) or (hd1,2) depending on where you had installed your Ubuntu.
5. Type

root

example:

root (hd1,2)



6. Then type:

setup (hd0)


and you're done.

The above tutorial was for newbies only, and I considered the most common circumstances. Experts already know what's wrong with their system and they play well with the circumstances :)

Tuesday, March 31, 2009

Receive your e-mails through SMS for free

This post is beneficial for Indian people only.
MyToday.com provides free, instant, e-mail alert notifications via SMS. I discovered this just a week ago, although it existed since quite long and many of my friends were using it and me being totally ignorant about it!!!
To use the service, you just need to carry out the following two steps:
1. Send an SMS to 575758 with the following text MAIL START <your city name>
For example: MAIL START DELHI
or
MAIL START CHANDIGARH
If you live in a small city/town, then you may send your state's capital city name.
2. The next step is to login to your e-mail account and set an autoforwarder that sends every incoming mail to 91<ur 10 digit mob. no.>@m3m.in
Example: 919876543210@m3m.in


Now whenever any e-mail arrives in your inbox, your mail provider will forward a copy of it to mytoday, and they'll in turn send it to you immediately through SMS.

There are several applications of this service. It depends on your thought power and creativity to tap them. One simple one is instant sms alerts for orkut scraps.

For that, just login to your orkut account from PC and click settings. There in notifications set scrap notifications to be sent by e-mail. And thats it!!! Now, whenever anyone scraps you, you'll immediately receive an SMS.

This service is absolutely free, except for the first activation SMS that you sent. Airtel charges Rs.3 for that. I dunno about other operator charges.

Enjoy!!!

Tuesday, March 24, 2009

Opera Turbo

And finally there's some relief to the people blessed by slow connection blues!!! I'm one among you, if you're a victim of turtle/earthworm slow net connections. I use Airtel Mobile Office, which here provides a maximum download speed of 5.4KB/s!! Browsing is even slower than that because of lethargic response times. If I try to view a site with lots of page elements, graphics, flash content, it takes several minutes to load. If I'm in a blog or a forum and click a few links while holding CTRL+SHIFT(new tab for opera), it'll take ages to load all the pages fully. But now Opera has brought a solution especially for me and the likes! There's no downloading speed boost but there's surely a multi-folds browsing boost. The browsing experience is streamlined several folds. The product name is Opera Turbo. For windows it can be downloaded right here and it is just a 6.2MB download.
So, what's special about it??
First thing, Opera Turbo doesn't connect to the site you wanna view, directly. Instead it uses its separate proxy server labs1-turbo.opera-mini.net to download the page for you. When you request a site say google.com from turbo, it connects to labs1-turbo.opera-mini.net where they've zillion times fast connection than yours. Google.com page is downloaded there, compressed and then sent to your computer! Now that's something rapid!!! But there's a con. The images are converted to save size, and the images look crippled while browsing through turbo. But who cares? Second thing is that, you don't have to compromise on security because secure connections are setup through your own computer and opera-mini server isn't going to perform any man in the middle attacks! ANyways, I trust Opera guys. They won't try eavesdropping my e-mail conversation, nor they've any time for that. lol
Ok, here are two reasons I found why it gives an ultra faster browsing experience for lethargic ISP users:
1. Compressed data download, as Opera designed it to do.
2. Instead of resolving several hostnames and connecting to several servers, it just connects to a single server and downloads all the stuff in one go.

I'm explaining the second one with a simple example. Suppose you wanna view a blog or a forum post with several images, frames, google ads, and several other page elements hosted at different servers. Like, your site is blah.com/blah and the page markup needs to connect to css.blah.com, static.blah.com, img1.blah.com, img2.blah.com, page2ad.googlesyndication.com etc....to display everything correctly Then on any other browser, separate connections to these servers will be opened hence crippling your already slow internet connection. Lots of bandwidth will be wasted to connect, download, manage error/flow control(if required) to each of these separate servers. But with turbo, a single connection will be made to opera-mini server and all data will be downloaded in one go and that too compressed hence giving you a smooth and fast browsing experience.

In the status bar there is a turbo button to enable turbo browsing or disable it. When red, turbo is enabled. When gray, itz disabled. When you hover your mouse pointer over the button, it'll show how much bandwidth you've saved by now.


What Opera have written about it on their blog can be read at http://labs.opera.com/news/2009/03/13/

Turbo will be a feature of Opera 10, which is still beta. I noticed some issues in it being beta. Here are the two:
1. If you toggle turbo anytime, the change will be available in all tabs you open afterwards. It won't be visible in the tab you toggled it or all the ones opened before.
2. The Transfers tool is buggy. Stopping and resume a download corrupts the file.

They'll surely fix the issues in the subsequent versions.
Enjoy fast browsing with Turbo and turbocharge yourself!!

Sunday, March 22, 2009

ACID3 Browser Test

You browse the web. There are several browsers to choose from. Everyone has his/her own taste. I like Opera. Someone likes FireFox. Someone else loves the shiny new Google Chrome. Someone sitting elsewhere likes sticking with the good old IE. The availability of myriads of browsers make it difficult for the web developers to code sites because different browsers differ at some part or the another of standards support. So, the geeks, the leaders of the web technology decided to unify web standards and Web Standards Project was born. They worked and designed tests for the browsers to measure the extent of standards supported. ACID3 is the latest in the series. Click the link to benchmark your browser. Following are the scores of some top browsers tested by me on my PC and phone.

Desktop Browsers
Opera 9.63 - 85/100
IE6 - 13/100
Firefox 3.0.0.5 - 71/100
Opera Kestrel Beta2 - 100/100
Opera WinGogi - 99/100

Mobile Browsers
Opera 8.65 on P1i - 38/100
Opera Mobile 9.50 beta2 fingertouch - 73/100
Ozone - 93/100
I'm attaching some screenshots at the end of this blog post.
By the way, Opera have released a specially designed browser codenamed WinGogi that they claim, passes ACID3 by 100/100. It can be downloaded here . I tested on my PC, but it scored 99/100. May be, due to some connection blues. They claim WinGogi to be the first browser that passed ACID3 by 100/100. Source is here. On the other hand Apple claims that WebKit is the first browser engine to pass ACID3 by 100/100. Source is here. lol Whatever... By the way, Opera 10 Kestrel Beta 2 on my PC reached 100/100.

Ok, here are the screenshots.

Ozone on P1i

Opera Mobile 8.65 on P1i

Opera 10 Kestrel

Opera WinGogi

Firefox 3.0.0.5

IE6

Opera 9.63

Saturday, March 14, 2009

nl2br() function in PHP

While working with the RW/LL WAP community script, I noticed a bug(???), better say unexpected behaviour in nl2br() PHP library function. I had a function for processing bbcodes. I added the nl2br() in it to convert all the enter/return presses into the xhtml <br /> tags. But I noticed, in the forum posts all other bbcodes didn't work whenever a call to nl2br() occured due to enter presses. After fiddling with a lot of sequences(which I later found to be illogical on my part) of the processing lines of codes for bbcodes and the nl2br() function, I figured out that the problem is not with my code but PHP's implementation of the nl2br() function. So, with the help of the nl2br() manual comments on php.net I wrote my own nl2br() function as follows:
function nl2br1($text){
$text=str_replace(array("\r\n", "\r", "\n"), "[br/]", $text);
return $text;
}


Well, the above function takes into concern that:
On Windows the enter key press means "\r\n",
On Linux/UNIX/BSD and other UNIX derivatives the enter key press means "\n"
and on a Mac, it is "\r\".
Probably the built in nl2br() in PHP is implemented differently, so the glitch appeared.

P1i - Opera Mobile 9.50 - SMS glitch

After the release of Opera Mobile 9.50 beta 2 Fingertouch, I've been using it a lot on my P1i for browsing for hours. I notice a strange behaviour in my P1i when I've browsed the web for long through it. My phone doesn't notify me of any SMS sent to me. Neither with the tone, nor with the icon in status bar. When I restart the phone, the new SMS is displayed. I wouldn't have noticed if I hadn't turned my phone off one night before going to bed when I was too tired. In the morning when I booted the phone back I got two SMSes that were sent to me three days ago. lol! I generally didn't use to turn the phone off for weeks. Whenever necessary I used to set it in flight mode. But now I do that every night before going to bed.
Well, a probable reason I guess is that the new Opera Mobile is a RAM hog, and when the RAM goes too low while web browsing, the phone shuts down the SMS client process that listens for SMSes, in order to free up some RAM. Whatever may be the exact reason, it should be fixed by Opera.

Sunday, March 8, 2009

Opera Mobile Finfertouch for UIQ3

On 6th of this month Opera released the second beta of Opera Mobile9.50 for us UIQ users!!! Contrary to the popular feeling that UIQ is dead and Opera too will ditch it. The new beta is great! I felt some improvement in stability issues and speed in loading large pages. They also changed the logo. Earlier it looked like the power key!! And the best thing of the new beta is the new Fingertouch technology. According to Opera's official blog:
Today we introduce Opera Fingertouch, a technology designed to make interacting with the Web easier and simpler on touch-based devices. Opera Fingertouch provides visual feedback when you hit a Web link, and assists you when you come across multiple links or other selectable elements in close proximity to one another.

Here's a video released by Opera officially about the new jargon:


I tried capturing the screenshot os fingertouch in action on my P1i but it didn't work. The screen capture apps weren't able to capture the display area of the browser. Only the address bar came. I tried two different apps TOSC(the Open Screen Capture) and CS(Capture Screen), but same result. I'm attaching a screenshot anyways.

Saturday, February 28, 2009

Display Live Cricket Score on your site

I wanted to display live cricket score on my site, so I pushed the tea cup aside and got down in front of my PC googling for something significant, to find an hour later that the previous hour I spent went in no man's land!!! I got an inspiration here too from the blog comments BBC Backstage. Ok, so I went ahead and decided to pull out the live score data from wap.cricinfo.com. I first tried to pull out their page source into a string using PHP built in function file_get_contents() but apparently it didn't work out because cricinfo server is too nasty to respond to your http GET request if you don't provide the user-agent string. So, I formulated my own http request and then it worked out effectively. Below is the PHP code fully commented for clarity. The code is in aqua and comments in yellow.

<?php
$matchid=18307; //enter the matchid here
/*How to get match id? Open wap.cricnfo.com through Opera or FF with XHTML-MP extension. Then click the match that you're interested in. From the address bar, read the matchid.
Ok, so now we've got the match ID lets proceed
*/

$fp = fsockopen("wap.cricinfo.com", 80, $errno, $errstr, 30);
/*the above line is to open a socket connection to their server and bind it to a file stream
*/

if (!$fp) {
echo "$errstr ($errno)
\n";
echo "Data not available!";
} else {

/* and these four lines below are our http request */
$out = "GET /liveScore.do?matchId=$matchid HTTP/1.1\r\n";
$out .= "Host: wap.cricinfo.com\r\n";
$out .= "User-Agent: SonyEricssonK800i/R1AA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1\r\n";
$out .= "\r\n";
fwrite($fp, $out);

/* the below while loop reads the response from their server and stores it into a string i.e. $page
*/

while (!feof($fp)) {
$page.=fread($fp, 512 );
}
fclose($fp);

/* now we've got the page source, just use explode to pull out only the live score from it
*/

$blah=explode("<tr align=\"center\" bgcolor=\"#85ADE4\">", $page);
$blah=explode("</tr>", $blah[1]);
echo $blah[0];
?>


Now you've got the live score in the variable $blah[0], you can do anything with it. Format it according to your site theme and add wherever you want :) You may also use the PHP GD library to create an image from it. Possibilities are endless...

Wednesday, February 25, 2009

Sony Ericsson Idou

Freaking hell!!! It boasts of a 12.1 megapixel camera, a 3.5 inch screen with resolution 640x360, a TV tuner and everything else!!! It'll run on the new open source Symbian OS that isn't yet complete. It was previewed by SE at MWC.
The GSMArena page containing its specs is here.
And, here are some pics of this stunning beauty.(Source: gsmarena.com)


New Site

On 19th of this month I purchased a new shared hosting plan from Umbrahosting. I couldn't get one from IXWebhosting cuz of some technical problems. At Umbra, I chose the Planet plan. Its good. They claim to give 10 gigs of disk space, 100 gigs transfer per month, unlimited FTP accounts, unlimited mail accounts, unlimited add-on domains, a free domain, unlimited DBs, unlimited subdomains and all other bells and whistles that any other host offers!!! Looks great!!! They charge $6.99 per month. On using the coupon code 20off I got a discount of 20% and got it for one year for only $59.99. They support payment through non-verified PayPal accounts too.SO far, the service seems pretty good. They had some downtime problems on their barbara server on which my site is hosted but it was resolved quickly. The support department is good and they respond very quick to tickets. My first ticket was replied just after 16 minutes of creation. They use cpanel for the management which is the best of all hosting control panel softwares. OS they use is centOS. The response times are pretty fast. The domain I took as free was indifun.org.
But I wanted indifun.in so I purchased it from Rediff and added to the site.
About the site
IndiFun has been my most dreamt off project since mid last year. I've been working on it with my oldest net friend REY619 but due to bad lucks hitting at regular intervals we coluldn't manage to run it smoothly and were always jumping from host to host. Free hosts suck!!!! We jumped from VNDV to Orgfree, to x10hosting.com to Freehostia and all of them are crap as hell!!! Finally we got a paid hosting solution and an stable site now. Now I aspire to carry IF to new heights.
IF is basically a mobile community based on the leaked ravingwap script in PHP, with several mods and added features that we both coded together. It works on low-end phones, hi end phones and PCs seamlessly. Check it out yourself if you're connected in someway to mobile sites. Click
If you're interested in purchasing the script just ask me. The price is $80 for non-Indian users and Rs.3000 INR for Indian users. Payments accepted through PayPal for non-Indians. For Indians, direct bank funds transfer is an added option.

Saturday, February 7, 2009

The Linux Cheatsheets

While browing Ubuntu forums after a long time, I came across the Linux cheatsheets maintained by FOSSwire.com. They're great for the experienced Linux n00bs!!!
Check them out:
Ubuntu Cheatsheet
Linux Cheatsheet
Linux is fun! Linux is great! Enjoy Linux! Spread Linux! Create awareness about Linux! Share Linux! Teach Linux! Use Linux!

My first online earning!!

I'm a netizen since June 2001, but never earned anything on net. Last year, I thought why shouldn't I try earning something using the Internet???? And finally I got success in selling a script for $80USD. I received the payment in my PayPal account. The customer was an Australian.
But PayPal deducted $5.02USD as their fee!!! lol
I'm planning to invest that amount in purchasing a nice webhosting plan for my dream site. I, after a few hours of Googling found that ixwebhosting.com is the best for me. But the 2 year expert plan requires $94.80USD. I'm almost $20USD short of that in my account. Ok, lets see how do I manage the rest. Being a student, I don't have any credit card so can't even get the restrictions lifted from my PayPal account.
I'm attaching a screenshot here.

Adsense glitches

I tried signing up for adsense for my blog. But I don't have any clue why Google doesn't want me to.
First of all I went straight to adsense site and there tried signing up with my primary gmail account. It said - "a user with that account already exists". Ok, thats me, I thought. So, I tried signing in directly, and it said "no account exists with that name"!!! Google glitch??? Seems to be.
I then clueless, decided to sign up for a new Google account just for adsense. I used my rediff email account for signing up. My application was accepted for review. A day letter my phone beeped and I knew I've a new mail in my rediff account. I checked and was surprised to see that my Google Adsense application has been rejected. The reason stated was:
My blog address is not a TLD!!!
What the ....???!!!
I see thousands of blogspot sites using adsense and they don't have any TLD.

Ok, finally I tried the Adsense gadget integrated in blogger. I signed up, confirmed my email and my application was taken for review. And afterwards I haven't got any reply from them although I was supposed to get one withinn 2-3 days!

So???? Is it that Google hates me???? I haven't sued them ever, nor ever had thrown a pie over Larry Page and countless more of them....

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 reset.zip
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>

example:
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 "mylogs.freehostia.com" 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":

<?php
$logged="";
$logged.="Time=".date("j/n/Y h:i:s a", time())."
";
$log2=$logged;
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")."
";
$logged.="---------------------------------------------
";
$log2.="---------------------------------------------
";
$blah=fopen("logdetails.htm", "a+");
fwrite($blah, $logged);
fclose($blah);

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

$blah3=fopen("img.jpg", "rb+");
header("Content-type: image/jpg");
while(!feof($blah3)){
echo fread($blah3, 128);
}
fclose($blah3);
?>


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="http://yoursubdomain.freehostia.com/logger.php" 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:

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


In the above code host.com 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
xterm
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

example:
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>

example:
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","airtelgprs.com"

Note that the above setting varies depending on your operator. But you just need to change the username, password and access point(airtelgprs.com) 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.
Enjoy!!

Monday, January 12, 2009

DreamLinux

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:
GIMP
Rhythmbox
Totem
OpenOffice.Org
Inkscape
gThumb
xsane
AVIDemux
gFtp
Pidgin
Thunderbird
Iceweasel
etc....
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!

Lessons:
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!!!