i have a hashmap where every key has many values(stored in a arraylist). How to display the arraylist i.e the values for a particular key in a hashmap in java??
I'm storing several versions of a file based on a digest of the original filename and its version, like this:
$filename = sha1($original . ':' . $version);
Would it be worth it to cache the digest ($filename) in memcache as a key/value pair (the key being the original + version and value the sha1 hash), or is generating the digest quick enough (for a high traffic php web app)?
Thanks,
Johnathan
What is the difference between INSTEAD OF and AFTER trigger in MS-SQL?
INSTEAD OF trigger invoked before unique key constraint, will the AFTER trigger invoke after unique key constraint?
So when I set up my entitlements in my iPhone app project, I create a new Entitlements.plist, and set the value of get-task-allow to false. But why? What does this key represent?
EDIT
Note this is related to this question - I found that flipping the value of this key to true allowed me to install the app on my device)
This is how I define the find object:
Range rngDoc = m_oDocument.GetContent();
nEnd = rngDoc.GetEnd();
rngDoc.SetRange(nStart,nEnd);//do not search entire document -> faster
Find fn = rngDoc.GetFind();
However, when I execute the Find, it finds objects that lay before the given start.
Any idea how do I define where the find should search?
Thanks!
I'm getting "The 'charCode' property of a keydown event should not be used. The value is meaningless" error in firefox using jQuery. My code looks like this:
$("div#center-box div#empid-textbox input.id").keydown(function(e){
key = e.which;
if(key===13){
//do something;
};
});
does anyone know how to remedy this error?
In my iPhone project I have used this solution to encrypt data with DER encoded certificate, which was generated by openssl commands like this:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.pem -out cert.pem
openssl x509 -outform der -in cert.pem -out cert.der
openssl rsa -in privateKey.pem -outform DER -out privateKey.der
And now I want to decrypt data using private key file. How can I get the private SecKeyRef instance from DER encoded private key file?
Hello, I can't login to github with generated ssh-keys. I've followed this manual: http://help.github.com/linux-key-setup but at step:
ssh [email protected]
I get:
Agent admitted failure to sign using
the key. Permission denied
(publickey).
What's wroing? And, of course, I'm adding my own user email.
I'm wondering how other developers are handling source code conflicts for config files when system admins modify them in production. For example, if a system admin updates a appsettings key on the production server and then my team publishes out a project, it will overwrite that key.
How do you handle config file updates in your organization?
I logged into my MSDN subscription (Premium) today to download the new expression studio, and I noticed that unlike Expression 3, it requires you to enter a key, and they only provide 1.
Previously I installed Expression 3 on 2 computer, my home and my work computer. So my question is, is this no longer allowed? or is it a key that can be used multiple times?
In ASP.NET, binding a DataGrid to a list of objects is super-easy.
I end up with a row for each object in the list, and any cell in a given row is bound to a property of the corresponding object.
However, suppose one of the properties of my object is a dictionary, and each is expected to contain a specific key. Is there any way to bind one of my DataGridColumns to that dictionary key?
Thanks.
Need help. I am trying to automate error notifications to be sent in mailers. For that I am querying the sysssislog table. I have pasted an "Execute SQl task" on the package event handler "On error". For testing purpose, I am deliberately trying to load duplicate keys in a table which consists of a Primary key column(so as to get an error).
But instead of having just one error, "Violation of primary key constraint", SSIS records 3 in the table. PFA the screenshot as well. How can i restrict the tool to log only one error and not multiple ???
Package Structure.
Package ("On error Event handler") - DFT -
Oledb Source - Oledb Destination
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_SalesPerson_SalesPersonID'. Cannot insert duplicate key in object 'dbo.SalesPerson'.".
SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (56)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (56)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (43) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (56). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Please guide me. Your help is very much appreciated.
Thanks
Need some help regarding array sorting....
I have two arrays. The main one (where the key is the user id) :
$user[31] = 'Tom'
$user[43] = 'Jane'
and another array with the order they should be displayed (where key is the order and value is the user id) :
$order[1] = 43
$order[2] = 31
How can I apply the ordering to the main array using the ordering one?
Thanks guys!
Okay.. i got the offline access session key
Can some please tell me how can i get a user's status updates using the offline access session key i have ?
Looked in the Graph API and PHP SDK but nothing helps
I'm doing a INSERT INTO query in order to initialize a new table.
The primary key is RFQ_ID and Action_Time
How could add 1 milisecond to each Action_Time on new record in order to avoid "Violation of PRIMARY KEY constraint"
INSERT INTO QSW_RFQ_Log
(RFQ_ID, Action_Time, Quote_ID)
SELECT
RFQ_ID
, GETDATE() AS Action_Time
, Quote_ID
, 'Added to RFQ on Initialization' AS Note
FROM QSW_Quote
I'm trying to figure out how to parse a VCard to a Python dictionary using VObject.
vobj=vobject.readOne(string)
print vobj.behavior.knownChildren
This is all I get:
{'CATEGORIES': (0, None, None), 'ADR': (0, None, None), 'UID': (0, None, None), 'PHOTO': (0, None, None), 'LABEL': (0, None, None), 'VERSION': (1, 1, None), 'FN': (1, 1, None), 'ORG': (0, None, None), 'N': (1, 1, None), 'PRODID': (0, 1, None)}
How can I populate the dictionary with my VCard data?
A couple of times I've been in the situation where I've wanted to refactor the design of some model and have ended up putting update logic in migrations. However, as far as I've understood, this is not good practice (especially since you are encouraged to use your schema file for deployment, and not your migrations). How do you deal with these kind of problems?
To clearify what I mean, say I have a User model. Since I thought there would only be two kinds of users, namely a "normal" user and an administrator, I chose to use a simple boolean field telling whether the user was an adminstrator or not.
However, after I while I figured I needed some third kind of user, perhaps a moderator or something similar. In this case I add a UserType model (and the corresponding migration), and a second migration for removing the "admin" flag from the user table. And here comes the problem. In the "add_user_type_to_users" migration I have to map the admin flag value to a user type. Additionally, in order to do this, the user types have to exist, meaning I can not use the seeds file, but rather create the user types in the migration (also considered bad practice). Here comes some fictional code representing the situation:
class CreateUserTypes < ActiveRecord::Migration
def self.up
create_table :user_types do |t|
t.string :name, :nil => false, :unique => true
end
#Create basic types (can not put in seed, because of future migration dependency)
UserType.create!(:name => "BASIC")
UserType.create!(:name => "MODERATOR")
UserType.create!(:name => "ADMINISTRATOR")
end
def self.down
drop_table :user_types
end
end
class AddTypeIdToUsers < ActiveRecord::Migration
def self.up
add_column :users, :type_id, :integer
#Determine type via the admin flag
basic = UserType.find_by_name("BASIC")
admin = UserType.find_by_name("ADMINISTRATOR")
User.all.each {|u| u.update_attribute(:type_id, (u.admin?) ? admin.id : basic.id)}
#Remove the admin flag
remove_column :users, :admin
#Add foreign key
execute "alter table users add constraint fk_user_type_id
foreign key (type_id) references user_types (id)"
end
def self.down
#Re-add the admin flag
add_column :users, :admin, :boolean, :default => false
#Reset the admin flag (this is the problematic update code)
admin = UserType.find_by_name("ADMINISTRATOR")
execute "update users set admin=true where type_id=#{admin.id}"
#Remove foreign key constraint
execute "alter table users drop foreign key fk_user_type_id"
#Drop the type_id column
remove_column :users, :type_id
end
end
As you can see there are two problematic parts. First the row creation part in the first model, which is necessary if I would like to run all migrations in a row, then the "update" part in the second migration that maps the "admin" column to the "type_id" column.
Any advice?
I have the ciphertext and an encrypting program (with the key hardcoded in). How would I go about finding the key? Surely the availability of the encryptor must open up possibilities beyond brute-forcing it.
I have a table of data with survey results, and I want to do certain calculations on this data. The datastructure is somewhat like this:
____________________________________________________________________________________
| group |individual | key | key | key |
| | |subkey|subkey|subkey|subkey|subkey|subkey|subkey|subkey|subkey|
| | |q|q|q |q |q |q|q|q |q|q|q |q |q |q|q|q |q|q|q |q |q |q|q|q |
|-------|-----------|-|-|--|--|---|-|-|--|-|-|--|--|---|-|-|--|-|-|--|--|---|-|-|--|
| 1 | 0001 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 1 | 0002 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 1 | 0003 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 2 | 0004 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 2 | 0005 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 3 | 0006 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 4 | 0007 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
------------------------------------------------------------------------------------
Excuse my poor ascii skills...
So, every individual belongs to a group, and has answered some questions. These questions are always grouped in keys and subkeys.
Is there any simple method to calculate averages, deviations and similar based on the groupings.
Something like
public float getAverage(int key, int individual);
float avg = getAverage(5,7);
I think what I'm asking is what would be the best way to structure the data in C# to make it as easy as possible to work with?
I have started making classes for every entity, but I got confused somewhere and something stopped working. So before I continue along this path, I was wondering if there are any other, better, ways of doing this?
(Every individual can also have describing variables, like agegroup and such, but that's not important for the base functionality.)
Our current solution does all calculations inline in the queries when requesting the data from the database. This works, but it's slow and the number of queries equals questions * individuals + keys * individuals, which could be alot if individual queries.
Any suggestions?
I need to have my edit box work the same for both tab and the enter key.
I have found lots of problems doing this in the application. Is there some way that I can send a tab key to the form/edit box.
(Note that this has to be in the Compact Framework.)
Trying to solve this problem.
I would like to learn how the bootstrapper detects if prerequisites (specifically .NET 3.5) are installed.
According to this reference, a way to detect if .NET is installed is to check the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
Using process monitor, I have inspected registry queries done by the bootstrapper (setup.exe) and it did not show any access to this registry key.
Does anybody know how the bootstrapper determines whether the prerequisites are installed on the target system?
Hi,
I have two tables, one table has rowguid column and other has auto incremented column but both tables dont have primary key or foreign key. I want to create third table that store the relationship between above two tables. can somebody give me the correct and easiest way to do that. i m new using sql server. please reply me
If I use routing with 2 query parameters, like this:
System.Web.Routing.RouteTable.Routes.MapPageRoute("HomeRoute", "home/{f1}/{f2}", "~/Home.aspx");
My image does not appear on my Home.aspx page:
<img src="~/img/img.jpg" /> or <img src="img/img.jpg" />
But it does appear when I access the http://localhost:3760/Website/Home.aspx URL
I tried using Routing.Ignore with no luck. I look for a solution wich should work for an unlimited number of subfolders: "home/{f1}/{f2}/.../{fn}"
A legacy database contains a join table which links tables table1 and table2, and contains just two foreign keys:
TABLE_ORIG:
table1_id
table2_id
In order to utilize this table using JPA I would need to create a surrogate primary key to the link table. However, the existing table must not be modified at all.
I would like to create another table which would contain also a primary key in addition to the foreign keys:
TABLE_NEW:
id
table1_id
table2_id
All changes to TABLE_ORIG should be reflected in TABLE_NEW, and vice versa.
Is this doable in mysql?