In Perl, I can do this:
push(@{$h->[x]}, y);
Can I simplify the following python codes according to above Perl example?
if x not in h:
h[x] = []
h[x].append(y)
I want to simplify this, because it goes many places in my code, (and I cannot initialize all possible x with []). I do not want to make it a function, because there is no 'inline' keyword.
Any ideas?
I need to get a dictionary of properties and their values from an object declared with the dynamic keyword in .NET 4? It seems using reflection for this will not work.
Example:
dynamic s = new ExpandoObject();
s.Path = "/Home";
s.Name = "Home";
// How do I enumerate the Path and Name properties and get their values?
IDictionary<string, object> propertyValues = ???
The answer to another SO question was to use this SQL query:
SELECT o.Id, o.attrib1, o.attrib2 FROM table1 o
JOIN (
SELECT DISTINCT Id FROM table1, table2, table3 WHERE ...
) T1
ON o.id = T1.Id
Now I wonder how I can use this statement together with the keyword FOR UPDATE. If I simply append it to the query, Oracle will tell me:
ORA-02014: cannot select FOR UPDATE from view
Do I have to modify the query or is there a trick to do this with Oracle?
With MySql the statement works fine.
Hi,
I'm thinking about using Rx (Reactive Framework) in order to asynchronously query Twitter search API on a given keyword. The sample app I'd like to build should be able to display new tweets in the console.
Do you think it is possible to do that ? Would it be simpler than using standard programming techniques ?
How would you do that ?
Thank !
Jeremy
Im trying to implement the search feature in my website.
when the search keyword is entered in the textbox, and the category combo is selected, the form will be Posted and the result will be shown on the same page.
what i want is to keep the selected category of the combo by default in the form after posted
For eg., If i select the category 'Automobiles' in the combo and click search, after form submit, the combo should show the automobiles as default selected option. Please help me. Any help will be appreciated
Hi,
Could anybody tell me
the difference between operator overloading using the friend keyword and as a member function inside a class?
also what is the difference incase of any unary operator overloading i.e., as a friend and as a member function
Hi,
Is there any keyword or design pattern for doing this?
public abstract class Root
{
public abstract void foo();
}
public abstract class SubClass extends Root
{
public void foo()
{
// Do something
}
}
public class SubberClass extends SubClass
{
// Here is it not necessary to override foo()
// So is there a way to make this necessary?
// A way to obligate the developer make again the override
}
Thanks
Is there some cool Moria like theme for Visual Studio 2010?
Mine is highlighting gray font with gray background!
I just can't configure it on Tools-Options-Environment-Fonts and Colors menu. Visual Studio doesn't seem to show an item for this "highlighting keyword/tag system". You select a variable on variable called myVar, and it highlights all with the same name but with a grayer color and gray background. I just can't read it and can't set it.
Hi, I need to write a bash script to do something as another user and then return to the initial user...
Suppose I run the following as root:
#!/bin/bash
USER=zaraza
su - "${USER}"
#do some stuff as zaraza
________ #here I should logout zaraza
#continue doing things as root
In the console I should write "exit", but in bash is a keyword and it exits the script...
Thanks in advance,
I'm trying to work with sockets and I have such problem
In code example:
setsockopt(socket.SOL_SOCKET,IN.SO_BINDTODEVICE,self.listen_address+'\0')
I have error
AttributeError: 'module' object has no attribute 'SO_BINDTODEVICE'
On Linux machine this attribute is OK but on FreeBSD trere are no any SO_* attributes in module IN. What port should I install to resolve this problem on FreeBDS machine?
Python versions on Linux tested:
2.5.4 and 2.6.4;
on FreeBSD:
2.5.5
I can't find anything about this module in my book, and googling keyword IN looks like seamless ...
I have an arraylist (eg: h1) contain some urls.
eg: http://www.google.com,http://www.yahoo.com,http://www.xyz.com,.....
How can i put hyperlinks to each elements in that arraylist in c# ? Means by clicking on that url it should navigate to corresponding website.Can you give an example??
Also, how can i use 'Hyperlink' keyword in c# ?
Possible Duplicate:
The written versions of the logical operators.
I notice that C++ define keyword and, or, not, xor, and_eq, or_eq, not_eq and xor_eq as an alternative to &&, ||, !, ^, &=, |=, != and |=. and they're rarely used! What's wrong? Are they not portable?
Hey,
I know whats the difference between a NULL value and an empty string ("") value, but if I want to get a value by using the OR keyword, I get no result for a NULL value
The table i want to query looks like this:
titles_and_tags
+----+----------+------+
| id | title | tag |
+----+----------+------+
| 1 | title1 | NULL |
| 2 | title2 | tag1 |
| 3 | title3 | tag2 |
+----+----------+------+
The query i use looks like this:
select * from `titles_and_tags` WHERE `title` LIKE "title" AND `tag` = "tag1" OR `tag` IS NULL
So i want to get here a rows (id: 1,2), BUT this results 0 rows. What have i done wrong?
The line cmd.ExecuteNonQuery();
cmd.CommandText
CREATE TRIGGER subscription_trig_0 ON subscription AFTER INSERT AS UPDATE user_data SET msg_count=msg_count+1 FROM user_data
JOIN INSERTED ON user_data.id = INSERTED.recipient;
The exception:
Incorrect syntax near the keyword 'TRIGGER'.
Then using VS 2010, connected to the very same file (a mdf file) I run the query above and I get a success message. WTF!
Within a static class you cannot use the keyword "this" so I can't call this.GetType().GetFullName if I have
public static class My.Library.Class
{
public static string GetName()
{
}
}
Is there anything I can call from within GetName that will return My.Library.Class
. I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue Can you please advice.
Employee emp = new Employee();
comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1")
select new { x.Id, Name = x.FirstName + " " + x.LastName };
comHandledBySQt.DisplayMember = "Name";
comHandledBySQt.ValueMember = "Id";
Above code should displays drop list of employees first name and last name in a combo box
Trying to add a 'class' html attribute, but I think the keyword 'class' is causing issues.
<%: Html.TextBox("name", "value", new {class: " required "})%>
Is there a workaround?
Respected sir ,
i need some help for Mutable keyword it is used in a const. funcation
and pls any body explain for the live example about the mutable and constant function and also diff. for the volatile member and function pls help me
in Advance Thank you,
Is it possible to have Visual Studio code completion use the System.[Type] instead of the keyword.
Example:
Autocomplete of List<String> myList = completes as:
List<String> myList = new List<string>();
whereas, I want:
List<String> myList = new List<String>():
This isn't the only example, but hopefully shows what I'm looking for.
I already create properties and add them to property group.Then I assign to my new product.But django show me
TypeError at /manage/update-product-properties/1
save() got an unexpected keyword argument 'using'
Hi my question
Need to get the 10 word before and 10 words after for the given text . i mean need to start the 10 words before the keyword and end with 10 word after the key word.
Given text : "Twenty-three"
The main trick : content having some html tags etc .. tags need to keep that tag with this content only . need to display the words from 10before - 10after
content is bellow :
removed
Thank you
I'm using some 3rd party AWT components in a desktop application. The component's layout is changed within the paint() method, and this causes some very strange behaviour. This appears to be fixed by adding the synchronized keyword to the paint() method, but is this a safe thing to do?
This is what I'm doing:
while (@counter < 3 and @newBalance >0)
begin
CASE
when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee)
when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee)
END
@counter = @counter +1
end
I get this error:
Incorrect syntax near the keyword 'CASE'.
No idea why. Please help!