Hello.
How can I define shared keys in my config/locales/lang.yml ?
For example I want to use
f.label :date
and to see translated word "date" in all forms for all models.
Hi!
Im trying to find a good way to handle memcache keys for storing, retrieving and updating data to/from the cache layer in a more civilized way.
Found this pattern, which looks great, but how do I turn it into a functional part of a PHP application?
The Identity Map pattern: http://martinfowler.com/eaaCatalog/identityMap.html
Thanks!
Session[Constant] vs Session["String Literal"] Performance
I'm retrieving user-specific data like ViewData["CartItems"] = Session["CartItems"]; with a string literal for keys on every request. Should I be using constants for this?
If yes, how should I go about implementing frequently used string literals and will it significantly affect performance on a high-traffic site?
Related question does not address ASP.NET MVC or Session.
My JSON looks like this:
{
"[email protected]":"Person1",
"[email protected]":"Person65",
"[email protected]":"Person24"
}
It's returned in various number of elements, and various keys. How do I traverse the data if my code is like this:
$.post("includes/ajax.php", {
group_id : $('#group').val()
}, function(data) {
//how do i traverse data here?
}, "json");
Any help will be appreciated :)
Thanks!
Hibernate criteria, using DB2 dialect, generates the following sql with
composite keys in the IN clause, but DB2 answers that the query is incorrect:
select * from tableA where (x, y) IN ( ( 'x1', y1) )
but, DB2 throws this:
SQL0104N An unexpected token "," was found following ", y) in
( ('x1'".
Expected tokens may include: "+". SQLSTATE=42601
Array(0= blabla
1 = blabla
2 = blblll) etc..
Is there a way to change all the numeric keys to "Name" without looping through the array (so a php function)?
Is it possible to get all keys in a column family using SimpleCassie?
I looked at SimpleCassie's google code, but do not figure out.
Another issue is that I used following code to access column value.
$price = $cassie-keyspace('ToyStore')-cf('Toys')-key('Transformer')-column('Price')-get();
echo $price;
It always complains "object of cassandra columnorsupercolumn cannot be converted to string".
Is it possible to print out the column value?
Hello, I have two tables that are connected via a join table in a many-to-many relationship in the Entity Framework. I need to add a composite primary key in the join table for the two columns that are related to the joined tables via standard foreign keys but I'm sure how to do that.
Hi,
If I delete every keys in a ColumnFamily in a Cassandra db using remove(key), then if I use get_range_slices, rows are still there but without columns. How could I remove entire rows?
Thanks
Tobia Loschiavo
I'm trying to set up the NERDComment plugin in vim, but I'm having some trouble with the keys. I'd like to set the basic toggle functionality (comment a line if it's uncommented, uncomment if it's commented) to be c. The problem is that I've remapped the Leader to be ,, which is the same key that NERD wants for all of it's hotkeys. Anyone have any idea as to how to set this up?
Is it possible to navigate an NSTableView's editable cell around the NSTableView using arrow keys and enter/tab? For example, I want to make it feel more like a spreadsheet.
The users of this application are expected to edit quite a lot of cells (but not all of them), and I think it would be easier to do so if they didn't have to double-click on each cell.
According to their documentation, you should use Array hydration rather than record hydration when retrieving data for read-only purposes.
However, this means I have to access the attributes of the retrieved object using arrays and string keys:
$user['Phonenumbers'][0]['number']
instead of the OO style:
$user->PhoneNumbers[0]->number
Now I'm kinda new to PHP, but in other languages I've worked with the 2nd notation would be preferable because typos would be caught at compile time while typos in string literals would not be noticed until runtime. Does this apply to PHP/Doctrine?
Are there any repercussions using Negative Primary Keys for tables (Identity Increment -1, Identity Seed -1 in SQL Server 2005)?
The reason for this is we're creating a new database to replace an existing one. There are similar tables between the two databases and we'd like the "source" of the information to be transparent to our applications. The approach is to create views that unions tables from both databases. Negative PKs ensures the identities don't overlap.
Hi, I have an NSArray of NSDictionary objects which I would like to be able to return a new array of NSDictionaries from, where every NSDictionary has "Area == North" (for example).
The closest example I have found so far is http://stackoverflow.com/questions/958622/using-nspredicate-to-filter-an-nsarray-based-on-nsdictionary-keys but this just returns the unique values for a given key, not the dictionary that has that key. Is there any way to perform a similar operation, and to return the entire dictionary?
Hi, I just want to delete cached data, but I have many keys, for example:
user_54_books
user_54_movies
user_54_comments
user_54_foobar
I can write $cache-delete('user_54_books'); but I have to do it with all "user_ID_objects", can I say to memcache, something like delete-('user_54_*'); ? how? thanks :)
I have an ASP.NET web application for data entry, and we have big lists of radiobuttons, and long lists of checkboxes, in some sections.
The client wants to be able to be able to navigate and manipulate these controls with their keyboard, like the tab/space/enter/right-left-up-down-arrow-keys. Are there any ASP.NET controls that I can use?
Currently I've been working with Entity Framework 1.0 which is located under a service façade.
Below is one of the save methods I've created to either update or insert the device in question.
This currently works but, I can't help feel that its a bit of a hack having to set the referenced properties to null then re-attach them just to get an insert to work. The changedDevice already holds these values, so why do I need to assign them again.
So, I thought I'll update the model to EF4. That way I can just directly access the foreign keys. However, on doing this I've found that there doesn't seem to be an easy way to add the foreign keys except by removing the entity from the diagram and re-adding it. I don't want to do this as I've already been through all the entity properties renaming them from the DB column names. Can anyone help?
/// <summary>
/// Saves the non network device.
/// </summary>
/// <param name="nonNetworkDeviceDto">The non network device dto.</param>
public void SaveNonNetworkDevice(NonNetworkDeviceDto nonNetworkDeviceDto)
{
using (var context = new AssetNetworkEntities2())
{
var changedDevice = TransformationHelper.ConvertNonNetworkDeviceDtoToEntity(nonNetworkDeviceDto);
if (!nonNetworkDeviceDto.DeviceId.Equals(-1))
{
var originalDevice =
context.NonNetworkDevices.Include("Status").Include("NonNetworkType").FirstOrDefault(
d => d.DeviceId.Equals(nonNetworkDeviceDto.DeviceId));
context.ApplyAllReferencedPropertyChanges(originalDevice, changedDevice);
context.ApplyCurrentValues(originalDevice.EntityKey.EntitySetName, changedDevice);
}
else
{
var maxNetworkDevice = context.NonNetworkDevices.OrderBy("it.DeviceId DESC").First();
changedDevice.DeviceId = maxNetworkDevice.DeviceId + 1;
var status = changedDevice.Status;
var nonNetworkType = changedDevice.NonNetworkType;
changedDevice.Status = null;
changedDevice.NonNetworkType = null;
context.AttachTo("DeviceStatuses", status);
if (nonNetworkType != null)
{
context.AttachTo("NonNetworkTypes", nonNetworkType);
}
changedDevice.Status = status;
changedDevice.NonNetworkType = nonNetworkType;
context.AddToNonNetworkDevices(changedDevice);
}
context.SaveChanges();
}
}
How do I bind the media keys (play pause stop forward .. ) to corresponding functions in the vlc player. For now, I have to use the spacebar for play/pause and stuff like that. I'd prefer being able to vlc even when it is minimized!
How do you access an std::vector of the keys or values of an std::map?
Thanks.
Edit: I would like to access the actual elements, not just copies of their contents. essentially I want a reference, not a copy.
This is essentially what I am wanting to do:
std::map<std::string, GLuint> textures_map;
// fill map
glGenTextures( textures_map.size(), &textures_map.access_values_somehow[0] );
I'm looking at the pros and cons of these three primary methods of coming up with primary keys for database rows.
So assuming I am using a database that supports more than one of these methods, is there a simple heuristic to determine what the best option would be for me?
How do considerations such a distributed/multiple masters, performance requirements, ORM use, security and testing have on the choice?
Any unexpected drawbacks that one might run into?
I created a Windows Forms Application to which I added a DataGridView and LINQ to SQL Classes from one of my databases. I can successfully bind one of my database's tables to my DataGridView:
var dataSource = from c in _db.NetworkedEquipments
select c;
dataGridView1.DataSource = dataSource;
However, the foreign keys get duplicated, that is, the columns appear twice. How can I prevent this?
say I have an Item document with :price and :qty fields. I sometimes want to find all documents matching a given :price AND :qty, and at other times it will be either :price on its own or :qty on its own.
I have already indexed the :price and :qty keys, but do I also need to create a compound index on both together or are the single key indexes enough?
Is there any way by which I can add keys to superglobals in php without defining the corresponding values to those key?
For example:
$_SESSION['key']='set';//key` automatically gets defined.
But I want to do something like this
add_key($_SESSION,'key')//key is added to $_SESSION array.
Is it possible?
I am using VS 2010 and SL 4.And I came up with strange behaviour of the listbox that it don't have keyboard navigation(the one which is present in wpf :( ).So is there a way or any idea or suggestion how can i do it.. I know the long way thats shown up here ,
link text
But anything simpler then this or shortes then this will be nice.. :)
Pressing up/down keys will navigate through items present in the silverlight listbox