Get dictionary value by key

It’s as simple as this: String xmlfile = Data_Array[“XML_File”]; Note that if the dictionary doesn’t have a key that equals “XML_File”, that code will throw an exception. If you want to check first, you can use TryGetValue like this: string xmlfile; if (!Data_Array.TryGetValue(“XML_File”, out xmlfile)) { // the key isn’t in the dictionary. return; // … Read more

SQL keys, MUL vs PRI vs UNI

DESCRIBE <table>; This is acutally a shortcut for: SHOW COLUMNS FROM <table>; In any case, there are three possible values for the “Key” attribute: PRI UNI MUL The meaning of PRI and UNI are quite clear: PRI => primary key UNI => unique key The third possibility, MUL, (which you asked about) is basically an … Read more

Get the new record primary key ID from MySQL insert query?

You need to use the LAST_INSERT_ID() function: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id Eg: INSERT INTO table_name (col1, col2,…) VALUES (‘val1’, ‘val2’…); SELECT LAST_INSERT_ID(); This will get you back the PRIMARY KEY value of the last row that you inserted: The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned … Read more

JavaScript: Object Rename Key

The most complete (and correct) way of doing this would be, I believe: if (old_key !== new_key) { Object.defineProperty(o, new_key, Object.getOwnPropertyDescriptor(o, old_key)); delete o[old_key]; } This method ensures that the renamed property behaves identically to the original one. Also, it seems to me that the possibility to wrap this into a function/method and put it … Read more

How to permanently add a private key with ssh-add on Ubuntu? [closed]

A solution would be to force the key files to be kept permanently, by adding them in your ~/.ssh/config file: IdentityFile ~/.ssh/gitHubKey IdentityFile ~/.ssh/id_rsa_buhlServer If you do not have a ‘config’ file in the ~/.ssh directory, then you should create one. It does not need root rights, so simply: nano ~/.ssh/config …and enter the lines … Read more

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