Friday, August 3, 2012

Edit name of label in blogger


When I started writing this blog, I wanted to create a label called ‘Java’ but typed ‘java’ by mistake. I could not change the first letter to capitals at the label section. Follow the below to change Label names. There is no direct way to manage/edit labels.

  • Login into your blogger account
  • Click on posts, and select the posts for which you want to change the label.

  • Click on ‘Label Selected posts’ on the top and click the on the label which you want to change/delete and say 'ok'

 You would get a message ‘Label java has been removed from the selected posts’
  • With the posts still selected, Click on New Label

  • Add the new Label.


7Here are the new changes

Disable Right Click on Blogger blogs


Paste the below code to disable right click anywhere in your blog.
  • Login into your blogger account
  • Goto Layout -->Add a Gadget [ You could add the gadget anywhere ]
  • Select HTML/JavaScript.
  • Add title for the script as ‘Right Click Disabled’ and paste the below code.

<script language=javascript>
<!--

function clickonNetScapeVer4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
}
}
}

function clickonIEVer4(){
if (event.button==2){
return false;
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown= clickonNetScapeVer4;
}
else if (document.all&&!document.getElementById){
document.onmousedown= clickonIEVer4;
}

document.oncontextmenu=new Function("return false")


// -->
</script>

What is the purpose of JVM (Java Virtual Machine)?


JVM stands for Java Virtual Machine. It acts as an intermediate layer between the Java program and the actual hardware. A ‘virtual’ machine in which the Java code is executed or runs the compiled Java code. The Java code is compiled and converted to byte code by the compiler. The JVM understands the compiled code and executes the java byte code. 


The main reason JVM was developed was for code portability thus providing platform independence. Let us understand portability – take the below HelloWorld.java, the program is first converted to byte codes by the compiler. These byte codes need to be understood by the machine to execute it. If JVM is present in the machine, it understands the byte code, takes care of memory management and interaction with the actual hardware. JVMs are developed for different hardware and software platforms. All that the user has to make sure is that the machine contains a JVM, irrespective of the platform where the code will run.


Below is an example and flow of compilation and execution.

Here is a sample code for HelloWorld.java

public class HelloWorld {
 
    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
 
}

Let us see the steps in the compilation and execution of this java program.