Hide and Show a Text Using jQuery – Example

By | February 26, 2011

With jQuery manipulation of HTML & CSS can be done very easily. Here we are going to show how to Hide a line of text using jQuery & Show it back also. Let’s code speak first…. <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#hideButton").click(function(){ $("p").hide(); }); $("#showButton").click(function(){ $("p").show(); }); }); </script> </head> <body> <p>Hey!… Read More »

Preventing Overriding in Java

By | February 25, 2011

Methods and variables can be ‘override’ in subclasses. (Yes, it’s a good feature too!). But what if we don’t want to ‘override’ our Methods and Variables in Java? It’s simple… Declare them using the keyword ‘final’ as modifier. That’s it. eg: So the value of myVariable can never be changed any way. Also for Classes/Methods.… Read More »

Creating Exceptions in JAVA

By | February 25, 2011

This is a simple custom exception in java. That is, we can create an exception by extending the exception class. The “throw new MyExcep” will throw an exception and the error message we specified will be displayed import java.lang.Exception; @SuppressWarnings(“serial”) class MyExcep extends Exception { MyExcep(String Errormsg) { super(Errormsg); // call Exception class error message… Read More »

PHP- Warning: session_start(): Cannot sent session cache limiter-headers already sent, ERROR

By | February 24, 2011

Most of the beginners in PHP while using sessions at the first time might have encountered a long error, starting with something like, Warning:session_start(): Cannot sent session cache limiter- headers already sent Fix : It’s too simple! Don’t ever leave atleast a single space before the PHP code (starting with

String Functions in C

By | February 23, 2011

Let’s now briefly discuss about four essential String function used in C. We are going to discuss about a) strlen() b) strcpy() c) strcat() d) strcmp() Codes speak louder than words! Let’s see what these functions do in a simple C Program. #include main() { char stringOne[15] = “CoderzHeaven”; char stringTwo[] =”Codes”; char stringThree[15]; int… Read More »

Create PopUp Window in Adobe AIR / FLEX, A simple Example.

By | February 23, 2011

Below code shows how to create a new popUp window in Adobe AIR or FLEX. To create a new window “right click on the src folder and create a new MXML Component named Here “MyLoginForm” It should be aTitleWindow for the example below. How ever You can create other components, but the code accordingly must… Read More »

FullScreen Event in Adobe AIR or FLEX

By | February 22, 2011

  The following simple code snippet explains how to get an eventListener for FullScreen Event in Adobe AIR or FLEX. The function “onScreenModeChange ” gets called when you maximizes your window. private function init():void { stage.addEventListener( FullScreenEvent.FULL_SCREEN, onEnteringFullScreenMode); } private function onEnteringFullScreenMode( e:FullScreenEvent ):void { if( e.fullScreen ) { // Do something on fullscreen…………… } else… Read More »

Abstract Class in java

By | February 20, 2011

This example shows how a simple java abstract class works Here “Shape” is the abstract class abstract class Shape { abstract void initial(); // methods only defined….. abstract void display(); } class cube extends Shape { void initial() // Abstract Methods defined…. { System.out.println(“Hello !! “); } void display() { System.out.println(“How are you?”); } }… Read More »

How to create custom layout for your spinner in ANDROID? or Customizable spinner

By | February 20, 2011

This code helps you to customize the spinner in ANDROID. For that you have to create an XML file inside your layout folder as shown below and name it spinner.xml. You can give all properties that are available for TextView inside this which is going to be then applied for your spinner. Now I will… Read More »

How to set an item selected in Spinner in ANDROID?

By | February 19, 2011

This code helps yoy to set an item in your combobox(spinner) in ANDROID. Here my_spinner is the combobox which we call as spinner in ANDROID. Declare it in your XML file and link to it by using the following code…. my_spinner= (Spinner)findViewById(R.id.my_spinner); After that in your code set an item Listener for the spinner using… Read More »

How to add categories / labels in your blogger?

By | February 19, 2011

Unlike wordpress blogger, blogspot don’t have direct method (I said direct not ‘NO’!) to add categories to your posts. Just adding ‘Labels’ while you post your posts won’t work always. But it’s simple to categorize posts in your blogspot. Follow the simple steps below. (Google is always simple & will be!) 1. From your ‘Dashboard’… Read More »

Java Exception

By | February 19, 2011

Simple java program to show how exception works public class exception { public static void main(String[] args) { try { int a = 10; int b = 10/0; } catch(ArithmeticException e) { System.out.println(“Exception Caught ” + e); } } } The output will be like you expect Exception Caught java.lang.ArithmeticException: / by zero

How to set wallpaper in ANDROID?

By | February 17, 2011

Following example shows how to set a Bitmap as wallpaper in ANDROID. After running this code your wallpaper on the ANDROID phone will change. Make sure that you have an image named ‘my_wallpaper’ in your drawable folder. And You have to set this permission in the Manifest.

Working with SQLite Database in ANDROID.

By | February 14, 2011

Below is a straight forward example of how to deal with SQLite database in ANDROID. Go ahead and copy and paste the following code to your java file. The example has one database and performs functions like insert delete and listing of values in a textView. In the XML file set up a TableLayout with… Read More »

How to dynamically add controls in Adobe AIR or Flex?

By | February 14, 2011

Below example shows how to add a label control dynamically in AIR or FLEX. var L : Label = new Label(); L.addEventListener(MouseEvent.CLICK,LabelListener); L.name = “my_label_name”; L.text = “my Text”; addChild(L); // This function listens to the mouse click in the above added label. private function LabelListener(event:MouseEvent):void { } Please note that you can add any… Read More »