Sunday, September 30, 2012

Ubuntu Java with Proxy, Openjdk

Youtube has been blocked in my country, such a lame we are! I don't know how they have blocked , Some sites of google aren't working. I wanted to use the  android sdk to install some of the packages and found out It can't connect. As I am on Ubuntu I tried using the System wide network proxy option but it didn't work. I tried the settings in /etc/environment without result.
At last inserting the proxy settings at /etc/java-6-openjdk/net.properties   worked for me.
As I am using the socks proxy , I set the ip and port and it's working for me in both eclipse and android sdk manager.



Sunday, September 16, 2012

wordpress ajax with different WordPress Address and Site Address

If in your WordPress General Settings WordPress address and Site address are different(if two domains are different), using Ajax in the frontend can be a little tricky. Usual approach is to localize a script :

        wp_localize_script('some_script_name, 'SomeVar', array(
                    'ajaxurl' => admin_url('admin-ajax.php')            
                ));

and you can get the ajaxurl from your javascript code by SomeVar.ajaxurl 

admin_url('admin-ajax.php') will return an url in respect to the Wordpress address. So, when you make an ajaxcall , it won't work, javascript will throw a cross-domain exception.


The solution is to use the home_url() and appending the ajax url:

        wp_localize_script('some_script_name, 'SomeVar', array(
                    'ajaxurl' => home_url('/').'/wp-admin/admin-ajax.php')           
                ));

and don't forget to add the nopriv hook:

add_action('wp_ajax_nopriv_action_name', 'function name');

other wise the frontend ajax won't work, as the request relays back to the WordPress url even if you're logged in as admin the request will not carry that info.


Thursday, August 30, 2012

Linux get Processor Info


Found some useful commands to get the cpu info.

sudo lshw -C cpu
cat /proc/cpuinfo
sudo dmidecode  --type processor

Also do
ls /sys/devices/system/cpu/

To get an idea about processors, cores, multithreading check

http://superuser.com/questions/329904/what-are-threads-and-what-do-they-do-in-the-processor


About Intel Hyperthreading read here:
http://software.intel.com/en-us/articles/performance-insights-to-intel-hyper-threading-technology/

Friday, August 3, 2012

Olympic 2012

I have been passionately following the Olympic 2012 especially the swimming events. I was amazed to see the 16 year old girl Ye Shiwen from China winning the gold Medal in 400m Medley. I became stunned while I found out the reaction of some of the people. They suspect her performance enhanced by dope! That's strange, when Stephanie Rice improved her personal timing 5 seconds that was a great performance or when the 15-year-old Katie Ledecky from USA wins the 800m making almost a world record , nobody questions her performance. After a lot of hard works and perseverence does the athlete really deserve this?

Friday, July 20, 2012

Python Basics

The single most important thing to know about python is that everything is object in python.

use dir() or the inspect module to inspect any object. The help() function is very useful. It's a wrapper around pydoc module.I use it frequently to know the statements like print, raise etc.

dir.__doc__ will give you the details.

inspect.getmembers() ouputs a list of all members of the passing object.

To know about any function at first try the __doc__ first

About Me

Web Developer From Dhaka, Bangladesh.