<?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-3589632861084571714</id><updated>2012-02-16T00:42:45.848-08:00</updated><category term='linux'/><category term='C++'/><category term='contest'/><category term='hello world'/><category term='challenge'/><category term='java'/><category term='python'/><category term='jcreator'/><category term='programming'/><category term='coding'/><category term='tutorial'/><category term='eclipse'/><category term='screenshot'/><category term='code'/><category term='BufferedImage'/><category term='ImageIO'/><category term='ide'/><category term='question'/><category term='netbeans'/><title type='text'>Code on Blog</title><subtitle type='html'>Code-on-Blog  has the simple task to teach you some stuff about programming.You will learn about programming languages such as Java, C++, Python and others.Learn some Linux tips and tricks in order to take advantage of its unique features! Hope this Code-on-Blog will help you !</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>BloodRain</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>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3589632861084571714.post-2815270216770060905</id><published>2008-02-08T01:22:00.000-08:00</published><updated>2008-02-08T01:30:47.000-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Linux Tip 4</title><content type='html'>This is a simple bash script that will shut down your computer.All you have to do is to open a text editor( such as gedit,vi,emacs or whatever your favorite is) write the code than save it as "theName.sh". Inside the file write "init 0" (for shutdown) or "init 6" (for reboot).Then place this in the /usr/bin/ directory. Now you can open a console window and call the "theName"(watch out for case) script.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-2815270216770060905?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/2815270216770060905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=2815270216770060905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/2815270216770060905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/2815270216770060905'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2008/02/linux-tip-4.html' title='Linux Tip 4'/><author><name>BloodRain</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-3589632861084571714.post-3986251428825876698</id><published>2008-01-15T14:23:00.000-08:00</published><updated>2008-01-15T14:38:52.098-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='BufferedImage'/><category scheme='http://www.blogger.com/atom/ns#' term='screenshot'/><category scheme='http://www.blogger.com/atom/ns#' term='ImageIO'/><title type='text'>Java screenshot</title><content type='html'>This is a simple class that takes a screenshot and saves the image as a jpeg file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;screenshot.java&lt;/span&gt; :&lt;br /&gt;&lt;br /&gt;import java.awt.AWTException;&lt;br /&gt;import java.awt.Rectangle;&lt;br /&gt;import java.awt.Robot;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;&lt;br /&gt;public class screenshot {&lt;br /&gt; int k;&lt;br /&gt;    public screenshot(){&lt;br /&gt;     k=0;&lt;br /&gt;    }&lt;br /&gt;    public void takeScreenShot() {&lt;br /&gt;        &lt;br /&gt;        try {&lt;br /&gt;            &lt;br /&gt;            Robot robot = new Robot();&lt;br /&gt;            BufferedImage bi=robot.createScreenCapture(new Rectangle(1024,768));&lt;br /&gt;            ImageIO.write(bi, "jpg", new File("E:\\PROJECTS\\Java Stuff\\My new Projects\\film\\imageTest"+k+".jpg"));&lt;br /&gt;            k++;&lt;br /&gt;        } catch (AWTException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;In the other class you first create an instance of the screenshot class like this :&lt;br /&gt;screenshot x=new screenshot();&lt;br /&gt;&lt;br /&gt;Then we call the function:&lt;br /&gt;x.takeScreenshot();&lt;br /&gt;&lt;br /&gt;and a picture is saved into the folder defined earlier.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is the code of the &lt;span style="font-weight:bold;"&gt;recording.java&lt;/span&gt; class.&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;public class recording implements Runnable {&lt;br /&gt;screenshot x=new screenshot();&lt;br /&gt;Thread th; &lt;br /&gt; public static void main(String args[])&lt;br /&gt;     {&lt;br /&gt;     new recording();  &lt;br /&gt;     }&lt;br /&gt;public recording()&lt;br /&gt;  {&lt;br /&gt;  th=null;&lt;br /&gt;  start();&lt;br /&gt;  } &lt;br /&gt;&lt;br /&gt;public void start()&lt;br /&gt; {&lt;br /&gt; if (th==null)&lt;br /&gt;  {&lt;br /&gt; th=new Thread(this);&lt;br /&gt; th.start(); &lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;public void run()&lt;br /&gt;   {&lt;br /&gt;   while(th!=null)&lt;br /&gt;     {&lt;br /&gt;      x.takeScreenShot();&lt;br /&gt;      try&lt;br /&gt;       {&lt;br /&gt;      Thread.sleep(1000);      &lt;br /&gt;       }&lt;br /&gt;      catch(InterruptedException e)&lt;br /&gt;       {&lt;br /&gt;       System.out.println(e); &lt;br /&gt;       }&lt;br /&gt;     } &lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;public void stop()&lt;br /&gt; {&lt;br /&gt; }              &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;This small java application takes a screenshot every second and saves it in your computer.If you want to capture all the action that takes place on your screen you can lower the 1000 miliseconds timeout.That will generate lots of images though :D  &lt;br /&gt;You can use this trick in many ways.You can spy on someone that chats on your pc ;), you can take screenshots of you playing some game and I will just let you think about others ... Hope you will find this useful !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-3986251428825876698?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/3986251428825876698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=3986251428825876698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/3986251428825876698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/3986251428825876698'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2008/01/java-screenshot.html' title='Java screenshot'/><author><name>BloodRain</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-3589632861084571714.post-8358644827575483070</id><published>2008-01-08T14:12:00.000-08:00</published><updated>2008-01-08T14:23:49.605-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Linux Tip 3</title><content type='html'>The &lt;span style="font-weight:bold;"&gt;find&lt;/span&gt; command is very useful in a unix environment when one needs to find a certain category of files.For example if you have to find all the files and folders that match a pattern you can use it like that :&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;find /ThePathToTheSearchedDirectory -name 'picture*' &lt;/span&gt;&lt;br /&gt;This way you can find all the files that start with 'picture'. You can find files like &lt;br /&gt;picture01.png , picture02.png, picture03.png ... and you can take further actions on them.&lt;br /&gt;The &lt;span style="font-weight:bold;"&gt;find&lt;/span&gt; command is far more complex than that.In order to learn more about a command use the man command :&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;man find&lt;br /&gt;man grep&lt;/span&gt;&lt;br /&gt;etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-8358644827575483070?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/8358644827575483070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=8358644827575483070' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/8358644827575483070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/8358644827575483070'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2008/01/linux-tip-3.html' title='Linux Tip 3'/><author><name>BloodRain</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-3589632861084571714.post-3028960250729828115</id><published>2008-01-08T10:00:00.000-08:00</published><updated>2008-01-08T10:08:12.492-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='contest'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>Java 4K Programming Contest</title><content type='html'>First of all : Happy new year !&lt;br /&gt;Java4k is a very funny contest . The best part is that you don't have to write 3 months to create a decent entry. You could create a nice game (that has to be under 4 kilobytes in size !!!) in a single night .All you have to do is to respect the rules and create a fun game.Even if you won't write a game you can just look at the other games an have tons of fun playing those small unique games.&lt;br /&gt; Here is the announcement :&lt;br /&gt;The Java 4K Programming Contest is the ultimate byte-squeezing Java challenge! Using only 4096 bytes, competitors use every trick up their sleeve to create an entire game.&lt;br /&gt;&lt;br /&gt;Submit your games here before March 1st, 2007!&lt;br /&gt;&lt;br /&gt;Contest Prizes&lt;br /&gt;* 6 months free playtime of Wurm Online, courtesy of Mojang Specifications!&lt;br /&gt;* Top 5 entries score a free copy of Tribal Trouble, courtesy of Oddlabs!&lt;br /&gt;&lt;br /&gt;Basic rules are as follows:&lt;br /&gt;* The final game package (byte code + resources) must be below or equal to 4096 bytes&lt;br /&gt;&lt;br /&gt;* Must be a playable game (cannot be a pointless animation)&lt;br /&gt;&lt;br /&gt;* Must be pure Java (no JNI)&lt;br /&gt;&lt;br /&gt;* Must be self-contained- no external resources (e.g. loading an image from a website)&lt;br /&gt;&lt;br /&gt;* No Pack200&lt;br /&gt;&lt;br /&gt;* No external libraries may be used - you must use the libraries that come with the “public” version of the JRE&lt;br /&gt;&lt;br /&gt;* No soundbanks may be used because they are not a default part of the “public” JRE. You will have to create your sounds at runtime rather than use MIDIs.&lt;br /&gt;&lt;br /&gt;* The presentation (jar, class, or other) does not matter, as long as the code can be executed without a command line&lt;br /&gt;&lt;br /&gt;* The target JRE is 1.5 (Java 5) or lower&lt;br /&gt;&lt;br /&gt;Specific questions and comments can be made at the official Java 4K forum.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java4k.com/"&gt;Official website&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Good luck ;) !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-3028960250729828115?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/3028960250729828115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=3028960250729828115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/3028960250729828115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/3028960250729828115'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2008/01/java-4k-programming-contest.html' title='Java 4K Programming Contest'/><author><name>BloodRain</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-3589632861084571714.post-8895508484338180439</id><published>2007-12-24T11:19:00.000-08:00</published><updated>2007-12-24T11:23:08.934-08:00</updated><title type='text'>Merry Christmas !</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_RKYTageDog8/R3AGxzN9WgI/AAAAAAAAADY/4cIsm8hIRMw/s1600-h/DukeTuxChristmas-small.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_RKYTageDog8/R3AGxzN9WgI/AAAAAAAAADY/4cIsm8hIRMw/s320/DukeTuxChristmas-small.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5147621826716588546" /&gt;&lt;/a&gt;&lt;br /&gt;Code-on-Blog wishes you a very merry Christmas !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-8895508484338180439?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/8895508484338180439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=8895508484338180439' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/8895508484338180439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/8895508484338180439'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/merry-christmas.html' title='Merry Christmas !'/><author><name>BloodRain</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/_RKYTageDog8/R3AGxzN9WgI/AAAAAAAAADY/4cIsm8hIRMw/s72-c/DukeTuxChristmas-small.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3589632861084571714.post-725645248757440223</id><published>2007-12-19T14:46:00.000-08:00</published><updated>2007-12-20T04:01:20.776-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='question'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>C++ challenge answer !</title><content type='html'>Remember the last C++ challenge question ? Here is the answer. It's C++ challenge not C :D.Wonder why ? Well all you have to do is to comment/delete the stdio.h inclusion.This makes the printf function an undeclared function, which you declare :D.The printing is done by using the cout function ;).&lt;br /&gt;  &lt;br /&gt;#include iostream.h&lt;br /&gt;//#include stdio.h&lt;br /&gt;void printf(char *c,int x)&lt;br /&gt; {&lt;br /&gt; cout&lt;&lt;"Nice trick, eh ? :)";&lt;br /&gt; }&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;int a=100,b=30;&lt;br /&gt;printf("%d",a+b);&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Doesn't sound that hard now,right ? :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-725645248757440223?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/725645248757440223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=725645248757440223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/725645248757440223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/725645248757440223'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/c-challange-answer.html' title='C++ challenge answer !'/><author><name>BloodRain</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-3589632861084571714.post-1965691596080548652</id><published>2007-12-17T13:16:00.000-08:00</published><updated>2007-12-17T13:28:36.265-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Linux Tip 2</title><content type='html'>One of the most used command in unix is cd , meaning "change directory".&lt;br /&gt;To change your directory to an absolute path you have to write this : cd /root/whatever . If you want to change to a relative path you have to execute something like this : cd ./dir3/dir5 . The added dot at the beginning represents the current directory, and the rest of the command represents the path relative to the current directory. You can also skip the "." part and just write cd dir3/dir5.But must not begin with "/" ! If you do so then it will be an absolute path ! To find out the current directory while in linux(or any other unix flavor) you can type : pwd (print working directory).&lt;br /&gt;&lt;br /&gt;This commands will help you navigate through your filesystem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-1965691596080548652?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/1965691596080548652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=1965691596080548652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/1965691596080548652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/1965691596080548652'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/linux-tip-2.html' title='Linux Tip 2'/><author><name>BloodRain</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-3589632861084571714.post-571501414503522680</id><published>2007-12-15T23:36:00.000-08:00</published><updated>2007-12-20T04:02:40.496-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='question'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>C++ challenge question</title><content type='html'>This question was given at some interviews. You have this code :&lt;br /&gt;#include stdio.h &lt;br /&gt;/*You have to put stdio.h between "&lt;" and "&gt;" , as I wasn't able to post that :)*/&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;int a=100,b=30;&lt;br /&gt;printf("%d",a+b);&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Without modifying the main function, can you make the program print "I am no longer unemployed :) " ? Good Luck ! Answer coming in 2 or 3 days :) .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-571501414503522680?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/571501414503522680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=571501414503522680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/571501414503522680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/571501414503522680'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/c-challange-question.html' title='C++ challenge question'/><author><name>BloodRain</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-3589632861084571714.post-7850869863840238417</id><published>2007-12-09T15:01:00.000-08:00</published><updated>2007-12-09T15:05:05.598-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Linux Tip</title><content type='html'>&lt;span style="font-size:100%;"&gt;I will post this kind of tips every few days. So.. How do you find out how much space do you have left on your disks when using linux ? You open a terminal window, and you execute the following command : &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);font-size:100%;" &gt;df&lt;/span&gt;&lt;span style="font-size:100%;"&gt; .&lt;/span&gt;&lt;span style="font-size:100%;"&gt; This will output the total space you have left on each mounted filesystem.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-7850869863840238417?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/7850869863840238417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=7850869863840238417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/7850869863840238417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/7850869863840238417'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/linux-tip.html' title='Linux Tip'/><author><name>BloodRain</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-3589632861084571714.post-1021886057148880050</id><published>2007-12-08T07:58:00.000-08:00</published><updated>2007-12-08T08:13:58.572-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ide'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hello world'/><category scheme='http://www.blogger.com/atom/ns#' term='jcreator'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>Hello World !</title><content type='html'>Here is the the classic "Hello World !" application that I've promised to you :). This one prints    "Hello World !" on your console. &lt;p&gt;     First download and install tha Java development Kit from   here : &lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;http://java.sun.com/javase/downloads/index.jsp&lt;/a&gt; &lt;/p&gt;&lt;p&gt;   Make sure you installed it right like this :Click Start-&gt;run&lt;/p&gt;&lt;p&gt;    Then write "cmd" and press enter. In the console window write "java -version" and press enter again. If you don't get an error then you made the first step :).&lt;/p&gt;&lt;p&gt;    Download and install an IDE(Integrated Development Environment) or simpler : "the program where you write the code".Here are some choices : &lt;/p&gt;&lt;p&gt;    Eclipse (big IDE written in java)-it's great but it's pretty big so you need a strong computer for it. Take it from here :&lt;a href="http://www.eclipse.org/"&gt;http://www.eclipse.org/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    Netbeans(big IDE written in java)-same as at Eclipse. You might have installed the JDK with bounded with this one. If not get it from here : &lt;a href="http://www.netbeans.org/"&gt;http://www.netbeans.org/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    JCreator(written in C++)-small and fast.It's a commercial software but you can install the free version of it. It's more than enough for beginning.Here it is : &lt;a href="http://jcreator.com/"&gt;http://jcreator.com/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    Now create a file called HelloWorld.java ,open it from the IDE and copy this code there :&lt;/p&gt;&lt;div style="background-color: rgb(255, 204, 102);" dir="ltr"&gt; &lt;pre class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style="color: rgb(51, 51, 255);" class="kw2"&gt;public&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);" class="kw2"&gt;class&lt;/span&gt; HelloWorld&lt;span class="br0"&gt;{&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span class="br0"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: rgb(51, 51, 255);" class="kw2"&gt;public&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);" class="kw2"&gt;  static&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);" class="kw4"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;main&lt;/span&gt;&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);" class="kw3"&gt;String&lt;/span&gt;&lt;span class="br0"&gt;[&lt;/span&gt;&lt;span class="br0"&gt;]&lt;/span&gt; args &lt;span class="br0"&gt;)&lt;/span&gt;&lt;span class="br0"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span class="kw3"&gt; &lt;span style="color: rgb(0, 0, 153);"&gt; System&lt;/span&gt;&lt;/span&gt;.&lt;span class="me1"&gt;out&lt;/span&gt;.&lt;span class="me1"&gt;println&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span style="color: rgb(153, 51, 153);" class="st0"&gt;"Hello world"&lt;/span&gt; &lt;span class="br0"&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span class="br0"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span class="br0"&gt;} &lt;/span&gt;&lt;/b&gt; &lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt; Save it. Now you might be able to compile and run it. If you are not  then  you might need to configure  your IDE or just use the command line mode of compiling.&lt;/p&gt;&lt;p&gt;Place your file in a directory (lets say c:\java\source\).&lt;/p&gt;&lt;p&gt;Open a command prompt (Start-&gt;run+"cmd" +Enter,remember ? :) )&lt;/p&gt;&lt;p&gt;Write :&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: rgb(255, 204, 102);"&gt;cd c:\java\source&lt;/span&gt;&lt;span style="background-color: rgb(102, 102, 102);"&gt;&lt;span style="background-color: rgb(255, 204, 102);"&gt;       &lt;enter&gt;&lt;/enter&gt;&lt;/span&gt;&lt;span style="background-color: rgb(192, 192, 192);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background-color: rgb(255, 204, 102);"&gt;"c:\Program Files\jdk1.6.0_03\bin\javac" HelloWorld.java &lt;enter&gt;&lt;/enter&gt;&lt;/p&gt;&lt;p&gt;You might need to change the your path ( c:\Program Files\jdk1.6.0_03\ ) to where the jdk is installed.&lt;br /&gt;Now you just compiled your first java program. All you have to do now is run it .In the same console window write :&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: rgb(255, 204, 102);"&gt;&lt;span style="font-size:100%;"&gt;java HelloWorld&lt;/span&gt; &lt;enter&gt;&lt;span style="background-color: rgb(255, 255, 255);"&gt;    &lt;/span&gt;&lt;/enter&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: rgb(255, 204, 102);"&gt;&lt;span style="background-color: rgb(255, 255, 255);"&gt;&lt;b&gt; (must be HelloWorld not HelloWorld.java)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This will output &lt;span style="background-color: rgb(255, 204, 102);"&gt;Hello World !&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Congratulations you just finished your first java program.&lt;/p&gt;&lt;p&gt;     Now try to change your source code then save,compile and run to see what happens.&lt;/p&gt;&lt;p&gt;Change this&lt;br /&gt;&lt;/p&gt;&lt;pre style="background-color: rgb(255, 204, 102); font-weight: bold;" class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 0, 153);" class="kw3"&gt;System&lt;/span&gt;.&lt;span class="me1"&gt;out&lt;/span&gt;.&lt;span class="me1"&gt;println&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span style="color: rgb(153, 51, 153);" class="st0"&gt;"Hello world"&lt;/span&gt; &lt;span class="br0"&gt;)&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt; to &lt;/p&gt;&lt;pre style="background-color: rgb(255, 204, 102);" class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style="color: rgb(0, 0, 153);" class="kw3"&gt;System&lt;/span&gt;.&lt;span class="me1"&gt;out&lt;/span&gt;.&lt;span class="me1"&gt;println&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span style="color: rgb(153, 51, 153);" class="st0"&gt;"The text changed :) "&lt;/span&gt; &lt;span class="br0"&gt;)&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt; run it. &lt;/p&gt;&lt;p&gt;Try this then. &lt;/p&gt;&lt;pre style="background-color: rgb(255, 204, 102);" class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style="color: rgb(0, 0, 153);" class="kw3"&gt;System&lt;/span&gt;.&lt;span class="me1"&gt;out&lt;/span&gt;.&lt;span class="me1"&gt;println&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span class="st0"&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;"Hello "&lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;"World !"&lt;/span&gt;&lt;/span&gt;&lt;span class="br0"&gt;)&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;Then change it to this &lt;/p&gt;&lt;pre style="background-color: rgb(255, 204, 51);" class="source-java"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style="color: rgb(0, 0, 153);" class="kw3"&gt;System&lt;/span&gt;.&lt;span class="me1"&gt;out&lt;/span&gt;.&lt;span class="me1"&gt;println&lt;/span&gt;&lt;span class="br0"&gt;(&lt;/span&gt; &lt;span class="st0"&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;"1+3="&lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;+&lt;/span&gt;(1&lt;span style="color: rgb(204, 0, 0);"&gt;+&lt;/span&gt;3)&lt;/span&gt; &lt;span class="br0"&gt;)&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt; That's all. Hope you enjoyed it !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-1021886057148880050?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/1021886057148880050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=1021886057148880050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/1021886057148880050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/1021886057148880050'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/hello-world.html' title='Hello World !'/><author><name>BloodRain</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-3589632861084571714.post-7141835820537398142</id><published>2007-12-07T09:43:00.000-08:00</published><updated>2008-01-08T14:11:54.065-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>The Java programming language</title><content type='html'>&lt;blockquote&gt;Write once, run everywhere !&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;Many know what java is . If you don't there's no need to panic. You will soon learn the concept of java.&lt;p&gt;&lt;b&gt;    Java&lt;/b&gt; is a &lt;span style="font-weight: bold;"&gt;programming language&lt;/span&gt; released in 1995 by &lt;span style="font-weight: bold;"&gt;Sun Microsystems&lt;/span&gt; . Most of it's syntax derives from &lt;span style="font-weight: bold;"&gt;C&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;C++&lt;/span&gt; &lt;span style="text-decoration: underline; font-weight: bold;"&gt;&lt;/span&gt;but is a higher level programming language.Higher level doesn't mean that it's better,it only means that it's used for things such as desktop,web applications , not for programming drivers or operating systems such as Windows and &lt;span style="font-weight: bold;"&gt;Linux&lt;/span&gt; . Java applications are compiled to bytecode which can run on any Java virtual machine (&lt;span style="font-weight: bold;"&gt;JVM&lt;/span&gt;) regardless of the operating system or computer architecture.&lt;/p&gt;&lt;p&gt;    &lt;b&gt;Java&lt;/b&gt; is not as fast as &lt;span style="font-weight: bold;"&gt;C++&lt;/span&gt;(because C++ is a compiled language) , but is not as slow as &lt;span style="font-weight: bold;"&gt;python&lt;/span&gt; (because python is an interpreted language) . The advantage of using it over faster languages is that it's syntax is very clear, it is an Object Oriented Programming (OOP) language, it's fast enough to be used in most cases, It's mostly &lt;b&gt;PORTABLE&lt;/b&gt; (big advantage in some cases) and because you won't have to deal with low level stuff, the time required to develop an application is greatly reduced. &lt;/p&gt;    I already said too much so the next post will teach you how to write a simple program in java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-7141835820537398142?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/7141835820537398142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=7141835820537398142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/7141835820537398142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/7141835820537398142'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/java-programming-language.html' title='The Java programming language'/><author><name>BloodRain</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-3589632861084571714.post-920423871743235189</id><published>2007-12-07T09:33:00.000-08:00</published><updated>2007-12-07T15:57:54.819-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>Welcome to Code-on-Blog</title><content type='html'>Hey there ! This is the first post on &lt;span style="font-weight: bold;"&gt;Code-on-Blog&lt;/span&gt; :D ! Obviously this site will be about &lt;span style="font-weight: bold;"&gt;coding&lt;/span&gt;(a.k.a. &lt;span style="font-weight: bold;"&gt;programming&lt;/span&gt;) in different languages. Some &lt;span style="font-weight: bold;"&gt;tuturials&lt;/span&gt; will come soon ;) . Enjoy them !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3589632861084571714-920423871743235189?l=code-on-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://code-on-blog.blogspot.com/feeds/920423871743235189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3589632861084571714&amp;postID=920423871743235189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/920423871743235189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3589632861084571714/posts/default/920423871743235189'/><link rel='alternate' type='text/html' href='http://code-on-blog.blogspot.com/2007/12/welcome-to-code-on-blog.html' title='Welcome to Code-on-Blog'/><author><name>BloodRain</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>
