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. eg: It will… Read More »

admin

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 } } public… Read More »

admin

Difference between & and * operator in C

By | February 24, 2011

A beginner to Pointers in C often perplexed by different operators & and * Let’s see what it really is and how simple it is. & – This operator gives ‘the address of’ a variable * – This operator gives ‘the value at address’ of a variable (Note! Note! Note! Not the other way round! By heart it… Read More »

James

Difference between & and * operator in C

By | February 24, 2011

A beginner to Pointers in C often perplexed by different operators & and * Let’s see what it really is and how simple it is. & – This operator gives ‘the address of’ a variable * – This operator gives ‘the value at address’ of a variable (Note! Note! Note! Not the other way round! By heart it… Read More »

admin

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 varOne, varTwo; //Counting… Read More »

admin

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 change. import mx.managers.PopUpManager;… Read More »

admin

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 { // Do… Read More »

admin

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?”); } } public class Abstract… Read More »

admin

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 the code below.… Read More »

admin

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’ , Go to… Read More »

admin

Why don’t my player showing subtitles?

By | February 19, 2011

You may be perplexed at a common situation where your movie player don’t showing up the subtitles even after you have the subtitle file! But the fix to this problem is too simple. How to fix subtitles not showing up problem? Ans : Just Rename the subtitle file with the same name as that of the movie file.… Read More »

James

Why don’t my player showing subtitles?

By | February 19, 2011

You may be perplexed at a common situation where your movie player don’t showing up the subtitles even after you have the subtitle file! But the fix to this problem is too simple. How to fix subtitles not showing up problem? Ans : Just Rename the subtitle file with the same name as that of the movie file.… Read More »

James

Why don't my player showing subtitles?

By | February 19, 2011

You may be perplexed at a common situation where your movie player don’t showing up the subtitles even after you have the subtitle file! But the fix to this problem is too simple. How to fix subtitles not showing up problem? Ans : Just Rename the subtitle file with the same name as that of the movie file.… Read More »

admin

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

admin

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.

admin

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 android:stretchColumns=”0,1″ and other… Read More »

admin

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 control by this… Read More »

admin

How to remove unwanted frames from memory in iPhone?

By | February 13, 2011

In Cocos2D in iPhone often you may be using spritesheets which amy cause memory leaks because they are unused textures in memory even when you go from one scene to other. So make sure to remove all those unwanted textures from memory to save memory. Copy this following code to dealloc function in your class which will remove… Read More »

admin