question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,262,354
6,264,481
Validate specific XML with XSD
We have specific XML that has specific structure: someValueA someValueB Is it possible to validate it using XSD in such a way that the element with type “a” is required and that of type “b” is not required?
In XSD 1.0 you can't apply different constraints to different sibling elements that have the same element name. It looks like you need XSD 1.1 assertions - available now in Saxon and Xerces.
Validate specific XML with XSD We have specific XML that has specific structure: someValueA someValueB Is it possible to validate it using XSD in such a way that the element with type “a” is required and that of type “b” is not required?
TITLE: Validate specific XML with XSD QUESTION: We have specific XML that has specific structure: someValueA someValueB Is it possible to validate it using XSD in such a way that the element with type “a” is required and that of type “b” is not required? ANSWER: In XSD 1.0 you can't apply different constraints to dif...
[ "xml", "validation", "xsd" ]
1
1
223
1
0
2011-06-07T08:10:51.887000
2011-06-07T11:25:51.540000
6,262,375
6,264,333
WP7 ListBox Scrolling Not Working
I have the following XAML markup in a WP7 UserControl. My problem is that when my ListBox has more items than will fit on a page it will not scroll properly. I can scroll the list by panning upwards with my finger but as soon as I remove my finger it jumps back to the top of the list (if the list is very long then the ...
Specify ListBox.Height - something like Height="200". As it is now, ListBox expands automatically to accomodate all loaded items and it grows out of the screen. As a result you get large page with no scroller. When you add ListBox.Height, the ListBox area won't grow. Instead ListBox ScrollViewer will be activated and y...
WP7 ListBox Scrolling Not Working I have the following XAML markup in a WP7 UserControl. My problem is that when my ListBox has more items than will fit on a page it will not scroll properly. I can scroll the list by panning upwards with my finger but as soon as I remove my finger it jumps back to the top of the list (...
TITLE: WP7 ListBox Scrolling Not Working QUESTION: I have the following XAML markup in a WP7 UserControl. My problem is that when my ListBox has more items than will fit on a page it will not scroll properly. I can scroll the list by panning upwards with my finger but as soon as I remove my finger it jumps back to the...
[ "windows-phone-7", "listbox", "scroll" ]
14
41
8,571
2
0
2011-06-07T08:12:34.130000
2011-06-07T11:11:23.863000
6,262,386
6,262,413
How can I return 10 of the most recent results in sql?
This works fine and gives me the most recent results back: SELECT * FROM table ORDER BY date ASC; But when I put a limit on it to reduce the results to just 10 of the most recent, it doesn't give me the most recent results: SELECT * FROM table ORDER BY date ASC LIMIT 30; How else can I do this?
try SELECT * FROM table ORDER BY date DESC LIMIT 10; the DESC clause asks for records with the most recent date first. Assuming your date field is a DATETIME-style field, this should work.
How can I return 10 of the most recent results in sql? This works fine and gives me the most recent results back: SELECT * FROM table ORDER BY date ASC; But when I put a limit on it to reduce the results to just 10 of the most recent, it doesn't give me the most recent results: SELECT * FROM table ORDER BY date ASC LIM...
TITLE: How can I return 10 of the most recent results in sql? QUESTION: This works fine and gives me the most recent results back: SELECT * FROM table ORDER BY date ASC; But when I put a limit on it to reduce the results to just 10 of the most recent, it doesn't give me the most recent results: SELECT * FROM table ORD...
[ "sql", "limit" ]
1
1
177
4
0
2011-06-07T08:14:29.087000
2011-06-07T08:18:10.683000
6,262,397
6,262,439
String.replaceAll is considerably slower than doing the job yourself
I have an old piece of code that performs find and replace of tokens within a string. It receives a map of from and to pairs, iterates over them and for each of those pairs, iterates over the target string, looks for the from using indexOf(), and replaces it with the value of to. It does all the work on a StringBuffer ...
While using regular expressions imparts some performance impact, it should not be as terrible. Note that using String.replaceAll() will compile the regular expression each time you call it. You can avoid that by explicitly using a Pattern object: Pattern p = Pattern.compile("[,. ]+"); // repeat only the following part...
String.replaceAll is considerably slower than doing the job yourself I have an old piece of code that performs find and replace of tokens within a string. It receives a map of from and to pairs, iterates over them and for each of those pairs, iterates over the target string, looks for the from using indexOf(), and repl...
TITLE: String.replaceAll is considerably slower than doing the job yourself QUESTION: I have an old piece of code that performs find and replace of tokens within a string. It receives a map of from and to pairs, iterates over them and for each of those pairs, iterates over the target string, looks for the from using i...
[ "java", "regex", "string", "replace" ]
36
71
42,066
5
0
2011-06-07T08:15:53.413000
2011-06-07T08:20:57.747000
6,262,398
6,262,479
java JOptionPane skip pressing OK button
Hi i have something like this JOptionPane.showMessageDialog(null, Config.CHECK_INTERNET_CONNECTION); System.out.println("go"); // HERE I CHECK MY INTERNET CONNECTION aftter Dialog window popup application has to wait with printing go till i press OK button, is there chance to skip it? So that sign go will print after w...
You have to use modeless JDialog. See The New Modality API in Java SE 6.
java JOptionPane skip pressing OK button Hi i have something like this JOptionPane.showMessageDialog(null, Config.CHECK_INTERNET_CONNECTION); System.out.println("go"); // HERE I CHECK MY INTERNET CONNECTION aftter Dialog window popup application has to wait with printing go till i press OK button, is there chance to sk...
TITLE: java JOptionPane skip pressing OK button QUESTION: Hi i have something like this JOptionPane.showMessageDialog(null, Config.CHECK_INTERNET_CONNECTION); System.out.println("go"); // HERE I CHECK MY INTERNET CONNECTION aftter Dialog window popup application has to wait with printing go till i press OK button, is ...
[ "java", "swing", "popup", "joptionpane" ]
1
2
439
2
0
2011-06-07T08:16:11.337000
2011-06-07T08:24:16.607000
6,262,424
6,262,518
Problem with updating record in database
I have problem to update user data in cakephp. When I submit form I have this data in $this->data: Array ( [User] => Array ( [first_name] => Dusan [last_name] => Stojanovic [native_language_id] => 25 ) ) but, when i try to update it with: $this->User->id = $id; $this->User->save($this->data) model is not saved, because...
To properly do this you should set the validation rules' on option to create only and/or set require to false. For a quickfix, supply a $fieldlist of fields you want to save: $this->User->save($this->data, true, array('first_name', 'last_name', 'native_language_id'));
Problem with updating record in database I have problem to update user data in cakephp. When I submit form I have this data in $this->data: Array ( [User] => Array ( [first_name] => Dusan [last_name] => Stojanovic [native_language_id] => 25 ) ) but, when i try to update it with: $this->User->id = $id; $this->User->save...
TITLE: Problem with updating record in database QUESTION: I have problem to update user data in cakephp. When I submit form I have this data in $this->data: Array ( [User] => Array ( [first_name] => Dusan [last_name] => Stojanovic [native_language_id] => 25 ) ) but, when i try to update it with: $this->User->id = $id;...
[ "cakephp", "cakephp-1.3", "cakephp-model", "validation" ]
0
1
723
2
0
2011-06-07T08:19:20.247000
2011-06-07T08:27:29.130000
6,262,425
6,262,516
Jquery selector problem about "+"
Today I found a strange jquery selector in the following code: $(this).find("+div.parent").hide(); I've searched this in Jquery API and only found what pre_element+next_element means.What does the + do in the code? Thanks.
the selector + matches the element that follows the previous one for example if you want to matches all the div s that are after bold text you can use this selector: $("b+div") so if $(this) is reference to: $(this).find('+div.parent') will match all the div with class parent that are immediately after
Jquery selector problem about "+" Today I found a strange jquery selector in the following code: $(this).find("+div.parent").hide(); I've searched this in Jquery API and only found what pre_element+next_element means.What does the + do in the code? Thanks.
TITLE: Jquery selector problem about "+" QUESTION: Today I found a strange jquery selector in the following code: $(this).find("+div.parent").hide(); I've searched this in Jquery API and only found what pre_element+next_element means.What does the + do in the code? Thanks. ANSWER: the selector + matches the element t...
[ "jquery", "jquery-selectors" ]
5
6
110
4
0
2011-06-07T08:19:46.140000
2011-06-07T08:27:23.907000
6,262,445
6,262,498
Gcc compilation error when compiling a *.cc file
I have written a simple C program using gcc compiler in Ubuntu enviroment. The code is simple. Howver, when i try to compile, it is giving an error which I am not able to fathom. Here is the code and the error # include int main() { enum mar_status { single,married,divorced }; enum mar_status person1,person2; person1 =...
You are using gcc to compile C++ code? (.cc extension) Either rename the file to enum2.c or compile with g++.
Gcc compilation error when compiling a *.cc file I have written a simple C program using gcc compiler in Ubuntu enviroment. The code is simple. Howver, when i try to compile, it is giving an error which I am not able to fathom. Here is the code and the error # include int main() { enum mar_status { single,married,divor...
TITLE: Gcc compilation error when compiling a *.cc file QUESTION: I have written a simple C program using gcc compiler in Ubuntu enviroment. The code is simple. Howver, when i try to compile, it is giving an error which I am not able to fathom. Here is the code and the error # include int main() { enum mar_status { si...
[ "c", "gcc", "compiler-errors" ]
2
4
1,381
4
0
2011-06-07T08:21:16.843000
2011-06-07T08:26:00.817000
6,262,447
6,262,501
Is the unencoded equals character (=) allowed as the value of a querystring?
Lets say i have the following URL: http://www.foo.com?key1=bar&key2=baz=egg Between "baz" and "egg" is an equals. Does "baz=egg" count as value for key2 or has = to be encoded? Thanks
It may depend on your server configuration, so maybe its a good idea to encode it, but certainly on my server the value of key2 in the above example is 'baz=egg' and so encoding is not needed.
Is the unencoded equals character (=) allowed as the value of a querystring? Lets say i have the following URL: http://www.foo.com?key1=bar&key2=baz=egg Between "baz" and "egg" is an equals. Does "baz=egg" count as value for key2 or has = to be encoded? Thanks
TITLE: Is the unencoded equals character (=) allowed as the value of a querystring? QUESTION: Lets say i have the following URL: http://www.foo.com?key1=bar&key2=baz=egg Between "baz" and "egg" is an equals. Does "baz=egg" count as value for key2 or has = to be encoded? Thanks ANSWER: It may depend on your server con...
[ "parsing", "url", "encoding", "query-string", "url-parsing" ]
0
1
168
1
0
2011-06-07T08:21:26.063000
2011-06-07T08:26:29.130000
6,262,454
6,263,468
C# Backing Up And Restoring Clipboard
I have a program that uses clipboard but I want to restore the clipboard to its former state after I am done with it. This is my code: IDataObject temp = Clipboard.GetDataObject(); //Some stuff that change Cliboard here Clipboard.SetText("Hello"); //Some stuff that change Cliboard here Clipboard.SetDataObject(temp); ...
I cannot confirm whether this will work, but I see no reason why you shouldn't be able to back up the data using the longer approach of actually reading the data and restoring it afterwards. Read here: http://msdn.microsoft.com/en-us/library/system.windows.forms.idataobject.aspx You would do something like (pseudo-code...
C# Backing Up And Restoring Clipboard I have a program that uses clipboard but I want to restore the clipboard to its former state after I am done with it. This is my code: IDataObject temp = Clipboard.GetDataObject(); //Some stuff that change Cliboard here Clipboard.SetText("Hello"); //Some stuff that change Cliboard...
TITLE: C# Backing Up And Restoring Clipboard QUESTION: I have a program that uses clipboard but I want to restore the clipboard to its former state after I am done with it. This is my code: IDataObject temp = Clipboard.GetDataObject(); //Some stuff that change Cliboard here Clipboard.SetText("Hello"); //Some stuff th...
[ "c#", "winforms", "clipboard" ]
10
3
5,156
6
0
2011-06-07T08:21:55.857000
2011-06-07T09:48:32.967000
6,262,455
6,264,593
Different url depending of language/culture in ASP.net
In a site with multiple cultures support I intend to have the following routes: routes.MapRoute( "ProductsStartPage", "{lang}/Products", new { lang = defaultLanguage, controller = "Products", action = "Index" } ); routes.MapRoute( "ProductsCategoryPage", "{lang}/Products/{category}", new { lang = defaultLanguage, contr...
I wouldn't be too scared of creating another route for each language. The value for the controller in the route is essential. This is the value that you want to change, so you need a place where you keep the different values for each languages. Then, when mapping the routes I would simply loop through the supported lan...
Different url depending of language/culture in ASP.net In a site with multiple cultures support I intend to have the following routes: routes.MapRoute( "ProductsStartPage", "{lang}/Products", new { lang = defaultLanguage, controller = "Products", action = "Index" } ); routes.MapRoute( "ProductsCategoryPage", "{lang}/Pr...
TITLE: Different url depending of language/culture in ASP.net QUESTION: In a site with multiple cultures support I intend to have the following routes: routes.MapRoute( "ProductsStartPage", "{lang}/Products", new { lang = defaultLanguage, controller = "Products", action = "Index" } ); routes.MapRoute( "ProductsCategor...
[ "asp.net-mvc-3", "localization", "routes" ]
1
2
406
1
0
2011-06-07T08:21:58.120000
2011-06-07T11:36:53.013000
6,262,460
6,262,528
phone number format for iPhone
I have to make calls programmatically in my iPhone app. I have set of numbers in different countries with different formatting - braces, dots, spaces, "+" sign. Can I simply remove all of this and left only numbers? for example: +1-(609) 452-8401 => 16094528401 // usa +49(0)89.439 => 49089439 // germany +1-(949)586-125...
try this:- NSMutableString *str1=[[NSMutableString alloc] initWithString:telephoneString]; [str1 setString:[str1 stringByReplacingOccurrencesOfString:@"(" withString:@""]]; [str1 setString:[str1 stringByReplacingOccurrencesOfString:@")" withString:@""]]; [str1 setString:[str1 stringByReplacingOccurrencesOfString:@"-" w...
phone number format for iPhone I have to make calls programmatically in my iPhone app. I have set of numbers in different countries with different formatting - braces, dots, spaces, "+" sign. Can I simply remove all of this and left only numbers? for example: +1-(609) 452-8401 => 16094528401 // usa +49(0)89.439 => 4908...
TITLE: phone number format for iPhone QUESTION: I have to make calls programmatically in my iPhone app. I have set of numbers in different countries with different formatting - braces, dots, spaces, "+" sign. Can I simply remove all of this and left only numbers? for example: +1-(609) 452-8401 => 16094528401 // usa +4...
[ "ios", "iphone", "formatting", "phone-number", "phone-call" ]
4
3
1,786
1
0
2011-06-07T08:22:32.643000
2011-06-07T08:28:19.867000
6,262,481
6,262,611
Best way to display data in a gridview in C#
I have data of the format Filename Status abc.txt Found xyz.txt Not Found I need to display it on a gridview. How do I hold these values in? Should I use a multidimensional array or other collections? Which one would be best suited?
Collections are best suited. Create a File class where you can put your fields like this: class File { private string _fileName; public string fileName{ get { return _fileName;} set { _fileName= value;} } private string _status; public string status{ get { return _status;} set { _status= value;} } } Then you add eve...
Best way to display data in a gridview in C# I have data of the format Filename Status abc.txt Found xyz.txt Not Found I need to display it on a gridview. How do I hold these values in? Should I use a multidimensional array or other collections? Which one would be best suited?
TITLE: Best way to display data in a gridview in C# QUESTION: I have data of the format Filename Status abc.txt Found xyz.txt Not Found I need to display it on a gridview. How do I hold these values in? Should I use a multidimensional array or other collections? Which one would be best suited? ANSWER: Collections are...
[ "c#", ".net", "visual-studio-2005" ]
0
4
1,194
3
0
2011-06-07T08:24:28.197000
2011-06-07T08:35:43.270000
6,262,483
6,262,563
default.properties error
I have a project which I have copied from my old workspace to a new workspace. But I am getting this error Project has no default.properties file! Edit the project properties to set one. But the problem is my project has a default.properties file in it. But still I get this error. Can anyone suggest me with ideas about...
Try remove R.java then generate again. Here same problem with you. Hope this can help you.
default.properties error I have a project which I have copied from my old workspace to a new workspace. But I am getting this error Project has no default.properties file! Edit the project properties to set one. But the problem is my project has a default.properties file in it. But still I get this error. Can anyone su...
TITLE: default.properties error QUESTION: I have a project which I have copied from my old workspace to a new workspace. But I am getting this error Project has no default.properties file! Edit the project properties to set one. But the problem is my project has a default.properties file in it. But still I get this er...
[ "android", "properties" ]
0
0
485
3
0
2011-06-07T08:24:35.823000
2011-06-07T08:31:27.103000
6,262,492
6,262,619
How to get a class instance name or the right format for eval(class_instance."func1().func2()") in Python?
In the code below I can get the class name via: s.__class__.__name__ #Seq but I can not get the intance name "s" directly, this will be problem if i use eval() in: eval(s."head(20).tail(10)") # must be eval("s.head(20).tail(10)") And def foo(i_cls): eval(i_cls."head(20).tail(10)") How? Code class Seq(object): def __ini...
If you want to filter all instances of class A and then evaluate call func_foo for them then you are also able to use Ignacio code with a small addition: map(lambda inst: getattr(inst, 'func_foo')(), filter(lambda x: isinstance(x, A), locals().values())) I am sorry if it is duplicate. EDITED: l = locals() instanceNames...
How to get a class instance name or the right format for eval(class_instance."func1().func2()") in Python? In the code below I can get the class name via: s.__class__.__name__ #Seq but I can not get the intance name "s" directly, this will be problem if i use eval() in: eval(s."head(20).tail(10)") # must be eval("s.hea...
TITLE: How to get a class instance name or the right format for eval(class_instance."func1().func2()") in Python? QUESTION: In the code below I can get the class name via: s.__class__.__name__ #Seq but I can not get the intance name "s" directly, this will be problem if i use eval() in: eval(s."head(20).tail(10)") # m...
[ "python", "parameters", "eval", "instance" ]
1
1
137
1
0
2011-06-07T08:25:40.660000
2011-06-07T08:36:11.847000
6,262,494
6,262,545
How to host a WCF Service in a reference DLL via an MVC Website?
I hope that title is clear enough. I have 2 projects, MyProject.Website (ASP.NET MVC3 Front End) and MyProject.WcfService. When i host the website, i'd rather not have to host two websites inside of IIS, i'd like to be able to host just MyProject.Website and inside of that reference MyProject.WcfService. I know i can d...
Check this post where i demostrated how you can host wcf service dll Create, Host(Self Hosting, IIS hosting) and Consume WCF servcie IIS hosting To host same WCF library in your application create WCF Web application project using WCF web application. Delete the files created in the IService.cs and Service.cs file from...
How to host a WCF Service in a reference DLL via an MVC Website? I hope that title is clear enough. I have 2 projects, MyProject.Website (ASP.NET MVC3 Front End) and MyProject.WcfService. When i host the website, i'd rather not have to host two websites inside of IIS, i'd like to be able to host just MyProject.Website ...
TITLE: How to host a WCF Service in a reference DLL via an MVC Website? QUESTION: I hope that title is clear enough. I have 2 projects, MyProject.Website (ASP.NET MVC3 Front End) and MyProject.WcfService. When i host the website, i'd rather not have to host two websites inside of IIS, i'd like to be able to host just ...
[ "c#", "asp.net", "wcf", "asp.net-mvc-3" ]
8
10
11,795
1
0
2011-06-07T08:25:41.660000
2011-06-07T08:29:19.693000
6,262,496
6,262,622
JavaScript Scroller Menu
I want to make a horizontal menu that has an arrow over it that scrolls with the mouse cursor. The example: http://cartubank.ge. Does anyone have the source code for that? I'd really appreciate.
It is like LavaLamp jQuery. Look at the example in following link. LavaLamp for jQuery lovers! jQuery LavaLamp Demos - a jQuery animated menu plugin But you have to play with it to change it according to your desired design.
JavaScript Scroller Menu I want to make a horizontal menu that has an arrow over it that scrolls with the mouse cursor. The example: http://cartubank.ge. Does anyone have the source code for that? I'd really appreciate.
TITLE: JavaScript Scroller Menu QUESTION: I want to make a horizontal menu that has an arrow over it that scrolls with the mouse cursor. The example: http://cartubank.ge. Does anyone have the source code for that? I'd really appreciate. ANSWER: It is like LavaLamp jQuery. Look at the example in following link. LavaLa...
[ "javascript", "html", "css", "dhtml" ]
3
1
347
2
0
2011-06-07T08:25:57.010000
2011-06-07T08:36:25.777000
6,262,524
6,262,614
Creating a login in javascript - array comparison
I have a login box using a simple javascript login comparing usernames and passwords, before you all start I know about the security issues in using javascript for authentication. Here is the code function validate() { var un = document.getElementById("usern").value; var pw = document.getElementById("pword").value; var...
Define a variable for full name, and set it if you have the valid user: var fn = ""; /*... */ valid = true; fn = fnArray[i]; /*... */ document.getElementById("mandatory1").value = fn; Note: Actually you can check validity later on using fn. If it is empty string, then no user was logged in. This makes it have same ...
Creating a login in javascript - array comparison I have a login box using a simple javascript login comparing usernames and passwords, before you all start I know about the security issues in using javascript for authentication. Here is the code function validate() { var un = document.getElementById("usern").value; va...
TITLE: Creating a login in javascript - array comparison QUESTION: I have a login box using a simple javascript login comparing usernames and passwords, before you all start I know about the security issues in using javascript for authentication. Here is the code function validate() { var un = document.getElementById(...
[ "javascript", "arrays", "function", "for-loop", "authentication" ]
1
1
6,007
4
0
2011-06-07T08:28:05.533000
2011-06-07T08:35:53.223000
6,262,525
6,262,672
Define multiple buttons
Is there a way to define 31 buttons in one action.. Something like this: Button but[] = new Button[31]; for(int i=1;i<32;i++) { but[i] = (Button) findViewById(R.id.Button0+i ---? ); }
ViewGroup parent = (ViewGroup)findViewById(R.id.PARENT_ID_HERE); Button but[] = new Button[31]; for(int i=1;i<32;i++) { but[i] = new Button(this); // set listeners and stuff parent.addView(but[i]); }
Define multiple buttons Is there a way to define 31 buttons in one action.. Something like this: Button but[] = new Button[31]; for(int i=1;i<32;i++) { but[i] = (Button) findViewById(R.id.Button0+i ---? ); }
TITLE: Define multiple buttons QUESTION: Is there a way to define 31 buttons in one action.. Something like this: Button but[] = new Button[31]; for(int i=1;i<32;i++) { but[i] = (Button) findViewById(R.id.Button0+i ---? ); } ANSWER: ViewGroup parent = (ViewGroup)findViewById(R.id.PARENT_ID_HERE); Button but[] = new ...
[ "java", "android" ]
0
1
110
2
0
2011-06-07T08:28:11.617000
2011-06-07T08:40:43.943000
6,262,533
6,263,299
sql group query with order by and limit
My table strucutre is as follows | id | cmp | empid | empname | ttm +------+----------+-------+---------+------ | 2 | xyz | 12 | swap | 2 | 2 | xyz | 12 | sag | 3 | 2 | xyz | 14 | azr | 1 | 3 | pqr | 2 | ron | 2 | 3 | pqr | 22 | rah | 1 | 3 | pqr | 32 | pra | 5 I have done query on that like as follows (select * from t...
Rather ugly looking, and ugly sounding, but it should do what you want. It retrieves the "maxttm" for each company with each record, then uses that in sorting to allow you to assign priority to companies based on their highest ttm. SELECT * FROM ( (SELECT *, (SELECT ttm FROM test.companies ic WHERE ic.id = oc.id ORDER ...
sql group query with order by and limit My table strucutre is as follows | id | cmp | empid | empname | ttm +------+----------+-------+---------+------ | 2 | xyz | 12 | swap | 2 | 2 | xyz | 12 | sag | 3 | 2 | xyz | 14 | azr | 1 | 3 | pqr | 2 | ron | 2 | 3 | pqr | 22 | rah | 1 | 3 | pqr | 32 | pra | 5 I have done query ...
TITLE: sql group query with order by and limit QUESTION: My table strucutre is as follows | id | cmp | empid | empname | ttm +------+----------+-------+---------+------ | 2 | xyz | 12 | swap | 2 | 2 | xyz | 12 | sag | 3 | 2 | xyz | 14 | azr | 1 | 3 | pqr | 2 | ron | 2 | 3 | pqr | 22 | rah | 1 | 3 | pqr | 32 | pra | 5 ...
[ "sql", "mysql" ]
2
3
736
3
0
2011-06-07T08:28:32.220000
2011-06-07T09:34:49.440000
6,262,537
6,262,936
JNI: How to get jbyteArray size
Background I'm working with byte arrays in JNI. And I can't get length of jbyteArray. I'm writing code in eclipse in Windows 7. Java code: private native int Enroll( byte[] pSeed ); JNI code: In JNI I have a struct that have two members unsigned long length and unsigned char data[1] typedef struct blobData_s { unsigned...
You can use GetArrayLength(JNIEnv* env, jbyteArray array) Read here. Not sure what you want to do, I assume you want the content of jpSeed in bd.data[1]. Anyways, accessing the contents of a byte array, should be done with GetByteArrayElements(...).
JNI: How to get jbyteArray size Background I'm working with byte arrays in JNI. And I can't get length of jbyteArray. I'm writing code in eclipse in Windows 7. Java code: private native int Enroll( byte[] pSeed ); JNI code: In JNI I have a struct that have two members unsigned long length and unsigned char data[1] type...
TITLE: JNI: How to get jbyteArray size QUESTION: Background I'm working with byte arrays in JNI. And I can't get length of jbyteArray. I'm writing code in eclipse in Windows 7. Java code: private native int Enroll( byte[] pSeed ); JNI code: In JNI I have a struct that have two members unsigned long length and unsigned...
[ "android", "arrays", "eclipse", "size", "java-native-interface" ]
18
34
33,246
2
0
2011-06-07T08:28:47.967000
2011-06-07T09:02:41.873000
6,262,539
6,262,591
is it secure to write mysql_connect ( "localhost", "root", "mypasswd" ) on file?
Or somthing like in www/html/inc/ folder connect_db.php mysql_connect ("localhost", "root", "hashed_mypasswd"); is this more secure? Or just write mysql_connect ("localhost", "root", "mypasswd"); and make the folder ( www/html/inc/ ) only accessble from localhost using.htaccess file? Please help me with a good practice...
As long as the file will be parsed by PHP, there's nothing to worry about, and the one isn't more secure than the other. Nonetheless, there's practicality involved as well: if you write your mysql_connect in more than one place and you've decided to move your database to another host, or you've decided to change the pa...
is it secure to write mysql_connect ( "localhost", "root", "mypasswd" ) on file? Or somthing like in www/html/inc/ folder connect_db.php mysql_connect ("localhost", "root", "hashed_mypasswd"); is this more secure? Or just write mysql_connect ("localhost", "root", "mypasswd"); and make the folder ( www/html/inc/ ) only ...
TITLE: is it secure to write mysql_connect ( "localhost", "root", "mypasswd" ) on file? QUESTION: Or somthing like in www/html/inc/ folder connect_db.php mysql_connect ("localhost", "root", "hashed_mypasswd"); is this more secure? Or just write mysql_connect ("localhost", "root", "mypasswd"); and make the folder ( www...
[ "mysql" ]
3
3
4,331
2
0
2011-06-07T08:29:02.640000
2011-06-07T08:33:53.983000
6,262,551
6,263,540
What is the difference between running in VS 2010 and running a builded EXE?
As a school project we've created a C# XNA 4.0 Game that runs perfectly when run (in either Release or Debug) from Visual Studio 2010 itself. However, when it's built, the game inexplicably crashes at a certain point. The responsible code portion seems to be this: while( true ) { if( Client.readInfo ) { t.Stop(); t.Dis...
Hard to tell from the code you have posted, but I believe you need to make Client.readInfo field volatile. The reason that Thread.Sleep fixed your problem is that it puts a memory barrier as a side effect.
What is the difference between running in VS 2010 and running a builded EXE? As a school project we've created a C# XNA 4.0 Game that runs perfectly when run (in either Release or Debug) from Visual Studio 2010 itself. However, when it's built, the game inexplicably crashes at a certain point. The responsible code port...
TITLE: What is the difference between running in VS 2010 and running a builded EXE? QUESTION: As a school project we've created a C# XNA 4.0 Game that runs perfectly when run (in either Release or Debug) from Visual Studio 2010 itself. However, when it's built, the game inexplicably crashes at a certain point. The res...
[ "c#", "visual-studio", "visual-studio-2010", "xna" ]
2
1
538
2
0
2011-06-07T08:29:45.900000
2011-06-07T09:54:43.323000
6,262,565
6,262,635
C# generics type resolving
I am writing a popup window service in for our mvvm application. I have wrote this method in the popup controller void ShowDialogWithResult (Action callbackAction) where TView: FrameworkElement, IPopupContent where TViewModel: IResultViewModel; As you can see to show a popup window with view model and result the view m...
There's no way of reducing these generic type parameters in this call, but you can use inheritance in order to specialize it overloading this method. For example, if there're a lot of calls to.ShowDialogWithResult, you can inherit your controller and add an overload like.ShowDialogWithResult. Take 2: Another approach l...
C# generics type resolving I am writing a popup window service in for our mvvm application. I have wrote this method in the popup controller void ShowDialogWithResult (Action callbackAction) where TView: FrameworkElement, IPopupContent where TViewModel: IResultViewModel; As you can see to show a popup window with view ...
TITLE: C# generics type resolving QUESTION: I am writing a popup window service in for our mvvm application. I have wrote this method in the popup controller void ShowDialogWithResult (Action callbackAction) where TView: FrameworkElement, IPopupContent where TViewModel: IResultViewModel; As you can see to show a popup...
[ "c#", "generics" ]
1
1
130
1
0
2011-06-07T08:31:41.580000
2011-06-07T08:38:00.470000
6,262,570
6,262,589
how to retrieve day month and year from Timestamp(long format)
I need to retrieve day year and month from a timestamp object as long numbers: public long getTimeStampDay() { String iDate = new SimpleDateFormat("dd/MM/yyyy").format(new Date(born_date.getDate()));..... return day; //just the day } public long getTimeStampMonth() { String iDate = new SimpleDateFormat("dd/MM/yyyy"...
long timestamp = bornDate.getTime(); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(timestamp); return cal.get(Calendar.YEAR); There are calendar fields for each property you need. Alternatively you can use joda-time: DateTime dateTime = new DateTime(bornDate.getDate()); return datetime.getYear();
how to retrieve day month and year from Timestamp(long format) I need to retrieve day year and month from a timestamp object as long numbers: public long getTimeStampDay() { String iDate = new SimpleDateFormat("dd/MM/yyyy").format(new Date(born_date.getDate()));..... return day; //just the day } public long getTime...
TITLE: how to retrieve day month and year from Timestamp(long format) QUESTION: I need to retrieve day year and month from a timestamp object as long numbers: public long getTimeStampDay() { String iDate = new SimpleDateFormat("dd/MM/yyyy").format(new Date(born_date.getDate()));..... return day; //just the day } p...
[ "java", "datetime" ]
29
67
106,453
5
0
2011-06-07T08:31:58.393000
2011-06-07T08:33:44.230000
6,262,571
6,262,640
How to check element existence using its alias attributes with Mootools
How to check element existence using its alias attributes with Mootools Tried as follows. But its not working, Select High School University Elementary Schools if($$('select[alias=school_type]')) { var elv = $$('select[alias=school_type]'); var schoolType = elv[0].id; data['type_id'] = $(schoolType).get('value'); } An...
$$ was sort of an alias for document.getElements (or Slick.find now) and will always return a HTML collection--even when with 0 members. hence, the if ($$()) assertion will not be falsy. either do if ($$('selector').length) or if (document.getElement('select[alias=foo]')) instead, which will be null or element object s...
How to check element existence using its alias attributes with Mootools How to check element existence using its alias attributes with Mootools Tried as follows. But its not working, Select High School University Elementary Schools if($$('select[alias=school_type]')) { var elv = $$('select[alias=school_type]'); var sch...
TITLE: How to check element existence using its alias attributes with Mootools QUESTION: How to check element existence using its alias attributes with Mootools Tried as follows. But its not working, Select High School University Elementary Schools if($$('select[alias=school_type]')) { var elv = $$('select[alias=schoo...
[ "mootools" ]
1
3
201
1
0
2011-06-07T08:32:03.643000
2011-06-07T08:38:23.213000
6,262,572
6,271,178
Change Pushpin visibility based on Zoom level in the Bing Maps control for Silverlight
So i'm pretty new to using the Bing Maps control in Silverlight, but I have managed to get a collection of pushpin objects (each with lat/long values) plotted on the map. My question now is, how can I change the visibility of these based on the current zoom level?. Say I have 10 locations scattered across the UK, I onl...
you need to handle one of the map controls events, like viewchangeend or TargetViewChanged and decide whether to show the pins based on the new views zoom level and bounding box (the lat/lons that make up the boundary of the new view) http://msdn.microsoft.com/en-us/library/microsoft.maps.mapcontrol.map_events.aspx
Change Pushpin visibility based on Zoom level in the Bing Maps control for Silverlight So i'm pretty new to using the Bing Maps control in Silverlight, but I have managed to get a collection of pushpin objects (each with lat/long values) plotted on the map. My question now is, how can I change the visibility of these b...
TITLE: Change Pushpin visibility based on Zoom level in the Bing Maps control for Silverlight QUESTION: So i'm pretty new to using the Bing Maps control in Silverlight, but I have managed to get a collection of pushpin objects (each with lat/long values) plotted on the map. My question now is, how can I change the vis...
[ ".net", "silverlight", "bing-maps" ]
1
2
2,416
2
0
2011-06-07T08:32:19.897000
2011-06-07T20:23:54.963000
6,262,584
6,262,682
How to determine if the client is a touch device
is there any nice and clean method or trick to find out if the user is on a touch-device or not? I know there is stuff like var isiPad = navigator.userAgent.match(/iPad/i)!= null; but I simply wonder if there is a trick to generally determine if the user is on Touch device? Because there are a lot more touch devices an...
You can use the following JS function: function isTouchDevice() { var el = document.createElement('div'); el.setAttribute('ongesturestart', 'return;'); // or try "ontouchstart" return typeof el.ongesturestart === "function"; } Source: Detecting touch-based browsing. Please note the above code only tests if the browser ...
How to determine if the client is a touch device is there any nice and clean method or trick to find out if the user is on a touch-device or not? I know there is stuff like var isiPad = navigator.userAgent.match(/iPad/i)!= null; but I simply wonder if there is a trick to generally determine if the user is on Touch devi...
TITLE: How to determine if the client is a touch device QUESTION: is there any nice and clean method or trick to find out if the user is on a touch-device or not? I know there is stuff like var isiPad = navigator.userAgent.match(/iPad/i)!= null; but I simply wonder if there is a trick to generally determine if the use...
[ "javascript", "jquery", "touch", "tablet" ]
32
27
49,906
6
0
2011-06-07T08:33:26.790000
2011-06-07T08:41:21.640000
6,262,588
6,262,724
Is it possible to stub Entity Framework context and classes to test data access layer?
I'm familiar with techniques used for testing controllers and business logic in ASP.NET MVC application. Data access in our app is concentrated in special services which are loosely coupled, use interfaces and work with actual database through Entity Framework. However, as DAL became increasingly more complex, hiding a...
Mocking / stubbing EF is partially possible if you use IObjectSet and custom interface for your derived ObjectContext instance and all your EF dependent code will access EF features only through these interfaces (context will be injected). Every other EF related features must be hidden in methods exposed on object cont...
Is it possible to stub Entity Framework context and classes to test data access layer? I'm familiar with techniques used for testing controllers and business logic in ASP.NET MVC application. Data access in our app is concentrated in special services which are loosely coupled, use interfaces and work with actual databa...
TITLE: Is it possible to stub Entity Framework context and classes to test data access layer? QUESTION: I'm familiar with techniques used for testing controllers and business logic in ASP.NET MVC application. Data access in our app is concentrated in special services which are loosely coupled, use interfaces and work ...
[ "unit-testing", "entity-framework", "mocking", "data-access-layer" ]
2
11
5,096
1
0
2011-06-07T08:33:43.757000
2011-06-07T08:44:47.413000
6,262,590
6,262,639
I need a regex that return non emails from a string
After a lot of searching I found this regex that finds emails inside a string: preg_match_all("/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i", $text, $output); How can I have the exact oposite effect? I really need to know what are the words that aren't a valid email address:-)
How can I have the exact oposite effect? I really need to know what are the words that aren't a valid email address:-) If the mentioned regular expression works sufficiently for you, use preg_replace to filter out the matches, the remaining text will be everything that isn't what matched:
I need a regex that return non emails from a string After a lot of searching I found this regex that finds emails inside a string: preg_match_all("/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i", $text, $output); How can I have the exact oposite effect? I really need to know what are the word...
TITLE: I need a regex that return non emails from a string QUESTION: After a lot of searching I found this regex that finds emails inside a string: preg_match_all("/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i", $text, $output); How can I have the exact oposite effect? I really need to know...
[ "php", "regex" ]
2
2
88
2
0
2011-06-07T08:33:53.723000
2011-06-07T08:38:15.620000
6,262,593
6,263,247
ejb3.1 @Startup.. @Singleton .. @PostConstruct read from XML the Objects
I need to initialize a set of static String values stored in an XML files [ I know this is against the EJB spec ] as shown below since the over all Idea is to not hardcore within EJB's the JNDI info Utils.xml java:jdbc/MYSQLDB10 java:jms/QueueName/remote DBConnections/remote AddressBean/remote The Onload of ejbserver s...
Have you considered using the deployment descriptor and having the container do this work for you? There are of course,, and elements to cover externally configuring which things should be made available to the bean for lookup. For example: db javax.sql.DataSource java:jdbc/MYSQLDB10 I'm not sure how your vendor handle...
ejb3.1 @Startup.. @Singleton .. @PostConstruct read from XML the Objects I need to initialize a set of static String values stored in an XML files [ I know this is against the EJB spec ] as shown below since the over all Idea is to not hardcore within EJB's the JNDI info Utils.xml java:jdbc/MYSQLDB10 java:jms/QueueName...
TITLE: ejb3.1 @Startup.. @Singleton .. @PostConstruct read from XML the Objects QUESTION: I need to initialize a set of static String values stored in an XML files [ I know this is against the EJB spec ] as shown below since the over all Idea is to not hardcore within EJB's the JNDI info Utils.xml java:jdbc/MYSQLDB10 ...
[ "singleton", "startup", "ejb-3.1" ]
1
3
4,295
1
0
2011-06-07T08:34:05.903000
2011-06-07T09:30:49.193000
6,262,594
6,262,652
How to find the duplicate entries of an array of string and make them null by using HashMap
I've an array of string, I want to find the duplicate strings in the array and want to make the duplicates null by using HashMap with a good time complexity.
Sounds like you want to use a Set. This clears all duplicate entries, but you can also just create an array which has the unique entries (and no null values) String[] array = Set found = new LinkedHashSet (); for(int i=0;i
How to find the duplicate entries of an array of string and make them null by using HashMap I've an array of string, I want to find the duplicate strings in the array and want to make the duplicates null by using HashMap with a good time complexity.
TITLE: How to find the duplicate entries of an array of string and make them null by using HashMap QUESTION: I've an array of string, I want to find the duplicate strings in the array and want to make the duplicates null by using HashMap with a good time complexity. ANSWER: Sounds like you want to use a Set. This cle...
[ "java", "collections" ]
3
4
4,842
4
0
2011-06-07T08:34:10.973000
2011-06-07T08:39:17.953000
6,262,596
6,262,862
C# get obscure Active Directory Attributes
I'm trying to retrieve some obsure Active Directory Attributes: msexchmailboxsecuritydescriptor, and terminalservicesprofilepath (in userparameters) I am having trouble getting to both of them. For example, for msexchmailboxsecuritydescriptor, if I have code similar to the following: DirectoryEntry deresult = result.Ge...
I think your problem is in.Value part of the statement. Not sure how the examples have been doing it but I've noticed that whenever I call an AD Property like that, I always get an array back of which I get index 0 in case of single result items. just changing the last statment to: byte[] btwMailACL = (byte[])deresult....
C# get obscure Active Directory Attributes I'm trying to retrieve some obsure Active Directory Attributes: msexchmailboxsecuritydescriptor, and terminalservicesprofilepath (in userparameters) I am having trouble getting to both of them. For example, for msexchmailboxsecuritydescriptor, if I have code similar to the fol...
TITLE: C# get obscure Active Directory Attributes QUESTION: I'm trying to retrieve some obsure Active Directory Attributes: msexchmailboxsecuritydescriptor, and terminalservicesprofilepath (in userparameters) I am having trouble getting to both of them. For example, for msexchmailboxsecuritydescriptor, if I have code ...
[ "c#", "active-directory" ]
3
5
1,290
1
0
2011-06-07T08:34:33.237000
2011-06-07T08:56:17.590000
6,262,620
6,262,789
Qt: Should I route my signals from an external object through my mainWindow or directly to the ui elements
Im building an application where a few objets outside the mainWindow will need to talk to be connected to the ui elements, just simple on click events triggering member functions. I was wondering whether to Add slots to the main window that connect to each ui element so that I only ever need to interface my external ob...
There is no difference in syntax between connecting an "external" object or an "internal" one to a slot. The connect call takes two object pointer (from/to) and doesn't really care about where they are (except if you're using threads). The Qt Signals and slots documentation has all you need to know about these connecti...
Qt: Should I route my signals from an external object through my mainWindow or directly to the ui elements Im building an application where a few objets outside the mainWindow will need to talk to be connected to the ui elements, just simple on click events triggering member functions. I was wondering whether to Add sl...
TITLE: Qt: Should I route my signals from an external object through my mainWindow or directly to the ui elements QUESTION: Im building an application where a few objets outside the mainWindow will need to talk to be connected to the ui elements, just simple on click events triggering member functions. I was wondering...
[ "qt", "qt4" ]
2
2
882
1
0
2011-06-07T08:36:14.153000
2011-06-07T08:49:56.687000
6,262,621
6,263,147
Scope of a LiteralControl problem
I have a piece of code that creates dynamic controls using 2 while loops. As you can see, I am forced to declare both LiteralControls INSIDE each while loop because if I don't, the puBugList.Controls.Add(lineBreak) will not acknowledge. Q: Why can I not see the scope of the controls from inside a while loop? //this con...
I think you'r problem is that if you instantiate LiteralControl outside the while loop you are effectively using the same object throughout your code, and you cannot add the same control twice to a Controls collection of another control. Try the following: LiteralControl lineBreak = null; (...) while (repReader.Read()...
Scope of a LiteralControl problem I have a piece of code that creates dynamic controls using 2 while loops. As you can see, I am forced to declare both LiteralControls INSIDE each while loop because if I don't, the puBugList.Controls.Add(lineBreak) will not acknowledge. Q: Why can I not see the scope of the controls fr...
TITLE: Scope of a LiteralControl problem QUESTION: I have a piece of code that creates dynamic controls using 2 while loops. As you can see, I am forced to declare both LiteralControls INSIDE each while loop because if I don't, the puBugList.Controls.Add(lineBreak) will not acknowledge. Q: Why can I not see the scope ...
[ "c#", "asp.net", "controls", "scope" ]
1
1
410
1
0
2011-06-07T08:36:14.403000
2011-06-07T09:22:07.913000
6,262,626
6,262,645
Until when does NetworkStream.Write block?
I can think of these possible answers: Until the data is written to some internal buffer in the IP stack. Until the data is sent over the wire. Until a confirmation of reception is received from the other machine.
Until data is written to the send buffer on the sender side. So if buffer is full, it will block. The send buffer can be full if it didn't transmit data yet, because of network issues or because receive buffer is full on the receiver side. There is an experiment you can conduct: make a sender and receiver, set sender's...
Until when does NetworkStream.Write block? I can think of these possible answers: Until the data is written to some internal buffer in the IP stack. Until the data is sent over the wire. Until a confirmation of reception is received from the other machine.
TITLE: Until when does NetworkStream.Write block? QUESTION: I can think of these possible answers: Until the data is written to some internal buffer in the IP stack. Until the data is sent over the wire. Until a confirmation of reception is received from the other machine. ANSWER: Until data is written to the send bu...
[ "c#", ".net", "tcp", "io", "networkstream" ]
4
4
2,200
2
0
2011-06-07T08:36:56.833000
2011-06-07T08:38:39.527000
6,262,629
6,262,859
Sorting through request.GET in Django
I want people to be able to sort things and not just me sorting things manually. So, for example, I will have a link to sorting, and the link will be something like, /?sort=issues and this would show a list of issues in alphabetical order, etc. Or /?sort=cover and it will show a list of issues with covers only. Views.p...
sort_by = request.GET.get('sort', '-date_added') if sort_by not in ['-date_added', 'date_addded', 'pub_date', 'importance']: sort_by = '-date_added' issues_list = Issue.objects.order_by(sort_by)
Sorting through request.GET in Django I want people to be able to sort things and not just me sorting things manually. So, for example, I will have a link to sorting, and the link will be something like, /?sort=issues and this would show a list of issues in alphabetical order, etc. Or /?sort=cover and it will show a li...
TITLE: Sorting through request.GET in Django QUESTION: I want people to be able to sort things and not just me sorting things manually. So, for example, I will have a link to sorting, and the link will be something like, /?sort=issues and this would show a list of issues in alphabetical order, etc. Or /?sort=cover and...
[ "django", "django-views" ]
1
5
2,171
2
0
2011-06-07T08:37:05.073000
2011-06-07T08:55:40.737000
6,262,646
6,262,864
Can you name the parameters in a Func<T> type?
I have a "dispatch map" defined as such: private Dictionary, string>> _messageProcessing; This allows me to dispatch to different methods easily depending on the name of the DynamicEntity instance. To avoid being hated by everyone who maintains the code forever more, is there any way of naming the parameters in the Fun...
You can't do it with the built-in Func types, but it's easy enough to create your own custom delegate type and use it in a similar way: _messageProcessing.Add("input", (x, y, z) => "output"); _messageProcessing.Add("another", (x, y, z) => "example"); //... delegate string DispatchFunc(DynamicEntity first, DynamicEnti...
Can you name the parameters in a Func<T> type? I have a "dispatch map" defined as such: private Dictionary, string>> _messageProcessing; This allows me to dispatch to different methods easily depending on the name of the DynamicEntity instance. To avoid being hated by everyone who maintains the code forever more, is th...
TITLE: Can you name the parameters in a Func<T> type? QUESTION: I have a "dispatch map" defined as such: private Dictionary, string>> _messageProcessing; This allows me to dispatch to different methods easily depending on the name of the DynamicEntity instance. To avoid being hated by everyone who maintains the code f...
[ "c#", "anonymous-function" ]
40
42
16,507
4
0
2011-06-07T08:38:50.487000
2011-06-07T08:56:23.143000
6,262,653
6,263,624
Inserting into two tables and Identity_Scope()
I am building a forum and I have two tables: Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date The ThreadID is connected to the users table with a primary key: Topics.TopicsID(PK)==Threads.TopicID(FK) First i insert into the Topics table and then to ...
Both Magnus & Damien_The_Unbeliever are right - you have few syntax errors (or typos). Correct insert command should be something like insertCommand.Append(@" DECLARE @TopicSID int INSERT INTO Topics(Theme,Topics,Date) VALUES(@topic,@subTopic,GETDATE()) SET @TopicSID = SCOPE_IDENTITY() INSERT INTO Threads(UsersID,To...
Inserting into two tables and Identity_Scope() I am building a forum and I have two tables: Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date The ThreadID is connected to the users table with a primary key: Topics.TopicsID(PK)==Threads.TopicID(FK) Fi...
TITLE: Inserting into two tables and Identity_Scope() QUESTION: I am building a forum and I have two tables: Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date The ThreadID is connected to the users table with a primary key: Topics.TopicsID(PK)==Thre...
[ "asp.net", "sql", "insert" ]
0
0
983
1
0
2011-06-07T08:39:18.137000
2011-06-07T10:01:52.150000
6,262,659
6,263,827
SQL Server Implicit Order
i've got an issue due to database conception. My data are grouped in a table which looks like: IdGroup | IdValue So for each group i've got the list of value. Indeed, we should have had an order column or an id, but i can't. Do you know anyway which can prove the order of the select value based on the insert order? I m...
A couple of ideas: DBCC PAGE (undocumented) can be used to look at the raw data pages of the table. It may be possible to determine insert order by looking at the low level information. If you cannot alter the table, can you add a table to the database? If so, consider creating a table with an identity column and use a...
SQL Server Implicit Order i've got an issue due to database conception. My data are grouped in a table which looks like: IdGroup | IdValue So for each group i've got the list of value. Indeed, we should have had an order column or an id, but i can't. Do you know anyway which can prove the order of the select value base...
TITLE: SQL Server Implicit Order QUESTION: i've got an issue due to database conception. My data are grouped in a table which looks like: IdGroup | IdValue So for each group i've got the list of value. Indeed, we should have had an order column or an id, but i can't. Do you know anyway which can prove the order of the...
[ "sql", "sql-server" ]
2
3
502
5
0
2011-06-07T08:39:59.090000
2011-06-07T10:21:36.047000
6,262,680
6,262,772
Cheap but programming rich phone?
You think to yourself: what this question has to do with programming? Let me explain. I had a SE K770i and tried to write a software on it that records sound and sends it to the server. And it occurred that the development framework on this phone limits and makes it hard to send big chunks of data. So now i use older p...
As HW goes, perhaps this one which is a cheep android phone which received a lot of positive acclaim http://en.wikipedia.org/wiki/ZTE_Blade.
Cheap but programming rich phone? You think to yourself: what this question has to do with programming? Let me explain. I had a SE K770i and tried to write a software on it that records sound and sends it to the server. And it occurred that the development framework on this phone limits and makes it hard to send big ch...
TITLE: Cheap but programming rich phone? QUESTION: You think to yourself: what this question has to do with programming? Let me explain. I had a SE K770i and tried to write a software on it that records sound and sends it to the server. And it occurred that the development framework on this phone limits and makes it h...
[ "android", "mobile", "java-me", "symbian" ]
0
3
520
2
0
2011-06-07T08:41:18.167000
2011-06-07T08:48:38.640000
6,262,687
6,262,729
php how to get each number in this json tree?
{ "value": { "num": [ [ [ 12, // $num1 34 // $val1 ], [ 15, // $num2 47 // $val2 ], [ 7, // $num3 86 // $val3 ], [ 9, // $val4 101 // $val4 ] ] ] } } I have already use json decode. How to get each value in this json tree? I only can get $num1 & $val1, but I still want to get the rests. Thanks. foreach ($data['value'][...
foreach ($data['value']['num'][0] as $data) { $num[]= $data[0]; $val[]= $data[1]; }
php how to get each number in this json tree? { "value": { "num": [ [ [ 12, // $num1 34 // $val1 ], [ 15, // $num2 47 // $val2 ], [ 7, // $num3 86 // $val3 ], [ 9, // $val4 101 // $val4 ] ] ] } } I have already use json decode. How to get each value in this json tree? I only can get $num1 & $val1, but I still want to g...
TITLE: php how to get each number in this json tree? QUESTION: { "value": { "num": [ [ [ 12, // $num1 34 // $val1 ], [ 15, // $num2 47 // $val2 ], [ 7, // $num3 86 // $val3 ], [ 9, // $val4 101 // $val4 ] ] ] } } I have already use json decode. How to get each value in this json tree? I only can get $num1 & $val1, but...
[ "php", "json" ]
0
3
134
2
0
2011-06-07T08:42:20.813000
2011-06-07T08:44:58.410000
6,262,694
6,262,831
Script to get movie posters images (from amazon ?) from a list of movies
I would like to create a poster showing the movies I've seen, in this fashion: https://i.stack.imgur.com/2z1js.jpg I have a text file with the list of movies, I know how to create the poster from a bunch of images (imagemagick...), what I don't know is how to download the images. How can I automate the task of finding ...
Searching for the movie and screen scraping http://www.impawards.com would also be a solution, yet a bit process-intensive and a bit shady (TOS usually forbid you to). You would then enter a query, parse the results, go to the poster page and get the URL of the displayed image Other than that, check out the (unofficial...
Script to get movie posters images (from amazon ?) from a list of movies I would like to create a poster showing the movies I've seen, in this fashion: https://i.stack.imgur.com/2z1js.jpg I have a text file with the list of movies, I know how to create the poster from a bunch of images (imagemagick...), what I don't kn...
TITLE: Script to get movie posters images (from amazon ?) from a list of movies QUESTION: I would like to create a poster showing the movies I've seen, in this fashion: https://i.stack.imgur.com/2z1js.jpg I have a text file with the list of movies, I know how to create the poster from a bunch of images (imagemagick......
[ "download", "language-agnostic" ]
1
1
1,240
2
0
2011-06-07T08:42:39.173000
2011-06-07T08:53:27.247000
6,262,696
6,263,328
AS2: Duplicate movieclip to new layer
Ok, I know layers dont exist once compiled and that duplicated movieclips cannot be duplicated to new levels but I need some kind of work around here. I cannot use the library as the movieclip I am duplicating is dynamically generated by actionscript (a graph based on user input over time) and thus cannot be made by me...
Sort of irrelevant now, I had an array of coords from my original production of the movieclip and just decided to use that to create another with() the higher leveled mc.
AS2: Duplicate movieclip to new layer Ok, I know layers dont exist once compiled and that duplicated movieclips cannot be duplicated to new levels but I need some kind of work around here. I cannot use the library as the movieclip I am duplicating is dynamically generated by actionscript (a graph based on user input ov...
TITLE: AS2: Duplicate movieclip to new layer QUESTION: Ok, I know layers dont exist once compiled and that duplicated movieclips cannot be duplicated to new levels but I need some kind of work around here. I cannot use the library as the movieclip I am duplicating is dynamically generated by actionscript (a graph base...
[ "actionscript", "actionscript-2", "movieclip" ]
0
0
535
1
0
2011-06-07T08:42:51.213000
2011-06-07T09:37:52.887000
6,262,704
6,264,172
How to resolve interface based on service where it's passed to
I have an interface. public interface ISomeInterface {...} and two implementations (SomeImpl1 and SomeImpl2): public class SomeImpl1: ISomeInterface {...} public class SomeImpl2: ISomeInterface {...} I also have two services where I inject ISomeInterface (via contructor): public class Service1: IService1 { public Servi...
Autofac supports identification of services by name. Using this, you can register your implementations with a name (using the Named extension method). You can then resolve them by name in the IServiceX registration delegates, using the ResolveNamed extension method. The following code demonstrates this. var cb = new Co...
How to resolve interface based on service where it's passed to I have an interface. public interface ISomeInterface {...} and two implementations (SomeImpl1 and SomeImpl2): public class SomeImpl1: ISomeInterface {...} public class SomeImpl2: ISomeInterface {...} I also have two services where I inject ISomeInterface (v...
TITLE: How to resolve interface based on service where it's passed to QUESTION: I have an interface. public interface ISomeInterface {...} and two implementations (SomeImpl1 and SomeImpl2): public class SomeImpl1: ISomeInterface {...} public class SomeImpl2: ISomeInterface {...} I also have two services where I inject...
[ "c#", "autofac" ]
27
34
23,919
3
0
2011-06-07T08:43:24.880000
2011-06-07T10:56:13.850000
6,262,712
6,262,784
c++ member function pointer problem
I'm new to c++. I want to know about object pointer and pointer to member function. I wrote a code which is following: code: #include using namespace std; class golu { int i; public: void man() { cout<<"\ntry to learn \n"; } }; int main() { golu m, *n; void golu:: *t =&golu::man(); //making pointer to member function ...
Two errors corrected here: int main() { golu m, *n; void (golu::*t)() =&golu::man; n=&m (n->*t)(); } you want a pointer to function the priority of the operators is not the one you expected, I had to add parenthesis. n->*t(); is interpreted as (n->*(t())) while you want (n->*t)();
c++ member function pointer problem I'm new to c++. I want to know about object pointer and pointer to member function. I wrote a code which is following: code: #include using namespace std; class golu { int i; public: void man() { cout<<"\ntry to learn \n"; } }; int main() { golu m, *n; void golu:: *t =&golu::man(); /...
TITLE: c++ member function pointer problem QUESTION: I'm new to c++. I want to know about object pointer and pointer to member function. I wrote a code which is following: code: #include using namespace std; class golu { int i; public: void man() { cout<<"\ntry to learn \n"; } }; int main() { golu m, *n; void golu:: *...
[ "c++", "pointer-to-member" ]
9
8
5,855
4
0
2011-06-07T08:44:05.307000
2011-06-07T08:49:27.460000
6,262,714
6,262,745
Why if I filter (WHERE=) a row to be equal to a value then in the results I get different values?
I made a view in IBM, then I linked my ms-access 2003 to that view and made a query like this: select * from my_view where a="hey" but in the results I get a="hey" as well a="asd" What may I do?
Use single quotes in literal SQL strings. SELECT * FROM my_view WHERE a = 'hey'
Why if I filter (WHERE=) a row to be equal to a value then in the results I get different values? I made a view in IBM, then I linked my ms-access 2003 to that view and made a query like this: select * from my_view where a="hey" but in the results I get a="hey" as well a="asd" What may I do?
TITLE: Why if I filter (WHERE=) a row to be equal to a value then in the results I get different values? QUESTION: I made a view in IBM, then I linked my ms-access 2003 to that view and made a query like this: select * from my_view where a="hey" but in the results I get a="hey" as well a="asd" What may I do? ANSWER: ...
[ "ms-access" ]
0
1
97
1
0
2011-06-07T08:44:12.923000
2011-06-07T08:46:22.460000
6,262,716
6,262,781
fail to get procees name (vb.net)
i wan to create a program that can get the application name i can start the program but cant get the program name a = Process.Start("calc").Handle MsgBox(a) MsgBox(Process.GetProcessById(a).ToSt ring) it show Process with an Id of 1796 is not running, but the program already opened
Handle!= Id, and ToString() won't give you the process name: Dim a = Process.Start("calc").Id MsgBox(a) MsgBox(Process.GetProcessById(a).ProcessName) Displays a process ID in one message box, then "calc" in the next. If you had Option Strict On, you'd have received a warning already about your mixup between Handle and ...
fail to get procees name (vb.net) i wan to create a program that can get the application name i can start the program but cant get the program name a = Process.Start("calc").Handle MsgBox(a) MsgBox(Process.GetProcessById(a).ToSt ring) it show Process with an Id of 1796 is not running, but the program already opened
TITLE: fail to get procees name (vb.net) QUESTION: i wan to create a program that can get the application name i can start the program but cant get the program name a = Process.Start("calc").Handle MsgBox(a) MsgBox(Process.GetProcessById(a).ToSt ring) it show Process with an Id of 1796 is not running, but the program ...
[ "vb.net", "user32" ]
1
1
157
1
0
2011-06-07T08:44:31.987000
2011-06-07T08:49:17.743000
6,262,719
6,263,003
Implementing the MVP pattern on a multipage ASPx website
I am currently redesigning a piece of software from an aspx application, to support winforms as well, and by doing this I am implementing the MVP pattern to easier handle further development and make it easier to maintain two versions of the same application. But this the first time I am implementing this pattern, so a...
For point 1 it should be 1 presenter per view, unless you have a very similar presenter which would use an identical view. For point 2, you should have this as just either the void DisableControl(string name) although this isn't too necessary as it can all be handled within your aspx.cs part of the page. It depends wha...
Implementing the MVP pattern on a multipage ASPx website I am currently redesigning a piece of software from an aspx application, to support winforms as well, and by doing this I am implementing the MVP pattern to easier handle further development and make it easier to maintain two versions of the same application. But...
TITLE: Implementing the MVP pattern on a multipage ASPx website QUESTION: I am currently redesigning a piece of software from an aspx application, to support winforms as well, and by doing this I am implementing the MVP pattern to easier handle further development and make it easier to maintain two versions of the sam...
[ "c#", "asp.net", "mvp" ]
0
0
142
2
0
2011-06-07T08:44:39.787000
2011-06-07T09:08:19.523000
6,262,723
6,262,795
solve error : "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"
In my application I have integrate Three20 Library and Restkit framework, after this I am Build the code the error was generated the error is: `"Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"` and the error description is ld: duplicate symbol _OBJC_METACLAS...
It seems that you have added that lib two times. Please search libRestKitJSONParserSBJSON.a and (RKJSONParser+SBJSON.o) in entire code and you may found one of these added two times. Simply solution is remove any one of two same files.
solve error : "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1" In my application I have integrate Three20 Library and Restkit framework, after this I am Build the code the error was generated the error is: `"Command /Developer/Platforms/iPhoneSimulator.platf...
TITLE: solve error : "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1" QUESTION: In my application I have integrate Three20 Library and Restkit framework, after this I am Build the code the error was generated the error is: `"Command /Developer/Platforms/iPh...
[ "objective-c", "ios4" ]
2
2
1,016
1
0
2011-06-07T08:44:42.820000
2011-06-07T08:50:34.450000
6,262,727
6,264,400
Get output of different controller action in rails3
For generating PDF from HTML, i need to fill a variable with output from another controller action output (HTML). Is there any elegant way, how to get this HTML? Thanks
You can use: def print output = render_to_string(:action =>:index) end in your controller.
Get output of different controller action in rails3 For generating PDF from HTML, i need to fill a variable with output from another controller action output (HTML). Is there any elegant way, how to get this HTML? Thanks
TITLE: Get output of different controller action in rails3 QUESTION: For generating PDF from HTML, i need to fill a variable with output from another controller action output (HTML). Is there any elegant way, how to get this HTML? Thanks ANSWER: You can use: def print output = render_to_string(:action =>:index) end i...
[ "ruby-on-rails", "ruby-on-rails-3", "get" ]
2
3
420
2
0
2011-06-07T08:44:55.603000
2011-06-07T11:18:26.093000
6,262,728
6,265,214
Eager loading problem
I've a problem with this linq to nhibernate query var listeShopping = (from cart in session.Query ().Fetch(cart => cart.ItemShopping).ThenFetch(item => item.Manufacturer) select cart.ItemShopping).ToList (); When I launch it I've a strange error: Query specified join fetching, but the owner of the fetched association w...
I don't think it's possible to handle this scenario with Linq. But it is with HQL: var listeShopping = session.CreateQuery(@" select item from Cart cart join cart.ItemShopping item join fetch item.Manufacturer ").List (); Side note: eager fetching the Manufacturer this way is not necessarily the best performing approac...
Eager loading problem I've a problem with this linq to nhibernate query var listeShopping = (from cart in session.Query ().Fetch(cart => cart.ItemShopping).ThenFetch(item => item.Manufacturer) select cart.ItemShopping).ToList (); When I launch it I've a strange error: Query specified join fetching, but the owner of the...
TITLE: Eager loading problem QUESTION: I've a problem with this linq to nhibernate query var listeShopping = (from cart in session.Query ().Fetch(cart => cart.ItemShopping).ThenFetch(item => item.Manufacturer) select cart.ItemShopping).ToList (); When I launch it I've a strange error: Query specified join fetching, bu...
[ "nhibernate", "linq-to-nhibernate" ]
1
0
298
1
0
2011-06-07T08:44:58.013000
2011-06-07T12:35:23.610000
6,262,731
6,262,767
Enable SSL on WCF. What is required to be done on Client Side?
I want to enable SSL on WCF and what is required to be done on the WCF client side? I found out that I can do as below. BasicHttpBinding b = new BasicHttpBinding(); b.Security.Mode = BasicHttpSecurityMode.Transport; b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows. But How about the client s...
Nothing is needed on the client side if the client is generated from WSDL exposed on your service. Otherwise you can use same binding configuration. The only needed thing is configuring a certificate. If you don't have a certificate for HTTPS issued by authority which your clients trust to you must distribute the certi...
Enable SSL on WCF. What is required to be done on Client Side? I want to enable SSL on WCF and what is required to be done on the WCF client side? I found out that I can do as below. BasicHttpBinding b = new BasicHttpBinding(); b.Security.Mode = BasicHttpSecurityMode.Transport; b.Security.Transport.ClientCredentialType...
TITLE: Enable SSL on WCF. What is required to be done on Client Side? QUESTION: I want to enable SSL on WCF and what is required to be done on the WCF client side? I found out that I can do as below. BasicHttpBinding b = new BasicHttpBinding(); b.Security.Mode = BasicHttpSecurityMode.Transport; b.Security.Transport.Cl...
[ "c#", "wcf", "wcf-security" ]
3
2
513
2
0
2011-06-07T08:45:09.723000
2011-06-07T08:48:09.473000
6,262,738
6,262,981
For games, would you implement to security or to usability?
I plan to create a game that is largely online-based via mobiles. I have in my mind how I would handle authentication for both a very secure standpoint (login, credential creation, etc), and also from a very usable standpoint (device authentication, client based, no action needed). Since I am the only one in my develop...
It completely depends on what kind of game you are trying to build. If the game you are going to make is a really simple quick multiplayer game it hardly makes any sense to incorporate heavy security, just entering a name would be enough for it to be playable. On the other hand, I don't really dislike logging in all th...
For games, would you implement to security or to usability? I plan to create a game that is largely online-based via mobiles. I have in my mind how I would handle authentication for both a very secure standpoint (login, credential creation, etc), and also from a very usable standpoint (device authentication, client bas...
TITLE: For games, would you implement to security or to usability? QUESTION: I plan to create a game that is largely online-based via mobiles. I have in my mind how I would handle authentication for both a very secure standpoint (login, credential creation, etc), and also from a very usable standpoint (device authenti...
[ "android", "security" ]
4
3
115
1
0
2011-06-07T08:45:47.247000
2011-06-07T09:06:52.737000
6,262,743
6,262,829
Convert cells(1,1) into "A1" and vice versa
I am working on an worksheet generator in Excel 2007. I have a certain layout I have to follow and I often have to format cells based on input. Since the generator is dynamic I have to calculate all kinds of ranges, merge cells, etc. How can I convert values like this? Cells(1,1) into A1 and vice versa
The Address property of a cell can get this for you: MsgBox Cells(1, 1).Address(RowAbsolute:=False, ColumnAbsolute:=False) returns A1. The other way around can be done with the Row and Column property of Range: MsgBox Range("A1").Row & ", " & Range("A1").Column returns 1,1.
Convert cells(1,1) into "A1" and vice versa I am working on an worksheet generator in Excel 2007. I have a certain layout I have to follow and I often have to format cells based on input. Since the generator is dynamic I have to calculate all kinds of ranges, merge cells, etc. How can I convert values like this? Cells(...
TITLE: Convert cells(1,1) into "A1" and vice versa QUESTION: I am working on an worksheet generator in Excel 2007. I have a certain layout I have to follow and I often have to format cells based on input. Since the generator is dynamic I have to calculate all kinds of ranges, merge cells, etc. How can I convert values...
[ "excel", "vba", "cell" ]
79
144
232,094
1
0
2011-06-07T08:46:05.880000
2011-06-07T08:53:20.167000
6,262,757
6,263,093
how to save data to XML file on iPhone
I want to save data to xml file, which include Create xml file insert in it delete from it update certain node read all the elements any suggestion please, any sample tutorial code will be highly appreciated
NSURL *url = [NSURL URLWithString:@"http://abcd.com/sample.xml"]; NSData *data = [NSData dataWithContentsOfURL:url]; // Load XML data from web // construct path within our documents directory NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject...
how to save data to XML file on iPhone I want to save data to xml file, which include Create xml file insert in it delete from it update certain node read all the elements any suggestion please, any sample tutorial code will be highly appreciated
TITLE: how to save data to XML file on iPhone QUESTION: I want to save data to xml file, which include Create xml file insert in it delete from it update certain node read all the elements any suggestion please, any sample tutorial code will be highly appreciated ANSWER: NSURL *url = [NSURL URLWithString:@"http://abc...
[ "iphone", "objective-c", "xml", "ipad" ]
1
4
3,220
3
0
2011-06-07T08:47:21.563000
2011-06-07T09:16:46.480000
6,262,763
6,262,949
jQuery SVG nested groups
I need to generate an SVG nested group with jQuerySVG or RaphaëlJS. The latter doesn't support groups, so I chose the former. What I need: The website is down at the moment, but checking the web archive for documentation I can't find a way to give an element two different groups: svg.line(g, 10, 80, 140, 70); I'm looki...
According to doc you can do this: g = svg.group(); g2 = svg.group(g); svg.line(g, 10, 80, 140, 70); svg.line(g2, 10, 80, 140, 70);
jQuery SVG nested groups I need to generate an SVG nested group with jQuerySVG or RaphaëlJS. The latter doesn't support groups, so I chose the former. What I need: The website is down at the moment, but checking the web archive for documentation I can't find a way to give an element two different groups: svg.line(g, 10...
TITLE: jQuery SVG nested groups QUESTION: I need to generate an SVG nested group with jQuerySVG or RaphaëlJS. The latter doesn't support groups, so I chose the former. What I need: The website is down at the moment, but checking the web archive for documentation I can't find a way to give an element two different grou...
[ "javascript", "jquery", "svg", "raphael" ]
4
2
1,331
1
0
2011-06-07T08:47:56.113000
2011-06-07T09:03:52.643000
6,262,771
6,262,887
Serialize List<T> containing List<T>
I am trying to serialize a list that contains non-system types. Below is my serialization code which is working fine on the top level. and returns a valid XmlDocument, but doesn't seem to contain anything in a inner list. I've looked around the net - and around SO - but can't seem to find anything! Any help much apprec...
inner property must have setter in order to be serializable. If you change it to public InnerListTestClass inner { get; set; } It will be serialized, as you expect it to. 1 string1 2011-06-07T01:57:07.1200742-07:00 1 string1 2011-06-07T01:57:07.1210743-07:00
Serialize List<T> containing List<T> I am trying to serialize a list that contains non-system types. Below is my serialization code which is working fine on the top level. and returns a valid XmlDocument, but doesn't seem to contain anything in a inner list. I've looked around the net - and around SO - but can't seem t...
TITLE: Serialize List<T> containing List<T> QUESTION: I am trying to serialize a list that contains non-system types. Below is my serialization code which is working fine on the top level. and returns a valid XmlDocument, but doesn't seem to contain anything in a inner list. I've looked around the net - and around SO ...
[ "c#", ".net", "generics", "serialization", "xml-serialization" ]
7
4
1,333
1
0
2011-06-07T08:48:35.813000
2011-06-07T08:58:08.200000
6,262,780
6,262,814
Java = What are alternatives / solutions to downcasting?
I have Value-Objects/Beans (only containing members, no logic): public class Parent { String first; String second; } Some processing logic returns the "Parent". I then do some further processing and want to add furtehr fields: public class ParentAddedMembers extends Parent { String third; String fourth; } The Problem i...
(From my point of view in this case it would be legal, when downcasting the unassigned, new fields would simply hold nulls. But it seems java does not allow this). This only makes sense intuitively because the fields in Parent and ParentAddedMembers have the same names for the fields. You say yourself that having a cop...
Java = What are alternatives / solutions to downcasting? I have Value-Objects/Beans (only containing members, no logic): public class Parent { String first; String second; } Some processing logic returns the "Parent". I then do some further processing and want to add furtehr fields: public class ParentAddedMembers exte...
TITLE: Java = What are alternatives / solutions to downcasting? QUESTION: I have Value-Objects/Beans (only containing members, no logic): public class Parent { String first; String second; } Some processing logic returns the "Parent". I then do some further processing and want to add furtehr fields: public class Paren...
[ "java" ]
4
4
4,128
8
0
2011-06-07T08:49:16.217000
2011-06-07T08:52:10.080000
6,262,800
6,263,578
Unit testing with Moq
Let's say I have a plain class with several functions: public class MyClass { public int GetTotal(int myValue, string myString) { if (myValue > 10) return GetTotal(myValue); else return GetTotal(myString); } public int GetTotal(int myValue) { return myValue * 25 / 12 + 156; } public int GetTotal(string myString) { re...
Sure! In Rhino Mocks you can use a partial mock for exactly that purpose. Create a new mock like this: var mock = MockRepository.GeneratePartialMock (); Then you can mock or stub those two methods that you don't want called like this: mock.Stub(x => x.GetTotal(10)).Return(42); It requires your GetTotal methods to be vi...
Unit testing with Moq Let's say I have a plain class with several functions: public class MyClass { public int GetTotal(int myValue, string myString) { if (myValue > 10) return GetTotal(myValue); else return GetTotal(myString); } public int GetTotal(int myValue) { return myValue * 25 / 12 + 156; } public int GetTotal...
TITLE: Unit testing with Moq QUESTION: Let's say I have a plain class with several functions: public class MyClass { public int GetTotal(int myValue, string myString) { if (myValue > 10) return GetTotal(myValue); else return GetTotal(myString); } public int GetTotal(int myValue) { return myValue * 25 / 12 + 156; } p...
[ "c#", "unit-testing", "mocking", "moq" ]
6
3
4,288
2
0
2011-06-07T08:50:51.140000
2011-06-07T09:58:15.627000
6,262,802
6,264,464
exec osascript(AppleScript) from within NodeJS
I know I am probably missing this hugely, but anyone knows why this keeps returning an error? $ node -v && node v0.4.6 > var cmd = 'osascript -e "open location \"http://google.com\""'; > require('child_process').exec(cmd, function (error, stdout, stderr) { console.log(error); }); //Error message > { stack: [Getter/Set...
Probably just a quoting issue. This one works for me: $ node -v && node v0.4.8 > var cmd = 'osascript -e \'open location \"http://google.com\"\''; > require('child_process').exec(cmd, function (error, stdout, stderr) { console.log(error); }); Btw, if you just want to open a URL, there is no need to go through AppleScri...
exec osascript(AppleScript) from within NodeJS I know I am probably missing this hugely, but anyone knows why this keeps returning an error? $ node -v && node v0.4.6 > var cmd = 'osascript -e "open location \"http://google.com\""'; > require('child_process').exec(cmd, function (error, stdout, stderr) { console.log(erro...
TITLE: exec osascript(AppleScript) from within NodeJS QUESTION: I know I am probably missing this hugely, but anyone knows why this keeps returning an error? $ node -v && node v0.4.6 > var cmd = 'osascript -e "open location \"http://google.com\""'; > require('child_process').exec(cmd, function (error, stdout, stderr) ...
[ "browser", "node.js", "applescript", "exec", "osascript" ]
2
4
2,877
2
0
2011-06-07T08:51:11.110000
2011-06-07T11:24:02.010000
6,262,803
6,262,932
Java library for creating console commands
Is there a common library which helps to implement commands entered on a Java console program? I don't mean a library for parsing Java command line options like Commons CLI. I am talking about creating commands which are used in a running Java program entered into the console: > connect 127.0.01 connected! > load poem....
You could use a parser to do this. You want to take some free form text and convert it into appropriate Java objects that represent the expression the user typed in. There are many libraries available from the heavyweight ( AntLR for example) to something simpler (like JParsec ). You have also always got the option of ...
Java library for creating console commands Is there a common library which helps to implement commands entered on a Java console program? I don't mean a library for parsing Java command line options like Commons CLI. I am talking about creating commands which are used in a running Java program entered into the console:...
TITLE: Java library for creating console commands QUESTION: Is there a common library which helps to implement commands entered on a Java console program? I don't mean a library for parsing Java command line options like Commons CLI. I am talking about creating commands which are used in a running Java program entered...
[ "java", "console-application" ]
8
2
3,778
4
0
2011-06-07T08:51:17.013000
2011-06-07T09:02:26.003000
6,262,804
6,263,591
Firefox bookmarks exploration not going past first level with Javascript
I've written some code to explore my Firefox bookmarks but I only get the first level of bookmarks (i.e. I don't get the links in the folders). e.g. Search_engines / yahoo.com google.com In this example I have only access to Search_engines and google.com not yahoo.com My function being recursive I don't know why this h...
One obvious mistake is using toolbarFolder as a starting point - that's only the bookmarks toolbar. If you want all bookmarks (meaning bookmarks menu, bookmarks toolbar and unsorted bookmarks) you need to change query parameters: query.setFolders([ bookmarksService.bookmarksMenuFolder, bookmarksService.toolbarFolder, b...
Firefox bookmarks exploration not going past first level with Javascript I've written some code to explore my Firefox bookmarks but I only get the first level of bookmarks (i.e. I don't get the links in the folders). e.g. Search_engines / yahoo.com google.com In this example I have only access to Search_engines and goo...
TITLE: Firefox bookmarks exploration not going past first level with Javascript QUESTION: I've written some code to explore my Firefox bookmarks but I only get the first level of bookmarks (i.e. I don't get the links in the folders). e.g. Search_engines / yahoo.com google.com In this example I have only access to Sear...
[ "javascript", "function", "recursion", "firefox-addon", "bookmarks" ]
1
3
377
2
0
2011-06-07T08:51:17.840000
2011-06-07T09:59:46.240000
6,262,806
6,263,094
Magento + jquery slider $ is not defined
I'm integrating a content slider into magento theme, but having some issue with the js. I get the error "$ is not defined", then I found a solution from a website stating that I should add this line "jQuery.noConflict();" into my jquery file. Then in the home.phtml,:- In my page.xml, this is how I include the js After ...
Actually, there is a better alternative to what Mathew is suggesting. Use a closure to limit the scope of $, in your example you would need to change the following code: $(document).ready(function(){ $("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); }); To something such as: jQuery.noConfli...
Magento + jquery slider $ is not defined I'm integrating a content slider into magento theme, but having some issue with the js. I get the error "$ is not defined", then I found a solution from a website stating that I should add this line "jQuery.noConflict();" into my jquery file. Then in the home.phtml,:- In my page...
TITLE: Magento + jquery slider $ is not defined QUESTION: I'm integrating a content slider into magento theme, but having some issue with the js. I get the error "$ is not defined", then I found a solution from a website stating that I should add this line "jQuery.noConflict();" into my jquery file. Then in the home.p...
[ "jquery", "jquery-ui", "magento" ]
1
3
7,198
4
0
2011-06-07T08:51:22.250000
2011-06-07T09:16:47.893000
6,262,809
6,262,922
How to calculate the closest co-ordinates to a given point from a list of co-ordinates
Basically i have a users current location. i then have a list of co-ordinates. How would i go about calculating the nearest set of co-ordinates from the list against the users current location. My application is written in java for hthe android platform
http://developer.android.com/reference/android/location/Location.html Location location = new Location(""); location.setLatitude(lat); location.setLongitude(lon); check for distanceTo or distanceBetween methods. Or you can manually calculate the distance among the coordinates and find the smallest distance for calculat...
How to calculate the closest co-ordinates to a given point from a list of co-ordinates Basically i have a users current location. i then have a list of co-ordinates. How would i go about calculating the nearest set of co-ordinates from the list against the users current location. My application is written in java for h...
TITLE: How to calculate the closest co-ordinates to a given point from a list of co-ordinates QUESTION: Basically i have a users current location. i then have a list of co-ordinates. How would i go about calculating the nearest set of co-ordinates from the list against the users current location. My application is wri...
[ "java", "android", "algorithm", "google-maps" ]
3
1
606
3
0
2011-06-07T08:51:52.537000
2011-06-07T09:01:25.133000
6,262,820
6,262,908
Can I use jquery to alternate the color of these fonts?
I am using this function to change the font-size on the class "tag-link," which is numbered like "tag-link-1" "tag-link-2" etc. So that's why it's using ^ $(function () { $('a[class^="tag-link"]').css('fontSize', '1em'); }); What I would like to do, however, is also make this function change the font-color of every oth...
Try like this $(function () { $('a[class^="tag-link"]').css('fontSize', '1em'); $('a[class^="tag-link"]:odd').css('color', '#FF0000'); $('a[class^="tag-link"]:even').css('color', '#00FF00'); }); or $(function () { $('a[class^="tag-link"]').css({ 'fontSize':'1em', 'color':'#FF0000' }); $('a[class^="tag-link"]:even').css...
Can I use jquery to alternate the color of these fonts? I am using this function to change the font-size on the class "tag-link," which is numbered like "tag-link-1" "tag-link-2" etc. So that's why it's using ^ $(function () { $('a[class^="tag-link"]').css('fontSize', '1em'); }); What I would like to do, however, is al...
TITLE: Can I use jquery to alternate the color of these fonts? QUESTION: I am using this function to change the font-size on the class "tag-link," which is numbered like "tag-link-1" "tag-link-2" etc. So that's why it's using ^ $(function () { $('a[class^="tag-link"]').css('fontSize', '1em'); }); What I would like to ...
[ "jquery" ]
2
3
90
3
0
2011-06-07T08:52:28.167000
2011-06-07T08:59:57.847000
6,262,832
6,263,102
Which memory profiler will tell me what is collected in each generation?
I've recently become curious about exactly which objects are collected in which generation. It's been a while since I last used a profiler, which I think was SciTech. I don't recall it showing a breakdown of collections sorted by generation number, but I may be wrong. Before I go and install a whole bunch of profilers,...
You can use WinDbg. There's an extension called SOSex ( SOSEX ) which extends the basic commands provided by the standard SOS.DLL debugger extension. Specifically, it has a command,!dumpgen, that dumps the contents of the specified generation. Also, with SOS!FindRoots you can set a breakpoint when the GC is about to co...
Which memory profiler will tell me what is collected in each generation? I've recently become curious about exactly which objects are collected in which generation. It's been a while since I last used a profiler, which I think was SciTech. I don't recall it showing a breakdown of collections sorted by generation number...
TITLE: Which memory profiler will tell me what is collected in each generation? QUESTION: I've recently become curious about exactly which objects are collected in which generation. It's been a while since I last used a profiler, which I think was SciTech. I don't recall it showing a breakdown of collections sorted by...
[ "c#", ".net", "memory" ]
5
1
113
4
0
2011-06-07T08:53:29.493000
2011-06-07T09:17:29.250000
6,262,838
6,262,996
Pretty print table with awk
I want to print a table that looks like this: > field1 field2 field3 field4 > 11.79 7.87 11.79 68 >.. more numbers How can I arrange it that the captions for the columns are arranged in a way that puts them on top of the respective column? > field1 field2 field3 field4 > 11.79 7.87 11.79 68 >.. more numbers My generati...
How about this one-liner: awk 'BEGIN {printf("%s %8s %8s %8s \n","field1", "field2", "field3", "field4")} {printf("%6.2f %8.2f %8.2f %8.2f\n", $1, $2, $3, $4)}' input field1 field2 field3 field4 11.79 7.87 11.79 68.00 11.79 7.87 11.79 68.00 11.79 7.87 11.79 68.00 11.79 7.87 11.79 68.00 I.e. using BEGIN to print the he...
Pretty print table with awk I want to print a table that looks like this: > field1 field2 field3 field4 > 11.79 7.87 11.79 68 >.. more numbers How can I arrange it that the captions for the columns are arranged in a way that puts them on top of the respective column? > field1 field2 field3 field4 > 11.79 7.87 11.79 68 ...
TITLE: Pretty print table with awk QUESTION: I want to print a table that looks like this: > field1 field2 field3 field4 > 11.79 7.87 11.79 68 >.. more numbers How can I arrange it that the captions for the columns are arranged in a way that puts them on top of the respective column? > field1 field2 field3 field4 > 11...
[ "awk", "formatting", "tabular" ]
14
28
41,866
2
0
2011-06-07T08:53:54.737000
2011-06-07T09:07:50.520000
6,262,848
6,264,905
Adding an attribute to a ModelAndView
I'm writing a HandlerInterceptor that needs to insert a certain session-scoped bean into the Model. postHandle 's signature looks like this: public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception ModelAndView has no addAttribute funct...
Use modelAndView.addObject("key", value) There are also some other indirect ways, through modelAndView.getModel() or modelAndView.getModelMap(). But you should prefer the addObject(..) version. In fact it invokes getModelMap().addAttribute(..)
Adding an attribute to a ModelAndView I'm writing a HandlerInterceptor that needs to insert a certain session-scoped bean into the Model. postHandle 's signature looks like this: public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception ...
TITLE: Adding an attribute to a ModelAndView QUESTION: I'm writing a HandlerInterceptor that needs to insert a certain session-scoped bean into the Model. postHandle 's signature looks like this: public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)...
[ "spring", "spring-mvc" ]
9
19
15,064
1
0
2011-06-07T08:54:48.600000
2011-06-07T12:06:59.710000
6,262,849
6,263,162
Best Practice for Skipping Duplicate Entries in MySQL
I have written a feed aggregator before but am trying to optimize it a bit. In the past, using simplepie (php class) to parse the feeds, I have used the get_id() function for each feed item to return a hash (an md5 mix of link + title). I store this "id" as the "remote_id" in MySQL. However to ensure that I have no dup...
Yes, if a key should be unique in mysql, it's generally a good idea to define it as a unique key. When inserting possible duplicates you may use PDO and try {} catch () {} statements to filter them out, they will throw an exception. You won't have to check beforehand. I use something like this in a similar situation (p...
Best Practice for Skipping Duplicate Entries in MySQL I have written a feed aggregator before but am trying to optimize it a bit. In the past, using simplepie (php class) to parse the feeds, I have used the get_id() function for each feed item to return a hash (an md5 mix of link + title). I store this "id" as the "rem...
TITLE: Best Practice for Skipping Duplicate Entries in MySQL QUESTION: I have written a feed aggregator before but am trying to optimize it a bit. In the past, using simplepie (php class) to parse the feeds, I have used the get_id() function for each feed item to return a hash (an md5 mix of link + title). I store thi...
[ "php", "mysql", "rss", "aggregation", "simplepie" ]
2
1
427
1
0
2011-06-07T08:54:54.033000
2011-06-07T09:23:30.897000
6,262,860
6,263,536
Get C#-style type reference from CLR-style type full name
Given a.NET type object found through reflection, is it possible to pretty print or decompile this type as a C# declaration, taking into account C# type aliases, etc.? For example, Int32 -> int String -> string Nullable -> int? List -> List I want to be able to print out methods close to what was originally written in ...
See this answer. Example: using System.CodeDom; using System.CodeDom.Compiler; CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"); var typeRef = new CodeTypeReference("System.Nullable`1[System.Int32]"); string typeOutput = provider.GetTypeOutput(typeRef); // "System.Nullable " It will help you with i...
Get C#-style type reference from CLR-style type full name Given a.NET type object found through reflection, is it possible to pretty print or decompile this type as a C# declaration, taking into account C# type aliases, etc.? For example, Int32 -> int String -> string Nullable -> int? List -> List I want to be able to ...
TITLE: Get C#-style type reference from CLR-style type full name QUESTION: Given a.NET type object found through reflection, is it possible to pretty print or decompile this type as a C# declaration, taking into account C# type aliases, etc.? For example, Int32 -> int String -> string Nullable -> int? List -> List I w...
[ "c#", "reflection", "types", "decompiling", "pretty-print" ]
7
9
1,319
4
0
2011-06-07T08:55:48.553000
2011-06-07T09:54:22.350000
6,262,867
6,262,902
Regex to match alphanumeric character and ampersand(&)
I need regex to search string for alphanumeric, (, ), -,., / and ampersand(&). Right now i m using this regex in client side validation [^A-Za-z0-9.)(/-\&] EDIT: I want to search my string for special characters VAL.search(/[^A-Za-z0-9.)(/-\&]+/g)==-1
Escape the backslash, put the dash at the end of the character class. [^A-Za-z0-9.)(/\\&-] Not sure why you included ^, as this negates the character class.
Regex to match alphanumeric character and ampersand(&) I need regex to search string for alphanumeric, (, ), -,., / and ampersand(&). Right now i m using this regex in client side validation [^A-Za-z0-9.)(/-\&] EDIT: I want to search my string for special characters VAL.search(/[^A-Za-z0-9.)(/-\&]+/g)==-1
TITLE: Regex to match alphanumeric character and ampersand(&) QUESTION: I need regex to search string for alphanumeric, (, ), -,., / and ampersand(&). Right now i m using this regex in client side validation [^A-Za-z0-9.)(/-\&] EDIT: I want to search my string for special characters VAL.search(/[^A-Za-z0-9.)(/-\&]+/g)...
[ "regex" ]
19
23
79,449
2
0
2011-06-07T08:56:55.353000
2011-06-07T08:59:21.103000
6,262,870
6,263,326
How can I handle this generalization design issue?
In our database model we have a Beneficiary entity. A beneficiary can be a physical person or a corporate beneficiary; a phisical beneficiary has a number of attributes such as name, surname, sex, etc.; in addition, a beneficiary (either corporate or physical person) can either be foreign or not; this further distincti...
"Clean Beneficiary table, keeping only common data;" Exactly what there is to do. "Add a surrogate primary key to Beneficiary table, let's call it BeneficiaryID;" May be useful, but don't forget that IF there exists a "natural" identifier, then the uniqueness of this should be enforced too. "Split Beneficiary table, cr...
How can I handle this generalization design issue? In our database model we have a Beneficiary entity. A beneficiary can be a physical person or a corporate beneficiary; a phisical beneficiary has a number of attributes such as name, surname, sex, etc.; in addition, a beneficiary (either corporate or physical person) c...
TITLE: How can I handle this generalization design issue? QUESTION: In our database model we have a Beneficiary entity. A beneficiary can be a physical person or a corporate beneficiary; a phisical beneficiary has a number of attributes such as name, surname, sex, etc.; in addition, a beneficiary (either corporate or ...
[ "sql", "sql-server", "database", "sql-server-2005", "database-design" ]
3
5
1,188
4
0
2011-06-07T08:57:03.860000
2011-06-07T09:37:29.110000
6,262,881
6,262,923
How can my app send MMS with a photo?
I would like to compose a message from my app which I can include a photo, for example: I entered my album in the IPhone and open a photo I can click on option and then on MMS tab and the photo will be added in a message and I can send it then to a whatever contact I want. what I want is that when I click on a button o...
This is not possible with the current MessageUI API. The MSMessageComposeViewController doesn't accept attachments like the Mail View controller.
How can my app send MMS with a photo? I would like to compose a message from my app which I can include a photo, for example: I entered my album in the IPhone and open a photo I can click on option and then on MMS tab and the photo will be added in a message and I can send it then to a whatever contact I want. what I w...
TITLE: How can my app send MMS with a photo? QUESTION: I would like to compose a message from my app which I can include a photo, for example: I entered my album in the IPhone and open a photo I can click on option and then on MMS tab and the photo will be added in a message and I can send it then to a whatever contac...
[ "iphone", "objective-c", "mms" ]
8
4
11,316
4
0
2011-06-07T08:57:40.960000
2011-06-07T09:01:28.690000
6,262,895
6,263,130
vb.net Algorithm for drawing tree diagrams
This is kindy hard to explain, Am looking for an Algorithms that will take object that a linked to multiple other object and work out the best location to draw each object based on there links. this would generate a tree like diagram. So i have Object 1 then hast 10 link, one of these link is object 2 that has 5 link b...
Graphviz is a library doing such thing. They have references to papers in their documentation.
vb.net Algorithm for drawing tree diagrams This is kindy hard to explain, Am looking for an Algorithms that will take object that a linked to multiple other object and work out the best location to draw each object based on there links. this would generate a tree like diagram. So i have Object 1 then hast 10 link, one ...
TITLE: vb.net Algorithm for drawing tree diagrams QUESTION: This is kindy hard to explain, Am looking for an Algorithms that will take object that a linked to multiple other object and work out the best location to draw each object based on there links. this would generate a tree like diagram. So i have Object 1 then ...
[ "vb.net", "algorithm", "tree", "drawing", "diagram" ]
1
3
1,888
2
0
2011-06-07T08:58:43.330000
2011-06-07T09:20:24.543000
6,262,896
6,266,101
How to create a django app to send massive emails?
I wanted to create a simple interface to send massive mails for a django project ( Gitorious, GitHub ) but I don't know how to start (models, forms, views, etc.). I looked at django-mailer but it doesn't suit my needs, also I dind't find another mailer application for django that was this complete. Any documentation, a...
Everything you write will be unreliable comparing to e.g. Postfix (bounces, failures, servers down etc). Therefore, as a minimal setup, I suggest to point Django SMTP config variables to the local Postfix instance and configure Postfix to relay emails through the email account you would otherwise use directly. Then you...
How to create a django app to send massive emails? I wanted to create a simple interface to send massive mails for a django project ( Gitorious, GitHub ) but I don't know how to start (models, forms, views, etc.). I looked at django-mailer but it doesn't suit my needs, also I dind't find another mailer application for ...
TITLE: How to create a django app to send massive emails? QUESTION: I wanted to create a simple interface to send massive mails for a django project ( Gitorious, GitHub ) but I don't know how to start (models, forms, views, etc.). I looked at django-mailer but it doesn't suit my needs, also I dind't find another maile...
[ "django", "email", "django-admin", "massmail", "django-email" ]
1
4
1,033
2
0
2011-06-07T08:58:46.647000
2011-06-07T13:41:08.687000
6,262,903
6,263,145
Exception occured while using (Intent.ACTION_VIEW) in my program
I am writing a code to open Browser. But when i m running the program it shows Activity not found. Is It necessary to declare activity in Mainfest file, when i use Intent.Action_VIEW,Uri Code in my Program? I have dont lot of R & D on google but not able to find the solution. Please help. The code is following. What i ...
It depends on what you type in the textbox. Try with http://www.google.com. It worked for me. From your comment it seems you typed google.com instead of http://www.google.com. Try this!!!
Exception occured while using (Intent.ACTION_VIEW) in my program I am writing a code to open Browser. But when i m running the program it shows Activity not found. Is It necessary to declare activity in Mainfest file, when i use Intent.Action_VIEW,Uri Code in my Program? I have dont lot of R & D on google but not able ...
TITLE: Exception occured while using (Intent.ACTION_VIEW) in my program QUESTION: I am writing a code to open Browser. But when i m running the program it shows Activity not found. Is It necessary to declare activity in Mainfest file, when i use Intent.Action_VIEW,Uri Code in my Program? I have dont lot of R & D on go...
[ "android", "android-intent", "android-manifest", "intentfilter" ]
0
2
4,422
3
0
2011-06-07T08:59:21.943000
2011-06-07T09:21:50.640000
6,262,906
6,263,586
Multi-device architecture
I'm at the moment trying to make up a "core" for my multi-device project. The project is all about a web application, that authenticates the user by facebook login, and then exposes a set of new actions they can do - ex. Get all records in the database thats related to their facebook id etc. The core should be understo...
Not sure if I understand your question correctly, but... First, you will have to define, or probably decide, what the "Core" is? or what the Core should be - what will be the functionality that Core will perform. Ideally, when we say Core, it essentially means, a layer that performs basic or atomic operations. Over tha...
Multi-device architecture I'm at the moment trying to make up a "core" for my multi-device project. The project is all about a web application, that authenticates the user by facebook login, and then exposes a set of new actions they can do - ex. Get all records in the database thats related to their facebook id etc. T...
TITLE: Multi-device architecture QUESTION: I'm at the moment trying to make up a "core" for my multi-device project. The project is all about a web application, that authenticates the user by facebook login, and then exposes a set of new actions they can do - ex. Get all records in the database thats related to their ...
[ "c#", "asp.net-mvc", "wcf", "json", "mobile-website" ]
5
4
459
1
0
2011-06-07T08:59:47.260000
2011-06-07T09:59:35.327000
6,262,909
6,262,960
How to sort joined table results?
My models: namespace Music.Models { public class Album { public int AlbumID { get; set; } public virtual ICollection Songs { get; set; } } } namespace Music.Models { public class Song { public int SongID { get; set; } public int AlbumID { get; set; } public int TrackNumber { get; set; } public virtual Album Album { ge...
You call OrderBy but the returned ordered enumerable is "lost". You could add an an getter in your Album class which returns the sorted Tracks. public class Album { public int AlbumID { get; set; } public virtual ICollection Songs { get; set; } public IOrderedEnumerable SortedSongs { get { return Songs.OrderBy(s => s.T...
How to sort joined table results? My models: namespace Music.Models { public class Album { public int AlbumID { get; set; } public virtual ICollection Songs { get; set; } } } namespace Music.Models { public class Song { public int SongID { get; set; } public int AlbumID { get; set; } public int TrackNumber { get; set;...
TITLE: How to sort joined table results? QUESTION: My models: namespace Music.Models { public class Album { public int AlbumID { get; set; } public virtual ICollection Songs { get; set; } } } namespace Music.Models { public class Song { public int SongID { get; set; } public int AlbumID { get; set; } public int Track...
[ "c#", ".net", "asp.net", "asp.net-mvc-3", "sql-order-by" ]
1
1
124
2
0
2011-06-07T09:00:01.223000
2011-06-07T09:04:51.797000
6,262,914
6,262,941
maximum size of std::vector
I am using vector in my code std::vector class CEventLogInfo { // date and time unsigned short m_sMonth; unsigned short m_sDay; unsigned int m_nYear; unsigned short m_sHour; unsigned short m_sMin; unsigned short m_sSec; unsigned long m_nGatewayMacID; unsigned char m_byCommandType; unsigned char m_byStatus; unsigned ch...
Your problem isn't the size of the vector (while there are practical limits, you're nowhere near them). It is most likely due to some bug in your code that gets exposed when you create more objects. I would recommend examining the stack trace at the point of the crash, and perhaps adding it to your question. Another go...
maximum size of std::vector I am using vector in my code std::vector class CEventLogInfo { // date and time unsigned short m_sMonth; unsigned short m_sDay; unsigned int m_nYear; unsigned short m_sHour; unsigned short m_sMin; unsigned short m_sSec; unsigned long m_nGatewayMacID; unsigned char m_byCommandType; unsigned ...
TITLE: maximum size of std::vector QUESTION: I am using vector in my code std::vector class CEventLogInfo { // date and time unsigned short m_sMonth; unsigned short m_sDay; unsigned int m_nYear; unsigned short m_sHour; unsigned short m_sMin; unsigned short m_sSec; unsigned long m_nGatewayMacID; unsigned char m_byComm...
[ "c++", "stl" ]
1
8
4,377
4
0
2011-06-07T09:00:31.420000
2011-06-07T09:03:17.200000
6,262,921
6,263,022
Is there any reason to use (window.)top to reference to the current window with JavaScript?
I am currently trying to display a third-party website in an iFrame on an internal website. They are both located on the same second-level domain. The third-party website uses some JavaScript script which use top and window.top to reference to the current window. Could there be any reason for this except to prevent tha...
There is no other reason for using top than to bother sites that are framing them. Perhaps it is legacy code that had the actual code in the frameset html. Other issues with iframes could be navigation using back and forward buttons and access denied when using a window.xxx statement
Is there any reason to use (window.)top to reference to the current window with JavaScript? I am currently trying to display a third-party website in an iFrame on an internal website. They are both located on the same second-level domain. The third-party website uses some JavaScript script which use top and window.top ...
TITLE: Is there any reason to use (window.)top to reference to the current window with JavaScript? QUESTION: I am currently trying to display a third-party website in an iFrame on an internal website. They are both located on the same second-level domain. The third-party website uses some JavaScript script which use t...
[ "javascript", "web", "integration" ]
2
1
94
1
0
2011-06-07T09:01:11.973000
2011-06-07T09:10:30.890000
6,262,930
6,263,031
start firefox extension without restart
i've created a firefox addon and working well. Now the question is how can i start this addon without restart. i don't want restart disable/enable or install/uninstall process. can any one help me in this? Thanks!
http://adblockplus.org/blog/how-many-hacks-does-it-take-to-make-your-extension-install-without-a-restart https://developer.mozilla.org/en/Extensions/Bootstrapped_extensions
start firefox extension without restart i've created a firefox addon and working well. Now the question is how can i start this addon without restart. i don't want restart disable/enable or install/uninstall process. can any one help me in this? Thanks!
TITLE: start firefox extension without restart QUESTION: i've created a firefox addon and working well. Now the question is how can i start this addon without restart. i don't want restart disable/enable or install/uninstall process. can any one help me in this? Thanks! ANSWER: http://adblockplus.org/blog/how-many-ha...
[ "javascript", "firefox", "firefox-addon" ]
4
6
4,301
5
0
2011-06-07T09:02:05.450000
2011-06-07T09:11:37.957000
6,262,931
6,262,962
How can I line up a select list on my DIV?
I have this code test1 test1 1 page 2 pages I would like my select dropdown to appear to the right of the button but it appears below. Is there an easy way to make it appear the way I would like?
The easiest way is to add display: inline; to your form element via CSS. Example.
How can I line up a select list on my DIV? I have this code test1 test1 1 page 2 pages I would like my select dropdown to appear to the right of the button but it appears below. Is there an easy way to make it appear the way I would like?
TITLE: How can I line up a select list on my DIV? QUESTION: I have this code test1 test1 1 page 2 pages I would like my select dropdown to appear to the right of the button but it appears below. Is there an easy way to make it appear the way I would like? ANSWER: The easiest way is to add display: inline; to your for...
[ "css" ]
2
1
90
3
0
2011-06-07T09:02:13.450000
2011-06-07T09:04:55.510000
6,262,935
6,263,235
I want to set an image saved on sd card in main layout background through my application
i am creating an application in which i want set different background images in main xml linearlayout.I have stored 5 image files on sd card.now i want to select a pic and set it as my maim xml linearlayout background.so it will replace the previous image and display the new image as background.
First assign an id to the main xml linearlayout, for example in the following case it is named" container" Then in the.java code you can find the layout object and set a drawable as its background: package org.example.app; import android.app.Activity; import android.content.Intent; import android.content.res.Resources...
I want to set an image saved on sd card in main layout background through my application i am creating an application in which i want set different background images in main xml linearlayout.I have stored 5 image files on sd card.now i want to select a pic and set it as my maim xml linearlayout background.so it will re...
TITLE: I want to set an image saved on sd card in main layout background through my application QUESTION: i am creating an application in which i want set different background images in main xml linearlayout.I have stored 5 image files on sd card.now i want to select a pic and set it as my maim xml linearlayout backgr...
[ "android", "android-layout", "android-sdcard" ]
6
17
8,268
1
0
2011-06-07T09:02:41.257000
2011-06-07T09:29:39.477000
6,262,938
6,262,997
Java: measuring performance of an application by upgrading it to a web service
I have an application that's behaving as a server in a way. I have some consumers (another application) which send tasks to the "server" application and get something as a result. The application is implemented in Java as a console application. The problem is that I need to measure the performance of the application (C...
Maybe you can use JMX protocol and JConsole to connect to your application. With JConsole you will have detailed information about memory usage, CPU usage, threads etc. It will also allow you to control your application on the fly by means of MBean. Take a look at: http://download.oracle.com/javase/1.5.0/docs/guide/man...
Java: measuring performance of an application by upgrading it to a web service I have an application that's behaving as a server in a way. I have some consumers (another application) which send tasks to the "server" application and get something as a result. The application is implemented in Java as a console applicati...
TITLE: Java: measuring performance of an application by upgrading it to a web service QUESTION: I have an application that's behaving as a server in a way. I have some consumers (another application) which send tasks to the "server" application and get something as a result. The application is implemented in Java as a...
[ "java", "web-services", "performance", "monitoring" ]
2
3
593
2
0
2011-06-07T09:02:56.903000
2011-06-07T09:07:56.077000
6,262,942
6,263,150
How can I remove/hide all toolbars from a QMainWindow?
I have a third party QMainWindow and I need to embed it in my own QMainWindow (i.e. use it as a normal widget). I know it's not a best practise (to say the least) but I have no other way right now. I need to hide the third-party window's statusbar, menubar and toolbars. I was able to remove the statusbar (setStatusBar(...
I suggest you get the pointer of the StatusBar, MenuBar, and call hide() on them. As for the toolbars, you should find them: QList toolbars = mainWindow.findChildren (); Then call hide() for them.
How can I remove/hide all toolbars from a QMainWindow? I have a third party QMainWindow and I need to embed it in my own QMainWindow (i.e. use it as a normal widget). I know it's not a best practise (to say the least) but I have no other way right now. I need to hide the third-party window's statusbar, menubar and tool...
TITLE: How can I remove/hide all toolbars from a QMainWindow? QUESTION: I have a third party QMainWindow and I need to embed it in my own QMainWindow (i.e. use it as a normal widget). I know it's not a best practise (to say the least) but I have no other way right now. I need to hide the third-party window's statusbar...
[ "qt4", "qmainwindow" ]
1
8
4,225
1
0
2011-06-07T09:03:18.423000
2011-06-07T09:22:25.650000
6,262,943
6,264,027
SQLAlchemy - How to make "django choices" using SQLAlchemy?
In Django we can use very simple "choices" e.g.: GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) class Foo(models.Model): gender = models.CharField(max_length=1, choices=GENDER_CHOICES) How to make something like this using SQLAlchemy?
Use custom types. Example: import sqlalchemy.types as types class ChoiceType(types.TypeDecorator): impl = types.String def __init__(self, choices, **kw): self.choices = dict(choices) super(ChoiceType, self).__init__(**kw) def process_bind_param(self, value, dialect): return [k for k, v in self.choices.iteritems() i...
SQLAlchemy - How to make "django choices" using SQLAlchemy? In Django we can use very simple "choices" e.g.: GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) class Foo(models.Model): gender = models.CharField(max_length=1, choices=GENDER_CHOICES) How to make something like this using SQLAlchemy?
TITLE: SQLAlchemy - How to make "django choices" using SQLAlchemy? QUESTION: In Django we can use very simple "choices" e.g.: GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) class Foo(models.Model): gender = models.CharField(max_length=1, choices=GENDER_CHOICES) How to make something like this using SQLAlchemy? ...
[ "python", "sqlalchemy" ]
50
39
25,983
4
0
2011-06-07T09:03:20.470000
2011-06-07T10:40:19.010000
6,262,952
6,263,079
Need nHibernate Guide to do CRUD
I need some tutorials on how to make CRUD using nhibernate in ASP.net MVC. Thanks
Here is a turorial on CRUD in nhibernate and here is a post describing how to test CRUD operations. Also have a look at this stackoverflow post. Look at the sidebar on this page to find many more posts on nhibernate
Need nHibernate Guide to do CRUD I need some tutorials on how to make CRUD using nhibernate in ASP.net MVC. Thanks
TITLE: Need nHibernate Guide to do CRUD QUESTION: I need some tutorials on how to make CRUD using nhibernate in ASP.net MVC. Thanks ANSWER: Here is a turorial on CRUD in nhibernate and here is a post describing how to test CRUD operations. Also have a look at this stackoverflow post. Look at the sidebar on this page ...
[ "c#", "asp.net-mvc", "nhibernate" ]
2
3
2,431
1
0
2011-06-07T09:03:58.497000
2011-06-07T09:15:39.317000
6,262,957
6,263,132
change sql code to eliminate repeating
Got a question regarding SQL and ColdFusion: I can't write SQL code properly, so that it won't repeat the variables twice. So far I've got: SELECT C.COMPANY_ID, C.FULLNAME, CP.MOBILTEL, CP.MOBIL_CODE, CP.IMCAT_ID, CP.COMPANY_PARTNER_TEL, CP.COMPANY_PARTNER_TELCODE, CP.COMPANY_PARTNER_TEL_EXT, CP.MISSION, CP.DEPARTMENT,...
I assume you mean that you get multiple columns in the result set, each with the name "COMPANY_ID". The solution to this is to specify specific columns from all of the tables, instead of SELECT * (not just for the COMPANY_CAT table, alias CC ). If you're getting "repeated" rows, then you need to examine the contents of...
change sql code to eliminate repeating Got a question regarding SQL and ColdFusion: I can't write SQL code properly, so that it won't repeat the variables twice. So far I've got: SELECT C.COMPANY_ID, C.FULLNAME, CP.MOBILTEL, CP.MOBIL_CODE, CP.IMCAT_ID, CP.COMPANY_PARTNER_TEL, CP.COMPANY_PARTNER_TELCODE, CP.COMPANY_PART...
TITLE: change sql code to eliminate repeating QUESTION: Got a question regarding SQL and ColdFusion: I can't write SQL code properly, so that it won't repeat the variables twice. So far I've got: SELECT C.COMPANY_ID, C.FULLNAME, CP.MOBILTEL, CP.MOBIL_CODE, CP.IMCAT_ID, CP.COMPANY_PARTNER_TEL, CP.COMPANY_PARTNER_TELCOD...
[ "sql", "coldfusion", "repeat" ]
0
2
234
3
0
2011-06-07T09:04:43.750000
2011-06-07T09:21:04.263000
6,262,961
6,263,072
Is there a php framework that makes working with jquery & ajax easier?
I've been using Codeigniter for the past two years and really have become a big fan, but over the past year I've found myself writing more and more javascript than PHP. In the begining, I would write everything with PHP, but now I find myself using $.ajax all the time. And I sort of feel like Im repeating myself betwee...
I use this piece of code in Javascript. Backend wise things are organized in a MVC type of organisation, so things affecting one module are usually grouped together. In general I also create a sperate module for a seperate model, but in some cases you may deviate from this principle. My setup is with symfony at the bac...
Is there a php framework that makes working with jquery & ajax easier? I've been using Codeigniter for the past two years and really have become a big fan, but over the past year I've found myself writing more and more javascript than PHP. In the begining, I would write everything with PHP, but now I find myself using ...
TITLE: Is there a php framework that makes working with jquery & ajax easier? QUESTION: I've been using Codeigniter for the past two years and really have become a big fan, but over the past year I've found myself writing more and more javascript than PHP. In the begining, I would write everything with PHP, but now I ...
[ "php", "jquery", "ajax", "codeigniter", "frameworks" ]
4
3
385
2
0
2011-06-07T09:04:52.783000
2011-06-07T09:15:07.480000
6,262,963
6,263,028
How do I access .Net objects in another process?
I have a.Net app running. I want another.Net app to connect the the first app and call public methods on one of its objects. I know I can do this via WCF, but my understanding is that.Net objects are all components in the COM sense, and so I assume can be marshalled across process boundaries on the same machine. Is thi...
Any object that inherits from MarshalByRefObject can be accessed across process boundaries (this is different from being COM visible though). This is what wcf will use under the bonnet. However, if you use wcf instead of (lower-level) Remoting then you allow the long-term option of crossing machine boundaries (remoting...
How do I access .Net objects in another process? I have a.Net app running. I want another.Net app to connect the the first app and call public methods on one of its objects. I know I can do this via WCF, but my understanding is that.Net objects are all components in the COM sense, and so I assume can be marshalled acro...
TITLE: How do I access .Net objects in another process? QUESTION: I have a.Net app running. I want another.Net app to connect the the first app and call public methods on one of its objects. I know I can do this via WCF, but my understanding is that.Net objects are all components in the COM sense, and so I assume can ...
[ ".net", "wcf", "process", "components" ]
1
1
356
2
0
2011-06-07T09:05:10.313000
2011-06-07T09:11:15.140000
6,262,973
6,263,175
Server side and client side method
I'm using ASP.NET with C# 2.0. I have created some objects for a database and each of these objects has properties which can be called natively or are called in a similar manner and create a RESTful JSON API from them. I have a lot of tab-like things I like to call 'modules' on this site - the function of a module is t...
I would discard option 4 as it will make maintenance more difficult and you may end up out of synch between the HTML generated via the Javascript and the one from the C# code. I would also discard the option 2 as that may make the code more difficult for other developers and also probably unnecessary. I would definitel...
Server side and client side method I'm using ASP.NET with C# 2.0. I have created some objects for a database and each of these objects has properties which can be called natively or are called in a similar manner and create a RESTful JSON API from them. I have a lot of tab-like things I like to call 'modules' on this s...
TITLE: Server side and client side method QUESTION: I'm using ASP.NET with C# 2.0. I have created some objects for a database and each of these objects has properties which can be called natively or are called in a similar manner and create a RESTful JSON API from them. I have a lot of tab-like things I like to call '...
[ "c#", "javascript", ".net", "ajax", "json" ]
6
1
1,480
2
0
2011-06-07T09:05:53.013000
2011-06-07T09:24:47.340000
6,262,986
6,273,422
Git pull results in "needs update" and files shown as modified
Upon pull (into a clean production-type repo) all the changesets come across and cause the files to appear modified and needing a commit. The git log does not show the commits that should have caused these changes... the changes just pull without the log notes so it believes it's out of sync. The result of the pull sho...
How I got out of the mess: As I kept pulling to test my solutions I had to make use of... git reset --hard which moves you back to the most recent commit in the log. git clean -fd which kills off the untracked files since the more recent commit in the log. Eventually I decided I needed to change the offending settings ...
Git pull results in "needs update" and files shown as modified Upon pull (into a clean production-type repo) all the changesets come across and cause the files to appear modified and needing a commit. The git log does not show the commits that should have caused these changes... the changes just pull without the log no...
TITLE: Git pull results in "needs update" and files shown as modified QUESTION: Upon pull (into a clean production-type repo) all the changesets come across and cause the files to appear modified and needing a commit. The git log does not show the commits that should have caused these changes... the changes just pull ...
[ "git", "git-pull" ]
6
6
7,634
2
0
2011-06-07T09:07:08.683000
2011-06-08T01:52:48.423000
6,262,993
6,263,048
Write a query to get an array and use that array in a subquery
What I am trying to do is get the results from the first query pass them into an array and then use them in a sub query. Both queries work separately if I input the id's into the sub query manually. Is there a way of linking these two queries? I have used this code $result = mysql_query("SELECT v2.video_id as v2id FROM...
Yes, it's called subquery (and what you use is not subquery, because it does not contain one query inside another. SELECT * FROM videos WHERE video_id IN ( SELECT v2.video_id FROM VideoTags AS v1 JOIN VideoTags AS v2 USING ( tag_id ) WHERE v1.video_id =1 AND v1.video_id <> v2.video_id GROUP BY v2.video_id ORDER BY COUN...
Write a query to get an array and use that array in a subquery What I am trying to do is get the results from the first query pass them into an array and then use them in a sub query. Both queries work separately if I input the id's into the sub query manually. Is there a way of linking these two queries? I have used t...
TITLE: Write a query to get an array and use that array in a subquery QUESTION: What I am trying to do is get the results from the first query pass them into an array and then use them in a sub query. Both queries work separately if I input the id's into the sub query manually. Is there a way of linking these two quer...
[ "php", "mysql", "arrays", "subquery" ]
4
3
928
4
0
2011-06-07T09:07:32.377000
2011-06-07T09:13:09.263000
6,262,999
6,303,185
(How) Does Unity3D perform sand-boxing and security?
Unity3D lets you write scripts in C# which are (IIRC) run through the mono framework on PCs with the Unity player installed. How does Unity3D sand-box this - I assume they must do - to prevent a malicious site trying to delete your files or report data back to a server about you and your PC?
The Unity Player runs it's own version of the Mono runtime that doesn't include file system access. There's a massive (10MB) list of what Mono/.Net classes are available for each supported platform. http://unity3d.com/support/documentation/ScriptReference/MonoCompatibility.html
(How) Does Unity3D perform sand-boxing and security? Unity3D lets you write scripts in C# which are (IIRC) run through the mono framework on PCs with the Unity player installed. How does Unity3D sand-box this - I assume they must do - to prevent a malicious site trying to delete your files or report data back to a serv...
TITLE: (How) Does Unity3D perform sand-boxing and security? QUESTION: Unity3D lets you write scripts in C# which are (IIRC) run through the mono framework on PCs with the Unity player installed. How does Unity3D sand-box this - I assume they must do - to prevent a malicious site trying to delete your files or report d...
[ "security", "sandbox", "unity-game-engine" ]
1
1
600
1
0
2011-06-07T09:08:00.490000
2011-06-10T07:21:49.953000
6,263,001
6,263,033
How to Set Time in QTimeEdit at Run Time in QT?
How to Set Time in QTimeEdit at Run Time in QT? Like I want to Show 17:30 in QtimeEdit. Thanks.
http://doc.qt.io/qt-5/qdatetimeedit.html#time-prop What exactly did you not understand? example: QTime time(17, 30); QTimeEdit te; te.setTime(time);
How to Set Time in QTimeEdit at Run Time in QT? How to Set Time in QTimeEdit at Run Time in QT? Like I want to Show 17:30 in QtimeEdit. Thanks.
TITLE: How to Set Time in QTimeEdit at Run Time in QT? QUESTION: How to Set Time in QTimeEdit at Run Time in QT? Like I want to Show 17:30 in QtimeEdit. Thanks. ANSWER: http://doc.qt.io/qt-5/qdatetimeedit.html#time-prop What exactly did you not understand? example: QTime time(17, 30); QTimeEdit te; te.setTime(time);
[ "qt" ]
3
4
14,113
3
0
2011-06-07T09:08:18.410000
2011-06-07T09:11:51.737000
6,263,009
6,273,280
Backbone.js REST URL with ASP.NET MVC 3
I have been looking into Backbone.js lately and i am now trying to hook it up with my server-side asp.net mvc 3. This is when i discovered a issue. ASP.NET listens to different Actions, Ex: POST /Users/Create and not just POST /users/. Because of that, the Model.Save() method in backbone.js will not work. How should we...
The answer is not to override Backbone.sync. You rarely would want to do this. Instead, you need only take advantage of the model's url property where you can assign a function which returns the url you want. For instance, Forum = Backbone.Model.extend({ url: function() { return this.isNew()? '/Users/Create': '/Users/...
Backbone.js REST URL with ASP.NET MVC 3 I have been looking into Backbone.js lately and i am now trying to hook it up with my server-side asp.net mvc 3. This is when i discovered a issue. ASP.NET listens to different Actions, Ex: POST /Users/Create and not just POST /users/. Because of that, the Model.Save() method in ...
TITLE: Backbone.js REST URL with ASP.NET MVC 3 QUESTION: I have been looking into Backbone.js lately and i am now trying to hook it up with my server-side asp.net mvc 3. This is when i discovered a issue. ASP.NET listens to different Actions, Ex: POST /Users/Create and not just POST /users/. Because of that, the Model...
[ "asp.net-mvc-3", "rest", "backbone.js" ]
13
15
7,013
4
0
2011-06-07T09:09:00.233000
2011-06-08T01:19:44.220000
6,263,014
6,263,030
Why isn't it possible to dynamically create a variable via self-invoking function in Javascript?
I'm trying to imitate some sort of constructor like in other programming languages. If I do it like this it doesn't work.:/ Sorry for being dumb!:/ Thanks for the help!! function foo(){ this.makeVar = function(){this.newVar = 'hello world'}(); } var test = new foo(); alert(test.newVar);
Because you are calling the (anonymous) function directly, and not as a method on an object. So this is window. Copy the value of this in the outside function to a variable that is still available on the inside function. function foo(){ var self = this; this.makeVar = function(){ self.newVar = 'hello world'; }(); }
Why isn't it possible to dynamically create a variable via self-invoking function in Javascript? I'm trying to imitate some sort of constructor like in other programming languages. If I do it like this it doesn't work.:/ Sorry for being dumb!:/ Thanks for the help!! function foo(){ this.makeVar = function(){this.newVa...
TITLE: Why isn't it possible to dynamically create a variable via self-invoking function in Javascript? QUESTION: I'm trying to imitate some sort of constructor like in other programming languages. If I do it like this it doesn't work.:/ Sorry for being dumb!:/ Thanks for the help!! function foo(){ this.makeVar = fun...
[ "javascript", "jquery", "html" ]
2
7
131
2
0
2011-06-07T09:09:34.413000
2011-06-07T09:11:36.333000
6,263,017
6,263,087
Odd behavior of stacked filter() calls
So I'm getting some interesting behaviour from some filters stacked within a for loop. I'll start with a demonstration: >>> x = range(100) >>> x = filter(lambda n: n % 2 == 0, x) >>> x = filter(lambda n: n % 3 == 0, x) >>> list(x) [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96] Here we get the expect...
In Python 3.x, filter() returns a generator instead of a list. As such, only the final value of factor gets used since all three filters use the same factor. You will need to modify your lambda slightly in order to make it work. result = filter(lambda n, factor=factor: n % factor!= 0, result)
Odd behavior of stacked filter() calls So I'm getting some interesting behaviour from some filters stacked within a for loop. I'll start with a demonstration: >>> x = range(100) >>> x = filter(lambda n: n % 2 == 0, x) >>> x = filter(lambda n: n % 3 == 0, x) >>> list(x) [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72,...
TITLE: Odd behavior of stacked filter() calls QUESTION: So I'm getting some interesting behaviour from some filters stacked within a for loop. I'll start with a demonstration: >>> x = range(100) >>> x = filter(lambda n: n % 2 == 0, x) >>> x = filter(lambda n: n % 3 == 0, x) >>> list(x) [0, 6, 12, 18, 24, 30, 36, 42, 4...
[ "python", "filter" ]
5
7
135
3
0
2011-06-07T09:10:04.057000
2011-06-07T09:16:26.900000
6,263,032
6,263,041
How do i refer to the $(this) element insidea $.post
I have this code $.post("recommend.php",{"jid":jid,"vid":vid,"eid":eid},function(data){ if(data=="1") { $(this).text("Recommended"); } else { $(thelink).text("Recommend"); } }); the post is executed properly but the text on the link is NOT changing though data is equal to 1. Any help...
this refers to the current context. In your AJAX callback it is different from the one of your calling function. However, you can simply preserve it by using var $this = $(this); and then use $this inside the callback instead of $(this); var $this = $(this); $.post("recommend.php", { "jid": jid, "vid": vid, "eid": eid ...
How do i refer to the $(this) element insidea $.post I have this code $.post("recommend.php",{"jid":jid,"vid":vid,"eid":eid},function(data){ if(data=="1") { $(this).text("Recommended"); } else { $(thelink).text("Recommend"); } }); the post is executed properly but the text on the link is NOT changing though data is eq...
TITLE: How do i refer to the $(this) element insidea $.post QUESTION: I have this code $.post("recommend.php",{"jid":jid,"vid":vid,"eid":eid},function(data){ if(data=="1") { $(this).text("Recommended"); } else { $(thelink).text("Recommend"); } }); the post is executed properly but the text on the link is NOT changing...
[ "jquery", "this" ]
2
5
65
3
0
2011-06-07T09:11:43.420000
2011-06-07T09:12:35.560000