key

search array and get array key

Hi all, I have an array, which I'd like to search for a value in and retreive the array key if it exists, but not sure how to even go about doing that. Here's my array: Array ( [hours] => Array ( [0] => 5 [1] => 5 [2] => 6 [3] => 6 [4] => 8 [5] => 10 ...

Retrieve autogenerated key in Oracle with SubSonic 2.2

Hi guys, I'm currently using SubSonic 2.2 to code against an Oracle XE DB, which carries certain tables that have a primary key which gets automatically filled by means of a sequence and corresponding trigger. In SQL Server this isn't a problem, since SubSonic automatically fills in the autoincrement key value into the correct property...

Find key of parent in array / PHP

Perhaps someone can help me out with this one: I'm using a basic search function to find an array deep within an array. The problem is, once that array is found, I'd also like to return it's parent key. Is there a PHP function that can determine the parent key of an array? Below is an example of the Search Function... Ideally I'd like...

Using one key for Encryption and HMAC

Hello, I am wondering whether I can use a shared secret key established between two clients as the HMAC key too. I saw that there is a problem when it is used as a CBC-MAC but I haven't found any evidence it is bad practice for HMACs. Thanks, Vladimir ...

Java HashSet key/value pair

Why does Java not provide functions to get at the key/value pairs in a HashSet like in Hashtable? It seems like a real pain to have to iterate over it every time you need to get at something. Or am I just a newb missing something? ...

PHP - Find parent key of array

I'm trying to find a way to return the value of an array's parent key. For example, from the array below I'd like to find out the parent's key where $array['id'] == "0002". The parent key is obvious because it's defined here (it would be 'products'), but normally it'd be dynamic, hence the problem. The 'id' and value of 'id' is known th...

PHP Key name array

I have an array $data fruit => apple, seat => sofa, etc. I want to loop through so that each key becomes type_key[0]['value'] so eg type_fruit[0]['value'] => apple, type_seat[0]['value'] => sofa, and what I thought would do this, namely foreach ($data as $key => $value) { # Create a new, renamed, key. $array[...

How do i replace a key up keyCode with another in jQuery?

I currently have a table which only has a single editable column. I have a jQCuery change() event associated with the column's input controls to prevent any non numeric keys being pressed, other than tab / delete / backspace. I would like to replace the Enter key with a Tab press. Can someone please show me the relevant statement to re...

Generating unique N-valued key

I want to generate unique random, N-valued key. This key can contain numbers and latin characters, i.e. A-Za-z0-9. The only solution I am thinking about is something like this (pseudocode): key = ""; smb = "ABC…abc…0123456789"; // allowed symbols for (i = 0; i < N; i++) { key += smb[rnd(0, smb.length() - 1)]; // select symbol at ra...

Encrypt a file base upon a pregenerated "key" C#

Hello everyone. I'm trying to determine the best course of action to implement a simple "licensing" system with a partner of mine. The concept is: Generate an encrypted value based upon several internal hardware components. Have the customer send this value to us which we will implement into our key generator. Once we have that, we add ...

Check For Duplicate Records VS try/catch Unique Key Constraint

I have a database table that has a Unique Key constraint defined to avoid duplicate records from occurring. I'm curious if it is bad practice to NOT manually check for duplicate records prior to running an INSERT statement on the table. In other words, should I run a SELECT statement using a WHERE clause that checks for duplicate value...

jquery event handler- trigger function upon specific key and action

Background story: when a user selects a portion of text in a text field with her mouse (mark it up manually), and subsequently hits "alt" key, a certain function would trigger. My questions are: How can I trigger a function when a user hits a key (in her keyboard)? How can I preserve a portion of text selected, and use it as a paramet...

What are the techniques to implement evaluation period and ensure it is not tempered?

I've a simple product installer for windows OS, which could be evaluated for a month. What are the techniques I can use so that this piece of software is not used after a month? I've seen that several s/w use system date to check it but it's very primitive and easily forge-able. I think a key based system based on registry or online veri...

Very long strings as primary keys in a database for caching

Hi, I am working on a web app that allows users to create dynamic PDF files based on what they enter into a form (it is not very structured data). The idea is that User 1 enters several words (arbitrary # of words, practically capped of course), for example: A B C D E There is no such string in the database, so I was thinking: Stor...

AS3 equivalent of PHP key array

Hey all, title may be abit misleading but i didnt know the correct way to write it. Basically, how can i do the AS3 equivalent of this php code: return array('x' => 0, 'y' => 0); ...

MySQL won't use index for query?

I have this table: CREATE TABLE `point` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `siteid` INT(11) NOT NULL, ...

Simulating Key Press event using Python for Linux

Hi, I am writing a script to automate running a particular model. When the model fails, it waits for a user input (Enter key). I can detect when the model has failed, but I am not able to use python (on linux) to simulate a key press event. Windows has the SendKeys library to do this but I was wondering if there is a similar library for...

Javascript Accessing Multidimensional Array Keys

Hi guys. I have a javascript array that looks like this: '40x27' => array( '1' => 0 '1.5' => 2 '2' = 1 ) '36x24' => array( '1' => 1 '1.5' => 1 '2' = 2 ) etc. I want to print out the values of the inner array like this: i = 0; for (i in outerArray){ var k = 0; for (k in innerArray){ ...

violation of primary key constraint .Cannot insert duplicate key in object using ADO

Hi All we are working on a users apllication using Access2003(VBA) as software language and SQL Server 2005 as database. We are using ADO method and we encounter a problem. when users create new record in a ADO Screen and they want to save the record after implementing it they receive this error : error -2147217873 violation of primary ...

How to Encrypt a soap request using a secretkeyspec?

I have Web Service client code generated by WSDL2Java. I am trying to encrypt the Soap Envelope specifying a CallbackHandler in the wsdd. I've managed to set a username and password in plain text on the soap request, but I need to use a key instead (I have been given a .key file which seems to be a SecretKeySpec). I load the .key file,...