Recent Notes

Displaying keyword search results 91 - 100
Created by jinx on May 16, 2011 20:55:53    Last update: May 16, 2011 20:55:53
The PHP break statement takes an optional level parameter, which indicates how many levels of loop structure to break out. Example code: <?php for ($i = 0; $i < 5; $i++) { for (... It's a fatal error if the level parameter exceeds the maximum number of enclosing loop structures. For example, " break 3; " in above code.
Created by jinx on May 16, 2011 20:21:38    Last update: May 16, 2011 20:21:38
PHP compares two arrays element for element for equality. Two arrays are considered equal when they have the same number of elements, and for each element key and value both match. Test code: <?php $cmp = array( array(array(1), array(1... Outputs: array(1) { [0]=> int(1) } array(2)...
Created by freyo on May 16, 2011 13:05:57    Last update: May 16, 2011 13:07:18
The root URL is: http://android.git.kernel.org/ Built-in applications are projects named platform/packages/apps/<app_name>.git , for example, phone app is: platform/packages/apps/Phone.git , contacts app is: platform/packages/apps/Contacts.git . Android framework classes such as android.app.Activity , android.content.ContentProvider etc., are under the platform/frameworks/base.git project. By default, browsing displays the HEAD branch, to see a different branch, add hb parameter. Compare: http://android.git.kernel.org/?p=platform/build.git;a=tree;f=tools to: http://android.git.kernel.org/?p=platform/build.git;a=tree;f=tools;hb=refs/tags/android-2.2.1_r1 , you'll notice that dexpreopt is missing in the former. Use the tags action to display a list of tags for the current project. For example: http://android.git.kernel.org/?p=platform/build.git;a=tags . An incomplete parameter list (parameters are separated by a semicolon): p : project, for example, platform/build.git . a : action, for example, tree , summary , log etc. f : file name. hb : branch or tag name, for example:...
Created by jinx on May 11, 2011 21:22:06    Last update: May 11, 2011 21:22:55
The PHP configuration parameter magic_quotes_gpc is a boolean that indicates the input parameters (Get, Post and Cookie) are automatically escaped (when it is on) for safe insertion into the database. It is deprecated as of PHP PHP 5.3.0, and will certainly be removed in the future . Although the intention was to help the user not to worry about escaping the special DB characters before database operations, the reverse side is now he needs to constantly worry about reversing the escape in the application logic. Code like this is abundant: <?php if (get_magic_quotes_gpc()) { $var... Another bad thing is, it does not work for all databases. Sybase, for example, uses the parameter magic_quotes_sybase , and when it is on, a single quote is escaped by...
Created by freyo on May 09, 2011 15:13:59    Last update: May 09, 2011 15:14:22
This code snippet opens and reads the Android APK archive file for a given package name. // import java.io.*; // import java.util.zip.*;...
Created by freyo on May 09, 2011 14:15:01    Last update: May 09, 2011 14:17:22
In short, use the PackageManager class to get the PackageInfo : PackageInfo pkgInfo = getPackageManager().getP... To build an APK, make these changes to the greetings app : Change the layout to ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <LinearL... Change the string values ( res/values/strings.xml ): <?xml version="1.0" encoding="utf-8"?> <resourc... Update AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Create a new Java class src/com/android/appinfo/GetAppVersion.java : package com.android.appinfo; import android... Edit build.xml , change project name to "AppInfo": <?xml version="1.0" encoding="UTF-8"?> <project... Install to emulator: ant install Screenshot:
Created by freyo on May 09, 2011 12:50:52    Last update: May 09, 2011 12:51:54
You can use the android.os.StatFs class to check for available space on the sd card. Example code: // import android.os.Environment; // import...
Created by freyo on May 09, 2011 12:16:58    Last update: May 09, 2011 12:16:58
The class android.os.Environment defines these constants for the status of external storage: MEDIA_BAD_REMOVAL : the media was removed before it was unmounted. MEDIA_CHECKING : the media is present and being disk-checked. MEDIA_MOUNTED : the media is present and mounted with read/write access. MEDIA_MOUNTED_READ_ONLY : the media is present and mounted with readonly access. MEDIA_NOFS : the media is present but is blank or using unsupported file system. MEDIA_REMOVED : the media is not present. MEDIA_SHARED : the media is present but shared via USB mass storage. MEDIA_UNMOUNTABLE : the media is present but cannot be mounted. MEDIA_UNMOUNTED : the media is present but not mounted. Example code: String state = Environment.getExternalStorageState...
Created by jinx on May 03, 2011 08:56:55    Last update: May 03, 2011 08:57:54
These error level constants are defined in PHP : Constant Value Description E_ERROR 1 Fatal run-time errors. Execution of the script is halted. E_WARNING 2 (1<<1) Run-time warnings (non-fatal errors). Execution of the script is not halted. E_PARSE 4 (1<<2) Compile-time parse errors. Parse errors should only be generated by the parser. E_NOTICE 8 (1<<3) Notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. E_CORE_ERROR 16 (1<<4) Fatal errors that occur during PHP's initial startup. This is like an E_ERROR, except it is generated by the core of PHP. E_CORE_WARNING 32 (1<<5) Warnings (non-fatal errors) that occur during PHP's initial startup. This is like an E_WARNING, except it is generated...
Created by Dr. Xi on April 20, 2011 21:44:15    Last update: May 02, 2011 20:56:58
The String.format() method provides versatile formatting capabilities. This tutorial tries to present these capabilities in a accessible manner. The format string A format string can contain zero, one, or more format specifiers . The general form of a format specifier is: %[argument_index$] [flags] [width] [.precision]co... where things in square brackets are optional, and conversion is a character indicating the conversion to be applied to the corresponding variable value. The only required characters in the format specifier is the percent sign % and the conversion character. A simple example: public static void simpleFormat() { System.out... The Argument index The argument index is specified by a number, terminated by the dollar sign $ . The same argument may be repeated multiple times in a format string. Unindexed...
Previous  5 6 7 8 9 10 11 12 13 14 Next