Any way to identify browser tab in JavaScript?

SessionStorage is per tab/window, so you can define a random number in sessionStorage and get it at first if exists: var tabID = sessionStorage.tabID ? sessionStorage.tabID : sessionStorage.tabID = Math.random(); UPDATE: In some cases, you may have same sessionStorage in multiple tabs (e.g. when you duplicate tab). In that case, following code may help: var … Read more

What is a Git commit ID?

Here’s an example of a commit object file, decompressed. commit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84 parent 6270c56bec8b3cf7468b5dd94168ac410eca1e98 author Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 committer Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 feature: I did something cool The commit ID is a SHA-1 hash of that. $ openssl zlib -d < .git/objects/81/2e8c33de3f934cb70dfe711a5354edfd4e8172 | sha1sum 812e8c33de3f934cb70dfe711a5354edfd4e8172 – This includes… Full … Read more

How to preserve identifierForVendor in ios after uninstalling ios app on device?

You may keep it in KeyChain -(NSString *)getUniqueDeviceIdentifierAsString { NSString *appName=[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; NSString *strApplicationUUID = [SSKeychain passwordForService:appName account:@”incoding”]; if (strApplicationUUID == nil) { strApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; [SSKeychain setPassword:strApplicationUUID forService:appName account:@”incoding”]; } return strApplicationUUID; }

C# guid and SQL uniqueidentifier

Here’s a code snippet showing how to insert a GUID using a parameterised query: using(SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using(SqlTransaction trans = conn.BeginTransaction()) using (SqlCommand cmd = conn.CreateCommand()) { cmd.Transaction = trans; cmd.CommandText = @”INSERT INTO [MYTABLE] ([GuidValue]) VALUE @guidValue;”; cmd.Parameters.AddWithValue(“@guidValue”, Guid.NewGuid()); cmd.ExecuteNonQuery(); trans.Commit(); } }

Generate a unique id

Why not just use ToString? public string generateID() { return Guid.NewGuid().ToString(“N”); } If you would like it to be based on a URL, you could simply do the following: public string generateID(string sourceUrl) { return string.Format(“{0}_{1:N}”, sourceUrl, Guid.NewGuid()); } If you want to hide the URL, you could use some form of SHA1 on the … Read more

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