If I have two dictionaries I'd like to combine in Python, i.e.
a = {'1': 1, '2': 2}
b = {'3': 3, '4': 4}
If I run update on them it reorders the list:
a.update(b)
{'1': 1, '3': 3, '2': 2, '4': 4}
when what I really want is attach "b" to the end of "a":
{'1': 1, '2': 2, '3': 3, '4': 4}
Is there an easy way to attach "b" to the end of "a" without having to manually combine them like so:
for key in b:
a[key]=b[key]
Something like += or append() would be ideal, but of course neither works on dictionaries.
I have this snippet of the code:
set calls = `cut -d" " -f2 ${2} | grep -c "$numbers"`
set messages = `cut -d" " -f2 ${3} | grep -c "$numbers"`
@ popularity = (calls * 3) + messages
and error
@ expression syntax
what does it mean? grep -c returns number, am I wrong, thanks in advance
in $numbers I have list of numbers, 2 and 3 parameters also contain numbers
I'm creating a Windows Phone 7 app and learning Silverlight in the process. I have a youtube video url and I'd like the user to be able to click a video thumbnail in my list and go to a youtube app to view the video (similar to iPhone). Is this possible? If so, can you share some code to send the user to the video? I already have a MouseLeftButtonUp event handler.
I converted all mysql tables to utf-8_unicode and started using mysql_set_charset('utf8'); function.
But after this, some characters like S, Ö started looking like Ö , Åž
How can i replace this kinda letters in mysql with UTF-8 format ?
shortly, can i find a list of all these kinda characters to replace ?
EDIT:
He is explaining about this issue in this article actually but i cannot understand it properly acutally lol
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html
Hi,
I have two tables table1 and table2, i need to write a select query which will list me the columns that exist in both the tables.(mysql)
I need to do for different tables (2 at a time)
Is this possible?
I tried using INFORMATION_SCHEMA.COLUMNS but am not able to get it right.
I have three models: User, RaceWeek, Race
#
Current associations:
User has_many race_weeks; RaceWeek belongs to user; RaceWeek has many races; Race belongs to RaceWeek
#
So the user_id is a foreign key in RaceWeek and race_week_id is a foreign key in Race.
#
fastest_time is an attribute of the Race model.
#
QUESTION: What's the optimal way to retrieve a list of users who have the top X fastest race times?
Hi, I have defined my class:
public class Host
{
public string Name;
}
then a strobgly-typed dictionary:
Dictionary<string, Host> HostsTable;
then I try to compare a value:
if (HostsTable.Values.Where(s => s.Name == "myhostname") != null) { doSomething }
and the problem is, nothing is found, even I'm sure the item is on the list. What I'm doing wrong ?
I have a class where I'm using __set. Because I don't want it to set just anything, I have an array of approved variables that it checks before it will actually set a class property.
However, on construct, I want the __construct method to set several class properties, some of which are not in the approved list. So when construct happens, and I do $this->var = $value, I of course get my exception that I'm not allowed to set that variable.
Can I get around this somehow?
hi,
I have a "Search" field in my website and I was wondering if I can assign my View to the search results, instead of using the default list.
Is this feasible ? How ?
thanks
git-cherry lets me find all the commits missing from upstream. How do I find all the commits that are there in local lab branch but not in local master branch.
git branch -d lab
Above operation fails because I have some commits not merged. I want the list of those commits that are not merged.
I need to divide into groups several <li> elements in a list, is it possible?
(I know I an give each element different class names/separate into different <ul>)
I have a business object structured like this:
Country has States, State has Cities
So Country[2].States[7].Cities[5].Name would be New York
Ok, I need to get a list of all the Country objects which have at least 1 City.IsNice == true
How do I get that?
Hi,
I am developing an Eclipse Plugin. I want to add my custom Task Tag programmatically within the plugin. (Lets say DOTHIS) Later, i want to list the lines marked with DOTHIS tag in my custom taskView
I know that it is done using the Eclipse UI from Project Properties Java Compiler Task Tags New. and then in the task view by Configure Contents but how can i do these arranegments within the plugin?
Thanks in advance.
You can do Type[] interfaces = typeof(MyClass).GetInterfaces(); to get a list of everything a class implements implements.
I am wondering if there is anyway to crawl the "extends" tree to see all the base types a class inherits, i.e. abstract classes etc.?
How to convert the below code
double sumxy = 0;
for (int i = 0; i < x.Count; i++)
{sumxy = sumxy + (x[i] * y[i]);}
by using lambda
I am using C#3.0. x and y are list of double numbers
Thanks
hi,
I'm running Drupal on IIS server 6.
I'm having an interesting error to upload images into my node. I get "png" is not a known file.
See image:
http://dl.dropbox.com/u/72686/pngError.png
But I've added png (default settings) to the allow image files list, and indeed you can see in the same image, that png is an allowed extension.
Thanks
i need to jquery script for show or append all selected lable of chekbox , radio button , options from form to views in page .
like andvanced search form , after submit show your selected options in top of result list .
I am familiar with obtaining the contents of a properties file given the name of the file, and obviously MyClass.class.getResource('*.properties') will not work, but how can I obtain a list of ALL the properties files located in the same package as my class?
Possible Duplicate:
Java Generics
To be more specific, whats the role of the <String> in the following line of code?
private List<String> item = new ArrayList<String>();
I want to generate a tuple of tuple in form of ((x1,y1,x2,y2),...(x1,y1,x2,y2)) where x1,y1,x2,y2 are all in range of (0,8).
Is there any other way rather than the following?
S = list()
for x1 in range(0, 8):
for y1 in range(0, 8):
for x2 in range(0, 8):
for y2 in range(0, 8):
S.append([x1,y1,x2,y2])
S = tuple(S)
thanks
Hi
I have a table (lets say it has one column called 'colLanguage') that contains a list of skills and has a full text index defined on it. One of the entries in the table is 'c#' but when I search for 'c#' (using the following SQL) I get no results back.
select *
from
FREETEXTTABLE(tblList, colLanguage, 'c#')
Can anyone help?
Thanks
K
I'm trying to filter a list of elements via ':not()', and jQuery seems to be ignoring my filter.
here is the code:
myElements.filter(':not(.someclass)');
jquery still selects all of myElements...