<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8722048993094113071</id><updated>2012-02-02T10:40:22.307-08:00</updated><category term='others'/><category term='c#'/><category term='linux'/><category term='ruby'/><category term='javascript'/><category term='bot'/><category term='Other'/><category term='java'/><category term='mysql'/><category term='python'/><category term='php'/><category term='photoshop'/><category term='C/C++'/><category term='perl'/><category term='Visual Basic'/><category term='windows'/><category term='games'/><category term='myspace'/><category term='youtube'/><category term='blogging'/><category term='site review'/><category term='oracle'/><category term='Freelancing'/><title type='text'>The world is amazing</title><subtitle type='html'>Just sharing my experience with all. If anything proves helpful for you, its my success.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default?start-index=101&amp;max-results=100'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>297</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-108687470507862832</id><published>2011-12-12T19:57:00.000-08:00</published><updated>2011-12-12T20:01:14.309-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Get the class name of any Object</title><content type='html'>Using the &lt;b&gt;getClass()&lt;/b&gt; method of any object, you can easily obtain the name of the class of that Object. Below is a simple code snippet to clear the things.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;TestClass t = new TestClass();&lt;br /&gt;System.out.println(t.getClass().getName());&lt;br /&gt;// output: TestClass&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-108687470507862832?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/108687470507862832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=108687470507862832&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/108687470507862832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/108687470507862832'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/12/java-get-class-name-of-any-object.html' title='Java: Get the class name of any Object'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3450157352334697700</id><published>2011-11-29T21:58:00.000-08:00</published><updated>2011-11-29T22:02:32.510-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Converting a  byte array into Hexadecimal String</title><content type='html'>I have written a method named byteArrayToHexString() which takes a byte array as parameter, and returns the Hexadecimal representation of the byte array. Below is the method.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    public static String byteArrayToHexString(byte []input){&lt;br /&gt;        String string = "";&lt;br /&gt;        if(input == null){&lt;br /&gt;            return string;&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        for(byte b : input){&lt;br /&gt;            string += Integer.toHexString(Integer.parseInt(Byte.toString(b))).toUpperCase();&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        return string;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3450157352334697700?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3450157352334697700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3450157352334697700&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3450157352334697700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3450157352334697700'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/11/java-converting-byte-array-into.html' title='Java: Converting a  byte array into Hexadecimal String'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3552269060842231857</id><published>2011-10-25T00:20:00.000-07:00</published><updated>2011-10-25T00:22:44.968-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>javax.ejb.EJBException: Could not unmarshal method ID</title><content type='html'>If you are seeing the following error from your EJB then the solution is really simple.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javax.ejb.EJBException: Could not unmarshal method ID; nested exception is: &lt;br /&gt; java.rmi.UnmarshalException: Method not found: 'YOUR_METHOD';&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This is because you have written some code but didn't compile or redeployed to your server after compile. So, build/compile your project again and deploy to your server. You'll not see this error again. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3552269060842231857?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3552269060842231857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3552269060842231857&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3552269060842231857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3552269060842231857'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/10/javaxejbejbexception-could-not.html' title='javax.ejb.EJBException: Could not unmarshal method ID'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7170922169712066372</id><published>2011-09-29T06:27:00.000-07:00</published><updated>2011-09-29T06:34:51.780-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Contains() method for String class</title><content type='html'>If you need to check whether a string contains inside another string or not, you can do this using the &lt;span style="font-weight:bold;"&gt;indexOf()&lt;/span&gt; method from String class. I didn't find the contains function or something similar to that from String class which will take String as parameter for checking.&lt;br /&gt;&lt;br /&gt;Below is the code that you can use like &lt;span style="font-weight:bold;"&gt;contains(String string)&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;String string = "My Test String...";&lt;br /&gt;String contains = "Test";&lt;br /&gt;if(string.indexOf(contains) &gt;= 0){&lt;br /&gt;    System.out.println("["+contains+"] is inside ["+string+"]");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Basically indexOf function returns the position of the string from searching string. An index always starts from 0 as we know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7170922169712066372?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7170922169712066372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7170922169712066372&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7170922169712066372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7170922169712066372'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/09/java-contains-method-for-string-class.html' title='Java: Contains() method for String class'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8917189139545791292</id><published>2011-09-25T03:36:00.000-07:00</published><updated>2011-09-25T11:43:17.972-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>C#: Encode String into base64</title><content type='html'>Below is the c# code that will convert the provided string into it's corresponding base64 string. This code will first convert the string into byte array, after that it will convert the array into base64 string.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String stringData = "hello world";&lt;br /&gt;Byte[] byteData = Encoding.ASCII.GetBytes(stringData);&lt;br /&gt;stringData = Convert.ToBase64String(byteData);&lt;br /&gt;Console.WriteLine(stringData);&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8917189139545791292?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8917189139545791292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8917189139545791292&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8917189139545791292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8917189139545791292'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/09/c-encode-string-into-base64.html' title='C#: Encode String into base64'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7621836941052833598</id><published>2011-09-25T03:28:00.000-07:00</published><updated>2011-09-25T11:46:32.081-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>C#: Decode base64 String</title><content type='html'>Last time I had an example of &lt;a href="http://icfun.blogspot.com/2011/09/c-encode-string-into-base64.html" target="_blank"&gt;Encoding of string into base64&lt;/a&gt;. This time Decoding.&lt;br /&gt;&lt;br /&gt;Below is the c# code block that will convert the provided base64 string into readable one. This c# code will first decode the base64 string into byte array. After that it will convert that byte array into String data.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// "hello world"&lt;br /&gt;String stringData = "aGVsbG8gd29ybGQ=";&lt;br /&gt;Byte[] byteData = Convert.FromBase64String(stringData);&lt;br /&gt;stringData = Encoding.ASCII.GetString(byteData);&lt;br /&gt;Console.WriteLine(stringData);&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7621836941052833598?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7621836941052833598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7621836941052833598&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7621836941052833598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7621836941052833598'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/09/c-decode-base64-string.html' title='C#: Decode base64 String'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5275668436154391260</id><published>2011-09-25T03:26:00.000-07:00</published><updated>2011-09-25T11:42:19.282-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Find last few characters from a string</title><content type='html'>Below is the code that uses &lt;span style="font-weight:bold;"&gt;substr()&lt;/span&gt; function that will return the last three characters from the string. You can change that -3 and 3 parameters according to your need.&lt;br /&gt;&lt;br /&gt;First param -3 means start from index 3 from last. And second param 3 means the three characters.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var string = "Test String";&lt;br /&gt;string = string.substr(-3, 3);&lt;br /&gt;document.write(string);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Pretty simple code...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5275668436154391260?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5275668436154391260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5275668436154391260&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5275668436154391260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5275668436154391260'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/09/find-last-few-characters-from-string.html' title='Find last few characters from a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8226842184253669534</id><published>2011-08-27T09:02:00.000-07:00</published><updated>2011-08-27T09:09:29.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>C#: convert string to byte array</title><content type='html'>In java, you can easily call the getBytes() from the String class. But at c# you have to use the GetBytes() method from the System.Text. Here is the simple piece of code.&lt;br /&gt;&lt;br /&gt;If your string contains the UTF-8 characters, that case this code will be suitable:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(string);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When you are wanting the byte array from plain text. That case it will be:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(string);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8226842184253669534?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8226842184253669534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8226842184253669534&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8226842184253669534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8226842184253669534'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/08/c-convert-string-to-byte-array.html' title='C#: convert string to byte array'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3741691782477740128</id><published>2011-08-08T09:28:00.000-07:00</published><updated>2011-08-08T09:31:55.290-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Reversing a String</title><content type='html'>As far I know, there is no method available under String class to reverse a provided string. You can achieve this by using the StringBuffer class. Here is an example code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String string = "Reverse It";&lt;br /&gt;string = new StringBuffer(string).reverse().toString();&lt;br /&gt;System.out.println(string);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;It is creating an object of StringBuffer using the string, and then doing the reverse operation using it's method. After reversing, its just converting back to string.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3741691782477740128?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3741691782477740128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3741691782477740128&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3741691782477740128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3741691782477740128'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/08/java-reversing-string.html' title='Java: Reversing a String'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3760982758089553563</id><published>2011-08-08T09:23:00.000-07:00</published><updated>2011-08-08T09:26:49.938-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Sort the content of a string</title><content type='html'>Arrays of java.util is very useful for sorting and other stuffs. You can easily sort your String using the sort() function of that class. Below is the sample code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String string = "String to sort";&lt;br /&gt;char[] array = string.toCharArray();&lt;br /&gt;java.util.Arrays.sort(array);&lt;br /&gt;string = new String(array);&lt;br /&gt;System.out.println(string);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Basically this simple piece of code is converting the string into a character array, and then sorting it and return back to the string again. Simple...!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3760982758089553563?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3760982758089553563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3760982758089553563&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3760982758089553563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3760982758089553563'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/08/java-sort-content-of-string.html' title='Java: Sort the content of a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4102101729930041903</id><published>2011-08-07T10:33:00.000-07:00</published><updated>2011-08-07T10:36:03.694-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Left padding a number with zero</title><content type='html'>For padding any string with zeros at left side, you can easily use the String.format() of Java. Here is an example code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;int number = 10;&lt;br /&gt;System.out.println(String.format("%05d",number));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Output will be&lt;code&gt;00010&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4102101729930041903?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4102101729930041903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4102101729930041903&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4102101729930041903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4102101729930041903'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/08/java-left-padding-number-with-zero.html' title='Java: Left padding a number with zero'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-9059963427203300768</id><published>2011-08-05T06:33:00.000-07:00</published><updated>2011-08-05T06:39:41.417-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>IllegalAnnotationsException, Two classes have the same XML type name</title><content type='html'>While working on a project using EJB3, I was getting the following error.&lt;br /&gt;&lt;br /&gt;Two classes have the same XML type name "...". Use @XmlType.name and @XmlType.namespace to assign different names to them.&lt;br /&gt;&lt;br /&gt;There are several cases those can raise this error. For my cases it was the following error. I have a function like below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public TestResponse test(TestRequest request){&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Look the method name and the return type, parameters. Possibly EJB internally used to add 'Request' and 'Response' tag with the method test(). So it becomes testResponse(), testRequest(), which is similar to parameter and return type of my code.&lt;br /&gt;&lt;br /&gt;To overcome the issue, I have changed the method name into testMethod(). And it solved the issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-9059963427203300768?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/9059963427203300768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=9059963427203300768&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9059963427203300768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9059963427203300768'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/08/illegalannotationsexception-two-classes.html' title='IllegalAnnotationsException, Two classes have the same XML type name'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6959386024877659691</id><published>2011-07-11T08:48:00.001-07:00</published><updated>2011-07-11T08:51:12.220-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='photoshop'/><title type='text'>Photoshop: Shortcut for zooming the image</title><content type='html'>To do the zoom in and zoom out at photoshop, you need to hold your Alt key and then scroll your mouse wheel. Based on the wheel moving direction, image will be zoomed in and out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6959386024877659691?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6959386024877659691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6959386024877659691&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6959386024877659691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6959386024877659691'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/07/photoshop-shortcut-for-zooming-image.html' title='Photoshop: Shortcut for zooming the image'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6743706724108011240</id><published>2011-07-11T08:25:00.000-07:00</published><updated>2011-07-11T08:29:35.755-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>How to add comment form at blogspot</title><content type='html'>If you want to add a comment form at your blog from blogger, you can do this easily. There are several options to change the comment form option.&lt;br /&gt;&lt;br /&gt;To do this, you have to do the following processes.&lt;br /&gt;&lt;br /&gt;1) Go to your blog's dashboard.&lt;br /&gt;2) Click "Settings"&lt;br /&gt;3) Click "Comments"&lt;br /&gt;4) Select "Embedded below post"&lt;br /&gt;5) Save the settings and you are done.&lt;br /&gt;&lt;br /&gt;Below screenshot may help you for above steps.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-uNU-j-QKGvM/ThsWLCJkgvI/AAAAAAAAE7E/qnzmx7RQOmk/s1600/blogger-comment-form.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 344px;" src="http://2.bp.blogspot.com/-uNU-j-QKGvM/ThsWLCJkgvI/AAAAAAAAE7E/qnzmx7RQOmk/s400/blogger-comment-form.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5628116538140951282" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6743706724108011240?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6743706724108011240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6743706724108011240&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6743706724108011240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6743706724108011240'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/07/how-to-add-comment-form-at-blogspot.html' title='How to add comment form at blogspot'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-uNU-j-QKGvM/ThsWLCJkgvI/AAAAAAAAE7E/qnzmx7RQOmk/s72-c/blogger-comment-form.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2089592336934695810</id><published>2011-07-09T10:05:00.000-07:00</published><updated>2011-07-09T10:09:06.019-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='photoshop'/><title type='text'>Photoshop: Keep only one color and make rest in gray</title><content type='html'>Using photoshop, you can keep one or more your desired color from the photo and make rest of the portion of the photo in gray(black/white). To do this follow the below steps.&lt;br /&gt;&lt;br /&gt;1) Using the magic wand select the portion from the photo.&lt;br /&gt;&lt;br /&gt;2) Pressing the Shift key, and clicking the mouse, you can expand and erase unwanted portions from selection.&lt;br /&gt;&lt;br /&gt;3) Press "Shift + Ctrl + i" to invert the selection.&lt;br /&gt;&lt;br /&gt;4) Now press "Shift + Ctrl + u" to make the selected portion into gray.&lt;br /&gt;&lt;br /&gt;That's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2089592336934695810?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2089592336934695810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2089592336934695810&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2089592336934695810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2089592336934695810'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/07/photoshop-keep-only-one-color-and-make.html' title='Photoshop: Keep only one color and make rest in gray'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5172289150633564958</id><published>2011-07-05T10:06:00.000-07:00</published><updated>2011-07-05T10:08:54.170-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Generate set/get method at JDeveloper</title><content type='html'>If you want to generate the accessors for the fields of a class using JDeveloper, below is the way to do that.&lt;br /&gt;&lt;br /&gt;1) Write your class with the private and public fields.&lt;br /&gt;&lt;br /&gt;2) On the source code, right click and you'll see a menu.&lt;br /&gt;&lt;br /&gt;3) From the menu, select "Generate accessors..."&lt;br /&gt;&lt;br /&gt;4) It will display a box and from there you can define the accessors for your fields easily.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5172289150633564958?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5172289150633564958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5172289150633564958&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5172289150633564958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5172289150633564958'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/07/generate-setget-method-at-jdeveloper.html' title='Generate set/get method at JDeveloper'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8258816917521428870</id><published>2011-07-05T10:03:00.000-07:00</published><updated>2011-07-05T10:06:11.040-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>What is the default password for weblogic</title><content type='html'>Well if you are bumped up to find the username and the password for your weblogic server console, here it is.&lt;br /&gt;&lt;br /&gt;Username/Password : weblogic/weblogic1&lt;br /&gt;&lt;br /&gt;The link is &lt;code&gt;http://localhost:7101/console&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8258816917521428870?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8258816917521428870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8258816917521428870&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8258816917521428870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8258816917521428870'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/07/what-is-default-password-for-weblogic.html' title='What is the default password for weblogic'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1780793139620583722</id><published>2011-06-24T09:34:00.000-07:00</published><updated>2011-06-24T09:36:13.112-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: write byte array into file</title><content type='html'>Using the java FileOutputStream class, you can easily write any given byte array into a text file easily. For example the below code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String fileName = "test.txt";&lt;br /&gt;FileOutputStream fos = new FileOutputStream(fileName);&lt;br /&gt;fos.write(byteArray);&lt;br /&gt;fos.close();&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1780793139620583722?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1780793139620583722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1780793139620583722&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1780793139620583722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1780793139620583722'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/06/java-write-byte-array-into-file.html' title='Java: write byte array into file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2548943304740320983</id><published>2011-06-24T02:10:00.000-07:00</published><updated>2011-06-24T09:34:33.465-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: read data as byte array from file</title><content type='html'>Using the FileInputStream of java, you can read data from a file into a byte array. Below is the sample code that will fill the byte array from the provided file.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String fileName = "test.txt";&lt;br /&gt;File file = new File(fileName);&lt;br /&gt;FileInputStream fin = new FileInputStream(file);&lt;br /&gt;byte byteArray[] = new byte[(int)file.length()];&lt;br /&gt;fin.read(byteArray);&lt;br /&gt;fin.close();&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2548943304740320983?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2548943304740320983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2548943304740320983&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2548943304740320983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2548943304740320983'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/06/java-read-data-as-byte-array-from-file.html' title='Java: read data as byte array from file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6877414334380760759</id><published>2011-06-05T06:01:00.000-07:00</published><updated>2011-06-05T06:07:51.834-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>java.lang.NoClassDefFoundError</title><content type='html'>The error java.lang.NoClassDefFoundError occurs when you'll find the nothing set at Classpath environment variable. You can resolve the issues by two ways.&lt;br /&gt;&lt;br /&gt;1) Using the classpath at runtime from commandline.&lt;br /&gt;&lt;code&gt;java -classpath . TestJava&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here dot(.) us the current directory. If you have jar files at other directories, that case you have to include all at classpath para.&lt;br /&gt;&lt;br /&gt;2) Or setting the classpath environment variable. It will be something like below&lt;br /&gt;&lt;code&gt;.;c:/java/jdk/lib&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6877414334380760759?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6877414334380760759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6877414334380760759&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6877414334380760759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6877414334380760759'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/06/javalangnoclassdeffounderror.html' title='java.lang.NoClassDefFoundError'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4375059372116401788</id><published>2011-06-05T05:57:00.000-07:00</published><updated>2011-06-05T06:01:44.384-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: include a jar file during compilation</title><content type='html'>There are lots of geeks who don't use IDE for doing Java. I am one of those freaks. If you need to use additional Jar file with your Java source, you can do this by two ways.&lt;br /&gt;&lt;br /&gt;1) adding the jar file at compile time.&lt;br /&gt;&lt;code&gt;javac -cp '.;lib/*;c:/lib/anotherdir/*' TestJar.java&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will include all the jar files from the lib directory of the current path, and the jar files from the c:/lib/anotherdir/ path.&lt;br /&gt;&lt;br /&gt;2) using the jar file names at &lt;span style="font-weight:bold;"&gt;classpath&lt;/span&gt; environment variable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4375059372116401788?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4375059372116401788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4375059372116401788&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4375059372116401788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4375059372116401788'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/06/java-include-jar-file-during.html' title='Java: include a jar file during compilation'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1972919123852214654</id><published>2011-05-30T23:50:00.000-07:00</published><updated>2011-05-31T08:29:10.784-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>ANT getting error to locate tools.jar</title><content type='html'>When I was using the below command to check the version of ANT&lt;br /&gt;&lt;code&gt;ant -version&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I was getting the following error.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Unable to locate tools.jar. Expected to find it in C:\java\jre6\lib\tools.jar&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To resolve the issue, I have copied the &lt;span style="font-weight:bold;"&gt;tools.jar&lt;/span&gt; file from C:\jdk160_21\lib to C:\java\jre6\lib\ and it worked for me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1972919123852214654?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1972919123852214654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1972919123852214654&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1972919123852214654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1972919123852214654'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/05/ant-getting-error-to-locate-toolsjar.html' title='ANT getting error to locate tools.jar'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4732248030565977033</id><published>2011-04-23T03:10:00.000-07:00</published><updated>2011-04-23T03:20:44.692-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Timezone issue and Oracle Enterprise Manager</title><content type='html'>This timezone issue can kill plenty of your time until if you are not resolved. I had this problem when I was running oem. I was having following error.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;oracle@psycho$ ./emctl start dbconsole&lt;br /&gt;Oracle Enterprise Manager 10g Database Control Release 10.1.0.4&lt;br /&gt;Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.&lt;br /&gt;http://psycho:5500/em/console/aboutApplication&lt;br /&gt;Starting Oracle Enterprise Manager 10g Database Control ............................................................................................. failed.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There are several issues can raise this error. Since my case it was timezone issue, I'll request you to check whether your computer timezone is matching with your oem timezone or not.&lt;br /&gt;&lt;br /&gt;This link &lt;a href="http://how-to.wikia.com/wiki/Oracle_HOWTO:_change_Enterprise_Manager_Console_Timezone" target=_blank&gt;http://how-to.wikia.com/wiki/Oracle_HOWTO:_change_Enterprise_Manager_Console_Timezone&lt;/a&gt; will tell you how to reset the timezone.&lt;br /&gt;&lt;br /&gt;After resetting the timezone, you can start your oem easily.&lt;br /&gt;&lt;br /&gt;This solution will work for both oracle 10g and 11g.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4732248030565977033?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4732248030565977033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4732248030565977033&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4732248030565977033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4732248030565977033'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/timezone-issue-and-oracle-enterprise.html' title='Timezone issue and Oracle Enterprise Manager'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2357553031269784544</id><published>2011-04-23T02:58:00.000-07:00</published><updated>2011-04-23T03:06:56.844-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>su: /bin/bash: Permission denied</title><content type='html'>This is a weird problem. It occurred for me when I was trying to login as another user from root. For example,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[root]# su user77&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;It generated the below error.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;su: /bin/bash: Permission denied&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I have seen many geeks from forums suggested several methods to resolve this issue. I have tried most of those. So not sure which one worked for me. But I think this one worked for me, so it can work for you too.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;I have changed the directory mode into &lt;span style="font-weight:bold;"&gt;755&lt;/span&gt; for the directory &lt;span style="font-weight:bold;"&gt;/&lt;/span&gt; and directory &lt;span style="font-weight:bold;"&gt;/bin&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;This error can happen if somehow your user is removed from the wheel group accidentally. To add an user to wheel, you can type below command&lt;/li&gt;&lt;br /&gt;&lt;code&gt;gpasswd -a username wheel&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you are still having this problem, then dig more at google.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2357553031269784544?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2357553031269784544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2357553031269784544&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2357553031269784544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2357553031269784544'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/su-binbash-permission-denied.html' title='su: /bin/bash: Permission denied'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1404028635142322936</id><published>2011-04-23T02:50:00.000-07:00</published><updated>2011-04-23T02:56:44.925-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Linux: Get the list of Environment Variables</title><content type='html'>Using the built in linux command, you can get all your Environment variables easily. The command is,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[root]# env&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can pipe the &lt;span style="font-weight:bold;"&gt;sort&lt;/span&gt; command with this to get the variables sorted.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[root]# env | sort&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Sometime the environment variable list can be large. That case I'll suggest to use the &lt;span style="font-weight:bold;"&gt;less&lt;/span&gt; command with &lt;span style="font-weight:bold;"&gt;env&lt;/span&gt;. This will help you to scroll around.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[root]# env | sort | less&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1404028635142322936?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1404028635142322936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1404028635142322936&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1404028635142322936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1404028635142322936'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/linux-get-list-of-environment-variables.html' title='Linux: Get the list of Environment Variables'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4244175179609849903</id><published>2011-04-22T14:13:00.000-07:00</published><updated>2011-04-22T14:20:42.911-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to find the all the installed java bin</title><content type='html'>On your linux pc, it can happen that you are having multiple Java installed. By default, when you are installing linux, a distribution of java already installed. Now, if you download another java binary, and install, it will create new directory. So you'll have another Java.&lt;br /&gt;&lt;br /&gt;Also, there are other software like Oracle, and packages of Oracle come up with their own Java. For example, if you install those software on your Pc, you'll find another Java is installed for those. So, you are dealing with another java.&lt;br /&gt;&lt;br /&gt;Sometime you may need to specify the exact Java(when all are different version). That case you can use the linux's &lt;span style="font-weight:bold;"&gt;locate&lt;/span&gt; command to find all the java bin directory.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;locate '/bin/java'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This command will display you all the directories consist with '/bin/java'. So from that list, you can easily identify all the Java bins. Now you can pick your one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4244175179609849903?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4244175179609849903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4244175179609849903&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4244175179609849903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4244175179609849903'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/how-to-find-all-installed-java-bin.html' title='How to find the all the installed java bin'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-9210890285640344431</id><published>2011-04-19T12:01:00.000-07:00</published><updated>2011-04-19T12:04:02.849-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Youtube resumable uploader is not working</title><content type='html'>Fucking youtube resumable uploader is no more resuming the uploading when the internet is download for a second. I am pissed as youtube didn't express any sorry officially, neither they have taken any initiative to resolve this issue. Fucking youtube uploader just pissed me off.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-9210890285640344431?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/9210890285640344431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=9210890285640344431&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9210890285640344431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9210890285640344431'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/youtube-resumable-uploader-is-not.html' title='Youtube resumable uploader is not working'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7490416298623286941</id><published>2011-04-04T09:48:00.000-07:00</published><updated>2011-04-19T12:05:53.860-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>DVD copying is too much slow, PIO issue</title><content type='html'>Recently I had a problem with my DVD drive on my Desktop. It was kinda weird. It was taking too much time while copying anything from the DVD disk to local hard drive. After searching google, finally I came up with a solution that worked for me. I am sharing exactly what I found from Web. My OS is Windows XP(SP 2).&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Go to Device Manager [Right-click on My Computer; select Properties; click on the Hardware tab; then click on Device Manager].   Expand the IDE/ATA/ATAPI Controllers line (click the "+" sign].   For each of the channels (Primary &amp; Secondary) do the following:   Right-click; select Properties; and click on the Advanced Settings tab.   Be sure the "Tranfer Mode" for all devices is set to "DMA if Available" =&gt; change it to that if necessary.    And look at the "Current Transfer Mode" (You can't change this) -- if ANY of these say "PIO" that is almost certainly your problem.&lt;br /&gt;&lt;br /&gt;If ANY of the settings said PIO, then do the following:&lt;br /&gt;&lt;br /&gt;Load RegEdit (Start - Run - Regedit)&lt;br /&gt;&lt;br /&gt;Go to the following keys:&lt;br /&gt;&lt;br /&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\000x&lt;br /&gt;&lt;br /&gt;The last four digits will be 0000, 0001, 0002, 0003, and so on.&lt;br /&gt;&lt;br /&gt;Under each key, delete all occurences of the following values (not every key will have these values, but delete them whenever they occur):&lt;br /&gt;&lt;br /&gt;     MasterIdDataChecksum&lt;br /&gt;     SlaveIdDataChecksum&lt;br /&gt;&lt;br /&gt;Now just reboot the system &amp; all should be well &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I was nearly about to buy a new DVD drive. But this solution saved some bucks from my pocket. Who knows, the new DVD drive could show this error too :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7490416298623286941?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7490416298623286941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7490416298623286941&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7490416298623286941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7490416298623286941'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/04/dvd-copying-is-too-much-slow-pio-issue.html' title='DVD copying is too much slow, PIO issue'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7924339804811380073</id><published>2011-03-26T12:36:00.000-07:00</published><updated>2011-03-26T12:39:13.045-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Other'/><title type='text'>Chrome: Where are the options and settings</title><content type='html'>If you need to find the options from your chrome browser, just type the below at the address bar.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;chrome://settings/browser&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The Click "Under The Hood" to get the available options for the Chrome. Or, you can type the below line directly at your browser.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;chrome://settings/advanced&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7924339804811380073?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7924339804811380073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7924339804811380073&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7924339804811380073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7924339804811380073'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/03/chrome-where-are-options-and-settings.html' title='Chrome: Where are the options and settings'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4759266204982736779</id><published>2011-03-26T12:32:00.000-07:00</published><updated>2011-03-26T12:36:12.054-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Squid: How to stop Caching</title><content type='html'>Is there any way to disable the caching mechanism for the squid proxy?&lt;br /&gt;&lt;br /&gt;You can do this by adding the below line inside your squid.conf configuration file for squid.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;cache deny all&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Sometimes you may want to stop the Negative Hit and other kind of errors. Blocking/disabling the cache will help you to prevail this issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4759266204982736779?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4759266204982736779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4759266204982736779&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4759266204982736779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4759266204982736779'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2011/03/squid-how-to-stop-caching.html' title='Squid: How to stop Caching'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6053050496134636690</id><published>2010-12-06T06:17:00.000-08:00</published><updated>2010-12-06T06:26:05.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>script to download gziped xml</title><content type='html'>There is a problem while downloading the gzip xml file from server. I have noticed that sometimes the PHP/Curl and LWP of Perl is not able to gunzip the xml.gz file properly.&lt;br /&gt;&lt;br /&gt;There are several ways to handle this problem. First of all you have to download the gzip file into local directory. You can use curl, lwp, or wget. Just download this and save into a file, for example "temp.xml.gz". A wget command you can use from your script.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;system('wget "http://www.example.com/file.xml.gz" -nv');&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;After downloading the script, use gunzip over the file. If you are using linux, that case you already having gunzip installed. If you are using windows, that case you have to get the gunzip.exe. You can download this &lt;a href="http://unxutils.sourceforge.net/"&gt;unxutils.sourceforge.net&lt;/a&gt; and place to the script directory. A gunzip command will be,&lt;br /&gt;&lt;code&gt;&lt;br /&gt;system("gunzip -f temp.xml.gz");&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This way you can handle gz files from any website.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6053050496134636690?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6053050496134636690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6053050496134636690&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6053050496134636690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6053050496134636690'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/12/script-to-download-gziped-xml.html' title='script to download gziped xml'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-354103450025606280</id><published>2010-11-29T11:43:00.000-08:00</published><updated>2010-12-08T08:15:16.302-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>Comparing date with any mysql column</title><content type='html'>You can easily compare dates at SELECT query from mysql.&lt;br /&gt;&lt;br /&gt;Using the function, just convert your date into appropriate one. For example using CAST('2010-10-18' as DATE) at select query.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT * from my_table WHERE date_column &amp;lt; CAST('2010-10-18' as DATE)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can use the date '2010-10-18' from a variable too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-354103450025606280?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/354103450025606280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=354103450025606280&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/354103450025606280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/354103450025606280'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/you-can-easily-compare-dates-at-select.html' title='Comparing date with any mysql column'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7356772129202069203</id><published>2010-11-27T14:21:00.000-08:00</published><updated>2010-11-27T14:26:19.565-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Other'/><title type='text'>Advance Youtube Uploader, it sucks</title><content type='html'>The java applet based youtube uploader is nothing but a bullshit. I have already enabled Java and i can browse other applet kits from millions of websites, but youtube sucker is not able to load their applet on my browser. Always showing &lt;br /&gt;&lt;code&gt;&lt;br /&gt;"You do not have Java installed or enabled. You can learn more about enabling Java, or go back and try the standard upload page."&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Also I have an objection about the claim "resumable uploads" about this advance uploader. They should retract about this claim. Its never resumable, if your internet line drops for around an hour, and you didn't notice the line  up, your uploader just failed due to longer period of no internet connection. A resumable version should work no matter how long i pause this(by the way you can not even pause this sucking stuff)&lt;br /&gt;&lt;br /&gt;sorry guys, take it easy. just busted the nuts out by the fcuking shit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7356772129202069203?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7356772129202069203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7356772129202069203&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7356772129202069203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7356772129202069203'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/advance-youtube-uploader-it-sucks.html' title='Advance Youtube Uploader, it sucks'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2221445058509696670</id><published>2010-11-27T02:55:00.000-08:00</published><updated>2010-11-27T03:11:58.539-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Unicode html character escape</title><content type='html'>Sometimes things can get too much irritating when you are in need of something, and you are not finding out the solution, but there is a easy way to do you know.&lt;br /&gt;&lt;br /&gt;I was working with a large python project, and it was handling with foreign language. Most of the characters are html encoded(i.e. aacute character entities). For example like below,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;amp;aacute; = &amp;aacute;&lt;br /&gt;&amp;amp;oacute; = &amp;oacute;&lt;br /&gt;&amp;amp;eacute; = &amp;eacute;&lt;br /&gt;&amp;amp;iacute; = &amp;iacute;&lt;br /&gt;&amp;amp;ntilde; = &amp;ntilde;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There are plenty of more like this. But I required to convert them using python script into appropriate one.&lt;br /&gt;&lt;br /&gt;Here is the technique that I have came up with &lt;span style="font-weight:bold;"&gt;BeautifulStoneSoup&lt;/span&gt; from &lt;span style="font-weight:bold;"&gt;BeautifulSoup&lt;/span&gt; and its really beautiful.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;## importing appropriate library&lt;br /&gt;from BeautifulSoup import BeautifulStoneSoup&lt;br /&gt;&lt;br /&gt;## input content&lt;br /&gt;content = 'Proceder&amp;amp;aacute; la aplicaci&amp;amp;oacute;n anal&amp;amp;oacute;gica de las normas cuando &amp;amp;eacute;stas no contemplen un supuesto espec&amp;amp;iacute;fico,'&lt;br /&gt;&lt;br /&gt;## doing conversion from html format to text format&lt;br /&gt;content=unicode(BeautifulStoneSoup(content,convertEntities=BeautifulStoneSoup.HTML_ENTITIES )).encode('utf-8')&lt;br /&gt;print content&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This code will print the content into screen after converting those html codes(i think these are Latin encoding??). If your console doesn't support those character encoding, it will not display into there properly.&lt;br /&gt;&lt;br /&gt;You can write the output into a file using python code, and browse the file form browser, and you'll find that its converted successfully.&lt;br /&gt;&lt;br /&gt;If you know other ways, you can share that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2221445058509696670?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2221445058509696670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2221445058509696670&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2221445058509696670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2221445058509696670'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/python-unicode-html-character-escape.html' title='Python: Unicode html character escape'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3968974447334916190</id><published>2010-11-20T10:41:00.000-08:00</published><updated>2010-11-20T10:45:15.383-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Get current directory name</title><content type='html'>You can easily get the current directory name at where the script is currently running. The below code will print the current directory name into screen.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$directory = dirname(__FILE__);&lt;br /&gt;print $directory;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;How the script works? Here &lt;span style="font-weight:bold;"&gt;__FILE__&lt;/span&gt; holds the name of the currently executing file. And using finction &lt;span style="font-weight:bold;"&gt;dirname()&lt;/span&gt; its extracting the directory name component from it. &lt;br /&gt;&lt;br /&gt;That means if your script name is "test.php", then __FILE__ has something like "c:\work\test.php". The function dirname() just removing that test.php from it, and returning "C:\work\"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3968974447334916190?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3968974447334916190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3968974447334916190&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3968974447334916190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3968974447334916190'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/php-get-current-directory-name.html' title='PHP: Get current directory name'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4945008304572882879</id><published>2010-11-20T08:08:00.000-08:00</published><updated>2010-11-20T08:11:43.065-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: get hidden files</title><content type='html'>I was working on linux, it was a script that used to move and extract some files. Some of the files were hidden files(started with a dot(.))&lt;br /&gt;&lt;br /&gt;If you use &lt;span style="font-weight:bold;"&gt;glob()&lt;/span&gt; function from Perl, it will not return those files. You have to relay on other functions. Like below one.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;use File::Glob qw( bsd_glob );&lt;br /&gt;my @files = ( bsd_glob("$dir/.*"), bsd_glob("$dir/*") );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you use this one, at array @files, you'll have your all hidden and non hidden files in it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4945008304572882879?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4945008304572882879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4945008304572882879&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4945008304572882879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4945008304572882879'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/perl-get-hidden-files.html' title='Perl: get hidden files'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6845916364761072701</id><published>2010-11-18T07:06:00.000-08:00</published><updated>2010-11-18T07:11:33.090-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>wget using HEAD call with server response</title><content type='html'>You can perform only the HEAD call using the wget tool from your linux box. You'll require to use the &lt;span style="font-weight:bold;"&gt;--spider&lt;/span&gt; parameter from the tool. For example the below command,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;wget --spider http://icfun.blogspot.com/&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will display the below output after HEAD on the url.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--15:06:47--  http://icfun.blogspot.com/&lt;br /&gt;Resolving icfun.blogspot.com... 74.125.127.132&lt;br /&gt;Connecting to icfun.blogspot.com|74.125.127.132|:80... connected.&lt;br /&gt;HTTP request sent, awaiting response... 200 OK&lt;br /&gt;Length: 0 [text/html]&lt;br /&gt;200 OK&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, if you want to see the full http response for your HEAD call, you can combined the command &lt;span style="font-weight:bold;"&gt;--server-response&lt;/span&gt; with that. For example the below command,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;wget --spider http://icfun.blogspot.com/ --server-response&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will display you the below output, where you'll have the required all http headers that came as server response from that site.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--15:07:37--  http://icfun.blogspot.com/&lt;br /&gt;Resolving icfun.blogspot.com... 74.125.127.132&lt;br /&gt;Connecting to icfun.blogspot.com|74.125.127.132|:80... connected.&lt;br /&gt;HTTP request sent, awaiting response... &lt;br /&gt;  HTTP/1.0 200 OK&lt;br /&gt;  Content-Type: text/html; charset=UTF-8&lt;br /&gt;  Expires: Thu, 18 Nov 2010 15:07:38 GMT&lt;br /&gt;  Date: Thu, 18 Nov 2010 15:07:38 GMT&lt;br /&gt;  Cache-Control: public, max-age=0, must-revalidate, proxy-revalidate&lt;br /&gt;  Last-Modified: Thu, 18 Nov 2010 15:06:18 GMT&lt;br /&gt;  ETag: "b0fd7a2a-8612-4b5a-a39a-41ad17059db6"&lt;br /&gt;  X-Content-Type-Options: nosniff&lt;br /&gt;  X-XSS-Protection: 1; mode=block&lt;br /&gt;  Content-Length: 0&lt;br /&gt;  Server: GSE&lt;br /&gt;  Connection: Keep-Alive&lt;br /&gt;Length: 0 [text/html]&lt;br /&gt;200 OK&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6845916364761072701?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6845916364761072701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6845916364761072701&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6845916364761072701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6845916364761072701'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/wget-using-head-call-with-server.html' title='wget using HEAD call with server response'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1886715836694843217</id><published>2010-11-16T10:52:00.000-08:00</published><updated>2010-11-16T10:56:28.698-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Get the OS name</title><content type='html'>You can get the OS name at where the php script is running using system commands. At one of my php application, I was looking for the exact function. Not interested to use the system command. Below is what I have used that time.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$os_name = php_uname('s');&lt;br /&gt;print $os_name;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The output will be "&lt;span style="font-weight:bold;"&gt;Windows NT&lt;/span&gt;" if you run this from your windows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1886715836694843217?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1886715836694843217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1886715836694843217&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1886715836694843217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1886715836694843217'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/php-get-os-name.html' title='PHP: Get the OS name'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6987535459119721764</id><published>2010-11-12T11:08:00.000-08:00</published><updated>2010-11-12T11:11:10.794-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>How to merge two arrays at Perl</title><content type='html'>Its easy to join two arrays at Perl to produce a new one. Just like other smaller tasks, for joining, you'll not require any function to aid you. Just a comma(,) can do the task for you.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$\ = $/;&lt;br /&gt;&lt;br /&gt;my @array_one = (1, 3, 5, 7);&lt;br /&gt;my @array_two = (2, 4, 6, 8);&lt;br /&gt;&lt;br /&gt;my @new_array = (@array_one, @array_two);&lt;br /&gt;print for @new_array;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code will join the two arrays, and will print the new one. Joining is done using a comma. You can pass multiple arrays are separated with comma. Pretty easy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6987535459119721764?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6987535459119721764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6987535459119721764&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6987535459119721764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6987535459119721764'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/how-to-merge-two-arrays-at-perl.html' title='How to merge two arrays at Perl'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4261059032946379041</id><published>2010-11-12T11:02:00.000-08:00</published><updated>2010-11-12T11:07:06.371-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Merging two or more arrays at PHP</title><content type='html'>Its easy to merge two or more arrays at PHP. There is a simple function named array_merge() that takes two or more arrays as parameter, and return a new array after adding all of those.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$array_one = array(1, 3, 5, 7);&lt;br /&gt;$array_two = array(2, 4, 6, 8);&lt;br /&gt;&lt;br /&gt;## new array after joining&lt;br /&gt;$new_array = array_merge($array_one, $array_two);&lt;br /&gt;print_r($new_array);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For example this tiny piece of code will join two arrays, and will produce a new array. After printing the array, you'll find the values are joined at new one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4261059032946379041?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4261059032946379041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4261059032946379041&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4261059032946379041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4261059032946379041'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/merging-two-or-more-arrays-at-php.html' title='Merging two or more arrays at PHP'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3983208004603907187</id><published>2010-11-07T01:27:00.000-07:00</published><updated>2010-11-07T01:30:47.253-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: to check wether its a file or directory</title><content type='html'>Lets say you have a list of files and folders on your hand(usually from glob() function), and now you are looking to detects whether its a file or folder. Its easy to handle from perl using (-f). For example.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;$file = "text.txt";&lt;br /&gt;if( (-f) $file){&lt;br /&gt;    print "its a file.";&lt;br /&gt;}else{&lt;br /&gt;    print "its a folder";&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Very simple.&lt;br /&gt;&lt;br /&gt;By the way, if you want to check whether the file or folder exists or not, that case you can use the (-e) for exists or not on similar fashion.&lt;br /&gt;&lt;br /&gt;have a nice day,&lt;br /&gt;demon!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3983208004603907187?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3983208004603907187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3983208004603907187&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3983208004603907187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3983208004603907187'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/perl-to-check-wether-its-file-or.html' title='Perl: to check wether its a file or directory'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7920213796075111851</id><published>2010-11-07T01:22:00.000-07:00</published><updated>2010-11-07T01:26:52.898-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Execute wget under silent mode</title><content type='html'>Sometimes you may need to run the wget under a silent mode, means it will not display any output on the screen while executing. Usually the wget used to display a progress line when its downloading any file. If you want to hide that progress bar, just use -nv option from wget. nv stands for non verbose mode. An example,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;wget "http://icfun.blogspot.com" -O test.html --nv &amp;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This is very useful when you are executing this kind of command from your script. Sometimes you want to download a large file form your script, or shell and want to push the command as background process. This command will be helpful for you when that time.&lt;br /&gt;&lt;br /&gt;Cheers!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7920213796075111851?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7920213796075111851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7920213796075111851&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7920213796075111851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7920213796075111851'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/11/execute-wget-under-silent-mode.html' title='Execute wget under silent mode'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-988047397634413368</id><published>2010-10-13T11:03:00.000-07:00</published><updated>2010-10-13T11:08:04.204-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='others'/><title type='text'>Opera Mobile: Open a link on a new tab</title><content type='html'>You can easily open a link into a new tab from your Opera Mobile 10.0 browser. If you are using a touchscreen phone, then its a piece of cake for you.&lt;br /&gt;&lt;br /&gt;To do that, just tap(press) your finger on a link until a menu arrive. It will display you a popup "open in new tab", select that, and it will open a new tab for the link.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-988047397634413368?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/988047397634413368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=988047397634413368&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/988047397634413368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/988047397634413368'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/10/opera-mobile-open-link-on-new-tab.html' title='Opera Mobile: Open a link on a new tab'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4698631851249518605</id><published>2010-10-08T10:16:00.000-07:00</published><updated>2010-10-08T10:42:09.269-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='others'/><title type='text'>AGV Anti Virus causing problem with youtube uploader</title><content type='html'>AVG Anti Virus version 2011 is causing problem with Youtube Advance Uploader(java applet based). If you install that anti virus, it will not allow you to upload videos using Firefox or Internet explorer.&lt;br /&gt;&lt;br /&gt;From firebug debug, the below error is showing while uploading a video.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://upload.youtube.com/A2EB891D63C8/avg_ls_dom.js :: checkData :: line 372"  data: no]&lt;br /&gt;&lt;br /&gt;Error: yt.www.upload is undefined&lt;br /&gt;Source File: http://upload.youtube.com/my_videos_upload?restrict=java&lt;br /&gt;Line: 128&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;To overcome this issue, you can follow the instructions below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jGEuU1zFjq8/TK9VQvN3ZwI/AAAAAAAAEjw/xjdB-o0PyBo/s1600/avg-2011.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="http://3.bp.blogspot.com/_jGEuU1zFjq8/TK9VQvN3ZwI/AAAAAAAAEjw/xjdB-o0PyBo/s400/avg-2011.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525729013847779074" /&gt;&lt;/a&gt;&lt;div align="center"&gt;1) Double click "Link Scanner".&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9VQcqNvKI/AAAAAAAAEjo/eL3ujcU-d8Q/s1600/avg-2011_1.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 236px;" src="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9VQcqNvKI/AAAAAAAAEjo/eL3ujcU-d8Q/s400/avg-2011_1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525729008866409634" /&gt;&lt;/a&gt;&lt;div align="center"&gt;2) Uncheck "Enable Surf Shield"&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jGEuU1zFjq8/TK9VQGx75qI/AAAAAAAAEjg/2r9yc8X0jSI/s1600/avg-2011_2.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 234px;" src="http://1.bp.blogspot.com/_jGEuU1zFjq8/TK9VQGx75qI/AAAAAAAAEjg/2r9yc8X0jSI/s400/avg-2011_2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525729002993215138" /&gt;&lt;/a&gt;&lt;div align="center"&gt;3) Click "Save Changes"&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;But this will display a ballon at the system tray. To remove that ballon,&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9UEF1ugII/AAAAAAAAEjQ/-QoS85yYuDc/s1600/avg-2011_3.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 177px;" src="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9UEF1ugII/AAAAAAAAEjQ/-QoS85yYuDc/s400/avg-2011_3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525727697070620802" /&gt;&lt;/a&gt;&lt;div align="center"&gt;4) Double click "Link Scanner"&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_jGEuU1zFjq8/TK9UEIHsaEI/AAAAAAAAEjI/BRIsiFhqoGk/s1600/avg-2011_4.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 235px;" src="http://2.bp.blogspot.com/_jGEuU1zFjq8/TK9UEIHsaEI/AAAAAAAAEjI/BRIsiFhqoGk/s400/avg-2011_4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525727697682851906" /&gt;&lt;/a&gt;&lt;div align="center"&gt;5) Click "Ignore the state of the Component."&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9VPwOjVVI/AAAAAAAAEjY/iGRsFICE7Ic/s1600/avg-2011_5.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 226px;" src="http://4.bp.blogspot.com/_jGEuU1zFjq8/TK9VPwOjVVI/AAAAAAAAEjY/iGRsFICE7Ic/s400/avg-2011_5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5525728996939224402" /&gt;&lt;/a&gt;&lt;div align="center"&gt;6) This will display "This state is ignored", so close the window now. Problem solved.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Restart the browser, and start uploading...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4698631851249518605?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4698631851249518605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4698631851249518605&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4698631851249518605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4698631851249518605'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/10/agv-anti-virus-causing-problem-with.html' title='AGV Anti Virus causing problem with youtube uploader'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_jGEuU1zFjq8/TK9VQvN3ZwI/AAAAAAAAEjw/xjdB-o0PyBo/s72-c/avg-2011.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4609485494562049182</id><published>2010-07-27T08:20:00.001-07:00</published><updated>2010-07-27T08:22:19.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>How to Reinstall Windows Movie Maker</title><content type='html'>I was having a problem with windows movie maker. I think during installing the Windows XP, somehow I didn't install the Movie maker or may be I have uninstalled that. I was about to download the movie maker from microsoft, cause I didn't find any way to install that from CD.&lt;br /&gt;&lt;br /&gt;But from the link &lt;a href="http://www.softwaretipsandtricks.com/windowsxp/articles/418/1/How-to-Reinstall-Windows-Movie-Maker" target="_blank"&gt;http://www.softwaretipsandtricks.com/windowsxp/articles/418/1/How-to-Reinstall-Windows-Movie-Maker&lt;/a&gt; I found that I don't need the XP installation CD for reinstall that. Thanks to the article.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4609485494562049182?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4609485494562049182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4609485494562049182&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4609485494562049182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4609485494562049182'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2010/07/how-to-reinstall-windows-movie-maker.html' title='How to Reinstall Windows Movie Maker'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4042405004913796498</id><published>2009-12-28T01:07:00.000-08:00</published><updated>2009-12-28T01:11:10.471-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Regular expression to match only for any type of symbols.</title><content type='html'>I'm going to write a simple regex that will validate whether the provided string contains only symbols or not. No alphabet or numbers or spaces are allowed. Giving the expression using Perl, but it will work with any programming language as long as it PCRE.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;my $str = "^%^";&lt;br /&gt;if( $str =~ /^[!-\/:-@\[-`\{-~]+$/ ){&lt;br /&gt;    print "String contains only symbols.\n";&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So the actual regex is &lt;span style="font-weight:bold;"&gt;^[!-\/:-@\[-`\{-~]+$&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4042405004913796498?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4042405004913796498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4042405004913796498&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4042405004913796498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4042405004913796498'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/12/regular-expression-to-match-only-for.html' title='Regular expression to match only for any type of symbols.'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2464557855143626333</id><published>2009-12-27T11:11:00.000-08:00</published><updated>2009-12-27T11:19:44.376-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Javascript: Replace all using REGEX for a string</title><content type='html'>Using the replace() function under the string object, you can easily perform the regular expression operation to replace a string.&lt;br /&gt;&lt;br /&gt;The replace() function from javascript supports the Perl's &lt;b&gt;s///&lt;/b&gt; operation. You can pass the modifier /g for replace all, and /i for case insensitive.&lt;br /&gt;&lt;br /&gt;Lets consider the below example code block. This will remove anything inside the &amp;lt;...&amp;gt; tags. Since i'm using the /g modifier after the regex, it will be used as replace all tags from the string&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;// initial string&lt;br /&gt;var str = "&amp;lt;a ...&amp;gt;hello&amp;lt;/a&amp;gt; and &amp;lt;ul ...&amp;gt;bla bla&amp;lt;/ul&amp;gt;";&lt;br /&gt;// remove any tags from the above string&lt;br /&gt;str = str.replace(/&amp;lt;.*?&amp;gt;/g, "");&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Remember, if you remove the /g at the end of the regex, it will only remove the first tag from sample string. Also once again you can use /i modifier to ignore case sensitivity.&lt;br /&gt;&lt;br /&gt;Cheers!!&lt;br /&gt;Wolf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2464557855143626333?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2464557855143626333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2464557855143626333&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2464557855143626333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2464557855143626333'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/12/javascript-replace-all-using-regex-for.html' title='Javascript: Replace all using REGEX for a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2894086047486379041</id><published>2009-12-03T11:25:00.000-08:00</published><updated>2009-12-03T11:32:41.223-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Regular expression to validate clock time</title><content type='html'>To validate time from 00:00 to 11:59 you can use a simple regex. &lt;br /&gt;&lt;br /&gt;The regex is &lt;b&gt;(?:0[0-9]|1[0-1]):[0-5][0-9]&lt;/b&gt;&lt;br /&gt;It means if the first digit of hour is 0, then second digit can be any one from 0-9.&lt;br /&gt;Otherwise if the first digit is 1, that case second digit can only be 1 or 2.&lt;br /&gt;&lt;br /&gt;For minute section, first digit can be only from 0-5, and second digit can be from 0-9.&lt;br /&gt;&lt;br /&gt;I'm giving you the example using a perl code, but the regex will work with any PCRE compatible engine.&lt;br /&gt;&lt;br /&gt;Using Perl&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;my $time = "01:19";&lt;br /&gt;if($time =~ /(?:0[0-9]|1[0-1]):[0-5][0-9]/){&lt;br /&gt;    print "the time is valid\n";&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;    print "the time is not valid\n";&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Simple task, but yet too hard if you don't this :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2894086047486379041?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2894086047486379041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2894086047486379041&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2894086047486379041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2894086047486379041'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/12/regular-expression-to-validate-clock.html' title='Regular expression to validate clock time'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3556092663131093670</id><published>2009-11-13T07:23:00.000-08:00</published><updated>2009-11-13T07:26:53.615-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: What is the equivalent of Ceil()</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Question&lt;/span&gt;: At Perl, what is the equivalent function of Ceil? Or how can I perform Ceil on a number like other languages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Answer&lt;/span&gt;: So far, I don't know any function to serve this issue. But if I need, I use &lt;span style="font-weight:bold;"&gt;sprintf&lt;/span&gt;() combined with floating. Below example will show you what exactly I mean for.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;my $number = 10.51;&lt;br /&gt;$number = sprintf("%.0f", $number);&lt;br /&gt;print $number;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The above code will output 11, which is the exact ceiling of 10.51.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3556092663131093670?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3556092663131093670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3556092663131093670&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3556092663131093670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3556092663131093670'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/11/perl-what-is-equivalent-of-ceil.html' title='Perl: What is the equivalent of Ceil()'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6107765075388855998</id><published>2009-11-13T07:18:00.000-08:00</published><updated>2009-11-13T07:21:29.413-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: What is the equivalent to floor()</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Question&lt;/span&gt;: What is the equivalent of function &lt;span style="font-weight:bold;"&gt;floor&lt;/span&gt;() at Perl?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Answer&lt;/span&gt;: Simple answer is to use &lt;span style="font-weight:bold;"&gt;int&lt;/span&gt;() function. This will just remove the decimal portion from the provided number. Example code using int() to serve like floor is,&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;print int(10.9);&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6107765075388855998?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6107765075388855998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6107765075388855998&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6107765075388855998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6107765075388855998'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/11/perl-what-is-equivalent-to-floor.html' title='Perl: What is the equivalent to floor()'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5341459041750821170</id><published>2009-11-11T06:33:00.000-08:00</published><updated>2009-11-11T06:40:13.148-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: How to read a GZip file</title><content type='html'>I was trying to read a gzip file using PHP. But I found it was a bit hard, and I waste a lot of times for this. I was trying the Zlib library of PHP. But damn! it wasn't working to read a GZip file.&lt;br /&gt;&lt;br /&gt;First I tried to read the file as binary mode, and then passed the whole content to the function &lt;span style="font-weight:bold;"&gt;gzuncompress()&lt;/span&gt;, but it was getting error. Failed to parse kinda error. When I was pissed off, I tried with other deflate/inflate functions, but all were suck.&lt;br /&gt;&lt;br /&gt;Later one of my friend suggested me to to read the file as gzip data using &lt;span style="font-weight:bold;"&gt;gzfile()&lt;/span&gt;, and it worked for me. It worked for me. Just a one line code that solved my problem, and I was scratching my head to find it at google. Here is the code.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;$__GZIP_FILE = "my_gzip_file.gz";&lt;br /&gt;$file_data = implode("", gzfile($__GZIP_FILE));&lt;br /&gt;echo $file_data;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's it. It will read your gzip file, and return the whole uncompressed content into the variable. So simple, but so hard if you don't know the right way ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5341459041750821170?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5341459041750821170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5341459041750821170&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5341459041750821170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5341459041750821170'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/11/php-how-to-read-gzip-file.html' title='PHP: How to read a GZip file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4300641946527082303</id><published>2009-10-31T07:36:00.000-07:00</published><updated>2009-10-31T07:40:38.639-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Read the whole file into array</title><content type='html'>Does anyone know about a function that will read the whole content from a given text file, and return an array which will contains the content from the input file. The array will have each lines at separate rows of the array. I didn't find such kind of function, so I made one for myself. This file reading code may not be the most efficient, but worked for me.&lt;br /&gt;&lt;br /&gt;Here is the function, this will take a file name, and return you an array.&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;function read_file_at_array($file){&lt;br /&gt;    $content = file_get_contents($file);&lt;br /&gt;    $lines = preg_split('/\n/', $content);&lt;br /&gt;    return $lines;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To call the function read_file_at_array(), just provide the file name. For example the below code.&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;$lines = read_file_at_array("input.txt");&lt;br /&gt;print_r($lines);&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's it. So simple. But remember, if your file name is too large, this function will not be efficient. I mean to load the whole large file into an array is not a good thing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4300641946527082303?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4300641946527082303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4300641946527082303&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4300641946527082303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4300641946527082303'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/10/php-read-whole-file-into-array.html' title='PHP: Read the whole file into array'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3068682809263693196</id><published>2009-10-31T07:21:00.000-07:00</published><updated>2009-10-31T07:35:52.473-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Using curl with private proxies</title><content type='html'>Curl is a supper thing. You can do whatever you like. It has almost every functionality for your needs. I'm a fan of CURL.&lt;br /&gt;&lt;br /&gt;Lets say you need to authenticate your proxy with a particular username and password. Using curl its just one single line of code. The below line will help you to connect to the proxy using authentication.&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password"); &lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;Remember, the username and password are separated with colon(:).&lt;br /&gt;&lt;br /&gt;Those who are new to proxy, here is the complete portion for proxy for your curl.&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);&lt;br /&gt;curl_setopt($ch, CURLOPT_PROXY, "192.179.1.32:808");&lt;br /&gt;curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password"); &lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Hope this will help you guys sometimes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3068682809263693196?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3068682809263693196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3068682809263693196&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3068682809263693196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3068682809263693196'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/10/php-using-curl-with-private-proxies.html' title='PHP: Using curl with private proxies'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-3786410986431503903</id><published>2009-09-06T09:10:00.000-07:00</published><updated>2009-09-06T09:13:56.381-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Warning: require_once(Spreadsheet/Excel/Reader/OLERead.php)</title><content type='html'>Did you get the error from your PHP/Excel library?&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Warning: require_once(Spreadsheet/Excel/Reader/OLERead.php): failed to open stream: No such file or directory in ...??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Looks like you have downloaded the opensource phpexcelreader library and didn't edit the reader.php file. Just follow the below two steps, and it will get out from the error.&lt;br /&gt;&lt;br /&gt;1) Open the reader.php file from the Excel folder. Remove the below code from the top of the line.&lt;br /&gt;require_once 'Spreadsheet/Excel/Reader/OLERead.php';&lt;br /&gt;&lt;br /&gt;2) And add the below code after remove that.&lt;br /&gt;require_once 'Excel/oleread.inc';&lt;br /&gt;&lt;br /&gt;Now try to run your code. It will work now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-3786410986431503903?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/3786410986431503903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=3786410986431503903&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3786410986431503903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/3786410986431503903'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/09/php-warning-requireoncespreadsheetexcel.html' title='PHP: Warning: require_once(Spreadsheet/Excel/Reader/OLERead.php)'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8219403908386356099</id><published>2009-09-06T09:04:00.001-07:00</published><updated>2009-09-06T09:10:24.772-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: How to Read XLS file</title><content type='html'>If you want to read any Microsoft excel file, then you can use an opensource php library to handle your task. The php library to read the excel file is "&lt;span style="font-weight:bold;"&gt;phpexcelreader&lt;/span&gt;". Recently I have used the library to read a excel file for one of my project. And it worked like a charm.&lt;br /&gt;&lt;br /&gt;You can find the library using google "&lt;span style="font-weight:bold;"&gt;phpexcelreader&lt;/span&gt;" or by downloading from &lt;a href="http://sourceforge.net/projects/phpexcelreader/" target="blank"&gt;http://sourceforge.net/projects/phpexcelreader/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1) Just download the library and unzip it using your zip software.&lt;br /&gt;&lt;br /&gt;2) Go inside the Excel folder, and open the reader.php file.&lt;br /&gt;&lt;br /&gt;3) remove the below code from the top of the line.&lt;br /&gt;&lt;code&gt;require_once 'Spreadsheet/Excel/Reader/OLERead.php';&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;4) And add the below code after remove that.&lt;br /&gt;&lt;code&gt;require_once 'Excel/oleread.inc';&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's it. Now try to run the sample codes, and then apply this library with your project or whatever you need.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8219403908386356099?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8219403908386356099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8219403908386356099&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8219403908386356099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8219403908386356099'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/09/php-how-to-read-xls-file.html' title='PHP: How to Read XLS file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7039622900624308562</id><published>2009-08-15T01:58:00.000-07:00</published><updated>2009-08-15T02:07:51.241-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Adding additional HTTP request header with URLConnection</title><content type='html'>I have already shown you few HTTP operation using URLConnection class of java at my previous few postings. now I'm going to tell you how to add additional headers with your HTTP request.&lt;br /&gt;&lt;br /&gt;First of all lets build a connection object, which we'll use at this post.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;String url = "http://www.google.com/";&lt;br /&gt;URLConnection urlConnection = new URL(url).openConnection();&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now we need to add a referer url with the urlConnection. The &lt;span style="font-weight:bold;"&gt;setRequestProperty()&lt;/span&gt; method of the URLConnection class is pretty useful for this kind of task.&lt;br /&gt;&lt;code&gt;urlConnection.setRequestProperty("referer", refererUrl);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Lets add an user agent with the request. People used to use lots of funny agent, we are considering our Opera as user agent.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;urlConnection.setRequestProperty("user-agent", "Opera/9.0");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Do you want to add some cookie with your request header? It is also available for you.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;urlConnection.setRequestProperty("cookie", "some_freaking_cookie_here");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Above three are the common headers that people used to add on request header. But its open to use more. For example to request GZip content, you can add below line of code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;urlConnection.setRequestProperty("Accept-Encoding", "gzip,deflate");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There are other headers like Accept-Charset, Accept-Language, Accept you can use too.&lt;br /&gt;&lt;br /&gt;I have just shown you the way, its now upto you how you'll use it.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7039622900624308562?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7039622900624308562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7039622900624308562&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7039622900624308562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7039622900624308562'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-adding-additional-http-request.html' title='Java: Adding additional HTTP request header with URLConnection'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1813271652413441686</id><published>2009-08-15T01:53:00.000-07:00</published><updated>2009-08-15T01:58:37.021-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>java: Perform HTTP POST operation with URLConnection</title><content type='html'>Using the java.net class URLConnection you can easily do your regular HTTP POST operation. Its almost similar to the GET operation. This case, you'll just need to write the post parameter to the post url. That's it. Here is an example code that will post some data to the post url, and the response HTML is at &lt;span style="font-weight:bold;"&gt;String html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;String html = "";&lt;br /&gt;String postUrl = "http://www.example.com/login.jsp";&lt;br /&gt;String data = "x=10&amp;y=20";&lt;br /&gt;&lt;br /&gt;URL url = new URL(postUrl);&lt;br /&gt;URLConnection urlConnection = url.openConnection();&lt;br /&gt;&lt;br /&gt;// Posting the content&lt;br /&gt;urlConnection.setDoOutput(true);&lt;br /&gt;OutputStreamWriter wr = new OutputStreamWriter(urlConnection.getOutputStream());&lt;br /&gt;wr.write(data);&lt;br /&gt;wr.flush();&lt;br /&gt;&lt;br /&gt;// make an input stream from the remote url&lt;br /&gt;DataInputStream dis = new DataInputStream(urlConnection.getInputStream());&lt;br /&gt;// read until all the html codes are fetched&lt;br /&gt;String tmp;&lt;br /&gt;while ((tmp = dis.readLine()) != null) {&lt;br /&gt;    html += tmp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// close the shits&lt;br /&gt;dis.close();&lt;br /&gt;wr.close();&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;At above code, you can see that I have posted my content at the site using OutputStreamWriter. But don't forget to encode your post string before sending.&lt;br /&gt;&lt;br /&gt;After posting the data, I have read the HTML from the site using DataInputStream from the connection. This is as like the GET method, just the OutputStreamWriter makes the different between the POST and GET method.&lt;br /&gt;&lt;br /&gt;Hope you enjoyed this small piece of code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1813271652413441686?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1813271652413441686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1813271652413441686&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1813271652413441686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1813271652413441686'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-perform-http-post-operation-with.html' title='java: Perform HTTP POST operation with URLConnection'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1853685994627235415</id><published>2009-08-15T01:37:00.000-07:00</published><updated>2009-08-15T01:44:31.881-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: Urlencode and Urldecode options</title><content type='html'>Java has two different class Called URLDecoder, and URLEncoder which has &lt;span style="font-weight:bold;"&gt;decoder()&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;encoder()&lt;/span&gt; method respectively to decode and encode your URL for HTTP request. (I wonder why two separate classes? One would have been better I guess)&lt;br /&gt;&lt;br /&gt;Lets say our initial string is&lt;br /&gt;&lt;pre&gt;&lt;code&gt;// our initial string&lt;br /&gt;String str = "hello world and some &amp; funny ?? Stuff++";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now using &lt;span style="font-weight:bold;"&gt;encoder()&lt;/span&gt; function I'm encoding the string. The function is static, and it is available to access using the Class name URLEncoder.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;// encoding the string using URLEncoder class&lt;br /&gt;str = java.net.URLEncoder.encode( str, "UTF-8");&lt;br /&gt;System.out.println(str);&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now using &lt;span style="font-weight:bold;"&gt;decoder()&lt;/span&gt; method from URLDecoder class, I'm converting the encoded string into its previous form. This is also a static method, and possible to access via the class name.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;// decoding the string using URLDecoder class&lt;br /&gt;str = java.net.URLDecoder.decode( str, "UTF-8");&lt;br /&gt;System.out.println(str);&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will help you to encode your data before POST operation. Also At your web application the decoder will help your decode the data from POST request.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1853685994627235415?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1853685994627235415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1853685994627235415&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1853685994627235415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1853685994627235415'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-urlencode-and-urldecode-options.html' title='Java: Urlencode and Urldecode options'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7673204703831001245</id><published>2009-08-15T01:24:00.000-07:00</published><updated>2009-08-15T01:32:31.925-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: download a png image and save as file</title><content type='html'>I'm giving you a simple java code that will download a png image from remote location, lets say from google. And save the image into your local pc. I'm using URLConnection and Java standard I/O libraries to do this task.&lt;br /&gt;&lt;br /&gt;When I didn't knew the proper way, I was using PrintWriter and reading the data line by line, and which actually messed the thing. But now its working for me.&lt;br /&gt;&lt;br /&gt;Here is the code,&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;// lets say saving the png file from google.&lt;br /&gt;URL url = new URL("http://www.google.com/intl/en_com/images/logo_plain.png");&lt;br /&gt;URLConnection urlConnection = url.openConnection();&lt;br /&gt;&lt;br /&gt;// creating the input stream from google image&lt;br /&gt;BufferedInputStream in = new BufferedInputStream(urlConnection.getInputStream());&lt;br /&gt;// my local file writer, output stream&lt;br /&gt;BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream( "image.png" ));&lt;br /&gt;&lt;br /&gt;// until the end of data, keep saving into file.&lt;br /&gt;int i;&lt;br /&gt;while ((i = in.read()) != -1) {&lt;br /&gt;    out.write(i);&lt;br /&gt;}&lt;br /&gt;out.flush();&lt;br /&gt;&lt;br /&gt;// closing all the shits&lt;br /&gt;out.close();&lt;br /&gt;in.close();&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Using this simple code, you should be able to download any kind of binary file(pdf, gif, jpg, etc) directly from website to your local pc. you'll just need to change the input URL, and output file name. That's all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7673204703831001245?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7673204703831001245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7673204703831001245&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7673204703831001245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7673204703831001245'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-download-png-image-and-save-as.html' title='Java: download a png image and save as file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2836723924068037480</id><published>2009-08-15T00:15:00.000-07:00</published><updated>2009-08-15T00:24:15.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: get all the cookies from http response header</title><content type='html'>If you are using URLConnection class from java, then below code will be helpful for you to extract the Set-Cookie header values from the HTTP response. The below function just return you the cookies from google.com,&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;public String getCookies() throws Exception{&lt;br /&gt;    String headerName = null, returnCookie = "";&lt;br /&gt;    &lt;br /&gt;    // creeating the url connection object&lt;br /&gt;    URL url = new URL("http://www.google.com");&lt;br /&gt;    URLConnection urlConnection = url.openConnection();&lt;br /&gt;    &lt;br /&gt;    // checking for each headers&lt;br /&gt;    for (int i=1; (headerName = urlConnection.getHeaderFieldKey(i))!=null; i++) {&lt;br /&gt;        // if its set-cookie, then take it&lt;br /&gt;        if (headerName.equalsIgnoreCase("Set-Cookie")) {                  &lt;br /&gt;            String cookie = urlConnection.getHeaderField(i);&lt;br /&gt;            returnCookie += cookie + "\n";&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return returnCookie;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Actually this function will help you to find other HTTP headers. you'll just need to replace the Set-Cookie with your header. It can be content encoding, Location, etc.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2836723924068037480?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2836723924068037480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2836723924068037480&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2836723924068037480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2836723924068037480'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-get-all-cookies-from-http-response.html' title='Java: get all the cookies from http response header'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6464084668362727505</id><published>2009-08-15T00:05:00.000-07:00</published><updated>2009-08-15T00:15:37.790-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java: How to create a jar archive</title><content type='html'>I don't used to make jar file to often to execute my program. I used to make a bat file, and paste my java xyz.class command inside that batch file and run. What I do when I need to make a jar file? I just do the below steps when I need.&lt;br /&gt;&lt;br /&gt;Lets say your main class name is &lt;span style="font-weight:bold;"&gt;ICFun&lt;/span&gt;&lt;br /&gt;1) First of create a Manifest file called ICFun.MF, and inside the file paste below lines&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;Manifest-Version: 1.0&lt;br /&gt;Main-Class: ICFun&lt;br /&gt;Created-By: 1.2 (Sun Microsystems Inc.)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) Create a batch file, which will import the path of your jar file at first line, and second line will contain the jar creating command with required classes.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;path="C:\Java\jdk1.6.0\bin"&lt;br /&gt;jar -cvfm ICFun.jar ICFun.MF *.class&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can add the class using folder, for example, folder1/*.class folder2/classes etc.&lt;br /&gt;&lt;br /&gt;3) Now your ICFun.jar file is ready. You can run it by clicking it, or from command line.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;java -jar ICFun.jar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's what I do for my java archive creating from my class files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6464084668362727505?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6464084668362727505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6464084668362727505&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6464084668362727505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6464084668362727505'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/java-how-to-create-jar-archive.html' title='Java: How to create a jar archive'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2652273745134878904</id><published>2009-08-14T06:43:00.000-07:00</published><updated>2009-08-14T06:46:02.002-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Perform HTTP POST operation with urllib2</title><content type='html'>The request function under the urllib2 class accepts both url and parameter. If you pass only url, it will act as HTTP GET. But if you pass the parameter with the url, it will perform the HTTP POST operation, where the url will be your post url, and the parameter will be http post content.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;import urllib2&lt;br /&gt;req = urllib2.Request(url, param)&lt;br /&gt;res = urllib2.urlopen(req)&lt;br /&gt;html = decodeContent(res)&lt;br /&gt;res.close()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can use the urllib2 various way to get HTML content from the website. I'm giving the example which I like to use. It will be different if you want to use it other ways.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2652273745134878904?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2652273745134878904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2652273745134878904&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2652273745134878904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2652273745134878904'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-perform-http-post-operation-with.html' title='Python: Perform HTTP POST operation with urllib2'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1823605626406305450</id><published>2009-08-07T10:52:00.000-07:00</published><updated>2009-08-07T11:01:39.968-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Read write binary file using Python</title><content type='html'>Like other programming languages, you have to handle binary file specifically. It will not work if you just dump your content into a file as text mode, if it is a binary data. You have to assign binary mode on it.&lt;br /&gt;&lt;br /&gt;Lets say you want to download a PDF file from a website, and want to save at your PC. Instead of "w" write mode, you have to use "wb" mode. Means write as binary mode. So the code will be.&lt;br /&gt;&lt;pre&gt;&lt;/code&gt;&lt;br /&gt;localFile = open("my_pdf.pdf", 'wb')&lt;br /&gt;localFile.write(pdf_content)&lt;br /&gt;localFile.close()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Similarly while reading the binary file, just use "wb" to read a file. Anyway here I'm giving a code that will help you to download a PDF file from a website. You can use any link of .doc, .xls, .gif, .jpg or any type. Just call the function with your url, and file name.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;from urllib2 import urlopen&lt;br /&gt;def downloadPDF(url, outfile):&lt;br /&gt;    try:&lt;br /&gt;        webFile = urlopen(url)&lt;br /&gt;        localFile = open(outfile, 'wb')&lt;br /&gt;        localFile.write(webFile.read())&lt;br /&gt;        webFile.close()&lt;br /&gt;        localFile.close()&lt;br /&gt;    except IOError, e:&lt;br /&gt;        print "Download error"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1823605626406305450?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1823605626406305450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1823605626406305450&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1823605626406305450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1823605626406305450'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-read-write-binary-file-using.html' title='Python: Read write binary file using Python'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-647838323031287800</id><published>2009-08-05T12:23:00.000-07:00</published><updated>2009-08-05T12:30:18.590-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Sql Injection and how to prevent this.</title><content type='html'>Its one of the dangerous hole to your site which will allow any unwanted guest access your database or control panel. Last few weeks I was working with SQL injecting, and found lots of websites from the worldwide which are welcoming the hackers to use their unknown hole of website.&lt;br /&gt;&lt;br /&gt;I'm not that much expert on website coding. You can say I don't work with database. So I don't know much about this stuff. But one thing I learned is, just validate every singe GET or POST parameter from your website script.&lt;br /&gt;&lt;br /&gt;Don't trust anyone. Just validate, and check whether its having the format you need or not. If you don't know how to validate your GET/POST parameters, not to worry. Just replace any single quote(') with anything. Don't let this shit to pass.&lt;br /&gt;&lt;br /&gt;Or you can use adding slashes types of function depending upon language, to get rid of it. At least it will save your ass for few. But there might be many other ways to find hole. I only know single quoting.&lt;br /&gt;&lt;br /&gt;Once again, try to go for validation, even for numbers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-647838323031287800?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/647838323031287800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=647838323031287800&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/647838323031287800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/647838323031287800'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/sql-injection-and-how-to-prevent-this.html' title='Sql Injection and how to prevent this.'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1508477647416222215</id><published>2009-08-05T12:17:00.000-07:00</published><updated>2009-08-05T12:22:23.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>Google: Search things from a specific country</title><content type='html'>I don't know about USA. But at my country, I can see that I have an option to search only inside my country. Means it will return the results from my country only.&lt;br /&gt;&lt;br /&gt;I was wondering whether I can get the search result for other country siting on my country or not. I just checked what is the parameter google sent to their server for country based searching. And just changed the two word country CODE with my string, and I think its working.&lt;br /&gt;&lt;br /&gt;For example the below link, I just used UK for country code. You can try with other.&lt;br /&gt;&lt;br /&gt;http://www.google.com/search?hl=en&amp;safe=off&amp;hs=L5l&amp;q=google+country+based+search&amp;btnG=Search&amp;meta=cr%3Dcountry&lt;span style="font-weight:bold;"&gt;UK&lt;/span&gt;&amp;aq=f&amp;oq=&lt;br /&gt;&lt;br /&gt;But I believe there must be some option at google to select. May be from advance search. But I just didn't find it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1508477647416222215?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1508477647416222215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1508477647416222215&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1508477647416222215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1508477647416222215'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/google-search-things-from-specific.html' title='Google: Search things from a specific country'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2977882269881352136</id><published>2009-08-05T11:38:00.000-07:00</published><updated>2009-08-05T11:46:03.458-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Customize sorting with a comparator function</title><content type='html'>Many other programming languages, Python does have the comparator facility to sort a list according to your need. You can define a customize compare function which will implement your logic for sorting.&lt;br /&gt;&lt;br /&gt;I'm giving few example about sorting first, then customize sorting. Lets talk about simple sorting option at Python.&lt;br /&gt;&lt;br /&gt;1) Sort using sorted() function or sort()&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## Initial Array&lt;br /&gt;array = [8, 2, 9, 0, 1, 2, 5];&lt;br /&gt;## General sorting&lt;br /&gt;array.sort()&lt;br /&gt;print array&lt;br /&gt;&lt;br /&gt;## Another approach&lt;br /&gt;## using function&lt;br /&gt;print sorted(array)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) Now sorting using custom comparator function.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## custom sort&lt;br /&gt;def comparator(x, y):&lt;br /&gt;    return x-y&lt;br /&gt;&lt;br /&gt;## Initial Array&lt;br /&gt;array = [8, 2, 9, 0, 1, 2, 5];&lt;br /&gt;array.sort(comparator)&lt;br /&gt;print array&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This the very basic of a comparator function. Its just take two objects as parameter, and compare, after that it just return like x&lt;y, x==y, or x&gt;y.&lt;br /&gt;&lt;br /&gt;3) Now put some logic inside the comparator function for your own purpose.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## custom sort&lt;br /&gt;def comparator(x, y):&lt;br /&gt;    ## Just a condition for example,&lt;br /&gt;    ## you can add as many you need.&lt;br /&gt;    if(x % 2):&lt;br /&gt;        return x&lt;br /&gt;    return x-y&lt;br /&gt;&lt;br /&gt;## Initial Array&lt;br /&gt;array = [8, 2, 9, 0, 1, 2, 5];&lt;br /&gt;array.sort(comparator)&lt;br /&gt;print array&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can see that I've just put a logic inside my compare function. You just need to build your own comparing mechanism when you'll go to use this type of sorting. Believe me, this kind of things just make your life easier, otherwise you would have to write hundred of lines of codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2977882269881352136?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2977882269881352136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2977882269881352136&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2977882269881352136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2977882269881352136'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-customize-sorting-with.html' title='Python: Customize sorting with a comparator function'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6622853213875844167</id><published>2009-08-05T11:10:00.000-07:00</published><updated>2009-08-05T11:21:35.579-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Swap string value using s///</title><content type='html'>This a funny way to swap two values from a string using perl's s///. This will only work if the two words contain exactly one times inside string. I was just wondering about it, and think to add here for all.&lt;br /&gt;&lt;br /&gt;Let say you have a string, and you want to swap the words "demo" and "test" with each other. So the simple code will be as below.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## initial string to swap&lt;br /&gt;my $string = "test string and demo string";&lt;br /&gt;## swaping test with demo&lt;br /&gt;$string =~ s/(test)(.*?)(demo)/$3$2$1/;&lt;br /&gt;print "$string\n";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Inside the regex you'll need to change the position of test and demo depending upon the position from original string. And remember this will work only if both string exist only once. For multiple I didn't check, So don't know.&lt;br /&gt;&lt;br /&gt;Once again, its a funny stuff, but may come helpful for somebody. Don't forget to add a comment if anyone find such.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6622853213875844167?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6622853213875844167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6622853213875844167&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6622853213875844167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6622853213875844167'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/perl-swap-string-value-using-s.html' title='Perl: Swap string value using s///'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4792112109883404260</id><published>2009-08-02T01:38:00.000-07:00</published><updated>2009-08-02T02:21:34.777-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Print HTTP Response header</title><content type='html'>Its easy to print or get any HTTP response header after performing a request using urllib2 from Python. Using info() from response of urlopen(), you can easily print all headers. For example the below code. This will request to google.com, and will print all the headers that came as response.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;import urllib2&lt;br /&gt;req = urllib2.Request('http://www.google.com/')&lt;br /&gt;res = urllib2.urlopen(req)&lt;br /&gt;print res.info() ## printing the headers&lt;br /&gt;res.close();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The output will be&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Date: Sun, 02 Aug 2009 09:17:10 GMT&lt;br /&gt;Expires: -1&lt;br /&gt;Cache-Control: private, max-age=0&lt;br /&gt;Content-Type: text/html; charset=ISO-8859-1&lt;br /&gt;Set-Cookie: PREF=ID=4...&lt;br /&gt;Server: gws&lt;br /&gt;Transfer-Encoding: chunked&lt;br /&gt;Connection: close&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you want to print only a single header from the response, you can do so. Let say you want to print only the header "Content-Type" from the response header. The code will be&lt;br /&gt;&lt;br /&gt;&lt;code&gt;print res.info().get('Content-Type')&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And it will output as below on your screen.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;text/html; charset=ISO-8859-1&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4792112109883404260?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4792112109883404260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4792112109883404260&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4792112109883404260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4792112109883404260'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-print-http-response-header.html' title='Python: Print HTTP Response header'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2745287901471019245</id><published>2009-08-02T01:25:00.000-07:00</published><updated>2009-08-02T01:36:31.116-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Add user-agent string with http request</title><content type='html'>When reading html content from an url, python by default used to set the useragent string as "&lt;span style="font-weight:bold;"&gt;Python-urllib/2.5&lt;/span&gt;" with http request, if you don't set any. So the actual request to the server will be like this.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;User-Agent: Python-urllib/2.5&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You might not want to let the website that you are using a python library to browse their page, and you are not a human, just a bot. They site might block you. That case its must to change this User-Agent String. Also few site used to provide different type of HTML data based on the User-Agent(browser).&lt;br /&gt;&lt;br /&gt;Using the add_header() function of a python request object, you can do this. This function used to take HTTP headers as key, value format. So if you want to set the UserAgent header, the code will be.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;req.add_header('User-agent', 'Mozilla 3.10')&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I'm now giving you a sample code, that will browse the google.com using mozilla user agent, and print the html from google into screen.&lt;br /&gt;&lt;code&gt;import re&lt;br /&gt;&lt;br /&gt;import urllib2&lt;br /&gt;req = urllib2.Request('http://www.google.com/')&lt;br /&gt;req.add_header('User-agent', 'Mozilla 3.10')&lt;br /&gt;res = urllib2.urlopen(req)&lt;br /&gt;html = res.read()&lt;br /&gt;&lt;br /&gt;print html&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2745287901471019245?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2745287901471019245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2745287901471019245&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2745287901471019245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2745287901471019245'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-add-user-agent-string-with-http.html' title='Python: Add user-agent string with http request'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5431854054973837946</id><published>2009-08-02T00:35:00.000-07:00</published><updated>2009-08-02T02:22:15.142-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Various ways to read a file</title><content type='html'>There is only one way to open or close a file usine open() close() function. You'll find lots of cpan modules which will help you to read file, but internally all the modules are using these to functions to open and close files. I'm showing you how can you read a file into array, or string, or anything else. Just few coding helps regarding file operation.&lt;br /&gt;&lt;br /&gt;1) Read the whole file content into an array directly.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;open(INFILE, "&amp;lt;input.txt"); ## open file handler&lt;br /&gt;my @lines = &amp;lt;INFILE&amp;gt;;       ## read into array&lt;br /&gt;close(INFILE);              ## close handler&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code will read all the contents from input.txt, and will load into array @lines directly. Later on, you can do whatever operation you need. You have the file on your hand.&lt;br /&gt;&lt;br /&gt;2) Read a single line from your input file.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;open(INFILE, "&amp;lt;input.txt"); ## open file handler&lt;br /&gt;my $line = &amp;lt;INFILE&amp;gt;;        ## read a single line&lt;br /&gt;close(INFILE);              ## close handler&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Perl interpreter is intelligent enough to understand your need. Since you provided a scalar to file handler, it will return you the current line that the file handler pointing. This case it will return you only the first line.&lt;br /&gt;&lt;br /&gt;3) Using a loop, say while(), process each line while reading without using any array.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;open(INFILE, "&amp;lt;input.txt"); ## open file handler&lt;br /&gt;while(&amp;lt;INFILE&amp;gt;){&lt;br /&gt;    # current line at the variable $_&lt;br /&gt;    ## process here&lt;br /&gt;}&lt;br /&gt;close(INFILE);              ## close handler&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you don't want to use the default $_ variable, that case you can use this loop.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;while (my $line = &amp;lt;INFILE&amp;gt;){&lt;br /&gt;    print $line;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4) Read the whole file content into a string instead of array. I used to use join() function to do this.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;open(INFILE, "&amp;lt;input.txt"); ## open file handler&lt;br /&gt;my $file_content = join('', &amp;lt;INFILE&amp;gt;);&lt;br /&gt;close(INFILE);              ## close handler&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This join function just take the whole file as array, and join each line from the array. A bit tricky, but nothing else.&lt;br /&gt;&lt;br /&gt;I think this will cover what you need when you'll do some file operation at perl scripting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5431854054973837946?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5431854054973837946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5431854054973837946&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5431854054973837946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5431854054973837946'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/perl-various-way-to-read-file.html' title='Perl: Various ways to read a file'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7343167239204965329</id><published>2009-08-01T12:22:00.001-07:00</published><updated>2009-08-01T12:25:55.970-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python:  working with hash as key, value pair</title><content type='html'>If you want to print your hash as key=value, or want to perform any other operation at your python hash, its simple. I used to do for loop for this kind of stuff.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## your hash&lt;br /&gt;MY_HASH = {"one":1, "two":2, "four":4, "three":3}&lt;br /&gt;## for each key from your hash&lt;br /&gt;for key in MY_HASH:&lt;br /&gt;    ## print as key value pair&lt;br /&gt;    print key,'=',MY_HASH[key]&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Its just taking each key out from the hash, and then using key, its retrieve the value associate with that hash.&lt;br /&gt;&lt;br /&gt;But if you need to debug the values of your hash, i don't think its necessary to use this kind of looping at python. Just use direct print on your hash. Like below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;print MY_HASH&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The print command from python is a bit intelligent then other languages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7343167239204965329?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7343167239204965329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7343167239204965329&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7343167239204965329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7343167239204965329'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-working-with-hash-as-key-value.html' title='Python:  working with hash as key, value pair'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2154130724285821579</id><published>2009-08-01T12:11:00.000-07:00</published><updated>2009-08-01T12:14:50.359-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: get current working directory</title><content type='html'>The os library of Python is simply awesome. If you need to get the current working directory of your script. Just used the getcwd() function from os package. Its like below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;print os.getcwd()&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;It will output your path something like below&lt;br /&gt;&lt;code&gt;E:\Documents and Settings\alesandro\Desktop\Work\temp&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2154130724285821579?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2154130724285821579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2154130724285821579&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2154130724285821579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2154130724285821579'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-get-current-working-directory.html' title='Python: get current working directory'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6255169820509316026</id><published>2009-08-01T10:58:00.000-07:00</published><updated>2009-08-01T11:09:51.252-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Global variable funda and a real mess</title><content type='html'>For any new python coder, its a pain, if you are not aware about local and global reference. Its not other scripting language, that if you change it locally, and it will be effected at global. Not at all. You have to tell you python about that.&lt;br /&gt;&lt;br /&gt;Here is an example.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## a global variable&lt;br /&gt;my_global_var = 10&lt;br /&gt;&lt;br /&gt;def set_global(val):&lt;br /&gt;    ## changing global variable&lt;br /&gt;    my_global_var = val&lt;br /&gt;    print "After Change ", my_global_var&lt;br /&gt;&lt;br /&gt;## Tesing&lt;br /&gt;set_global(5)&lt;br /&gt;print "Finally ", my_global_var&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;At this example, you can see that the global variable is changed inside the function set_global(), but the output of the script is not telling this is true. Its output should show 5 both cases. Instead, it is displaying&lt;br /&gt;&lt;pre&gt;&lt;code&gt;After Change  5&lt;br /&gt;Finally  10&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Why? It will be your question, if you are a new coder at python world. To use a global variable at locally, you have to use global like PHP before the variable inside the local scope. So the correct code will be.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;## a global variable&lt;br /&gt;my_global_var = 10&lt;br /&gt;&lt;br /&gt;def set_global(val):&lt;br /&gt;    ## using global variable at local scope&lt;br /&gt;    global my_global_var&lt;br /&gt;    &lt;br /&gt;    ## changing global variable&lt;br /&gt;    my_global_var = val&lt;br /&gt;    print "After Change ", my_global_var&lt;br /&gt;&lt;br /&gt;## Tesing&lt;br /&gt;set_global(5)&lt;br /&gt;print "Finally ", my_global_var&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It will now display the 5 for both cases.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;After Change  5&lt;br /&gt;Finally  5&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6255169820509316026?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6255169820509316026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6255169820509316026&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6255169820509316026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6255169820509316026'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-global-variable-funda-and-real.html' title='Python: Global variable funda and a real mess'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7485910370440148182</id><published>2009-08-01T10:51:00.000-07:00</published><updated>2009-08-01T10:56:59.337-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Convert integer into string</title><content type='html'>Python is not like other script language. Its strongly against the variable types mismatch. For example at other scripting language, you can easily assign an integer into a string type of variable. Or concat them easily with concatination operators.&lt;br /&gt;&lt;br /&gt;But at python, you can not concat a string with an integer until you are making them both string. If you try to do that, you'll get an error like below.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;TypeError: cannot concatenate 'str' and 'int' objects&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You must need to convert your integer into string. If you are a new at Python, that will be difficult for you to find the simple str() function that will convert your integer to string. Here is a code which using str() function to do that.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;integer = 10&lt;br /&gt;string = "ten"&lt;br /&gt;output = string + str(integer)&lt;br /&gt;print output&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7485910370440148182?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7485910370440148182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7485910370440148182&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7485910370440148182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7485910370440148182'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-convert-integer-into-string.html' title='Python: Convert integer into string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-132077551325264590</id><published>2009-08-01T10:47:00.001-07:00</published><updated>2009-08-01T10:50:22.960-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: How to chomp a string</title><content type='html'>What is the equivalent function of chomp() or chop() at python to remove the newline from the end of any string?&lt;br /&gt;&lt;br /&gt;Here is a small piece of code. This will just remove the newline from the hello world string using strip() function.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;string = "hello world\n"&lt;br /&gt;string = string.strip() ## chomping or choping the new line&lt;br /&gt;print string&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To chomp, you can use regular expression too. Using \s you can do it easily. It will be something like that. Means replacing space with space. But at the end it will eat that new line.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;string = re.sub('\s', ' ', string)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-132077551325264590?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/132077551325264590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=132077551325264590&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/132077551325264590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/132077551325264590'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-how-to-chomp-string.html' title='Python: How to chomp a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5152225602524324938</id><published>2009-08-01T10:37:00.000-07:00</published><updated>2009-08-01T10:45:47.200-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python: Multidimensional array</title><content type='html'>In python, multiple dimensional array is slightly different. Its not like C/C++ or that kind of language. I'm giving you an example code regarding two dimensional array, and small explanation of it.&lt;br /&gt;&lt;br /&gt;Here is a way to declare a 5x5 array at python.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;array = [ [0 for col in range(5) ] for row in range(5)]&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will give you 5x5 2-d array. What does that code mean? Here,&lt;br /&gt;Initialize Value = 0&lt;br /&gt;for col in range(5) = create a linear or one dimensional array with 5 field and all are initialized with 0.&lt;br /&gt;&lt;br /&gt;Now change the initializing value,&lt;br /&gt;Initialize Value = [0 for col in range(5) ]&lt;br /&gt;for row in range(5) = on each five rows of your array will contain a copy of above array.&lt;br /&gt;&lt;br /&gt;So each row has pointing to another row. Which is nothing but a 2-d array.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5152225602524324938?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5152225602524324938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5152225602524324938&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5152225602524324938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5152225602524324938'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/08/python-multidimensional-array.html' title='Python: Multidimensional array'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6066422742173594002</id><published>2009-07-24T06:39:00.001-07:00</published><updated>2009-07-24T07:01:09.093-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Explanation of your regular expression</title><content type='html'>Perl CPAN has a module called "&lt;span style="font-weight:bold;"&gt;YAPE::Regex::Explain&lt;/span&gt;" which will help you to understand what is a perl regular expression doing.&lt;br /&gt;&lt;br /&gt;Lets say you have a Regex &lt;span style="font-weight:bold;"&gt;[Za-z0-9]+&lt;/span&gt; Here is the sample code if you want to get the explanation of your regex.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;use YAPE::Regex::Explain;&lt;br /&gt;print YAPE::Regex::Explain-&gt;new('[A-Za-z0-9]+')-&gt;explain;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This simple code will output as below on your screen, and which is easily understandable to get what is going on.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;The regular expression:&lt;br /&gt;&lt;br /&gt;(?-imsx:[A-Za-z0-9]+)&lt;br /&gt;&lt;br /&gt;matches as follows:&lt;br /&gt;  &lt;br /&gt;NODE                     EXPLANATION&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;(?-imsx:                 group, but do not capture (case-sensitive)&lt;br /&gt;                         (with ^ and $ matching normally) (with . not&lt;br /&gt;                         matching \n) (matching whitespace and #&lt;br /&gt;                         normally):&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  [A-Za-z0-9]+             any character of: 'A' to 'Z', 'a' to 'z',&lt;br /&gt;                           '0' to '9' (1 or more times (matching the&lt;br /&gt;                           most amount possible))&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;)                        end of grouping&lt;br /&gt;----------------------------------------------------------------------&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lets try with a bit complex regular expression &lt;span style="font-weight:bold;"&gt;ST[^;]*(?:[A-Za-z0-9]+|[\.,\s]+)ET&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The code for explaining for REGEX will be,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;use YAPE::Regex::Explain;&lt;br /&gt;print YAPE::Regex::Explain-&gt;new('ST[^;]*(?:[A-Za-z0-9]+|[\.,\s]+)ET')-&gt;explain;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Output is as below, and which is damn understandable.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;The regular expression:&lt;br /&gt;&lt;br /&gt;(?-imsx:ST[^;]*(?:[A-Za-z0-9]+|[\.,\s]+)ET)&lt;br /&gt;&lt;br /&gt;matches as follows:&lt;br /&gt;  &lt;br /&gt;NODE                     EXPLANATION&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;(?-imsx:                 group, but do not capture (case-sensitive)&lt;br /&gt;                         (with ^ and $ matching normally) (with . not&lt;br /&gt;                         matching \n) (matching whitespace and #&lt;br /&gt;                         normally):&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  ST                       'ST'&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  [^;]*                    any character except: ';' (0 or more times&lt;br /&gt;                           (matching the most amount possible))&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  (?:                      group, but do not capture:&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;    [A-Za-z0-9]+             any character of: 'A' to 'Z', 'a' to&lt;br /&gt;                             'z', '0' to '9' (1 or more times&lt;br /&gt;                             (matching the most amount possible))&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;   |                        OR&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;    [\.,\s]+                 any character of: '\.', ',', whitespace&lt;br /&gt;                             (\n, \r, \t, \f, and " ") (1 or more&lt;br /&gt;                             times (matching the most amount&lt;br /&gt;                             possible))&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  )                        end of grouping&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;  ET                       'ET'&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;)                        end of grouping&lt;br /&gt;----------------------------------------------------------------------&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Running the code from Command Line:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you don't like to write a code for this, you can do it from your command line. Just one liner perl script. For above expression the code will be as below.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;perl -MYAPE::Regex::Explain -e "print YAPE::Regex::Explain-&gt;new('ST[^;]*(?:[A-Za-z0-9]+|[\.,\s]+)ET')-&gt;explain;"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How to install the module:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To install the module from your command prompt,&lt;br /&gt;&lt;code&gt;ppm install YAPE::Regex::Explain&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And then type&lt;br /&gt;&lt;code&gt;ppm install YAPE::Regex&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This installation can be done using cpan too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6066422742173594002?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6066422742173594002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6066422742173594002&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6066422742173594002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6066422742173594002'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/07/perl-explanation-of-your-regular.html' title='Perl: Explanation of your regular expression'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2041948727959226338</id><published>2009-07-24T06:21:00.000-07:00</published><updated>2009-07-24T06:37:38.091-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>javascript: function replace and regular expression</title><content type='html'>Today I'm going to tell you how to handle the regex from the function replace() of javascript. It is more or less similar to other scripting language. But still I'm going to provide few sample code chunk with explanation, which may help you.&lt;br /&gt;&lt;br /&gt;Lets say that we have a str variable for our all example&lt;br /&gt;&lt;code&gt;&lt;pre&gt;// our experimental variable&lt;br /&gt;var str = '  [  EEUa testing  1278  &amp;lt;p&amp;gt; adsUYJJDsa  UIU &amp;lt;p&amp;gt; 123 asdasd ]  ';&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now you want to remove a certain word from it. It is a simple regular expression. For example removing the test from the string&lt;br /&gt;&lt;code&gt;str = str.replace(/test/, "");&lt;/code&gt;&lt;br /&gt;This will just remove the text &lt;span style="font-weight:bold;"&gt;test &lt;/span&gt;from the str, and will replace with empty. You can add g or i after the regex. g for global, means it will replace until all matches are found, and i for case insensitive.&lt;br /&gt;&lt;br /&gt;Now if you want to remove all p tags from your string, the regular expression will be simply as below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;// remove p tags&lt;br /&gt;str = str.replace(/&amp;lt;p&amp;gt;/gi, " ");&lt;br /&gt;document.write(str);&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now lets replace all the white spaces from the space, and replace with single space. The regular expression with code will be as below.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;// remove multiple spaces&lt;br /&gt;str = str.replace(/\s+/g, " ");&lt;br /&gt;document.write(str);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now lets trim our str variable. Means to remove the leading and trailing free spaces.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;// trim&lt;br /&gt;str = str.replace(/^\s+|\s+$/g, "");&lt;br /&gt;document.write(str);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Lets replace all the numbers from the string.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;// remove numbers&lt;br /&gt;str = str.replace(/\d+/g, "");&lt;br /&gt;document.write(str);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now, finally replace all the capital letters from the string.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;// remove all upper case&lt;br /&gt;str = str.replace(/[A-Z]+/g, "");&lt;br /&gt;document.write(str);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You have seen that I have used the i and g modifier of regular expression according to my need. I'll hope that these few code example will help you a bit to understand about the regular expression using from your javascript code.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Wolf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2041948727959226338?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2041948727959226338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2041948727959226338&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2041948727959226338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2041948727959226338'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/07/javascript-function-replace-and-regular.html' title='javascript: function replace and regular expression'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8567708477791172218</id><published>2009-07-10T23:38:00.000-07:00</published><updated>2009-07-10T23:47:25.195-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Http::Cookies not saving cookie correctly</title><content type='html'>The below code for saving the http cookie after requesting some data over http is not working!!! Did you face this kind of problem anyway?&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$cookie_jar-&gt;save()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For example the server sent you 4 cookies. But your cookie_jar is only saving the 2 of them, and rest of the two are ignored. Do you know the reason behind this?&lt;br /&gt;&lt;br /&gt;It's not a bug of http cookies of perl, or lwp. Just lack of knowing the issue. Initially I thought it was a bug. The rest of the two cookies are session cookie. And it will die when you'll close your browser( this case your LWP ). That's why Http::Cookies is not saving the cookie on your file. Here is what it was said on the docs of HTTP::Cookies,&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$cookie_jar-&gt;save&lt;br /&gt;$cookie_jar-&gt;save( $file )&lt;br /&gt;&lt;br /&gt;    This method file saves the state of the $cookie_jar to a file. The state can then be restored later using the load() method. If a filename is not specified we will use the name specified during construction. If the attribute ignore_discard is set, then we will even save cookies that are marked to be discarded.&lt;br /&gt;&lt;br /&gt;    The default is to save a sequence of "Set-Cookie3" lines. "Set-Cookie3" is a proprietary LWP format, not known to be compatible with any browser. The HTTP::Cookies::Netscape sub-class can be used to save in a format compatible with Netscape.&lt;/blockquote&gt; &lt;a href="http://kobesearch.cpan.org/htdocs/libwww-perl/HTTP/Cookies.html#cookie_jar_gt_save" target="_blank"&gt;HTTP::Cookies&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So, this means you have to notify the cookie_jar to save your session cookie too. To do this you have to do as below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;$cookie_jar = HTTP::Cookies-&gt;new(&lt;br /&gt;    file =&gt; "cookie.txt",&lt;br /&gt;    ignore_discard =&gt; 1,&lt;br /&gt;  );&lt;br /&gt;  &lt;br /&gt;$cookie_jar = HTTP::Cookies-&gt;new(&lt;br /&gt;    ignore_discard =&gt; 1,&lt;br /&gt;  );&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8567708477791172218?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8567708477791172218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8567708477791172218&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8567708477791172218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8567708477791172218'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/07/perl-httpcookies-not-saving-cookie.html' title='Perl: Http::Cookies not saving cookie correctly'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2656836970352880780</id><published>2009-06-27T10:05:00.000-07:00</published><updated>2009-06-27T10:08:16.695-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: Left padding an integer using sprintf</title><content type='html'>Using the function &lt;span style="font-weight:bold;"&gt;sprintf()&lt;/span&gt; of Perl, you can easily left pad any given integer number easily. The &lt;span style="font-weight:bold;"&gt;sprintf()&lt;/span&gt; function is similar to use like other programming languages. I'm giving an example of showing a given integer number with 5 field, where left sides will filled with zeros if any.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;my $integer = 10;&lt;br /&gt;$integer = sprintf("%05d", $integer);&lt;br /&gt;print "$integer\n";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Just a simple left padding.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2656836970352880780?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2656836970352880780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2656836970352880780&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2656836970352880780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2656836970352880780'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/perl-left-padding-integer-using-sprintf.html' title='Perl: Left padding an integer using sprintf'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7123805839243091183</id><published>2009-06-22T11:04:00.000-07:00</published><updated>2009-06-22T11:24:50.312-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>How to write a money making article</title><content type='html'>Everyone is writing to blog for money. And targeting Google Adsense to generate revenue for their blogs. But it is not always easy to select a right topic for your new article. Its really hard for you to know whether your new article will be a booming or not. That's why article selection is more important. I'm going to give a tips to you.&lt;br /&gt;&lt;br /&gt;I'm assuming that you have already google adsense and google analytics are installed on your blog. Now from your adsense account, just relate both of the account. Its just one click task. Or if you already have both the accounts are related, then its fine. Just follow the next.&lt;br /&gt;&lt;br /&gt;Give some days to analytics to collect some data(for new, other don't need that). After that, click on &lt;span style="font-weight:bold;"&gt;Content&lt;/span&gt; from the left menu from your Analytics account.&lt;br /&gt;&lt;br /&gt;Select &lt;span style="font-weight:bold;"&gt;Adsense&lt;/span&gt; from the below of Content. After selecting this, it will look like the below image.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jGEuU1zFjq8/Sj_KUIyWgaI/AAAAAAAACRo/iSpf4JI_s64/s1600-h/analytics%2Bleft%2Bmenu.JPG" target="_blank"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 133px; height: 320px;" src="http://4.bp.blogspot.com/_jGEuU1zFjq8/Sj_KUIyWgaI/AAAAAAAACRo/iSpf4JI_s64/s320/analytics%2Bleft%2Bmenu.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5350217329644306850" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now scroll down to bottom of the page, and you'll find top 5 links from your blogs which generated the highest number of money through adsense. For my case, the screen shot from my account looks like below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jGEuU1zFjq8/Sj_K2ibPEnI/AAAAAAAACRw/xsLnuBk9H7I/s1600-h/analytics%2Btop%2Bfive.JPG"  target="_blank"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 224px;" src="http://3.bp.blogspot.com/_jGEuU1zFjq8/Sj_K2ibPEnI/AAAAAAAACRw/xsLnuBk9H7I/s320/analytics%2Btop%2Bfive.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5350217920642224754" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can see that its showing the top five revenue generated links for my blog for last 30 days. Based on your analytic data, you can get an idea about what kind of article are more useful for adsense. You can spend more time on those kind of article's topics to make a new article your blog.&lt;br /&gt;&lt;br /&gt;Since the topics are already time tested, you can easily depend or trust on them. But don't forget to check the top revenue generated articles frequently. Following this simple tip will help you to write a new article which will boom your adsense revenue.&lt;br /&gt;&lt;br /&gt;Let me know if this tip help you. You can put suggestion or critics on this tip. I accept all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7123805839243091183?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7123805839243091183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7123805839243091183&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7123805839243091183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7123805839243091183'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/how-to-write-money-making-article.html' title='How to write a money making article'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_jGEuU1zFjq8/Sj_KUIyWgaI/AAAAAAAACRo/iSpf4JI_s64/s72-c/analytics%2Bleft%2Bmenu.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4403545569074352394</id><published>2009-06-21T08:37:00.000-07:00</published><updated>2009-06-21T08:40:33.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Are there too many Spammers at youtube</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Too many Spammers at youtube&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Youtube is a big place for people. Lots of peoples browse the site. And its a great place for online marketers. You'll find lots of spammers on youtube who will send you friend request, or send private message. They can write a comment on your video or at your profile page. They used to share you videos frequently. But all the things are done automatically. People are using Bot to perform those tasks.&lt;br /&gt;&lt;br /&gt;There are few sites which are selling those kinds of bots. If you search at google, you'll find them easily. But the competitor(are they really?) of youtube are way behind in terms of popularity. But this is helping those tiny bulls to become a big giant. People are showing interest to switch those sites as those are cool place to breath. No bugging issue. More ever, all sites are now days trying to provide maximum support to you.&lt;br /&gt;&lt;br /&gt;If you browse any video site, you'll not find anything to say that the site is better to that one in terms of video streaming or anything. You can't say that this site is slow, and that site is faster while playing a video. Everyone is using latest technique, and tools. All try to provide the end user the same taste. So if any user moves from Youtube to another one, it will be a loss for them, and I can bet you there will be little chance for those user to come back youtube.&lt;br /&gt;&lt;br /&gt;Finally my summary is "&lt;span style="font-style:italic;"&gt;Youtube may lose few amount of users due to noisy spammers&lt;/span&gt;".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4403545569074352394?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4403545569074352394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4403545569074352394&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4403545569074352394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4403545569074352394'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/are-there-too-many-spammers-at-youtube.html' title='Are there too many Spammers at youtube'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1595114868877702306</id><published>2009-06-21T08:34:00.000-07:00</published><updated>2009-06-21T08:37:46.543-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Youtube Video Infringement Issue</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Youtube Video Infringement Issue&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I bet there no site on earth who can say that we don't have any infringement content(otherwise official, for example mtv, espn, national geography, etc). But everyone is pointed to youtube for the infringement issue as Youtube is the only Giant from video sharing community. That's why when any newly released video is uploaded to youtube, youtube itself takes steps to take down the video ASAP. So you'll not find that kind of video on youtube.&lt;br /&gt;&lt;br /&gt;I know watching or sharing copyrighted content at any video sharing site is illegal and crime. But all people are not like me. They will search for a newly released video on internet. As other sites are not used to take down video as frequently Youtube does, and people find those videos on Youtube's competitor's sites. Which is in a sense bad for youtube. I can give you tons of example about copyrighted videos which are erased from youtube, but exists at other sites.&lt;br /&gt;&lt;br /&gt;This is in a sense good for youtube as they are keeping clean, but Bad in other sense that they might lose some user. No one will interested lose client to competitors at market, but youtube is forced to do that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1595114868877702306?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1595114868877702306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1595114868877702306&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1595114868877702306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1595114868877702306'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/youtube-video-infringement-issue.html' title='Youtube Video Infringement Issue'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7863646533906374439</id><published>2009-06-21T07:53:00.000-07:00</published><updated>2009-06-21T08:33:59.181-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>High-Quality video viewing Experience</title><content type='html'>&lt;span style="font-weight:bold;"&gt;High-Quality video viewing Experience comparison With youtube&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Youtube started to display high quality/definition videos as an option. But the case is not always true for all uploaded video. If you are searching for any video at youtube, you might not get it on high quality. But there are lots of sites who are sharing video, and all are uploaded with enormously high definition. They are not allowing to user to upload lower quality video. &lt;a href="http://stagevu.com/" target="_blank"&gt;StageVU&lt;/a&gt; is one of them.&lt;br /&gt;&lt;br /&gt;But there are also more sites which are having more high quality video compare to youtube(if you consider % quality video from total uploaded video). &lt;a href="http://www.vimeo.com" target="_blank"&gt;Vimeo&lt;/a&gt;, &lt;a href="http://veoh.com/" target="_blank"&gt;VEOH&lt;/a&gt;, &lt;a href="http://www.revver.com" target="_blank"&gt;Revver&lt;/a&gt; are the example of such sites. I don't know why people used to upload quality video there. But this tendency from people might cause a problem for youtube in future.&lt;br /&gt;&lt;br /&gt;But the current video which are enabled with high quality, are awesome. I just love them to watch. I already filled my hard disk by downloading those videos.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7863646533906374439?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7863646533906374439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7863646533906374439&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7863646533906374439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7863646533906374439'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/high-quality-video-viewing-experience.html' title='High-Quality video viewing Experience'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-9107794203815219205</id><published>2009-06-20T06:45:00.000-07:00</published><updated>2009-06-20T06:57:47.263-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Pidgin Login issue with yahoo</title><content type='html'>For last two days the popular chat client Pidgin failed to connect yahoo server. But it is still can connect with MSN and other servers. I used to use both Linux and Windows, and from my both OS, non of the pidgin version is not working. At linux its 2.5.2 and at windows its 2.5.5.&lt;br /&gt;&lt;br /&gt;Anyway I got a solution to day about how to fix the issue. I'm going to tell you solution for both windows and linux.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Linux:&lt;/span&gt;&lt;br /&gt;Just add &lt;span style="font-weight:bold;"&gt;66.163.181.170 scs.msg.yahoo.com&lt;/span&gt; inside your &lt;span style="font-weight:bold;"&gt;/etc/host&lt;/span&gt; file. It will work like a charm.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Windows:&lt;/span&gt;&lt;br /&gt;Just open the file &lt;span style="font-weight:bold;"&gt;c:/WINDOWS/System32/drivers/etc/hosts&lt;/span&gt; and add the line &lt;span style="font-weight:bold;"&gt;66.163.181.170 scs.msg.yahoo.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Or if you don't wanna change the host file, just modify your account, and from advance tab, change the &lt;span style="font-weight:bold;"&gt;pager server&lt;/span&gt; as &lt;span style="font-weight:bold;"&gt;66.163.181.170&lt;/span&gt; or &lt;span style="font-weight:bold;"&gt;cs101.msg.mud.yahoo.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope your problem is solved, and you can now enjoy your Pidgin messenger once again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-9107794203815219205?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/9107794203815219205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=9107794203815219205&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9107794203815219205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/9107794203815219205'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/pidgin-login-issue-with-yahoo.html' title='Pidgin Login issue with yahoo'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2805551777513916392</id><published>2009-06-18T12:00:00.000-07:00</published><updated>2009-06-18T12:06:32.226-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl: how to get position of a certain character in a string</title><content type='html'>There is a function called &lt;span style="font-weight:bold;"&gt;strpos()&lt;/span&gt; at php for this, and if you are looking for the similar function support at perl, then you have &lt;span style="font-weight:bold;"&gt;index()&lt;/span&gt; at Perl.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight:bold;"&gt;index()&lt;/span&gt; function takes string and search string as parameter. Here is the example code.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;$string = "tester of the world";&lt;br /&gt;$search_string = "r";&lt;br /&gt;print index($string, $search_string);&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will output 5, as 5 is the first occurrence or search string from the provided string. You can use character, or string as search. And remember the index starts from 0. At above example r is at the 5th index.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2805551777513916392?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2805551777513916392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2805551777513916392&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2805551777513916392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2805551777513916392'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/perl-how-to-get-position-of-certain.html' title='Perl: how to get position of a certain character in a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-5477234063106212055</id><published>2009-06-18T09:39:00.000-07:00</published><updated>2009-06-18T09:43:06.475-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Hard drive usage status from linux</title><content type='html'>How to get the hard disk usage status from linux OS?&lt;br /&gt;&lt;br /&gt;Simple command &lt;b&gt;df -h&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Output will be&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Filesystem            Size  Used Avail Use% Mounted on&lt;br /&gt;simfs                 4.0G  1.4G  2.7G  34% /&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;here -h for human readable format. Otherwise only df command with -h for disk space will display in below format&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Filesystem           1K-blocks      Used Available Use% Mounted on&lt;br /&gt;simfs                  4194304   1422100   2772204  34% /&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-5477234063106212055?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/5477234063106212055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=5477234063106212055&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5477234063106212055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/5477234063106212055'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/hard-drive-usage-status-from-linux.html' title='Hard drive usage status from linux'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-1515830573740481744</id><published>2009-06-18T08:39:00.001-07:00</published><updated>2009-06-18T08:43:49.216-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: Get the host name of a given domain</title><content type='html'>I didn't know that there is an easy function called &lt;span style="font-weight:bold;"&gt;gethostbyname&lt;/span&gt;() exist at PHP. I used to do ping from my php script, and obtained host IP address when I needed that before.&lt;br /&gt;&lt;br /&gt;But I got the easiest way now. Its just a single line function call with the domain name to get the server IP address. Here is the example that will find the IP address of the domain hosted.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;echo gethostbyname("zit7.com"); &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This example code will print &lt;span style="font-weight:bold;"&gt;82.98.86.165&lt;/span&gt; or something like that on screen for &lt;a href="http://zit7.com" target="_blank"&gt;zit7.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-1515830573740481744?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/1515830573740481744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=1515830573740481744&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1515830573740481744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/1515830573740481744'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/php-get-host-name-of-given-domain.html' title='PHP: Get the host name of a given domain'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2493893288217098429</id><published>2009-06-18T08:24:00.000-07:00</published><updated>2009-06-18T08:37:14.277-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Pidgin crashes while starting</title><content type='html'>I'm using CentOS 5.1, and just wanted to update my pidgin using "&lt;span style="font-weight:bold;"&gt;yum update pidgin&lt;/span&gt;", its updated something, but after that my pidgin used to crash. And giving me the error "&lt;span style="font-weight:bold;"&gt;pidgin:undefined symbol:gst_registry_fork_set_enabled&lt;/span&gt;" when I ran from command line.&lt;br /&gt;&lt;br /&gt;I have removed/erased the pidgin using "&lt;span style="font-weight:bold;"&gt;yum remove pidgin&lt;/span&gt;" and "&lt;span style="font-weight:bold;"&gt;yum erase pidgin&lt;/span&gt;", and installed again using "&lt;span style="font-weight:bold;"&gt;yum install pidgin&lt;/span&gt;" but not working. Same undefined ... error once again.&lt;br /&gt;&lt;br /&gt;I just didn't know what was going on. But finally got rescued fortunately. From a blog I found that yum will display a message something like below&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Dependencies Resolved&lt;br /&gt;&lt;br /&gt;=============================================&lt;br /&gt; Package      Arch    Version      Repository&lt;br /&gt;=============================================&lt;br /&gt;Installing:&lt;br /&gt; pidgin       x86_64  2.5.2-6.el5  &lt;span style="font-weight:bold;"&gt;base&lt;/span&gt;      &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But instead of base, my pidgin was showing me updates on the script. I mean as below&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Dependencies Resolved&lt;br /&gt;&lt;br /&gt;=============================================&lt;br /&gt; Package      Arch    Version      Repository&lt;br /&gt;=============================================&lt;br /&gt;Installing:&lt;br /&gt; pidgin       x86_64  2.5.5-6.el5  &lt;span style="font-weight:bold;"&gt;updates&lt;/span&gt;  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I have just disabled the updates for installing, and worked for me. Below is what I used to install pidgin with disabling updates Repository.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;yum install --disablerepo=updates pidgin&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This command just took the version 2.5.2-6.el5 from base repository instead of picking 2.5.5-6.el5 from updates repository.&lt;br /&gt;&lt;br /&gt;I'm now happy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2493893288217098429?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2493893288217098429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2493893288217098429&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2493893288217098429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2493893288217098429'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/pidgin-crashes-while-starting.html' title='Pidgin crashes while starting'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4558784450273239094</id><published>2009-06-17T10:13:00.000-07:00</published><updated>2009-06-17T10:16:58.706-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>how can i invite someone to subscribe to my blogspot blog</title><content type='html'>The only way you can invite anyone to subscribe to your blog using feedburner email subscription option. Just put the email address of the user there, and he/she will be notified at their inbox. If they like, they will confirm by clicking the link.&lt;br /&gt;&lt;br /&gt;Note: &lt;span style="font-weight:bold;"&gt;This kind of activities are called spamming&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4558784450273239094?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4558784450273239094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4558784450273239094&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4558784450273239094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4558784450273239094'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/how-can-i-invite-someone-to-subscribe.html' title='how can i invite someone to subscribe to my blogspot blog'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7133983704791515263</id><published>2009-06-17T10:08:00.000-07:00</published><updated>2009-06-17T10:13:11.365-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>does facebook views count as a view on youtube</title><content type='html'>The answer of the above question is &lt;span style="font-weight:bold;"&gt;YES&lt;/span&gt;. One of my youtube related post, i have mentioned that embedded view count for any youtube video count as viewed. Facebook also loads the youtube video using embed code when you click the pay button from facebook.&lt;br /&gt;&lt;br /&gt;Also facebook takes you to youtube page directly with I frame or java script i think when you click the youtube video link, where you can see your facebook bar at the top of the page, and rest of the thing is youtube video view page. Which means you are browsing the youtube page from facebook.&lt;br /&gt;&lt;br /&gt;So you are confirmed now that viewing a video from facebook count as video viewed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7133983704791515263?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7133983704791515263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7133983704791515263&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7133983704791515263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7133983704791515263'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/does-facebook-views-count-as-view-on.html' title='does facebook views count as a view on youtube'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-681672496131145647</id><published>2009-06-14T04:37:00.000-07:00</published><updated>2009-06-14T04:48:33.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='site review'/><title type='text'>Attention to the European Domain buyers.</title><content type='html'>If you are an European domain buyer, or you are planning to launch your product at European market, then there is a lucrative news for you. The domain name &lt;a href="http://www.10th.eu/" target="_blank"&gt;10th.eu&lt;/a&gt; may suit for your purpose.&lt;br /&gt;&lt;br /&gt;You can use &lt;a href="http://www.10th.eu/" target="_blank"&gt;10th.eu&lt;/a&gt; for your Traveling site hosting, or a online European shopping. Also you can use the domain name &lt;a href="http://www.10th.eu/" target="_blank"&gt;10th.eu&lt;/a&gt; for your company website name. Which will mean that you are the top 10 organization or company from European territory.&lt;br /&gt;&lt;br /&gt;The name &lt;a href="http://www.10th.eu/" target="_blank"&gt;10th.eu&lt;/a&gt; is such a generic name, that you can fit any business under the domain name. I'm not telling you that you need to be an European, an US business party can obtain the domain if they are interested.&lt;br /&gt;&lt;br /&gt;Any way, The domain &lt;a href="http://www.10th.eu/" target="_blank"&gt;10th.eu&lt;/a&gt; is under sell at &lt;a href="http://sedo.com" target="_blank"&gt;sedo.com&lt;/a&gt; and owener is &lt;a href="http://www.ccvid.com/" target="_blank"&gt;ccvid.com&lt;/a&gt;. You can go for it.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf&lt;br /&gt;&lt;br /&gt;Note: Do you want to post your article related to your website or domain name? Just let me know. Will provide you an email address for that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-681672496131145647?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/681672496131145647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=681672496131145647&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/681672496131145647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/681672496131145647'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/attention-to-european-domain-buyers.html' title='Attention to the European Domain buyers.'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-2584058726514828025</id><published>2009-06-11T07:07:00.000-07:00</published><updated>2009-06-11T07:24:40.598-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='site review'/><title type='text'>Spamming Mail send by Zorpia</title><content type='html'>It seemed to me that &lt;a href="http://www.zorpia.com" target="_blank" rel="nofollow"&gt;Zorpia.com&lt;/a&gt; could be an exciting social networking site. But I found a really shocking, and terrible spamming experience from that fucking site.&lt;br /&gt;&lt;br /&gt;I had an account at that site. Just invited my friends using contact importer under the condition "&lt;span style="font-weight:bold;"&gt;do not store passwords nor send spam messages&lt;/span&gt;". But you know. They lied to me, and all other users too. Since then, they just keep sending invitation to my contact list on behalf of me. But I was not sending, or asking zorpia to spam.&lt;br /&gt;&lt;br /&gt;I have got lots of msgs from my friends to stop this. But you know I wasn't doing that. So i better terminate my account. But still I'm having same problem, do you know why? Few of my friends did same as me, and zorpia now sending spam mail to me with a certain interval. Its really irritating.&lt;br /&gt;&lt;br /&gt;The site is sucks. Not trusty, and violated the terms and condition as they are promised. You can't be a giant service provider like facebook or myspace with such kind of lower level mind set. have to be big hearted zorpia. You are really a sucker. I appreciate Wikipidea that they didn't listed you so called zorpia.com. You'll never get listed as you are a shitty rat.&lt;br /&gt;&lt;br /&gt;So readers, if you have a zorpia account just terminate that, and better chose facebook or myspace. They are trustworthy. If you don't believe me, just do what I did, and you'll find everything.&lt;br /&gt;&lt;br /&gt;So friends keep yourself away from zorpia, a sucking social networking site.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-2584058726514828025?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/2584058726514828025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=2584058726514828025&amp;isPopup=true' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2584058726514828025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/2584058726514828025'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/spamming-mail-send-by-zorpia.html' title='Spamming Mail send by Zorpia'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4485745380643021943</id><published>2009-06-10T09:38:00.000-07:00</published><updated>2009-06-10T09:42:36.479-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>can I sell my blogspot blog?</title><content type='html'>Suppose I have a blog under blogspot dot com. And is it possible to sell or buy another blog name with content? Or I google will handle this issue strictly?&lt;br /&gt;&lt;br /&gt;Just wondering what it would be. Also what about the other blogs publishers, I meant the wordpress and others?&lt;br /&gt;&lt;br /&gt;So far I didn't hear about selling or buying blog before. I don't have any intention to buy a new blog or sell my one. My blog is my hard work.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4485745380643021943?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4485745380643021943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4485745380643021943&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4485745380643021943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4485745380643021943'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/can-i-sell-my-blogspot-blog.html' title='can I sell my blogspot blog?'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-854966976337995798</id><published>2009-06-09T10:59:00.000-07:00</published><updated>2009-06-09T11:05:34.410-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl Number formating using Regexp</title><content type='html'>Using a single regex you can easily convert a number like 1234567890 into 1,234,567,890. I don't what this call, that's why I was put the title is number formatting. Here goes the regular expression with example.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;my $number = 1234567890;&lt;br /&gt;$number =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g;&lt;br /&gt;print $number;&lt;br /&gt;&lt;br /&gt;Output : 1,234,567,890&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above regex just takes the digits from last, or three digits just before the comma, and if another extra digit exist without those three, it just push a comma inside. This will make one digit goes to left side, and other three digits goes to right side.&lt;br /&gt;&lt;br /&gt;Just a simple regexp made your life easier to do such kind of conversion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-854966976337995798?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/854966976337995798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=854966976337995798&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/854966976337995798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/854966976337995798'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/perl-number-formating-using-regexp.html' title='Perl Number formating using Regexp'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-4690319146332389170</id><published>2009-06-08T09:10:00.000-07:00</published><updated>2009-06-08T09:22:21.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='myspace'/><title type='text'>How to watch Myspace private video?</title><content type='html'>Hey guys. Are you interested to watch any private video of your buddy from Myspace?? Its easy to watch such kind of video as long as you have the myspace video url on your hand.&lt;br /&gt;&lt;br /&gt;For example you have a myspace private video as below.&lt;br /&gt;http://vids.myspace.com/index.cfm?fuseaction=vids.individual&amp;&lt;span style="font-weight:bold;"&gt;videoid=xxxxxxxx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just copy the videoid from your myspace private video link. And paste the video id at url like below.&lt;br /&gt;http://mediaservices.myspace.com/services/rss.ashx?type=video&amp;&lt;span style="font-weight:bold;"&gt;mediaID=xxxxxxxx&lt;/span&gt; &lt;-- replace xxxxxxxx with your private video id.&lt;br /&gt;&lt;br /&gt;Now browse the link at your browser, and view the source code(view -&gt; source, or right click on page, click view source). From the source code of the xml page, you'll find something like below.&lt;br /&gt;&lt;br /&gt;&amp;lt;media:content url="&lt;span style="font-weight:bold;"&gt;http://cache01-videos02.myspacecdn.com/73/vid_bd75c8abc87adbf56d6b49d908a87df5.flv&lt;/span&gt;" type="video/x-flv" medium="video" duration="219" /&amp;gt;&lt;br /&gt;&lt;br /&gt;Here the bold portion like above from the source code will be the flv download link for your very desired private video from myspace.com&lt;br /&gt;&lt;br /&gt;Enjoy watching!!! until myspace block that ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-4690319146332389170?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/4690319146332389170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=4690319146332389170&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4690319146332389170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/4690319146332389170'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/how-to-watch-myspace-private-video.html' title='How to watch Myspace private video?'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-871044843257961710</id><published>2009-06-06T23:22:00.000-07:00</published><updated>2009-06-06T23:27:56.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Does embedded youtube videos count as a view</title><content type='html'>Does embedded YouTube videos count as a view?&lt;br /&gt;&lt;br /&gt;The answer is yes. If you Embed your video at different website or blog, and if any user watch the video from that blog/website, youtube will count the video as viewed.&lt;br /&gt;&lt;br /&gt;Remember, view will not count if the user just only browse the page. The user needs to click the play from embed player. You can do a trick here. Make the embed code as auto play. So that whenever the user will load the page, the video will be played automatically, and you'll be granted a view count.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Wolf.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-871044843257961710?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/871044843257961710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=871044843257961710&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/871044843257961710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/871044843257961710'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/does-embedded-youtube-videos-count-as.html' title='Does embedded youtube videos count as a view'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-7345900966388574322</id><published>2009-06-01T06:41:00.000-07:00</published><updated>2009-06-01T06:47:39.129-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Linux: How to Kill a process forcefully</title><content type='html'>Facing problem to kill a problem at your linux box? The process is not killing although you are typing killall xxx or kill xxx???&lt;br /&gt;&lt;br /&gt;Here is a way to kill your process forcefully from Linux. Just use -9 as option with kill. And this will not be blocked while killing. According to Linux MAN page, -9 = "this signal may not be blocked"&lt;br /&gt;&lt;br /&gt;For example you need to kill process 1234, so just type as below&lt;br /&gt;&lt;br /&gt;&lt;code&gt;kill -9 1234&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will kill the process with a charm. The pain is gone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-7345900966388574322?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/7345900966388574322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=7345900966388574322&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7345900966388574322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/7345900966388574322'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/06/linux-how-to-kill-process-forcefully.html' title='Linux: How to Kill a process forcefully'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-6833077206103052072</id><published>2009-05-31T09:24:00.000-07:00</published><updated>2009-05-31T09:33:13.407-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Remove the words having special characters from a string</title><content type='html'>Lets learn how to remove the words from a string which contains the special characters. I mean the word having non-English characters. Consider the below example.&lt;br /&gt;&lt;code&gt;asdasd óadsa, xxxÂr 123, asda koskso øppp iø1 asdakjd*ads8&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can see several words from the above contains special/non-english character on them. I'll write a regex that will remove those kind of words from the sentence above.&lt;br /&gt;&lt;br /&gt;A PHP code:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;$string = "asdasd óadsa, xxxÂr 123, asda koskso øppp iø1 asdakjd*ads8";&lt;br /&gt;$string = preg_replace('/\S*[^a-z0-9A-Z\s,\.]+\S*/', '', $string);&lt;br /&gt;print "$string\n";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Output: asdasd   123, asda koskso   &lt;br /&gt;&lt;br /&gt;A Perl code:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;$string = "asdasd óadsa, xxxÂr 123, asda koskso øppp iø1 asdakjd*ads8";&lt;br /&gt;$string =~ s/\S*[^a-z0-9A-Z\s,\.]+\S*//g;&lt;br /&gt;print "$string\n";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Output: asdasd   123, asda koskso   &lt;br /&gt;&lt;br /&gt;You can use trim on the string, or replace multiple spaces with single one after that. Also you can add other characters like dot, comma inside the regex to distinguish the word.&lt;br /&gt;&lt;br /&gt;Cheers!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-6833077206103052072?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/6833077206103052072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=6833077206103052072&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6833077206103052072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/6833077206103052072'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/05/remove-words-having-special-characters.html' title='Remove the words having special characters from a string'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8722048993094113071.post-8700089727867794378</id><published>2009-05-31T08:20:00.000-07:00</published><updated>2009-05-31T08:22:37.462-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>Relation between Alexa ranking and Google PR</title><content type='html'>Are there any relation between Alexa ranking and Google page rank system. I mean while calculating the page rank of any site, does Google take the alexa ranking on count? or same thing for Alexa? I heard google and other search engine counts the links from DMOZ for pagerank caltulation.&lt;br /&gt;&lt;br /&gt;Does anyone have a clear idea???&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8722048993094113071-8700089727867794378?l=icfun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://icfun.blogspot.com/feeds/8700089727867794378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8722048993094113071&amp;postID=8700089727867794378&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8700089727867794378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8722048993094113071/posts/default/8700089727867794378'/><link rel='alternate' type='text/html' href='http://icfun.blogspot.com/2009/05/relation-between-alexa-ranking-and.html' title='Relation between Alexa ranking and Google PR'/><author><name>Demon</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
