for-accessing-nsmutable-dictionary-for-each-loop-in-objective-c

for (NSString* key in xyz) {
id value = [xyz objectForKey:key];
// do stuff
}

Access User -/Library Folder in OS X Lion

chflags nohidden ~/Library/

generate random password

< ?php

function generateRandomPassword ($length = 12)
{
$password = "";
$possible = "12346789abcdfghjkmnpqrtvwxyzABCDFGHJKLMNPQRTVWXYZ";
$maxlength = strlen($possible);

if ($length > $maxlength) {
$length = $maxlength;
}
$i = 0;
while ($i < $length) {
$char = substr($possible, mt_rand(0, $maxlength-1), 1);
if (!strstr($password, $char)) {
$password .= $char;
$i++;
}
}
return $password;
}
?>

Get User IP Address

< ?php
function getRemoteIPAddress ()
{

if (strlen($_SERVER["HTTP_X_FORWARDED_FOR"]) > 0) {
$HTTPXFORWARDEDFOR = $_SERVER["HTTP_X_FORWARDED_FOR"];
$reserved = false;
if (substr($HTTPXFORWARDEDFOR, 0, 3) == “10.”) {
$reserved = true;
}
if (substr($HTTPXFORWARDEDFOR, 0, 4) == “172.” && substr($HTTPXFORWARDEDFOR, 4, 2) > 15 && substr($HTTPXFORWARDEDFOR, 4, 2) < 32) {
$reserved = true;
}
if (substr($HTTPXFORWARDEDFOR, 0, 8) == "192.168.") {
$reserved = true;
}
if (!$reserved) {
$ipAddress = $HTTPXFORWARDEDFOR;
}
}
if (!isset($ipAddress)) {
$ipAddress = $_SERVER["REMOTE_ADDR"];
}
return $ipAddress;
}
?>

get list of files in a directory

< ?php

function getDirectoryList ($directory)
{
$results = array();

$handler = opendir($directory);

while ($file = readdir($handler)) {

if ($file != "." && $file != "..") {
$results[] = $file;
}

}
closedir($handler);

return $results;
}

?>

sqlite.org/capi3ref.html

detect ios device type

+(DeviceType) getDeviceType{

NSString *model = [UIDevice currentDevice].model;
if(([model isEqualToString:@"iPhone"] || [model isEqualToString:@"iPhone Simulator"] ) == YES ){
return EIPhone;
}

if([model isEqualToString:@"iPod touch"] == YES){
return EIPod;
}

if(( [model isEqualToString:@"iPad"] || [model isEqualToString:@"iPad Simulator"]) == YES){
return EIPad;
}

return ENONE;
}

How to Write UIAlert View in iPhone

UIAlertView *alertView = [[[UIAlertView alloc]
initWithTitle:@”Bookmark is not installed” message:@”Do you want to install it from AppStore”
delegate:self cancelButtonTitle:@”NO” otherButtonTitles:@”Yes”, nil] autorelease];

[alertView show];

How to initialize the framework?

Just import this to in main application
import org.spicefactory.parsley.flex.FlexContextBuilder;

Controls Available in Flex 4.5 for mobiles

Hi All,

Here is the list of controls available in Flex 4.5 for mobiles.

BusyIndicator
Button
ButtonBar
CheckBox
HSlider
Image
Label
List
RadioButton / RadioButtonGroup
TextArea
TextInput