Tag Archives: function

Three common errors in Python programming along with examples

By | January 5, 2024

1. Syntax ErrorExample: 2. IndentationErrorExample: Explanation: Python relies on indentation to define block structures. The print statement is not properly indented under the if statement, leading to an indentation error. 3.NameErrorExample: Explanation: The variable y is not defined before trying to print it, resulting in a NameError. It’s worth noting that the examples provided are… Read More »

What are Angular JS modules? – A Simple Demo

By | July 15, 2017

Angular JS modules means : An AngularJS module defines an application. The module is a container for the different parts of an application like controller, services, filters, directives etc. The module is a container for the application controllers. Controllers always belong to a module. Example Here we have a module named “MyApp” and controller for… Read More »

Creating Dynamic table rows and colums in JQuery and removing it one by one.

By | September 4, 2013

Hi all… Apart from Android, I am now going to post something in jquery. In this post I will be showing how to create a dynamic table in jquery and adding data to it using objects and also deleting each row with a remove button in the corresponding row. This is how it is done.… Read More »

How to crop an Image in Android?

By | December 15, 2012

This is a sample program that launches the camera and crop the captured image. Check this link to another crop image example. http://www.coderzheaven.com/2011/03/15/crop-an-image-in-android/ This is the layout xml. activity_main.xml Now this is the Main Java File that implements the crop functionality. Here we are using the “com.android.camera.action.CROP” Intent to crop the Image passing the captured… Read More »

How to add sprite to a body in Box2D in Adobe AIR, FLEX and FLASH? Or Add image/Sprite to a body in ActionScript.

By | April 12, 2012

The below code is for FlashBuilder 4, If you are using FlexBuilder3 use addChild() instead of the commented block in the following code.

How to drag and drop a file from outside to your flex or AIR application and render it correctly?

By | April 7, 2012

Actually we have to do this by registering your application with the eventlisteners for NATIVE_DRAG_ENTER and NATIVE_DRAG_DROP. The following code shows how to do this. Just copy and paste the code to your MXML file and see the result. Drag and drop an image file from outside to your AIR application. import mx.controls.Alert; import mx.controls.Image;… Read More »

Creating Menu in Iphone Cocos2D or Box2D?

By | April 3, 2012

Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on… Read More »

Creating Menu in Iphone Cocos2D or Box2D?

By | April 3, 2012

Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on… Read More »

Creating Menu in Iphone Cocos2D or Box2D?

By | April 3, 2012

Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on… Read More »

Creating Menu in Iphone Cocos2D or Box2D?

By | April 3, 2012

Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on… Read More »

How to check whether an application is installed in your ANDROID Phone?

By | March 28, 2012

This sample code comes handy when you have to check that an application is already installed in your ANDROID Phone. Call the below function appInstalledOrNot() with the package name of the app installed on the ANDROID Device as a string parameter. This function returns true if the app is installed otherwise returns false.

Get a file from PhotoGallery and copy it to your directory in your project resources in Titanium(iPhone or ANDROID).

By | May 3, 2011

This example opens the photogallery and then when you select a file from it , it will be copied to your resources directory. First manually create a directory in your resources, here the directory is named “mydirectory”. Call this functiion inside a button click or something Now after running this code check the directory you… Read More »

ToolTip Sound in Adobe AIR/FLEX…

By | March 10, 2011

Sometimes we may need to have a sound when we hover over something, i.e when a tooltip appears. Actually this can be done easily by adding an eventListener to the corresponding control. Take a look at the example. This line is the important line. myLabel.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myListener); The function myListener gets called when we hover over… Read More »

How to Disable Right Click on HTML page using jQuery ?

By | March 8, 2011

Hi, In some special cases you may need to disable the Right Click option on HTML page you are using. An easy way to do it using jQuery is follows. Use the following code in the HTML page where you want to disable Right Click. $(document).ready(function(){ $(document).bind(“contextmenu”,function(e){ return false; }); }); 🙂

Remove unwanted memory from iPhone….

By | March 5, 2011

Hi all …… You know iPhone doesnot have garbage collection like ANDROID. So it becomes the responsibility of the developer or programmer to release the resources and remove the unwanted textures from your memory. If you don’t remove the unused textures and other variables from your memory your application will exit after a while. You… Read More »

Client Side Form Validation – using JavaScript

By | March 1, 2011

Hi, JavaScript is mainly used for client side scripting. In client side scripting one of the thing which we are usually in need is Validation of Forms. We want to know the user , who is interacting with the form have already given the necessary details before submitting or saving etc. Here is a simple… Read More »

Using ButtonBar in Adobe AIR/FLEX, A simple Example

By | March 1, 2011

Hello………. A button Bar is a convenient way to place your buttons in an application. It saves a lots of space in your application interface. Take a look at the following example which shows how to use the ButtonBar. An itemClickEvent is attached to each button in the ButtonBar. You can place as many buttons… Read More »