Friday, January 28, 2011

How to run WiFi on Dell Inspiron N5010 in Ubuntu

Dell Inspiron N5010 is a wonderful notebook. But there are some irritating issues in it. The one I hate the most is that you need to press the Fn key before using F1-F12 keys. It kinda sucks!!! Any ways, the other frustration in it is that if you install Ubuntu in it(I tested 10.10 Maverick) the WiFi doesn't work. The lspci command shows the presence of Broadcom Wireless Ethernet card but it doesn't work out of the box. While fiddling with a friend's N5010 today, I found how to make it work. It is a very simple process, but it took me a lot of internet research to make it work. So, I'm posting it for whoever is going to do that research, to save his/her precious time.

Step 1. Reload the package information in Synaptic. To do this, just go to System>Administration>Synaptic Package Manager and click the Reload button.

Step 2. Download and install the firmware corresponding to the WiFi card present in your N5010. You can download it from:
http://ftp.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_0.28_all.deb
or
http://http.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_0.28_all.deb
To install it, just double click the .deb file you downloaded and click Install. When asked for password, enter your password and press enter. Wait till the installation is complete. After the installation, restart your system.

Step 3. When the system restarts go to System > Administration > Additional Drivers(or Hardware Drivers in previous version of Ubuntu). There, click the Activate button at the bottom of the dialog. You must be connected to he internet prior to this. Once you click activate, Ubuntu will download and install the appropriate driver for you on its own. And once the driver is installed successfully, you can use WiFi. In the notification area when you click the corresponding icon for Network you will be able to see the Wireless networks if you are in the range of one.
Happy Linuxing!!!

Friday, December 24, 2010

New domain

Life of a tech addict is now TechBite! Please update your bookmarks.

The address of Facebook page is now

http://www.facebook.com/pages/TechBite/167386736616047

A new venture has been started by me

http://techbeat.in
TechBeat
The Facebook page for TechBeat is
http://www.facebook.com/pages/TechBeat/151453284907451
Like it to have the latest technology news coming in the news feed of your facebook profile.
On twitter
http://twitter.com/techbeatindia

The site will have the most important tech news of the day, delivered to you directly aggregated at one cool place. It is like a technology news magazine with short news stories.

Sunday, December 12, 2010

An airtel trick

I have an Airtel UP East sim and today I accidently discovered a cool feature. Using this trick you can keep your phone turned on and whoever calls your number will be intimated that your number is switched off. And you will even get an SMS with the number of caller so you will get to know who is calling you. This feature can come handy sometimes when you want to use your phone for outgoing or internet browsing without letting anyone disturb you. Also in situations when you have a fight with your significant other and you want to see them trying to call you madly, without turning your phone off. The trick is to go into your phone settings and inside that navigate to call settings then call forwarding or call diverting. Set your phone to divert all calls to the number 9935044567 and viola! Whoever calls you will now be informed that either your phone is switched off or not reachable. Also, you will receive an SMS in a few moments from the caller's number. If you are an Airtel customer of some other circle then too this trick will work but you have to change the number. The number can be obtained easily by going to call divert or forwarding settings and seeing the preset number for the field Divert when not reachable. Set that same number to Divert always and you are done! I tested with my Reliance GSM number of UP east and set its divert to that Airtel number 9935044567 and w00t!! When anyone calls my Reliance number he/she is told that This airtel number is not reachable! ROFL! Its fun and useful at times! Do try it.

Saturday, November 20, 2010

Importing MS Access database into Oracle 10g or MySQL

While working on a data mining project I came across an issue in which I had to dump all the data from an MS Access mdb file into Oracle and MySQL database tables. Actually, to test your implementations of various data mining algorithms you need huge real life data sets, and they are mostly available on the internet in CSV formats or MS Access mdb files. One great place to download such data sets is the Machine Learning repository of University of California. Here is the link:

http://archive.ics.uci.edu/ml/

Now lets get back to the point of this post. Yesterday I got an mdb file and I needed to put all the data into my Oracle 10g XE installation for developing and testing an implementation of CTU-Tree data mining algorithm. The table had 1 lakh records. The first column was the ID, for serial number or transaction ID and next 19 were labelled as A to S. It was a transactional dataset. I would like to point that here transactional doesn't mean the ACID property following database, but actual data pertaining to transactions in supermarkets.
I personally hate MS Access as a database and I am a big fan of Oracle (although they're doing nasty things with Android now a days :P).
First attempt
I fiddled with some options in MS Access and exported the whole data set into XML format. For that, in the left column just right click the table name and see the Export menu option. Then I went to application express in 10g XE and tried the Load XML data option. Unfortunately it didn't work. Probably Oracle's Load XML Data couldn't parse Access's exported XML well.
Second Attempt
Next, I tried to export the Access file into TXT format delimited by commas. The export was successful except with an issue that I got warnings because some of the cells in the Access DB were null. I tried Load Text Data, in Oracle.This time Oracle's importer crashed, dunno why. I tried the same thing again but in vain. The application didn't crash but it showed me the status as
Succeeded: 0
Failed: 100000
Third attempt with MySQL
I thought, let me dump all of it to MySQL as MySQL is more flexible in many trivial things. The text export had one lakh lines like these two:


1,"25","52","164","240","274","328","368","448","538","561","630","687","730","775","825","834","0","0","0","100"
2,"39","120","124","205","401","581","704","814","825","834","0","0","0","0","0","0","0","0","0","0"

I created a table in a MySQL database with 20 columns all of type INT. Then I used this command in the mysql client command line utility:

LOAD DATA INFILE 'G:\TRANSACTIONS.TXT' INTO TABLE transactions;

I pressed the enter and within a second the output came. But it showed some warning. I ignored and straight away launched PHPMyAdmin to have a glance at the data. Alas! Only the first column had data! Rest all were set to NULL! Then I noticed the double quotes enclosed values in the rest 19 columns except the first. In the text editor(I use jEdit) I did a find and replace for " and tried to replace it with nothing. But it crashed. Same thing happened with Notepad++. This was due to the high volume of data.
I straight away went to MS Access and in the export wizard I removed the TEXT QUALIFIER as " and set it to {none} in the third dialog of the wizard. This time all the data in the export was without double quotes. I ran the MySQL's LOAD DATA command as written earlier, again and still I got warnings.
Then I modified the command a bit as follows to indicate the comma delimitation:
LOAD DATA INFILE 'G:\TRANSACTIONS.TXT' INTO TABLE transactions FIELDS TERMINATED BY ','
and executed it. Voila! The first success! It all went well and within a second, 1 lakh entries were inside MySQL. And this time without any errors and warnings.
Attempt 4: Oracle
Now after a fortune with MySQL I had to get the data anyhow into Oracle. I created a table in Oracle with the requisite number of columns all with NUMBER data type. Then I wrote a PHP program to automate the task, and in 1 minutes 47 seconds it did the job! Here is the program:


<?php
ini_set("max_execution_time",1200);
// Connect to the Oracle 10g XE database
$conn = oci_connect('user', 'pass', '127.0.0.1/XE');

if (!$conn){
   $e = oci_error();
   trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$blah=file_get_contents("TRANSACTIONS.TXT");
$blah1=explode("\n",$blah);
$i=0;
while($i<count($blah1)){
   $blah2="INSERT INTO transactions VALUES(".$blah1[$i].")";
   //use the below line instead of above if you need to dump a file that has field values enclosed with double quotes
   //$blah2="INSERT INTO transactions VALUES(".str_replace('"','',$blah1[$i]).")";
   //echo $blah2;
   $stid = oci_parse($conn, $blah2);
   oci_execute($stid);
   $i++;
}
echo "Done!";
?>
The latest update is that I successfully dumped the file that I had dumped in MySQL(i.e. the one without double quotes enclosed field values), into Oracle using the built in Load Text Data technique. The errors earlier were due to the double quotes which made the data as string but the column types were NUMBERs in the table.