Quantcast
Channel: snippet Feed
Browsing all 29 articles
Browse latest View live

Can you have the same development and distribution certificates for your iOS...

AnswerYou can, but then both your development and distribution certificates will be tied to the same public/private key pair (which is generated when you create the certificate request). This may work...

View Article



How to rename file in PHP?

If you want to rename a file in PHP you can use the rename function. The syntax of the rename function is same as that of the UNIX mv(move) command. The general syntax is:rename('/pathA/old_file_name',...

View Article

How to list files in a directory in PHP?

<?phpif($handle=opendir('/path/to/directory')){    echo"Directory handle: $handle\n";    echo"Entries:\n";    /* This is the correct way to loop over the directory. */...

View Article

How to save an NSArray into Plist with a Key?

Saving an NSArray with a Key into PList is easy. You can start with a NSMutableDictionary and add each array as an entry with a key. Finally save into file.+(void) saveArrayIntoPlist:(NSArray*)aArray...

View Article

How to compute SHA1 digest for NSString?

Computing SHA1 (Message Digest). The following is implemented as extension to NSString.

View Article


Some useful Box 2D macros

BOX2D has uses meters as a unit for length and width. However the objects need to be draw on screen in pixel sizes. The following macros helps with those conversions.#define PTM_RATIO 40.0f#define...

View Article

How to hide UITextView Keyboard in OS?

Basically UITextView is for Multi line Text. However if you want to hid the keyboard when the user presses the Return Key using the following snippet:-(BOOL)textView:(UITextView *)textView...

View Article

How do you hide the back button in UINavigationController?

Whenever a child view is pushed into the Navigation Controller, a back button on the top left of the page is displayed. Using this button the user can go back to the parent view. In some case we like...

View Article


How can you cache CCAnimation in Cocos2D?

Cocos2D provides a simple way to cache you Animations using CCAnimationCache class. The CCAnimationCache is implemented as a singleton which can be accessed using the [CCAnimationCache...

View Article


How to list all the fonts available in the iOS platform?

A variety of fonts are available in iOS platform. The following code snippet shows how to list all such fonts and add the font names into an array.

View Article

How to display PHP setup and environment variables?

In order to display PHP setup, configuration and environmental variables simply create a php page and execute the phpinfo command. It will display all the relevant information about PHP as output in...

View Article

How to load image from PhotoGallery into a CCSprite?

SinppetThe Asset Library is used here, so add import.#import "AssetsLibrary/AssetsLibrary.h"   CCSprite *playPhoto;  CCLOG(@"Photo %@",dataManager.playerPhoto);// check if the URL is an asset URL from...

View Article

How to change font to bold and color of a UILabel?

SnippetThe following snippet provides a utiity method to change the label font from bold to regular along with that it changes the color to red or black respectively

View Article


What are the various Enums used by the Facebook iOS SDK?

The following are the various Enumeration defined and used by the Facebook iOS SDK. Please review these for full understanding of how the SDK behaves for various operations./* * Constants used by...

View Article

How to load an remote image as a Drawable in Android?

Loading an remote image from a online server accessible via a URL as Drawable is very straightforward.// Utililty Methodpublic static Drawable loadImageAsDrawable(String url) {    try {        // open...

View Article


How to allow multiple line text in EditText view in Android?

The EditText widget by default is single line. In order to allow mutiple lines modify and customize the widget definition in the layout file as below:<EditText    android:singleLine="false"<!--...

View Article

How to show Alert Dialog in Java Swing?

Displaying a simple message box or an alert dialog with an Ok button can be done with just one line of code as show below:A) Without a JFrameJOptionPane.showMessageDialog(null, "Message goes...

View Article


How do you create a simple Swing based Window with Frame?

importjava.awt.EventQueue; importjavax.swing.JFrame;  publicclass MainWindow {      privateJFrame frame;      /**     * Launch the application.     */     publicstaticvoid main(String[] args){...

View Article

How to check the version of MySQL database using Python?

#!/usr/bin/python# -*- coding: utf-8 -*- import MySQLdb as mdbimport sys con = None try:     con = mdb.connect('localhost','username',        'password','dbname');     cur = con.cursor()...

View Article

How to remove all files of a particular type from a directory in iOS?

Lets say you want to remove(delete) all the files of a particular extension say PNG from the Documents folder of the app. We can use the following code snippet.NSString*fileExt =@"png";</p>

View Article
Browsing all 29 articles
Browse latest View live




Latest Images