Saturday, January 22, 2011

Dell Laptop : Ubuntu 10.x Wireless Disabled : Quick Fix

I face this quite often in my ubuntu 10.x on Dell laptop, though I am not really sure why it happens. After troubleshooting so many steps, I figured out a quick fix.

First verify whether your connection is hard blocked or soft blocked.


$ rfkill list
0: dell-wifi: Wireless LAN
Soft blocked: no
Hard blocked: yes
1: dell-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: yes
2: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
Soft blocks, you can enable the wireless through right-click on top panel task bar.

If its hard blocked as its shown above , following command did trick for me 

$ sudo rmmod -f dell-laptop

Anyone knows why it happens? 

Saturday, January 1, 2011

Happy New Year 2011

Wish you all happy new year 2011.

I wish I can learn and share many more things this year.

Let this year be another creative adventure for all of us!

Tuesday, November 23, 2010

Twitter4J - Twitter Integration

Interesting pure Java API to fully integrate with Twitter API.

The highlight of the API is asynchronous requests/listeners.

http://twitter4j.org

Thursday, November 18, 2010

How to get rid of windows control characters in unix

Open file and on command mode execute below

%s/ctrl-v ctrl-m//g

Finally, it should show :%s/^M//g

Alternatively we can also execute dos2unix utility to convert the file from windows to unix.

dos2unix filefromdos.xml filetounix.xml


We can also transfer the zip file and unzip it using ASCII mode.


$unzip -a mywindowsfile.zip

Tuesday, November 16, 2010

How to execute JavaScript in Java

Java 6 provides full fledged scripting support. There is a in-built Mozilla Rhino Javascript engine available in JDK6 and JRE6.

Scripting is recommended in many large scale applications for Sophisticated configurations and ease of maintenance.

Using scripting from the Java platform is easy because the API is relatively small. You can quickly add scripting support to your application using only a handful of interfaces and classes in the javax.script package.

Following code quickly enables your Java environment to run a Java script.


ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
try {
jsEngine.eval("print('Hello, world!')");
} catch (ScriptException ex) {
ex.printStackTrace();
}


More Details

Monday, November 15, 2010

What is Lambda in Javascript?

Java Script allows passing a function as an argument to another function. This is called lambda.

Example. Following code will alert Hi.


function executeFn(fn){
fn();
}
executeFn(function(){ alert('Hi');});

Tuesday, November 2, 2010

Robotstxt.org

How search engines craws/spider the websites and how it can be controlled (legally) is maintained by publicly available /robots.txt on all websites.

Sample robots.txt files

http://www.google.com/robots.txt
http://www.microsoft.com/robots.txt
http://www.amazon.com/robots.txt
http://www.facebook.com/robots.txt
http://www.wiley.com/robots.txt

Standards are defined in

http://www.robotstxt.org/robotstxt.html