Unique Identifier of a Mac?

Apple has a technote on uniquely identifying a mac. Here’s a loosely modified version of the code Apple has posted in that technote… don’t forget to link your project against IOKit.framework in order to build this: #import <IOKit/IOKitLib.h> – (NSString *)serialNumber { io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(“IOPlatformExpertDevice”)); CFStringRef serialNumberAsCFString = NULL; if (platformExpert) { serialNumberAsCFString … Read more

How to generate and manually insert a uniqueidentifier in SQL Server?

ApplicationId must be of type UniqueIdentifier. Your code works fine if you do: DECLARE @TTEST TABLE ( TEST UNIQUEIDENTIFIER ) DECLARE @UNIQUEX UNIQUEIDENTIFIER SET @UNIQUEX = NEWID(); INSERT INTO @TTEST (TEST) VALUES (@UNIQUEX); SELECT * FROM @TTEST Therefore I would say it is safe to assume that ApplicationId is not the correct data type.

Convert NULL to empty string – Conversion failed when converting from a character string to uniqueidentifier

SELECT Id ‘PatientId’, ISNULL(CONVERT(varchar(50),ParentId),”) ‘ParentId’ FROM Patients ISNULL always tries to return a result that has the same data type as the type of its first argument. So, if you want the result to be a string (varchar), you’d best make sure that’s the type of the first argument. COALESCE is usually a better function … Read more

Reliable way of generating unique hardware ID

It seems to me that you should construct the unique ID corresponding to your requirements. This ID can be constructed as a hash (like MD5, SHA1 or SHA512) from the information which is important for you (some information about software and hardware component). You can make your solution more secure if you sign such hash … Read more

Programmatic Views how to set unique id’s?

Just want to add to Kaj’s answer, from API level 17, you can call View.generateViewId() then use the View.setId(int) method. In case you need it for targets lower than level 17, here is its internal implementation in View.java you can use directly in your project: private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1); /** * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)