|
For retrieving the iOS device UUID we need to call uniqueIdentifier that helps us in retrieving the UUID of the device.
[[UIDevice currentDevice] uniqueIdentifier]
|
|
|
|
|
|
Bar button Get click event
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"My profile" style:UIBarButtonItemStyleBordered target:self action:@selector(leftBarButtonEventCatcher)];
[self.navigationItem setLeftBarButtonItem:backButton];
Bar button setting the Image
UIImage *backImage = [UIImage imageNamed:@"button_back_Iphone.png"];
//create the button and assign the image
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[backButton setImage:backImage forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(leftBarButtonEventCatcher) forControlEvents:UIControlEventTouchUpInside];
//set the frame of the button to the size of the image (see note below)
backButton.frame = CGRectMake(0, 0, backImage.size.width, backImage.size.height);
//create a UIBarButtonItem with the button as a custom view
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem= customBarItem;
|
|
|
|
|
iPhone SDK 2.2.1 Leopard (10.5.4)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_for_iphone_os_2.2.1__9m2621a__final/iphone_sdk_for_iphone_os_2.2.19m2621afinal.dmg
iPhone SDK 3.0 (Xcode 3.1.3) Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__leopard__9m2736__final.dmg
iPhone SDK 3.0 (Xcode 3.2) Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__snow_leopard__final.dmg
iPhone SDK 3.1 with Xcode 3.1.4 Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.1_final__leopard__9m2809.dmg
iPhone SDK 3.1 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.2_final__snow_leopard__10a432.dmg
iPhone SDK 3.1.2 with XCode 3.1.4 for Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.1.4__leopard__9m2809.dmg
iPhone SDK 3.1.2 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.2.1__snow_leopard__10m2003.dmg
iPhone SDK 3.1.3 with XCode 3.1.4 for Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.1.4__leopard__9m2809a.dmg
iPhone SDK 3.1.3 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg
iPhone SDK 3.2 Final with Xcode 3.2.2 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.2__final/xcode_3.2.2_and_iphone_sdk_3.2_final.dmg
Xcode 3.2.3 and iPhone SDK 4 GM seed for Snow Leopard (10.6.2)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_4_gm_seed/xcode_3.2.3_and_iphone_sdk_4_gm_seed.dmg
Xcode 3.2.3 and iOS SDK 4.0.1 for Snow Leopard (10.6.4)
https://developer.apple.com/iphone/download.action?path=/ios/ios_sdk_4.0.1__final/xcode_3.2.3_and_ios_sdk_4.0.1.dmg
.
|
|
|
|
|
iPhone SDK 2.2.1 Leopard (10.5.4)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_for_iphone_os_2.2.1__9m2621a__final/iphone_sdk_for_iphone_os_2.2.19m2621afinal.dmg
iPhone SDK 3.0 (Xcode 3.1.3) Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__leopard__9m2736__final.dmg
iPhone SDK 3.0 (Xcode 3.2) Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__snow_leopard__final.dmg
iPhone SDK 3.1 with Xcode 3.1.4 Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.1_final__leopard__9m2809.dmg
iPhone SDK 3.1 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.2_final__snow_leopard__10a432.dmg
iPhone SDK 3.1.2 with XCode 3.1.4 for Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.1.4__leopard__9m2809.dmg
iPhone SDK 3.1.2 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.2.1__snow_leopard__10m2003.dmg
iPhone SDK 3.1.3 with XCode 3.1.4 for Leopard (10.5.7)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.1.4__leopard__9m2809a.dmg
iPhone SDK 3.1.3 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg
iPhone SDK 3.2 Final with Xcode 3.2.2 for Snow Leopard (10.6.0)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.2__final/xcode_3.2.2_and_iphone_sdk_3.2_final.dmg
Xcode 3.2.3 and iPhone SDK 4 GM seed for Snow Leopard (10.6.2)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_4_gm_seed/xcode_3.2.3_and_iphone_sdk_4_gm_seed.dmg
Xcode 3.2.3 and iOS SDK 4.0.1 for Snow Leopard (10.6.4)
https://developer.apple.com/iphone/download.action?path=/ios/ios_sdk_4.0.1__final/xcode_3.2.3_and_ios_sdk_4.0.1.dmg
.
|
|
|
|
|
#import <sys utsname.h="">
/**
@brief helper class to detects the device on which the program is running
*/
@interface DeviceDetection : NSObject
enum {
MODEL_UNKNOWN=0,/**< unknown model */
MODEL_IPHONE_SIMULATOR,/**< iphone simulator */
MODEL_IPAD_SIMULATOR,/**< ipad simulator */
MODEL_IPOD_TOUCH_GEN1,/**< ipod touch 1st Gen */
MODEL_IPOD_TOUCH_GEN2,/**< ipod touch 2nd Gen */
MODEL_IPOD_TOUCH_GEN3,/**< ipod touch 3th Gen */
MODEL_IPHONE,/**< iphone */
MODEL_IPHONE_3G,/**< iphone 3G */
MODEL_IPHONE_3GS,/**< iphone 3GS */
MODEL_IPHONE_4, /**< iphone 4 */
MODEL_IPAD/** ipad */
};
/**
get the id of the detected device
*/
+ (uint) detectDevice;
/**
get the string for the detected device
*/
+ (NSString *) returnDeviceName:(BOOL)ignoreSimulator;
@end
#import "DeviceDetection.h"
@implementation DeviceDetection
+ (uint) detectDevice {
NSString *model= [[UIDevice currentDevice] model];
struct utsname u;
uname(&u);
if (!strcmp(u.machine, "iPhone1,1")) {
return MODEL_IPHONE;
} else if (!strcmp(u.machine, "iPhone1,2")){
return MODEL_IPHONE_3G;
} else if (!strcmp(u.machine, "iPhone2,1")){
return MODEL_IPHONE_3GS;
} else if (!strcmp(u.machine, "iPhone3,1")){
return MODEL_IPHONE_4;
} else if (!strcmp(u.machine, "iPod1,1")){
return MODEL_IPOD_TOUCH_GEN1;
} else if (!strcmp(u.machine, "iPod2,1")){
return MODEL_IPOD_TOUCH_GEN2;
} else if (!strcmp(u.machine, "iPod3,1")){
return MODEL_IPOD_TOUCH_GEN3;
} else if (!strcmp(u.machine, "iPad1,1")){
return MODEL_IPAD;
} else if (!strcmp(u.machine, "i386")){
//NSString *iPhoneSimulator = @"iPhone Simulator";
NSString *iPadSimulator = @"iPad Simulator";
if([model compare:iPadSimulator] == NSOrderedSame)
return MODEL_IPAD_SIMULATOR;
else
return MODEL_IPHONE_SIMULATOR;
}
else {
return MODEL_UNKNOWN;
}
}
+ (NSString *) returnDeviceName:(BOOL)ignoreSimulator {
NSString *returnValue = @"Unknown";
switch ([DeviceDetection detectDevice])
{
case MODEL_IPHONE_SIMULATOR:
returnValue = @"iPhone Simulator";
break;
case MODEL_IPOD_TOUCH_GEN1:
returnValue = @"iPod Touch";
break;
case MODEL_IPOD_TOUCH_GEN2:
returnValue = @"iPod Touch";
break;
case MODEL_IPOD_TOUCH_GEN3:
returnValue = @"iPod Touch";
break;
case MODEL_IPHONE:
returnValue = @"iPhone";
break;
case MODEL_IPHONE_3G:
returnValue = @"iPhone 3G";
break;
case MODEL_IPHONE_3GS:
returnValue = @"iPhone 3GS";
break;
case MODEL_IPHONE_4:
returnValue = @"iPhone 4";
break;
case MODEL_IPAD:
returnValue = @"iPad";
break;
default:
break;
}
return returnValue;
}
@end
|
|
|
|
|
NSURL *url = [NSURL URLWithString: strUrlForImage];
UIImage imageCategoryLogo = [[UIImage alloc] initWithData: [NSData dataWithContentsOfURL:url]];
|
|
|
|
|
- (BOOL) validateEmail: (NSString *) candidate {
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:candidate];
}
|
|
|
|
|
It is very easy to get distance between two GPS Location but It is very difficult to get angle between two GPS positions.
Here is the Mathematics for retrieving angle between two GPS location.
double PoiModel::findAngleFromNorth(double lat1, double long1, double lat2, double long2)
{
//Convert input values to radians
double Lat1_Rad = DegToRad(lat1);
double Lon1_Rad = DegToRad(long1);
double Lat2_Rad = DegToRad(lat2);
double Lon2_Rad = DegToRad(long2);
double xvalue, yvalue;
xvalue = sin(Lon2_Rad - Lon1_Rad) * cos(Lat2_Rad);
yvalue = cos(Lat1_Rad) * sin(Lat2_Rad) - sin(Lat1_Rad) * cos(Lat2_Rad) * cos(Lon2_Rad - Lon1_Rad);
// Bearing_Radian = ATAN2(COS(Lat1_Rad) * SIN(Lat2_Rad) - SIN(Lat1_Rad) * COS(Lat2_Rad) * COS(Lon2_Rad - Lon1_Rad); SIN(Lon2_Rad - Lon1_Rad) * COS(Lat2_Rad))
double Bearing_Radian = atan2(xvalue, yvalue);
//Bearing_Radian = fmod(Bearing_Radian + (2 * M_PI), 2 * M_PI);
Bearing_Radian =(Bearing_Radian + (2 * M_PI)) % (2 * M_PI);
return Bearing_Radian;
}
double PoiModel::DegToRad(double degrees)
{
return degrees * ( M_PI / 180);
}
modified on Friday, April 9, 2010 1:41 AM
|
|
|
|
|
Java certification sites ::
http://www.javaprepare.com/notes/intro.html
http://www.jchq.net/faq/jcertfaq.htm
C++ sites ::
www.tenouk.com
www.parashift.com
For VC++ ::
you need to change linker option from /SUBSYSTEM:CONSOLE to /SUBSYSTEM:WINDOWS. This prevents showing Console window. After changing this option, possibly you need to change /ENTRY option to tell to the linker that your program has main and not WinMain entry point.
Playing with these options, it is possible to hide console window in console application, or add console window to Windows application.
For C# ::
Just use the WindowStyle property and set it to Hidden
for example ::
Process process = new Process();
process.StartInfo.FileName = "test.exe";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
modified on Friday, February 27, 2009 2:00 AM
|
|
|
|
|
*************************** Get User Permission **************************
sp_helprotect TableName
or
sp_helprotect storeprocName
ex:
sp_helprotect comms_txn_incoming -- Table Name
sp_helprotect bene_failed_delivery -- StoreProc Name
**************************** Get Table Size ****************************
SP_SPACEUSED 'Table Name'
Ex ::
SP_SPACEUSED 'sysobjects'
Output ::
name rows reserved data index_size unused
---------- ----- ---------- ----- -------- ----------
sysobjects 1546 584 KB 200 KB 240 KB 144 KB
************************** Primary & Foreign Key ************************
sp_pkeys 'comms_txn_incoming'
sp_fkeys 'comms_txn_incoming'
*************************************************************************
modified on Tuesday, November 18, 2008 6:57 AM
|
|
|
|
|
select sysObj.name , sysIndex.rowcnt from sysobjects as sysObj
inner join sysindexes as sysIndex on sysObj.id = sysIndex.id
where sysObj.xtype = 'u'
|
|
|
|
|
SELECT object_name(sc.id) FROM SYSCOMMENTS sc WITH (NOLOCK)
WHERE sc.text LIKE '%Search_Content%'
and sc.id > 0
ORDER BY object_name(sc.id)
// For purging ::
DBCC SQLPERF(LOGSPACE)
modified on Friday, March 20, 2009 7:58 AM
|
|
|
|
|
// Please include #include "Windows.h" -- HANDLE defination
// Please include #include "Winbase.h"
// Please include #include "TCHAR.h" --
HANDLE hEventSource;
/* Get a handle to use with ReportEvent(). */
// TCHAR chMsg[1000];
// LPTSTR lpszStrings[1];
LPCTSTR lpstr = "Testing going on.";
hEventSource = RegisterEventSource(NULL,_T("test"));
if (hEventSource != NULL)
{
/* Write to event log. */
// EventID is very important we need to create DLL for the same
// DLL will be created and will be registered to eventlog
// NumberofParameter will specify what should be input lpstr will be LPCTSTR array if NumberofParameter paramter is more then 1.
ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE, 0,0 , NULL, 1, 0, &lpstr, NULL);
// ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE, category ,EventID , NULL, NumberofParameter , 0, &lpstr, NULL);
DeregisterEventSource(hEventSource);
}
----------------------------------------------------------------------------------
Note :: for proper eventlog we requried DLL to be registered on Eventlog path
// "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\ApplicationName"
// copy to file xxx.mc
;//**********************Category Definitions***********************
MessageId=1
Facility=Application
Severity=Success
SymbolicName=CATEGORY1
Language=English
Test Category 1
.
;//********************End of Category Definitions******************
;// MessageIdTypeDef should NOT be altered
;// Event definitions are of type DWORD
MessageIdTypedef=DWORD
;//***********************Event Definitions***************************
MessageId=1001
Facility=Application
Severity=Success
SymbolicName=EVENT_1001
Language=English
Username: %1, Password: %2.
.
;//***********************End of Event Definitions********************
// xxx.mc file completed ---------------------------------------------------------
// compile xxx.mc file C:\Program Files\Microsoft Visual Studio\VC98\Bin\mc.exe
// output of it will be xxx.rc
// include it to resouce file of DLL and build DLL.
----------------------------------------------------------------------------------
// Refer url for any further understanding
_http://www.codeproject.com/KB/system/eventlogging.aspx
modified on Wednesday, March 25, 2009 12:21 PM
|
|
|
|
|
|
----------------------------- ShellExecute -------------------------
For executing any application from Executable in VC
ShellExecute(NULL,NULL, "iexplore.exe","http://www.test.com", NULL, SW_SHOWNORMAL);
------------------------------- Registry -----------------------------
For opening registry RegOpenKey or RegOpenKeyEx functions. If the keys need to be created, the RegCreateKey and RegCreateKeyEx functions do the job. Ex is for 32 bit versions
The RegSetValue and RegSetValueEx functions allow the settings of a value to be modified, while RegQueryValue and RegQueryValueEx retrieve the current setting of a value.
Example ::
RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&, _ vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, _ 0&, hNewKey, lRetVal)
RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, _ KEY_QUERY_VALUE, hKey)
HKEY hRegKey = NULL;
DWORD regDword;
// creates or opens(if key already exists) the registry key
RegOpenKeyEx(HKEY_LOCAL_MACHINE, MY_LOGGER_REG_PATH, 0, KEY_QUERY_VALUE, &hRegKey) ;
if (hRegKey == NULL)
RegCreateKeyEx(HKEY_LOCAL_MACHINE, MY_LOGGER_REG_PATH, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hRegKey, ®Dword);
modified on Wednesday, March 25, 2009 11:05 AM
|
|
|
|
|