key

When working with most APIs, why do they require two types of authentication, namely a key and a secret?

I have been working with APIs and I've always wondered why you have to use a key and a secret? Why do you need two types of authentication? ...

Convert received keys in PreviewKeyDown to a string

I am using PreviewKeyDown event on a window to receive all the keys from a barcode scanner. The KeyEventArgs is an enumeration and does not given me the actual string. I dont want to use TextInput as some of the keys may get handled by the control itself and may not bubble up to the TextInput event. I am looking for a way to convert th...

Using MD5 to generate an encryption key from password?

I'm writing a simple program for file encryption. Mostly as an academic exercise but possibly for future serious use. All of the heavy lifting is done with third-party libraries, but putting the pieces together in a secure manner is still quite a challenge for the non-cryptographer. Basically, I've got just about everything working the w...

How can I see what exactly contains a proprieties variable?

I'm pretty new to Java, so don't kill me :) FileInputStream files = new FileInputStream(path); Properties prop = new Properties(); try { props.load(fis); ..... Let's say the files is: Mary goes to school, or, not. How can I see how the information was stocked inside the prop variable. I understand that...

Google App Engine encoded key in Java

Can someone provide some simple code about how to use an encoded key in Java for the Google app engine. The sample code is a little bit confusing. Suppose I have an employee class and I want the primary key to be manually constructed with a format of "name, email, phone" for example a sample key would be"James Smith,[email protected]...

Compound String key in HashMap

We are storing a String key in a HashMap that is a concatenation of three String fields and a boolean field. Problem is duplicate keys can be created if the delimiter appears in the field value. So to get around this, based on advice in another post, I'm planning on creating a key class which will be used as the HashMap key: class The...

Dictionary<> is reporting invalid key when it's not

I have some code that adds a Func<short> to a Dictionary<byte, Func<short>> at index 0. Later on, some code within the class that contains the dictionary attempts to extract this Func (via TryGetValue) and execute it, throwing an exception if it does not work. Even though the index being accessed is valid, it throws the exception that si...

Are Multi-column Primary Keys in MySQL a optimisation problem?

Been looking into using multi-column primary keys and as performance is extremely important with the size of traffic and database I need to know if there is anything to consider before I start throwing out the unique ID method on many of my tables and start using mulit column primary keys. So, what are the performance/optimisation pros/...

XML Schema - Key in sequence

I'm trying to put a key in sequence and am being bombarded with errors. It seems I can't do this. Additionally, I am being told my key needs a field and selector, which I have been able to find very little documentation on. (In fact, in desperation, I downloaded Liquid XML Studio [vs. Notepad] and searched it's help files. . . to find NO...

Exploding Arrays in PHP While Keeping the Original Key

How can I do the following without lots of complicated code? Explode each value of an array in PHP (I sort of know how to do this step) Discard the first part Keep the original key for the second part (I know there will be only two parts) By this, I mean the following: $array[1]=blue,green $array[2]=yellow,red becomes $array[1]=g...

Hibernate - How to use an Enumeration as Map's Key

Hi all, My entity defines a field like Map<String, String> props; I've got this hibernate xml configuration <map name="props" table="PROPS"> <key column="id"/> <index column="name" type="string"/> <element column="value" type="string"/> </map> Now I want my Map to be an EnumMap like Map<MyEnum, String> prop...

Java swap two keys in a Map

Welcome. I have a generic void method swap that takes a Map and 2 keys. The method will swap the values associated with the keys in the Map. I already checked that both keys are contained in the Map somewhere else, but in this method, I can't use looping. My method answer: public static<K, W> swap(Map<K,V m, K key1, K key2>){ m.put(ke...

How to check for COMMAND key held down Java/SWT at startup on Mac OS X

My app is cross-platform, hence why SWT is being used. I can easily monitor for the Mac Command/Flower key press when the app is running using SWT (they have SWT.COMMAND as a key press). I want to know how to see if the command key is being pressed and held down as the app opens. I found a few examples on here, but those were for caps ...

How do I determine whether or not a particluar Key Combination is already in a MULTI-DIMENSIONAL associative array in PHP?

To simplify this posed question, assume that each cell has a Row Name and a Column name that properly maps you to the appropriate cell. I'm looping through DB records and creating a location for certain fields in a 2D array that I'll be returning to the caller. My question is how can I tell if a cell already exists at array[rownName][col...

How can i tell if an object has a key value observer attached

if you tell an objective c object to removeObservers: for a key path and that key path has not been registered, it cracks the sads. like - 'Cannot remove an observer for the key path "theKeyPath" from because it is not registered as an observer.' is there a way to determine if an object has a registered observer, so i can do this if...

xslt count nodesets returned by key

In my xslt, I am trying to determine the number of distinct schedule_id values in my <event/>s so that I can output a table where each column is used for one schedule_id. The following key should retrieve the nodesets grouped as I require. So how do I determine how many nodesets are returned? <xsl:key name="events-by-schedule" match="...

Pattern Match on a Array Key

Hi. Since I'm finding this site helpful I thought I'd sign up :) I need to get the stock values out of this array: Array ( [stock0] => 1 [stockdate0] => [stock1] => 3 [stockdate1] => apple [stock2] => 2 [ stockdate2] => ) I need to pattern match on this array, where the array key = "stock" + 1 wildcard character. I have tried us...

How can I use externally generated keys to encrypt and decrypt the data in iPhone?

I am working on an application, in which I need to encrypt and decrypt the data, with the keys generated by server. I viewed the sample code of Crypto Exercise. In that keys are automatically generated. How can I use externally generated keys in the code? Please help. ...

How to use KeyPress event in textBox with Tab character?

private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Tab) { keybox4.Focus(); } } It not working but enter character its Working? ...

array component with string keys

About two years ago I have found a component that can be used to create array with string keys on delphi... anyone know a component like this?? ...