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,282,498 | 6,282,512 | Generics and casting | class B: A {} class Sub where T:A { //... } I want to store Sub instances in a collection. var c = new List >(); c.Add(new Sub ()); //doesn't work However, to get it to actually work, I have to declare an interface and store instances of that interface. interface IBase { void DoStuff(A a); }
var c = new List (); c.Add... | No. Instantiations of a generic type with different type arguments are completely unrelated. The only way you can get them in the same list is by having the list use a common non-generic base class or interface, as you did here. You can achieve an approximation of what you want by using a covariant generic interface: c... | Generics and casting class B: A {} class Sub where T:A { //... } I want to store Sub instances in a collection. var c = new List >(); c.Add(new Sub ()); //doesn't work However, to get it to actually work, I have to declare an interface and store instances of that interface. interface IBase { void DoStuff(A a); }
var c... | TITLE:
Generics and casting
QUESTION:
class B: A {} class Sub where T:A { //... } I want to store Sub instances in a collection. var c = new List >(); c.Add(new Sub ()); //doesn't work However, to get it to actually work, I have to declare an interface and store instances of that interface. interface IBase { void DoSt... | [
"c#",
"generics"
] | 10 | 9 | 188 | 2 | 0 | 2011-06-08T17:04:25.847000 | 2011-06-08T17:06:13.443000 |
6,282,499 | 6,283,154 | Transform a web page with Javascript framework to a static html page | Because I need to save a web page as a mht file format for a report function. But, my page is build by a Javascript framework(dojo) and the html source just like this. At the same time, I also have a controller to set report html to these DOM object dynamically. But I can not save this page as a mht file. Because "Save... | Here is an example of how to print out the source for any DOM node - you should be able to use that to print the entire page HTML. EDIT: You might even be able to do something easier: print(document.body.innerHTML); EDIT2: Since you want the generated html to be a static html page, pretty much the only way you're going... | Transform a web page with Javascript framework to a static html page Because I need to save a web page as a mht file format for a report function. But, my page is build by a Javascript framework(dojo) and the html source just like this. At the same time, I also have a controller to set report html to these DOM object d... | TITLE:
Transform a web page with Javascript framework to a static html page
QUESTION:
Because I need to save a web page as a mht file format for a report function. But, my page is build by a Javascript framework(dojo) and the html source just like this. At the same time, I also have a controller to set report html to ... | [
"javascript",
"jquery",
"html",
"dojo",
"report"
] | 1 | 1 | 1,668 | 1 | 0 | 2011-06-08T17:04:28.417000 | 2011-06-08T17:59:39.210000 |
6,282,500 | 6,282,676 | Hide DataTrigger if RelativeSource doesn't exist | I want to add a DataTrigger to my base TextBox style so that it sets the foreground color to a different value if it is inside of a DataGridCell that is selected. Here is what my trigger looks like: This works great, except that when my TextBox is not in a DataGrid the Binding fails and writes an exception to the outpu... | In general just only apply the style where applicable. If you want implicit application use nested styles: If you have other parts which you want to apply to all TextBoxes take out those parts in a serarate style and use BasedOn in the style which applies to the TextBoxes inside the DataGrid. Edit: MultiDataTrigger see... | Hide DataTrigger if RelativeSource doesn't exist I want to add a DataTrigger to my base TextBox style so that it sets the foreground color to a different value if it is inside of a DataGridCell that is selected. Here is what my trigger looks like: This works great, except that when my TextBox is not in a DataGrid the B... | TITLE:
Hide DataTrigger if RelativeSource doesn't exist
QUESTION:
I want to add a DataTrigger to my base TextBox style so that it sets the foreground color to a different value if it is inside of a DataGridCell that is selected. Here is what my trigger looks like: This works great, except that when my TextBox is not i... | [
"wpf",
"binding"
] | 2 | 6 | 1,876 | 1 | 0 | 2011-06-08T17:04:30.193000 | 2011-06-08T17:19:58.240000 |
6,282,517 | 6,282,612 | Horizontal scalability for distributed apps, how to achieve that? | I would like to disregard web applications here, because to scale them horizontally, ie to use multiple server instances together, it is "sufficient" to just duplicate the server software over the machines and just use a sort of router that forwards requests to the "less busy" server machine. But what if my server appl... | One solution to achive that is to use distibuted caches like memcache (Facebook also uses that aproach). Then all the information which is needed on all nodes is stored in that cache (and a database if it needs to be permanent) an so all nodes can access that information (with a very small latency between the nodes). r... | Horizontal scalability for distributed apps, how to achieve that? I would like to disregard web applications here, because to scale them horizontally, ie to use multiple server instances together, it is "sufficient" to just duplicate the server software over the machines and just use a sort of router that forwards requ... | TITLE:
Horizontal scalability for distributed apps, how to achieve that?
QUESTION:
I would like to disregard web applications here, because to scale them horizontally, ie to use multiple server instances together, it is "sufficient" to just duplicate the server software over the machines and just use a sort of router ... | [
"real-time",
"horizontal-scaling"
] | 1 | 1 | 206 | 2 | 0 | 2011-06-08T17:06:42.563000 | 2011-06-08T17:14:38.397000 |
6,282,519 | 6,282,749 | How to package a python program for distribution on a network | I'm not sure if I'm even asking this question correctly. I just built my first real program and I want to make it available to people in my office. I'm not sure if I will have access to the shared server, but I was hoping I could simply package the program (I hope I'm using this term correctly) and upload it to a websi... | PyInstaller or py2exe can package your Python program. Both are actively maintained. PyInstaller is actively maintained. py2exe has not been updated for at least a year. I've used each with success. Also there is cx_Freeze which I have not used. | How to package a python program for distribution on a network I'm not sure if I'm even asking this question correctly. I just built my first real program and I want to make it available to people in my office. I'm not sure if I will have access to the shared server, but I was hoping I could simply package the program (... | TITLE:
How to package a python program for distribution on a network
QUESTION:
I'm not sure if I'm even asking this question correctly. I just built my first real program and I want to make it available to people in my office. I'm not sure if I will have access to the shared server, but I was hoping I could simply pac... | [
"python"
] | 1 | 3 | 323 | 2 | 0 | 2011-06-08T17:06:46.107000 | 2011-06-08T17:26:13.213000 |
6,282,524 | 6,282,810 | YUI3 Plugin.base not rendering | I'm trying to use a yui plugin that pulls from a json file and populates a div on the page. Everything should be a go, however, since the plugin never gets to the render stage, the rest of it does not run. It is successfully loaded otherwise (if I stick an alert or console.log at the beginning of the event, it works fi... | I've used YUI3 plugins before and they are a bit difficult to grasp, but I'll try to help if I can. Once you've created the plugin, which, from what I can tell, you've already done so successfully, you plug it into an object somewhere else in your code: someObj.plug(Y.Plugin.EventList, cfg); After that, you can access ... | YUI3 Plugin.base not rendering I'm trying to use a yui plugin that pulls from a json file and populates a div on the page. Everything should be a go, however, since the plugin never gets to the render stage, the rest of it does not run. It is successfully loaded otherwise (if I stick an alert or console.log at the begi... | TITLE:
YUI3 Plugin.base not rendering
QUESTION:
I'm trying to use a yui plugin that pulls from a json file and populates a div on the page. Everything should be a go, however, since the plugin never gets to the render stage, the rest of it does not run. It is successfully loaded otherwise (if I stick an alert or conso... | [
"javascript",
"plugins",
"yui",
"yui3"
] | 1 | 1 | 250 | 1 | 0 | 2011-06-08T17:07:17.530000 | 2011-06-08T17:30:47.700000 |
6,282,534 | 6,287,226 | sqlalchemy pagination | I'm building a REST app with flask and sqlalchemy and I came across an issue. I want to query all users with their number of books. Each user has many books so my query should return the number of books each user has in the resultset. // Models class User( object ): __tablename__ = 'user'
class Book( object ): __table... | I'm gonna answer my own question with the solution for every1 else in the same situation. If you're on ubuntu and installed sqlalchemy from repo uninstall it and go to sqlalchemy website and follow their instructions for installing. The new version (0.7.1 atm) has this bug fixed. Ubuntu ships with 0.6.4 version. | sqlalchemy pagination I'm building a REST app with flask and sqlalchemy and I came across an issue. I want to query all users with their number of books. Each user has many books so my query should return the number of books each user has in the resultset. // Models class User( object ): __tablename__ = 'user'
class B... | TITLE:
sqlalchemy pagination
QUESTION:
I'm building a REST app with flask and sqlalchemy and I came across an issue. I want to query all users with their number of books. Each user has many books so my query should return the number of books each user has in the resultset. // Models class User( object ): __tablename__... | [
"python",
"sqlalchemy"
] | 5 | 0 | 11,334 | 2 | 0 | 2011-06-08T17:07:54.360000 | 2011-06-09T01:48:03.193000 |
6,282,548 | 6,282,987 | javascript refresh popup from another popup | Window A opens window B Window A opens window C
On Window C (after user action) I need Window B refreshed. some more explanation: yes. Window A is the main calendar. window B is opened manually and is smaller and shows stats about the calendar (window A) When user clicks on a calendar event in window A then Window C o... | First of all I have to warn you that what you are trying to achieve is not a good practice. Many browsers are opening new tabs instead of new windows, which can influence the availability of the window.opener. Although this depends heavily on the browser settings. So first of all you should test to see that your code i... | javascript refresh popup from another popup Window A opens window B Window A opens window C
On Window C (after user action) I need Window B refreshed. some more explanation: yes. Window A is the main calendar. window B is opened manually and is smaller and shows stats about the calendar (window A) When user clicks on ... | TITLE:
javascript refresh popup from another popup
QUESTION:
Window A opens window B Window A opens window C
On Window C (after user action) I need Window B refreshed. some more explanation: yes. Window A is the main calendar. window B is opened manually and is smaller and shows stats about the calendar (window A) Wh... | [
"javascript"
] | 0 | 1 | 541 | 2 | 0 | 2011-06-08T17:09:09.990000 | 2011-06-08T17:43:28.483000 |
6,282,549 | 6,282,754 | Fastest Way to display a data node + all its attributes in PHP? | I'm using php to take xml files and convert them into single line tab delimited plain text with set columns (i.e. ignores certain tags if database does not need it and certain tags will be empty). The problem I ran into is that it took 13 minutes to go through 56k (+ change) files, which I think is ridiculously slow. (... | A comment would be a little short, so I write it as an answer: It's hard to say where actually your setup can benefit from optimizing. Perhaps it's possible to join multiple of your many XML files together before loading. From the information you give in your question I would assume that it's more the disk operations t... | Fastest Way to display a data node + all its attributes in PHP? I'm using php to take xml files and convert them into single line tab delimited plain text with set columns (i.e. ignores certain tags if database does not need it and certain tags will be empty). The problem I ran into is that it took 13 minutes to go thr... | TITLE:
Fastest Way to display a data node + all its attributes in PHP?
QUESTION:
I'm using php to take xml files and convert them into single line tab delimited plain text with set columns (i.e. ignores certain tags if database does not need it and certain tags will be empty). The problem I ran into is that it took 13... | [
"php",
"optimization",
"dom"
] | 1 | 2 | 141 | 1 | 0 | 2011-06-08T17:09:09.823000 | 2011-06-08T17:26:52.120000 |
6,282,557 | 6,282,602 | Flushing output buffer in C (cgi) | The following code: int z = 0; while(z < 4) { printf("iteration %d\n",z); sleep(1); z++; } Works fine and stdout buffer is flushed every second if running the program from command line. However, when I try to access the program in a web browser (server - apache on linux, compiled executable (with gcc) handled through c... | I am not quite sure I understand your question correctly, but in C you can Flush after each print ( fflush ) Disable buffering ( setbuf, setvbuf ) setvbuf(stdout, NULL, _IONBF, 0); /* this will disable buffering for stdout */ If these won't work, then either something else is doing buffering or buffering is not the pro... | Flushing output buffer in C (cgi) The following code: int z = 0; while(z < 4) { printf("iteration %d\n",z); sleep(1); z++; } Works fine and stdout buffer is flushed every second if running the program from command line. However, when I try to access the program in a web browser (server - apache on linux, compiled execu... | TITLE:
Flushing output buffer in C (cgi)
QUESTION:
The following code: int z = 0; while(z < 4) { printf("iteration %d\n",z); sleep(1); z++; } Works fine and stdout buffer is flushed every second if running the program from command line. However, when I try to access the program in a web browser (server - apache on lin... | [
"c",
"cgi",
"buffer",
"stdout"
] | 1 | 2 | 1,728 | 2 | 0 | 2011-06-08T17:10:06.750000 | 2011-06-08T17:13:52.523000 |
6,282,562 | 6,282,607 | Android ListView not retaining values through orientation change | I am a bit perplexed on what Android holds onto in a view orientation change and what it doesn't. Some things it seems it holds onto nicely, other things it seems it doesn't.. So I am not sure if it is my code, or something else. (I assume I am doing something stupid) What I have is a view with a listview in it, the li... | No, you could also have a persistent model through Activity lifecycle like this: define a singleton app, with a method to get your singleton model. At on create get your datas from your model. As your model will no be recreated but will persist, this can be used as a workaround for preserving objets through rotation ch... | Android ListView not retaining values through orientation change I am a bit perplexed on what Android holds onto in a view orientation change and what it doesn't. Some things it seems it holds onto nicely, other things it seems it doesn't.. So I am not sure if it is my code, or something else. (I assume I am doing some... | TITLE:
Android ListView not retaining values through orientation change
QUESTION:
I am a bit perplexed on what Android holds onto in a view orientation change and what it doesn't. Some things it seems it holds onto nicely, other things it seems it doesn't.. So I am not sure if it is my code, or something else. (I assu... | [
"android",
"listview",
"orientation"
] | 2 | 3 | 934 | 1 | 0 | 2011-06-08T17:10:42.780000 | 2011-06-08T17:14:21.870000 |
6,282,574 | 6,283,280 | How can I sort a list of strings by numbers in them? | I have a list of filenames which are like so: fw_d.log.1.gz through fw_d.log.300.gz When I use this code block below, it almost sorts it the way I want, but not quite: #!/usr/bin/perl -w my $basedir = "/var/log"; my @verdir = qw(fw_d); my $fulldir; my $configs; my $combidir;
foreach $combidir (@verdir) { $fulldir = "$... | You could use Schartzian-transform: my @sorted = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, $_=~/(\d+)/] } @files; print Dumper \@sorted; Added benchmark for comparison between Schwartzian-Transform and subroutine use Benchmark qw(:all);
# build list of files my @files = map {'fw_d.log.'.int(rand()*1000).... | How can I sort a list of strings by numbers in them? I have a list of filenames which are like so: fw_d.log.1.gz through fw_d.log.300.gz When I use this code block below, it almost sorts it the way I want, but not quite: #!/usr/bin/perl -w my $basedir = "/var/log"; my @verdir = qw(fw_d); my $fulldir; my $configs; my $c... | TITLE:
How can I sort a list of strings by numbers in them?
QUESTION:
I have a list of filenames which are like so: fw_d.log.1.gz through fw_d.log.300.gz When I use this code block below, it almost sorts it the way I want, but not quite: #!/usr/bin/perl -w my $basedir = "/var/log"; my @verdir = qw(fw_d); my $fulldir; ... | [
"perl",
"sorting",
"numbers",
"natural-sort"
] | 15 | 22 | 8,834 | 4 | 0 | 2011-06-08T17:11:43.107000 | 2011-06-08T18:12:44.097000 |
6,282,575 | 6,283,224 | zlib compressing byte array? | I have this uncompressed byte array: 0E 7C BD 03 6E 65 67 6C 65 63 74 00 00 00 00 00 00 00 00 00 42 52 00 00 01 02 01 00 BB 14 8D 37 0A 00 00 01 00 00 00 00 05 E9 05 E9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 81 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 01 00 00 00 And I n... | First, some information: DEFLATE is the compression algorithm, it is defined in RFC 1951. DEFLATE is used in the ZLIB and GZIP formats, defined in RFC 1950 and 1952 respectively, which essentially are thin wrappers around DEFLATE bytestreams. The wrappers provide metadata such as, the name of the file, timestamps, CRCs... | zlib compressing byte array? I have this uncompressed byte array: 0E 7C BD 03 6E 65 67 6C 65 63 74 00 00 00 00 00 00 00 00 00 42 52 00 00 01 02 01 00 BB 14 8D 37 0A 00 00 01 00 00 00 00 05 E9 05 E9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 81 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00... | TITLE:
zlib compressing byte array?
QUESTION:
I have this uncompressed byte array: 0E 7C BD 03 6E 65 67 6C 65 63 74 00 00 00 00 00 00 00 00 00 42 52 00 00 01 02 01 00 BB 14 8D 37 0A 00 00 01 00 00 00 00 05 E9 05 E9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 81 01 00 00 00 00 00 00 00 00 00 00 00 00 00... | [
"c#",
"arrays",
"zlib",
"compression"
] | 16 | 36 | 32,563 | 2 | 0 | 2011-06-08T17:11:51.067000 | 2011-06-08T18:05:50.957000 |
6,282,579 | 6,282,690 | XPATH query to filter values on certain attributes only | I have following XML: smooth mid 60026 mid mp3 4584972 I'd like to get all item names of items of the file type "mid". My XPATH query looks as /Library/Item/Field [ @Name="Name" and (../Field[@Name="File Type" and../Field[.="mid"]]) ] But unfortunately both items are returned from that query. smooth mid Seems that the ... | XPath predicates can be applied anywhere, this would be more straight-forward: /Library/Item[Field[@Name="File Type"] = "mid"]/Field[@Name="Name"] Your own expression would be correct as /Library/Item/Field[ @Name="Name" and../Field[@Name="File Type"] = "mid" ] | XPATH query to filter values on certain attributes only I have following XML: smooth mid 60026 mid mp3 4584972 I'd like to get all item names of items of the file type "mid". My XPATH query looks as /Library/Item/Field [ @Name="Name" and (../Field[@Name="File Type" and../Field[.="mid"]]) ] But unfortunately both items ... | TITLE:
XPATH query to filter values on certain attributes only
QUESTION:
I have following XML: smooth mid 60026 mid mp3 4584972 I'd like to get all item names of items of the file type "mid". My XPATH query looks as /Library/Item/Field [ @Name="Name" and (../Field[@Name="File Type" and../Field[.="mid"]]) ] But unfortu... | [
"xpath"
] | 28 | 40 | 58,934 | 1 | 0 | 2011-06-08T17:12:10.237000 | 2011-06-08T17:21:13.143000 |
6,282,580 | 6,282,593 | Is there any difference between $("#item1 #item2") and $("#item1>#item2")? | I was reviewing code and found that $("#item1 #item2") and $("#item1>#item2") are used interchangeably. Is there any difference or is it one and the same? | Both will match But only the first one will match The first expression uses the descendant selector. The > symbol in the second expression is the child selector. Both are standard CSS selectors. However, since id s must be unique, both are overcomplicated. Instead, you should just use $('#item2') | Is there any difference between $("#item1 #item2") and $("#item1>#item2")? I was reviewing code and found that $("#item1 #item2") and $("#item1>#item2") are used interchangeably. Is there any difference or is it one and the same? | TITLE:
Is there any difference between $("#item1 #item2") and $("#item1>#item2")?
QUESTION:
I was reviewing code and found that $("#item1 #item2") and $("#item1>#item2") are used interchangeably. Is there any difference or is it one and the same?
ANSWER:
Both will match But only the first one will match The first exp... | [
"jquery",
"jquery-selectors"
] | 2 | 5 | 204 | 4 | 0 | 2011-06-08T17:12:12.250000 | 2011-06-08T17:13:29.247000 |
6,282,585 | 6,282,914 | Android - Activities and navigation? | I navigate from Activity1 to Activity2 On Activity 2 I have a keyboard and this keyboard stays on the screen after selecting the back button and going to Activity 1. This is how I fixed this issue // This code is in Activity 2 @Override public void onBackPressed() { startActivity(intentForActivity1); finish(); } Is thi... | Since you're capturing the back button press, most probably the soft keyboard does not receive the press and thus it does not hide. Try hiding it yourself: @Override public void onBackPressed() { InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myE... | Android - Activities and navigation? I navigate from Activity1 to Activity2 On Activity 2 I have a keyboard and this keyboard stays on the screen after selecting the back button and going to Activity 1. This is how I fixed this issue // This code is in Activity 2 @Override public void onBackPressed() { startActivity(in... | TITLE:
Android - Activities and navigation?
QUESTION:
I navigate from Activity1 to Activity2 On Activity 2 I have a keyboard and this keyboard stays on the screen after selecting the back button and going to Activity 1. This is how I fixed this issue // This code is in Activity 2 @Override public void onBackPressed() ... | [
"android",
"android-activity",
"navigation"
] | 0 | 1 | 260 | 2 | 0 | 2011-06-08T17:12:58.937000 | 2011-06-08T17:38:47.697000 |
6,282,586 | 6,282,934 | solve negative values in a javascript based countdown | I am creating a countdown to count the time between a match of the euro2012 that I intend to watch. I've come with a working version of it but I don't understand why it gives me sometimes negative values. I think it has to do with the way I wrote it, using the getTime() method. Here is my code, could you guys help me f... | KOGI has the answer to your problem: You should use Math.floor instead of Math.round: When there's x minutes and 30 - 59 seconds left, the (x - Math.round(x)) would be equivalent to (x - (x + 1)) after the rounding was done. var ddays = diff/days; var dhours = (ddays - Math.floor(ddays))*24; var dminutes = (dhours - Ma... | solve negative values in a javascript based countdown I am creating a countdown to count the time between a match of the euro2012 that I intend to watch. I've come with a working version of it but I don't understand why it gives me sometimes negative values. I think it has to do with the way I wrote it, using the getTi... | TITLE:
solve negative values in a javascript based countdown
QUESTION:
I am creating a countdown to count the time between a match of the euro2012 that I intend to watch. I've come with a working version of it but I don't understand why it gives me sometimes negative values. I think it has to do with the way I wrote i... | [
"javascript",
"countdown",
"gettime"
] | 0 | 1 | 990 | 2 | 0 | 2011-06-08T17:13:05.853000 | 2011-06-08T17:40:06.700000 |
6,282,601 | 6,282,746 | How do I declare objects from my main window in Qt Creator? | This question should hopefully be easy to answer. I created a few buttons in my MainWindow using Qt Creator, and when I go to write the functions for the buttons, the compiler says they were not declared in this scope. What do I need to #include for these objects to be declared? The compiler error for the following wou... | The items you define in your.ui file are not added directly to your main window class, they are added to its ui membre. Try with: ui->baseDir->setText( path ); Look at the ui_mainwindow.h file that is generated during the build if you're curious. | How do I declare objects from my main window in Qt Creator? This question should hopefully be easy to answer. I created a few buttons in my MainWindow using Qt Creator, and when I go to write the functions for the buttons, the compiler says they were not declared in this scope. What do I need to #include for these obje... | TITLE:
How do I declare objects from my main window in Qt Creator?
QUESTION:
This question should hopefully be easy to answer. I created a few buttons in my MainWindow using Qt Creator, and when I go to write the functions for the buttons, the compiler says they were not declared in this scope. What do I need to #incl... | [
"c++",
"qt"
] | 1 | 2 | 3,766 | 1 | 0 | 2011-06-08T17:13:49.903000 | 2011-06-08T17:25:59.217000 |
6,282,616 | 6,282,644 | how to concatenate javascript and rails 3 | I have the following code in my application.erb.html $alertdiv.text("some message"); but I need to pass in message instead of hard coded message. I need to pass in the notice so I tried doing something like $alertdiv.text(<%= notice %>); but that didn't work | You still need to wrap the <%= %> tags in quotation marks: $alertdiv.text("<%= notice %>"); | how to concatenate javascript and rails 3 I have the following code in my application.erb.html $alertdiv.text("some message"); but I need to pass in message instead of hard coded message. I need to pass in the notice so I tried doing something like $alertdiv.text(<%= notice %>); but that didn't work | TITLE:
how to concatenate javascript and rails 3
QUESTION:
I have the following code in my application.erb.html $alertdiv.text("some message"); but I need to pass in message instead of hard coded message. I need to pass in the notice so I tried doing something like $alertdiv.text(<%= notice %>); but that didn't work
... | [
"javascript",
"ruby-on-rails-3"
] | 0 | 1 | 165 | 1 | 0 | 2011-06-08T17:14:58.397000 | 2011-06-08T17:16:52.700000 |
6,282,618 | 6,282,646 | Inserted, Deleted Tables (Magic Tables) in MySQL | I am regular user of MS-SQL but now working on a project which has mysql as a back-end. Please tell me that is there exists such a inserted/Deleted tables (Magic tables) in mysql which I can use inside trigger or in normal queries. | They are called NEW and OLD in MySQL. NEW is the new record to be inserted or the updated data. OLD is the deleted record, or the old data before an update. See the documentation for creating a trigger here: http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html | Inserted, Deleted Tables (Magic Tables) in MySQL I am regular user of MS-SQL but now working on a project which has mysql as a back-end. Please tell me that is there exists such a inserted/Deleted tables (Magic tables) in mysql which I can use inside trigger or in normal queries. | TITLE:
Inserted, Deleted Tables (Magic Tables) in MySQL
QUESTION:
I am regular user of MS-SQL but now working on a project which has mysql as a back-end. Please tell me that is there exists such a inserted/Deleted tables (Magic tables) in mysql which I can use inside trigger or in normal queries.
ANSWER:
They are cal... | [
"mysql",
"database-trigger"
] | 6 | 9 | 12,948 | 1 | 0 | 2011-06-08T17:15:03.310000 | 2011-06-08T17:16:55.010000 |
6,282,619 | 6,282,671 | Is there a way to bitwise-OR enums in Java? | I'm using a state machine, and the code's getting really verbose when testing against a large number of possible states. enum Mood { HAPPY, SAD, CALM, SLEEPY, OPTIMISTIC, PENSIVE, ENERGETIC; } Is there any way to do this: if (currentMood == (HAPPY | OPTIMISTIC | ENERGETIC) {} Instead of this: if (currentMood == HAPPY |... | Maybe use something like EnumSet? if (EnumSet.of(HAPPY, OPTIMISTIC, ENERGETIC).contains(currentMood)) { //Do stuff... } | Is there a way to bitwise-OR enums in Java? I'm using a state machine, and the code's getting really verbose when testing against a large number of possible states. enum Mood { HAPPY, SAD, CALM, SLEEPY, OPTIMISTIC, PENSIVE, ENERGETIC; } Is there any way to do this: if (currentMood == (HAPPY | OPTIMISTIC | ENERGETIC) {}... | TITLE:
Is there a way to bitwise-OR enums in Java?
QUESTION:
I'm using a state machine, and the code's getting really verbose when testing against a large number of possible states. enum Mood { HAPPY, SAD, CALM, SLEEPY, OPTIMISTIC, PENSIVE, ENERGETIC; } Is there any way to do this: if (currentMood == (HAPPY | OPTIMIST... | [
"java",
"enums"
] | 35 | 49 | 22,782 | 9 | 0 | 2011-06-08T17:15:07.313000 | 2011-06-08T17:19:48.957000 |
6,282,623 | 6,291,914 | Temporary changing python logging handlers | I'm working on an app that uses the standard logging module to do logging. We have a setup where we log to a bunch of files based on levels etc. We also use celery to run some jobs out of the main app (maintenance stuff usually that's time consuming). The celery task does nothing other than call functions (lets say spa... | The thing about the StringIO is, there could be multiple processes running (Celery tasks), hence multiple StringIOs, right? You can do something like this: In the processes run under Celery, add to the root logger a handler which sends events to a socket (SocketHandler for TCP or DatagramHandler for UDP). Create a sock... | Temporary changing python logging handlers I'm working on an app that uses the standard logging module to do logging. We have a setup where we log to a bunch of files based on levels etc. We also use celery to run some jobs out of the main app (maintenance stuff usually that's time consuming). The celery task does noth... | TITLE:
Temporary changing python logging handlers
QUESTION:
I'm working on an app that uses the standard logging module to do logging. We have a setup where we log to a bunch of files based on levels etc. We also use celery to run some jobs out of the main app (maintenance stuff usually that's time consuming). The cel... | [
"python",
"logging",
"celery"
] | 2 | 2 | 1,153 | 2 | 0 | 2011-06-08T17:15:15.010000 | 2011-06-09T11:16:17.213000 |
6,282,639 | 6,283,090 | Getting the name of Ruby method for a literal hash query | In a rails application, I have a number of attributes for a model called Record. I want to design a method that when called on an attribute, returns the name of the attribute (which is essentially a method on the Record object). This name is then passed to an Hash, which returns a number (for the sake of this example, ... | Ryan, I'm struggling to understand your question, but I think this is what you want, for record.teachers_percent, for example: ["teachers", "students", "principals", "parents"].each do |attrib| Record.class_eval <<-RUBY def #{attrib}_percent #{attrib} * PERCENTAGE[#{attrib.inspect}] end RUBY end Although this is probab... | Getting the name of Ruby method for a literal hash query In a rails application, I have a number of attributes for a model called Record. I want to design a method that when called on an attribute, returns the name of the attribute (which is essentially a method on the Record object). This name is then passed to an Has... | TITLE:
Getting the name of Ruby method for a literal hash query
QUESTION:
In a rails application, I have a number of attributes for a model called Record. I want to design a method that when called on an attribute, returns the name of the attribute (which is essentially a method on the Record object). This name is the... | [
"ruby-on-rails",
"ruby",
"methods",
"hash"
] | 1 | 2 | 194 | 1 | 0 | 2011-06-08T17:16:11.720000 | 2011-06-08T17:54:08.823000 |
6,282,642 | 6,282,711 | how to "prepare" a view in the background? | I have a two views, 1st is a simple view with some introduction about usage and by click of a button it opens the main view. The main view has many images and two customized tables with rows consists of text and image, thus the creation of the main view is quite slow. The profiler shows most of the time is consumed by ... | You should: Use Instruments to see where your code is spending the most time, and optimize there. It may not be where you think. If you are using a UITableView, learn how to create UITableViewCells on demand (rather than preloading a large number) and recycle instances (rather than recreating them). Only if Instruments... | how to "prepare" a view in the background? I have a two views, 1st is a simple view with some introduction about usage and by click of a button it opens the main view. The main view has many images and two customized tables with rows consists of text and image, thus the creation of the main view is quite slow. The prof... | TITLE:
how to "prepare" a view in the background?
QUESTION:
I have a two views, 1st is a simple view with some introduction about usage and by click of a button it opens the main view. The main view has many images and two customized tables with rows consists of text and image, thus the creation of the main view is qu... | [
"iphone",
"cocoa-touch",
"ipad",
"uiview",
"uiviewcontroller"
] | 2 | 8 | 2,795 | 2 | 0 | 2011-06-08T17:16:21.797000 | 2011-06-08T17:23:24.790000 |
6,282,654 | 6,283,483 | wxPython - Getting attribute from another class? | I want to update the self.CreateStatusBar() in MainWindow from MainPanel. And update the self.textOutput in MainPanel from MainWindow. Been reading alot, but still cant grasp it. Please help me. =) import wx
ID_EXIT = 110
class MainPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent)
self.but... | I agree with AJ. You shouldn't modify GUI elements from each other directly. That ties things together pretty tightly. Instead, you should use something like pubsub or maybe wx.PostEvent to communicate between classes. Here's a simple pubsub example: http://www.blog.pythonlibrary.org/2010/06/27/wxpython-and-pubsub-a-si... | wxPython - Getting attribute from another class? I want to update the self.CreateStatusBar() in MainWindow from MainPanel. And update the self.textOutput in MainPanel from MainWindow. Been reading alot, but still cant grasp it. Please help me. =) import wx
ID_EXIT = 110
class MainPanel(wx.Panel): def __init__(self, p... | TITLE:
wxPython - Getting attribute from another class?
QUESTION:
I want to update the self.CreateStatusBar() in MainWindow from MainPanel. And update the self.textOutput in MainPanel from MainWindow. Been reading alot, but still cant grasp it. Please help me. =) import wx
ID_EXIT = 110
class MainPanel(wx.Panel): de... | [
"python",
"class",
"attributes",
"get",
"wxpython"
] | 1 | 1 | 1,604 | 3 | 0 | 2011-06-08T17:18:03.013000 | 2011-06-08T18:30:38.377000 |
6,282,655 | 6,282,692 | plot of an empirical cumulative distribution function (was Percentile plot) | How can I generate a plot like the following in R. It shows the percent of transactions (x) for a given response time (y), see my own answer below for my own go at it. | Methinks you want a plot of an empirical cumulative distribution function. So take a look at the documentation for ecdf() as well as the more featureful Ecdf() in the CRAN package Hmisc. Hmisc Ecdf example: ExecTm array of execution times, HttpProvCall array of time it took to call downstream system and we compare the ... | plot of an empirical cumulative distribution function (was Percentile plot) How can I generate a plot like the following in R. It shows the percent of transactions (x) for a given response time (y), see my own answer below for my own go at it. | TITLE:
plot of an empirical cumulative distribution function (was Percentile plot)
QUESTION:
How can I generate a plot like the following in R. It shows the percent of transactions (x) for a given response time (y), see my own answer below for my own go at it.
ANSWER:
Methinks you want a plot of an empirical cumulati... | [
"r"
] | 3 | 15 | 8,221 | 2 | 0 | 2011-06-08T17:18:03.197000 | 2011-06-08T17:21:21.353000 |
6,282,663 | 6,282,774 | Making a button semi-transparent in android | Possible Duplicate: How to Set Opacity (Alpha) for View in Android i want to ask two questions: 1) i want to make the buttons in my main.xml i.e simply the first screen look semi-transparent. It should be such that the background image can be partly-seen through it. But the button should maintain its normal size and lo... | To change the appearance of a button depending on state, use a StateList. | Making a button semi-transparent in android Possible Duplicate: How to Set Opacity (Alpha) for View in Android i want to ask two questions: 1) i want to make the buttons in my main.xml i.e simply the first screen look semi-transparent. It should be such that the background image can be partly-seen through it. But the b... | TITLE:
Making a button semi-transparent in android
QUESTION:
Possible Duplicate: How to Set Opacity (Alpha) for View in Android i want to ask two questions: 1) i want to make the buttons in my main.xml i.e simply the first screen look semi-transparent. It should be such that the background image can be partly-seen thr... | [
"android"
] | 4 | 3 | 20,238 | 2 | 0 | 2011-06-08T17:18:57.430000 | 2011-06-08T17:28:07.250000 |
6,282,680 | 6,282,699 | jQuery validation without "form" tag | According to http://docs.jquery.com/Plugins/Validation the "form" tag is necessary in order to do validation. In my case I don't have form tag. How can I validate(required field) my textbox on click of "button" type control | Why not just add a form tag? If it's an input, then it should normally be part of a form. | jQuery validation without "form" tag According to http://docs.jquery.com/Plugins/Validation the "form" tag is necessary in order to do validation. In my case I don't have form tag. How can I validate(required field) my textbox on click of "button" type control | TITLE:
jQuery validation without "form" tag
QUESTION:
According to http://docs.jquery.com/Plugins/Validation the "form" tag is necessary in order to do validation. In my case I don't have form tag. How can I validate(required field) my textbox on click of "button" type control
ANSWER:
Why not just add a form tag? If ... | [
"javascript",
"jquery"
] | 7 | 3 | 25,625 | 3 | 0 | 2011-06-08T17:20:21.477000 | 2011-06-08T17:21:52.537000 |
6,282,681 | 6,282,736 | ASP.NET: are aspx/ascx files accessed from disk on every request? | I googled forever, and I couldn't find an answer to this; the answer is either obvious (and I need more training) or it's buried deep in documentation (or not documented). Somebody must know this. I've been arguing with somebody who insisted on caching some static files on an ASP.NET site, where I thought it's not nece... | If I'm not mistaken ASPX files are compiled at run-time, on first access. After the page is compiled into an in-memory instance of a Page class, requests to the same resource (ASPX page) are serviced against the object in memory. So in essence, they are cached with respect to disk-access. Obviously the dynamic content ... | ASP.NET: are aspx/ascx files accessed from disk on every request? I googled forever, and I couldn't find an answer to this; the answer is either obvious (and I need more training) or it's buried deep in documentation (or not documented). Somebody must know this. I've been arguing with somebody who insisted on caching s... | TITLE:
ASP.NET: are aspx/ascx files accessed from disk on every request?
QUESTION:
I googled forever, and I couldn't find an answer to this; the answer is either obvious (and I need more training) or it's buried deep in documentation (or not documented). Somebody must know this. I've been arguing with somebody who ins... | [
"asp.net",
"caching",
"static-files"
] | 0 | 0 | 349 | 3 | 0 | 2011-06-08T17:20:25.397000 | 2011-06-08T17:25:24.673000 |
6,282,687 | 6,282,738 | When to use NavigationHandler.handleNavigation vs ExternalContext.redirect/dispatch | It would seem that the following are equivalent: FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation("/index.xhtml?faces-redirect=true");
FacesContext.getCurrentInstance().getExternalContext().redirect("/testapp/faces/index.xhtml"); Are there any differences and when should each ... | With the NavigationHandler#handleNavigation() approach you're dependent on the implemented navigation handlers. You or a 3rd party could easily overridde/supply this in the webapp. This can be advantageous if you want more fine grained control, but this can be disadvantagrous if you don't want to have external controll... | When to use NavigationHandler.handleNavigation vs ExternalContext.redirect/dispatch It would seem that the following are equivalent: FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation("/index.xhtml?faces-redirect=true");
FacesContext.getCurrentInstance().getExternalContext().red... | TITLE:
When to use NavigationHandler.handleNavigation vs ExternalContext.redirect/dispatch
QUESTION:
It would seem that the following are equivalent: FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation("/index.xhtml?faces-redirect=true");
FacesContext.getCurrentInstance().getExt... | [
"jsf",
"redirect",
"jsf-2",
"navigation"
] | 16 | 16 | 19,423 | 1 | 0 | 2011-06-08T17:20:53.290000 | 2011-06-08T17:25:28.830000 |
6,282,694 | 6,282,735 | Jquery - Treat a string like a variable name | This is my shortened script: var string1 = "This is string 1"; var string2 = "This is string 2";
function test() { var selectedOption = $("select#myoptions option:selected").attr("id"); var str = 'string'+selectedOption; $("div#result").html(str); } $("select#myoptions").change(test); I have a drop down list, every op... | You could update your test function to use eval(): function test() { var selectedOption = $("select#myoptions option:selected").attr("id"); eval('$("div#result").html(string' + selectedOption + ');'); } Give that a shot. I provided this as a way of giving you exactly what you asked for, though I really like the answer ... | Jquery - Treat a string like a variable name This is my shortened script: var string1 = "This is string 1"; var string2 = "This is string 2";
function test() { var selectedOption = $("select#myoptions option:selected").attr("id"); var str = 'string'+selectedOption; $("div#result").html(str); } $("select#myoptions").ch... | TITLE:
Jquery - Treat a string like a variable name
QUESTION:
This is my shortened script: var string1 = "This is string 1"; var string2 = "This is string 2";
function test() { var selectedOption = $("select#myoptions option:selected").attr("id"); var str = 'string'+selectedOption; $("div#result").html(str); } $("sel... | [
"jquery"
] | 6 | 6 | 9,436 | 5 | 0 | 2011-06-08T17:21:33.113000 | 2011-06-08T17:25:24.303000 |
6,282,695 | 6,283,522 | how to change div content by time of the day? | I want to be able to change the content of a certain div according to the time of the user. For example, if it's 5am, certain content would show. If it's 6am, another content shows. John Doe 8am-4pm (changes to that name when its 8am-4pm) John Doe 5pm-6pm (changes to that name when its 5pm-6pm) John Doe 7pm-8pm (change... | Something like this should be a good start for you: $(function(){
$('#timeperiod1').mood({ range: [1, 7] // hours }); $('#timeperiod2').mood({ range: [7, 12] // hours }); $('#timeperiod3').mood({ range: [12, 24] // hours }); });
// the jquery plugin // TODO: add end of day re init // add min/sec along with hours $.fn... | how to change div content by time of the day? I want to be able to change the content of a certain div according to the time of the user. For example, if it's 5am, certain content would show. If it's 6am, another content shows. John Doe 8am-4pm (changes to that name when its 8am-4pm) John Doe 5pm-6pm (changes to that n... | TITLE:
how to change div content by time of the day?
QUESTION:
I want to be able to change the content of a certain div according to the time of the user. For example, if it's 5am, certain content would show. If it's 6am, another content shows. John Doe 8am-4pm (changes to that name when its 8am-4pm) John Doe 5pm-6pm ... | [
"javascript",
"jquery",
"rotation",
"dynamic-content"
] | 3 | 2 | 4,597 | 2 | 0 | 2011-06-08T17:21:35.527000 | 2011-06-08T18:33:37.947000 |
6,282,697 | 6,282,822 | Why does Visual Studio 2010 create precompiled header files even if I don't ask for it? | I have Visual Studio 2010 with SP1 installed. I want to create a simple Win32 console application in C++. I click New Project \ Win32 Console Application There I click Console Application, no for "Empty project", no for "Precompiled header", no for "ATL" and "MFC". The wizard looks like this: Now, if I click finish, I ... | They're not precompiled header files unless they are compiled with the appropriate compiler flags(Yc to create the pch, and Yu to use it). If you check the Precompiled Header checkbox, those flags are set by default on all files added to the project. If you don't check it, they are not. If you don't want any files gene... | Why does Visual Studio 2010 create precompiled header files even if I don't ask for it? I have Visual Studio 2010 with SP1 installed. I want to create a simple Win32 console application in C++. I click New Project \ Win32 Console Application There I click Console Application, no for "Empty project", no for "Precompiled... | TITLE:
Why does Visual Studio 2010 create precompiled header files even if I don't ask for it?
QUESTION:
I have Visual Studio 2010 with SP1 installed. I want to create a simple Win32 console application in C++. I click New Project \ Win32 Console Application There I click Console Application, no for "Empty project", n... | [
"c++",
"visual-studio",
"visual-studio-2010",
"visual-c++"
] | 10 | 9 | 4,378 | 2 | 0 | 2011-06-08T17:21:38.813000 | 2011-06-08T17:31:41.323000 |
6,282,702 | 6,283,036 | how to allow only 1 android toggle button out of 3 to be on at once | i am using 3 toggle buttons. In my android application i would like that only 1 of these toggle buttons can be selected at once. How would i go about doing this? | You could use radio buttons. If you don't want that, check out this link - it shows you how to listen for changes to the button state. If you find that one of your buttons is changed, change the other 2 to the off state. | how to allow only 1 android toggle button out of 3 to be on at once i am using 3 toggle buttons. In my android application i would like that only 1 of these toggle buttons can be selected at once. How would i go about doing this? | TITLE:
how to allow only 1 android toggle button out of 3 to be on at once
QUESTION:
i am using 3 toggle buttons. In my android application i would like that only 1 of these toggle buttons can be selected at once. How would i go about doing this?
ANSWER:
You could use radio buttons. If you don't want that, check out ... | [
"java",
"android",
"togglebutton"
] | 9 | 3 | 12,431 | 5 | 0 | 2011-06-08T17:22:28.673000 | 2011-06-08T17:48:34.327000 |
6,282,712 | 6,282,898 | How to extract file paths from a text file | I am looking for a tool / code in C#, or C++ / C that can extract file paths from a file e.g. File.txt: Lorem Impusum C:\Windows\System32\test.exe C:\Users\Limited\Downloads.txt testing 123 So it would output File.txt as follows: C:\Windows\System32\test.exe C:\Users\Limited\Downloads.txt | This should return what you're after, assuming you've loaded the contents of your file into a List or string[] var result = potentialPaths.Where(Path.IsPathRooted).ToList(); Also, this is C#. | How to extract file paths from a text file I am looking for a tool / code in C#, or C++ / C that can extract file paths from a file e.g. File.txt: Lorem Impusum C:\Windows\System32\test.exe C:\Users\Limited\Downloads.txt testing 123 So it would output File.txt as follows: C:\Windows\System32\test.exe C:\Users\Limited\D... | TITLE:
How to extract file paths from a text file
QUESTION:
I am looking for a tool / code in C#, or C++ / C that can extract file paths from a file e.g. File.txt: Lorem Impusum C:\Windows\System32\test.exe C:\Users\Limited\Downloads.txt testing 123 So it would output File.txt as follows: C:\Windows\System32\test.exe ... | [
"c#",
".net",
"c++",
"c",
"parsing"
] | 0 | 2 | 647 | 4 | 0 | 2011-06-08T17:23:26.473000 | 2011-06-08T17:37:37.323000 |
6,282,713 | 6,282,781 | Jquery - Check if a value of a select box changed from another JS code | I know that you can use the "onChange" method, but the onChange doesn't get fired if I change the value by code, like this: 1 2 3 When the document loads, I would like the alert "changed" to popup... Is this possible? | You could try firing the change event manually, like so: $('#selectBox').val('3').change(); | Jquery - Check if a value of a select box changed from another JS code I know that you can use the "onChange" method, but the onChange doesn't get fired if I change the value by code, like this: 1 2 3 When the document loads, I would like the alert "changed" to popup... Is this possible? | TITLE:
Jquery - Check if a value of a select box changed from another JS code
QUESTION:
I know that you can use the "onChange" method, but the onChange doesn't get fired if I change the value by code, like this: 1 2 3 When the document loads, I would like the alert "changed" to popup... Is this possible?
ANSWER:
You ... | [
"jquery",
"onchange"
] | 3 | 6 | 8,456 | 2 | 0 | 2011-06-08T17:23:29.690000 | 2011-06-08T17:28:24.050000 |
6,282,714 | 6,282,731 | c# handle return value and execute code | there is some code to execute after validation. consider a variable SOQualityStandards = true; this variable is validated before the execution of code. i have come across two ways of checking SOQualityStandards one is if(SOQualityStandards) { //code to execute } and the other is if(!SOQualityStandards) return; //code t... | They have the same semantics (assuming there is no other code in the function after the if-block in the first example). I find the first to be clearer, but that is a matter of personal preference. | c# handle return value and execute code there is some code to execute after validation. consider a variable SOQualityStandards = true; this variable is validated before the execution of code. i have come across two ways of checking SOQualityStandards one is if(SOQualityStandards) { //code to execute } and the other is ... | TITLE:
c# handle return value and execute code
QUESTION:
there is some code to execute after validation. consider a variable SOQualityStandards = true; this variable is validated before the execution of code. i have come across two ways of checking SOQualityStandards one is if(SOQualityStandards) { //code to execute }... | [
"c#",
".net",
"optimization"
] | 2 | 5 | 564 | 4 | 0 | 2011-06-08T17:23:30.903000 | 2011-06-08T17:25:17.233000 |
6,282,719 | 6,282,825 | Remove folders from php scandir listing | I have a php script $filelist = scandir('myfolder/') which list outs files from my folder. But it is adding child folders also to the array so that they are also populated when i print the result using foreach. I want to remove folders from getting added to the array. How can I do this?? | You can use the function glob(), and check if the item of array is_dir(). | Remove folders from php scandir listing I have a php script $filelist = scandir('myfolder/') which list outs files from my folder. But it is adding child folders also to the array so that they are also populated when i print the result using foreach. I want to remove folders from getting added to the array. How can I d... | TITLE:
Remove folders from php scandir listing
QUESTION:
I have a php script $filelist = scandir('myfolder/') which list outs files from my folder. But it is adding child folders also to the array so that they are also populated when i print the result using foreach. I want to remove folders from getting added to the ... | [
"php"
] | 7 | 4 | 18,909 | 6 | 0 | 2011-06-08T17:23:41.790000 | 2011-06-08T17:31:47.153000 |
6,282,741 | 6,282,973 | WebClient doesn't seem to work? | I've got the following code: WebClient client = new WebClient(); client.OpenReadAsync(new Uri("whatever")); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); and: void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { Stream reply = (Stream)e.Result; StreamRe... | I would advice you to not use the WebClient since this has a negative impact on your UI because the callback will always return on the UI thread because of a bug. Here is explained why and how you can use HttpWebRequest as an alternative http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/594e1422-... | WebClient doesn't seem to work? I've got the following code: WebClient client = new WebClient(); client.OpenReadAsync(new Uri("whatever")); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); and: void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { Stream re... | TITLE:
WebClient doesn't seem to work?
QUESTION:
I've got the following code: WebClient client = new WebClient(); client.OpenReadAsync(new Uri("whatever")); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); and: void client_OpenReadCompleted(object sender, OpenReadCompletedEventA... | [
"c#",
"windows-phone-7",
"webclient"
] | 3 | 0 | 3,277 | 3 | 0 | 2011-06-08T17:25:43.787000 | 2011-06-08T17:42:44.067000 |
6,282,745 | 6,282,811 | Best practice to stage files in git | I am looking for a better description of staging files with git itself (other than Git big commit best practices ). I don't need to stash files into smaller commits, ignore files by pattern, etc. What I am looking for is a tutorial that is only about adding files - efficient by browsing through big packs (up to 100) of... | Why is git add -p -- some/dir not good enough? There is also git-gui Hope this helps | Best practice to stage files in git I am looking for a better description of staging files with git itself (other than Git big commit best practices ). I don't need to stash files into smaller commits, ignore files by pattern, etc. What I am looking for is a tutorial that is only about adding files - efficient by brows... | TITLE:
Best practice to stage files in git
QUESTION:
I am looking for a better description of staging files with git itself (other than Git big commit best practices ). I don't need to stash files into smaller commits, ignore files by pattern, etc. What I am looking for is a tutorial that is only about adding files - ... | [
"git",
"staging"
] | 1 | 9 | 1,408 | 2 | 0 | 2011-06-08T17:25:52.913000 | 2011-06-08T17:31:03.263000 |
6,282,759 | 6,282,928 | IOS Memory Management and Application Foreground/Background | In my IOS application, I have a NSDate* property that is marked as retain When My application becomes active again, the properties value has been released. Did I misunderstand how properties and memory management work, and how can I guard against this? | Its obvious that something is sending a release or dealloc message somewhere. If I were you I would create a deep copy like: NSItem *ref = [[NSItem alloc] initWithData: x]; As far as finding out what is happening to that item in question I suggest you use NSZombie as an env variable as step through the call stack to se... | IOS Memory Management and Application Foreground/Background In my IOS application, I have a NSDate* property that is marked as retain When My application becomes active again, the properties value has been released. Did I misunderstand how properties and memory management work, and how can I guard against this? | TITLE:
IOS Memory Management and Application Foreground/Background
QUESTION:
In my IOS application, I have a NSDate* property that is marked as retain When My application becomes active again, the properties value has been released. Did I misunderstand how properties and memory management work, and how can I guard aga... | [
"ios",
"memory-management"
] | 0 | 2 | 250 | 1 | 0 | 2011-06-08T17:26:58.800000 | 2011-06-08T17:39:40.843000 |
6,282,762 | 6,282,808 | What are the differences between non-compiled and compiled ASP.NET pages | Got a situation where we have a working production website that is moving to a different group of servers. The team handling that site has gotten it to work without any issue (we can test it all day long.) The problem they are encountering is that in order for it to go live it has to compile/build without any errors. I... | IIS will compile.as?x files as they are requested. You can have a bug in one and not find it till the page is loaded. If you create a web project (instead of a web directory), when you go to publish, a dll is compiled of ALL your code in the site. None of the.vb files are necessary at that point and only the compiled d... | What are the differences between non-compiled and compiled ASP.NET pages Got a situation where we have a working production website that is moving to a different group of servers. The team handling that site has gotten it to work without any issue (we can test it all day long.) The problem they are encountering is that... | TITLE:
What are the differences between non-compiled and compiled ASP.NET pages
QUESTION:
Got a situation where we have a working production website that is moving to a different group of servers. The team handling that site has gotten it to work without any issue (we can test it all day long.) The problem they are en... | [
"visual-studio-2008",
"build"
] | 0 | 2 | 212 | 1 | 0 | 2011-06-08T17:27:17.990000 | 2011-06-08T17:30:45.190000 |
6,282,766 | 6,282,840 | multi query with prepared statements | I am trying understand how multi queries work in mysqli. But I confess that is not easy to understand. Basically how I can do these queries in a multi query? The page doesn't talk about prepared statements in multi queries. ($sql = $db -> prepare("INSERT INTO users (username, email, password) VALUES (?,?,?)")); $sql ->... | You can't use prepared statements there, and the speedup is also negligible, so go for the easier to debug seperate queries. If you really want to do it in 1 call with prepared statements, create a PROCEDURE (even more difficult to debug...), and prepare CALL(:param1,:param2);. | multi query with prepared statements I am trying understand how multi queries work in mysqli. But I confess that is not easy to understand. Basically how I can do these queries in a multi query? The page doesn't talk about prepared statements in multi queries. ($sql = $db -> prepare("INSERT INTO users (username, email,... | TITLE:
multi query with prepared statements
QUESTION:
I am trying understand how multi queries work in mysqli. But I confess that is not easy to understand. Basically how I can do these queries in a multi query? The page doesn't talk about prepared statements in multi queries. ($sql = $db -> prepare("INSERT INTO users... | [
"php",
"mysql",
"mysqli",
"prepared-statement",
"mysqli-multi-query"
] | 0 | 2 | 1,539 | 2 | 0 | 2011-06-08T17:27:35.493000 | 2011-06-08T17:33:02.077000 |
6,282,776 | 6,283,024 | Copying only a part of a buffer from native code to Java using JNI | I have a very large char buffer in C and need to copy some part of it to a Java array. Specifically, I need the elements starting at 16,384 and ending at 32000. How can I do this? Initially I tried this: jbyte * bytes = (* env) -> GetByteArrayElements (env, array, NULL); memmove (bytes, (jbyte *) buffer, buffer_size); ... | Why not just: memmove(bytes, (jbyte*)(buffer+16384),(32001-16384)); with appropriate changes to the target Java array, and appropriate bounds checking of the C++ buffer. As an aside: My C/C++ is rusty, but is not memcpy more efficient than memmove if you know you don't have overlapping memory? Edit 2011-06-13 Looking o... | Copying only a part of a buffer from native code to Java using JNI I have a very large char buffer in C and need to copy some part of it to a Java array. Specifically, I need the elements starting at 16,384 and ending at 32000. How can I do this? Initially I tried this: jbyte * bytes = (* env) -> GetByteArrayElements (... | TITLE:
Copying only a part of a buffer from native code to Java using JNI
QUESTION:
I have a very large char buffer in C and need to copy some part of it to a Java array. Specifically, I need the elements starting at 16,384 and ending at 32000. How can I do this? Initially I tried this: jbyte * bytes = (* env) -> GetB... | [
"java",
"c",
"java-native-interface",
"byte",
"arrays"
] | 1 | 2 | 1,041 | 2 | 0 | 2011-06-08T17:28:14.190000 | 2011-06-08T17:47:26.290000 |
6,282,784 | 6,282,836 | Oracle debugging technique for row difference | I am running a query on production and it is say returning me 500 rows and I have the same copy on my dev and the query is returning only 497 rows. What approach or steps can be taken to compare the results? Is there a tool? | Assuming there is a database link between the two databases and that the data being returned matches for most of the rows in question, you could use a MINUS operation. Something like SELECT list_of_columns FROM some_table WHERE some_criteria MINUS SELECT list_of_columns FROM some_table@db_link_to_dev WHERE some_criteri... | Oracle debugging technique for row difference I am running a query on production and it is say returning me 500 rows and I have the same copy on my dev and the query is returning only 497 rows. What approach or steps can be taken to compare the results? Is there a tool? | TITLE:
Oracle debugging technique for row difference
QUESTION:
I am running a query on production and it is say returning me 500 rows and I have the same copy on my dev and the query is returning only 497 rows. What approach or steps can be taken to compare the results? Is there a tool?
ANSWER:
Assuming there is a da... | [
"oracle",
"oracle10g"
] | 3 | 4 | 78 | 2 | 0 | 2011-06-08T17:28:25.833000 | 2011-06-08T17:32:30.993000 |
6,282,796 | 6,283,023 | Is it a bad practice to use an identity column to determine the order of row creation? | Possible Duplicate: Can I use a SQL Server identity column to determine the inserted order of rows? If an identity column is reseeded, then it can not be used be used to determine the order of row insertion, but I have no reason to ever reseed the identity. Are there any reasons why I should not use the identity column... | It is not considered a good practice. For example, two processes doing inserts on a table in simultaneous transactions can in some servers have chunks of ids assigned to them, so any row inserted from one transaction will have a lesser id than any row inserted from the other transaction. Also, this can sometimes cause ... | Is it a bad practice to use an identity column to determine the order of row creation? Possible Duplicate: Can I use a SQL Server identity column to determine the inserted order of rows? If an identity column is reseeded, then it can not be used be used to determine the order of row insertion, but I have no reason to e... | TITLE:
Is it a bad practice to use an identity column to determine the order of row creation?
QUESTION:
Possible Duplicate: Can I use a SQL Server identity column to determine the inserted order of rows? If an identity column is reseeded, then it can not be used be used to determine the order of row insertion, but I h... | [
"sql",
"sql-server"
] | 4 | 1 | 575 | 2 | 0 | 2011-06-08T17:29:50.733000 | 2011-06-08T17:47:03.567000 |
6,282,800 | 6,282,900 | What is causing the Disallowed Key Characters error? | Is there a way to find what part of my code is causing the Disallowed Key Characters error in Codeigniter? | It's could be a "bad" form input name that you are trying to run through the Form_validation library. This is the only time I've had this issue, but it could be a $_GET key as well. Without more details from you, it's hard to say - but there's a good place to check. | What is causing the Disallowed Key Characters error? Is there a way to find what part of my code is causing the Disallowed Key Characters error in Codeigniter? | TITLE:
What is causing the Disallowed Key Characters error?
QUESTION:
Is there a way to find what part of my code is causing the Disallowed Key Characters error in Codeigniter?
ANSWER:
It's could be a "bad" form input name that you are trying to run through the Form_validation library. This is the only time I've had ... | [
"php",
"codeigniter"
] | 2 | 1 | 5,109 | 2 | 0 | 2011-06-08T17:30:00.213000 | 2011-06-08T17:37:44.767000 |
6,282,819 | 6,282,970 | How to pass parameter when calling a .ascx control from javascript? | I am using this line to load the.ascx control after running a few javascript statements __doPostBack('<%=Basket1.ClientID %>', null) I do this then i get to the.ascx.cs file i run the code good..but can i pass parameter using the above line, and if i can how can i retrieve them on the ascx.cs page. I want to do it beca... | Ask yourself this: If I look at the flow (not the code, but the business flow), what information do I have when I am running the code one way that I don't when I run it another. If you figure that out, it is what has to be passed to the ASCX control. Then there is the question of when you have to do it. The load of thi... | How to pass parameter when calling a .ascx control from javascript? I am using this line to load the.ascx control after running a few javascript statements __doPostBack('<%=Basket1.ClientID %>', null) I do this then i get to the.ascx.cs file i run the code good..but can i pass parameter using the above line, and if i c... | TITLE:
How to pass parameter when calling a .ascx control from javascript?
QUESTION:
I am using this line to load the.ascx control after running a few javascript statements __doPostBack('<%=Basket1.ClientID %>', null) I do this then i get to the.ascx.cs file i run the code good..but can i pass parameter using the abov... | [
"javascript",
"postback",
"ascx"
] | 0 | 0 | 2,259 | 1 | 0 | 2011-06-08T17:31:37.873000 | 2011-06-08T17:42:36.620000 |
6,282,845 | 6,283,194 | ASP.net MVC ValidationSummary always being rendered | I've added an ASP.net MVC validation summary and even when the page is first loaded and when ModelState is valid it renders this out... Errors The text 'Errors' is not hidden! (Its not even styled but that's not the point!) How do I make it only show the validation summary heading when there's an error? Cheers, Ian. | The validation-summary-valid CSS class is defined in the default MVC /Content/Site.css file as:.validation-summary-valid { display: none; }...do you definitely have a reference to this file in your View? | ASP.net MVC ValidationSummary always being rendered I've added an ASP.net MVC validation summary and even when the page is first loaded and when ModelState is valid it renders this out... Errors The text 'Errors' is not hidden! (Its not even styled but that's not the point!) How do I make it only show the validation su... | TITLE:
ASP.net MVC ValidationSummary always being rendered
QUESTION:
I've added an ASP.net MVC validation summary and even when the page is first loaded and when ModelState is valid it renders this out... Errors The text 'Errors' is not hidden! (Its not even styled but that's not the point!) How do I make it only show... | [
"validation",
"asp.net-mvc-3",
"jquery-validate",
"unobtrusive-validation"
] | 5 | 12 | 3,648 | 1 | 0 | 2011-06-08T17:33:30.430000 | 2011-06-08T18:02:28.197000 |
6,282,848 | 6,282,917 | Are methods in classes using the 'Curiously Recurring Template Pattern' inlined by a modern c++ compiler | I have a performance critical piece of code for which I am considering using the CRTP. My question is to what extent most compilers are able to optimize the code. In particular I am wondering if the compiler can inline (when appropriate) methods. For example, in the following code: template struct Base { void interface... | With optimization turned on, and if the compiler considers this to be worth inlining, yes. What's good in CRTP compared to dynamic dispatch, is that from compiler's point of view it's a regular function call. | Are methods in classes using the 'Curiously Recurring Template Pattern' inlined by a modern c++ compiler I have a performance critical piece of code for which I am considering using the CRTP. My question is to what extent most compilers are able to optimize the code. In particular I am wondering if the compiler can inl... | TITLE:
Are methods in classes using the 'Curiously Recurring Template Pattern' inlined by a modern c++ compiler
QUESTION:
I have a performance critical piece of code for which I am considering using the CRTP. My question is to what extent most compilers are able to optimize the code. In particular I am wondering if th... | [
"c++",
"compiler-optimization",
"crtp"
] | 2 | 3 | 377 | 2 | 0 | 2011-06-08T17:33:37.573000 | 2011-06-08T17:38:58.103000 |
6,282,869 | 6,282,977 | php function with arrays | I want to pass one argument to a function, rather than multiple arguments, that tend to grow unexpectedly. So I figure an array will get the job done. Here's what I've drafted so far... I haven't quite grasped the concept of parsing an array. And this is a good way for me to learn. I generally pass the same variables, ... | Yes you are on the right track. The approach I take is put required paramters as the first parameters and all optional parameters in the last argument which is an array. For example: function fun_stuff($required1, $required2, $var = array()) { // parse optional arguments $recordId = (key_exists('recordID', $var)? $var[... | php function with arrays I want to pass one argument to a function, rather than multiple arguments, that tend to grow unexpectedly. So I figure an array will get the job done. Here's what I've drafted so far... I haven't quite grasped the concept of parsing an array. And this is a good way for me to learn. I generally ... | TITLE:
php function with arrays
QUESTION:
I want to pass one argument to a function, rather than multiple arguments, that tend to grow unexpectedly. So I figure an array will get the job done. Here's what I've drafted so far... I haven't quite grasped the concept of parsing an array. And this is a good way for me to l... | [
"php",
"arrays"
] | 1 | 1 | 111 | 11 | 0 | 2011-06-08T17:35:01.443000 | 2011-06-08T17:43:01.580000 |
6,282,894 | 6,283,269 | remote form_tag rails3 | I have the following remote form_tag, whose goal is to POST the following params: Promotion id and bgUploaderFields to the create action of the csv_upload controller, mimicking the behavior of csv_uploads/new action, from another screen. = form_tag csv_uploads_path(:method=>:post),:remote => true,:disable_with => 'Addi... | Look at your params: Parameters: {"utf8"=>"✓", "authenticity_token"=>"1zJCwY0sXb4TaTpO2d+MLox2CHk1sBpho/JR4oH18sw=", "bgUploaderFieldName"=>"http://upload.contextoptional.com/chag/assets/20110608172149.csv", "promotion_id"=>"{:value=>2}", "commit"=>"Add multiple", "method"=>"post"} You don't have a key named:csv_upload... | remote form_tag rails3 I have the following remote form_tag, whose goal is to POST the following params: Promotion id and bgUploaderFields to the create action of the csv_upload controller, mimicking the behavior of csv_uploads/new action, from another screen. = form_tag csv_uploads_path(:method=>:post),:remote => true... | TITLE:
remote form_tag rails3
QUESTION:
I have the following remote form_tag, whose goal is to POST the following params: Promotion id and bgUploaderFields to the create action of the csv_upload controller, mimicking the behavior of csv_uploads/new action, from another screen. = form_tag csv_uploads_path(:method=>:pos... | [
"ruby-on-rails",
"forms"
] | 0 | 1 | 840 | 1 | 0 | 2011-06-08T17:37:13.840000 | 2011-06-08T18:11:43.703000 |
6,282,897 | 6,282,921 | Can't figure out how to use $(this) correctly in jQuery to get hovered element | So I have several DIVs called achievement, and each one contains a span called recent-share. WHat I would like to do is have each recent-share hidden at first, and the have it appear when the parent 'acheivement' class is hovered. I'm trying to use $(this) to get it, but it won't work. I'm assuming this is a syntax err... | Try: $( ".achievement" ).hover( function() { $( this ).find( ".recent-share" ).show(); }); Also you had a syntax error – it should be function () {, not function()) {. | Can't figure out how to use $(this) correctly in jQuery to get hovered element So I have several DIVs called achievement, and each one contains a span called recent-share. WHat I would like to do is have each recent-share hidden at first, and the have it appear when the parent 'acheivement' class is hovered. I'm trying... | TITLE:
Can't figure out how to use $(this) correctly in jQuery to get hovered element
QUESTION:
So I have several DIVs called achievement, and each one contains a span called recent-share. WHat I would like to do is have each recent-share hidden at first, and the have it appear when the parent 'acheivement' class is h... | [
"javascript",
"jquery",
"hover",
"this",
"show"
] | 1 | 3 | 61 | 3 | 0 | 2011-06-08T17:37:33.393000 | 2011-06-08T17:39:17.233000 |
6,282,901 | 6,283,056 | HtmlGenericControl("img") not generating proper image tag | in asp.net, I'm trying to generate an image tag with: var img = new HtmlGenericControl("img"); it seems to generate How would I generate a normal image tag with asp.net/C#? e.g. | There's a specialized html control for the image element. System.Web.UI.HtmlControls.HtmlImage which generates the html you want. | HtmlGenericControl("img") not generating proper image tag in asp.net, I'm trying to generate an image tag with: var img = new HtmlGenericControl("img"); it seems to generate How would I generate a normal image tag with asp.net/C#? e.g. | TITLE:
HtmlGenericControl("img") not generating proper image tag
QUESTION:
in asp.net, I'm trying to generate an image tag with: var img = new HtmlGenericControl("img"); it seems to generate How would I generate a normal image tag with asp.net/C#? e.g.
ANSWER:
There's a specialized html control for the image element.... | [
"c#",
"asp.net"
] | 2 | 6 | 3,467 | 3 | 0 | 2011-06-08T17:37:47.423000 | 2011-06-08T17:50:32.830000 |
6,282,904 | 6,296,678 | Iterating SelectedItems in a ListBox only returns the first item | I have a databound ListBox that is behaving strangely. The ListBox's SelectionMode property is set to MultiExtended, and on a button click, I need to copy the items to another control, in this case, a TreeView. However, for some reason, every iterator I've tried only loops once. I've attempted both SelectedItems and Se... | Well, it turns out I did withhold some critical information. The listbox has drag-drop behavior enabled, and part of this is a handler for the MouseDown event. The handler has this code in it: private void listBox_MouseDown(object sender, MouseEventArgs e) { if (listBox.Items.Count = 0) return; listBox.DoDragDrop(listB... | Iterating SelectedItems in a ListBox only returns the first item I have a databound ListBox that is behaving strangely. The ListBox's SelectionMode property is set to MultiExtended, and on a button click, I need to copy the items to another control, in this case, a TreeView. However, for some reason, every iterator I'v... | TITLE:
Iterating SelectedItems in a ListBox only returns the first item
QUESTION:
I have a databound ListBox that is behaving strangely. The ListBox's SelectionMode property is set to MultiExtended, and on a button click, I need to copy the items to another control, in this case, a TreeView. However, for some reason, ... | [
".net",
"winforms",
"listbox",
"iteration",
"selecteditem"
] | 2 | 0 | 1,795 | 3 | 0 | 2011-06-08T17:38:03.547000 | 2011-06-09T17:12:13.897000 |
6,282,916 | 6,283,018 | Migrating from jQuery to Prototype (code snippet) | I am using Ruby on Rails 3 and I am migrating from jQuery to Prototype but I am a newbie with the first JavaScript framework so I have some trouble. I would like to write the jQuery version of the following Prototype code: page.select("#test_id").each do |element| element.replace( "Test text ) end How can I do? What is... | $('#test_id').html('Test text'); or $('.test_class').each(function(){ $(this).html('Test text'); }); | Migrating from jQuery to Prototype (code snippet) I am using Ruby on Rails 3 and I am migrating from jQuery to Prototype but I am a newbie with the first JavaScript framework so I have some trouble. I would like to write the jQuery version of the following Prototype code: page.select("#test_id").each do |element| eleme... | TITLE:
Migrating from jQuery to Prototype (code snippet)
QUESTION:
I am using Ruby on Rails 3 and I am migrating from jQuery to Prototype but I am a newbie with the first JavaScript framework so I have some trouble. I would like to write the jQuery version of the following Prototype code: page.select("#test_id").each ... | [
"jquery",
"ruby-on-rails",
"ruby",
"ruby-on-rails-3",
"prototypejs"
] | 0 | 3 | 100 | 1 | 0 | 2011-06-08T17:38:57.547000 | 2011-06-08T17:46:09.977000 |
6,282,923 | 6,283,324 | jQuery FadeTo on two elements triggering one div | I have probably simple question: /the code: http://jsfiddle.net/FZufj/8/ / I have a simple code for a fading menu. I want the menu to fade after mouse over on both the menu and the 'menu button' That isn't hard but I have no idea how to disable the fade effect when mouse moves from menu to menu button I want the menu t... | you should use the.stop(true,false) to stop the current animation. Here's a working version of the code. (removed the double code by using 1 selector to select both the.menu and the.button $(document).ready(function() { // This sets the opacity of the thumbs to fade down to 60% when the page loads $(".menu").fadeTo(600... | jQuery FadeTo on two elements triggering one div I have probably simple question: /the code: http://jsfiddle.net/FZufj/8/ / I have a simple code for a fading menu. I want the menu to fade after mouse over on both the menu and the 'menu button' That isn't hard but I have no idea how to disable the fade effect when mouse... | TITLE:
jQuery FadeTo on two elements triggering one div
QUESTION:
I have probably simple question: /the code: http://jsfiddle.net/FZufj/8/ / I have a simple code for a fading menu. I want the menu to fade after mouse over on both the menu and the 'menu button' That isn't hard but I have no idea how to disable the fade... | [
"jquery",
"menu",
"fadeto"
] | 0 | 0 | 135 | 2 | 0 | 2011-06-08T17:39:23.753000 | 2011-06-08T18:17:06.497000 |
6,282,950 | 6,283,430 | calling a custom @helper method in ms web pages from a client side event | I have a myPage.cshtml page. i have written a @helper method( myMethod() ) in myHelper.cshtml. I can call the helper method inline in the page ( @myHelper.myMethod(); ) and it works just fine. How do i call this same method from a user initiated event like ( menu.item.click, button.click, link click )? | Because your method executes in server-side code, you'll have to create a way to call the code on your server from the client. For example, you could have an action method like this: [HttpPost] public ActionResult MyHelperCaller() { // Returns the contents of the 'myHelperCaller' view: return this.View(); }...where the... | calling a custom @helper method in ms web pages from a client side event I have a myPage.cshtml page. i have written a @helper method( myMethod() ) in myHelper.cshtml. I can call the helper method inline in the page ( @myHelper.myMethod(); ) and it works just fine. How do i call this same method from a user initiated e... | TITLE:
calling a custom @helper method in ms web pages from a client side event
QUESTION:
I have a myPage.cshtml page. i have written a @helper method( myMethod() ) in myHelper.cshtml. I can call the helper method inline in the page ( @myHelper.myMethod(); ) and it works just fine. How do i call this same method from ... | [
"razor",
"webmatrix"
] | 0 | 0 | 888 | 1 | 0 | 2011-06-08T17:41:14.687000 | 2011-06-08T18:26:00.910000 |
6,282,953 | 6,290,677 | Formatting a JSON Date with javascript | I am returning a JSON object from my web service method. The object has some dates in it and so the generated JSON is like the following: {"d": [ {"PeriodID":8,"Period":"072011","BeginDate":"\/Date(1294268400000)\/"}, {"PeriodID":2,"Period":"052011","BeginDate":"\/Date(1293836400000)\/"} ]} I am trying to convert this ... | https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse For example // create 1 of June 2011 from Jun 2011 var period = new Date(Date.parse("1 "+period)); Here is what I think you want | Formatting a JSON Date with javascript I am returning a JSON object from my web service method. The object has some dates in it and so the generated JSON is like the following: {"d": [ {"PeriodID":8,"Period":"072011","BeginDate":"\/Date(1294268400000)\/"}, {"PeriodID":2,"Period":"052011","BeginDate":"\/Date(12938364000... | TITLE:
Formatting a JSON Date with javascript
QUESTION:
I am returning a JSON object from my web service method. The object has some dates in it and so the generated JSON is like the following: {"d": [ {"PeriodID":8,"Period":"072011","BeginDate":"\/Date(1294268400000)\/"}, {"PeriodID":2,"Period":"052011","BeginDate":"... | [
"javascript",
"jquery",
"json",
"datetime",
"date-format"
] | 0 | 1 | 1,250 | 2 | 0 | 2011-06-08T17:41:25.997000 | 2011-06-09T09:24:20.990000 |
6,282,954 | 6,283,369 | StandardInputEncoding for ProcessStartInfo? | When i am adding service to windows manually by typing in CMD something like this: "C:\Program Files (x86)\Windows Resource Kits\Tools\instsrv.exe" "some-pl-char-ąźńćńół" "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe"... everything is good with service name, but when i try do that in c#: ProcessStartIn... | Arguments belongs assigned to the Arguments property and backslashes needs to be escaped by another one. \ -> \\ Updated: using (var process = new Process()) { var encoding = Encoding.GetEncoding(852);
var psi = new ProcessStartInfo(); psi.FileName = "cmd"; psi.RedirectStandardInput = true; psi.RedirectStandardOutput ... | StandardInputEncoding for ProcessStartInfo? When i am adding service to windows manually by typing in CMD something like this: "C:\Program Files (x86)\Windows Resource Kits\Tools\instsrv.exe" "some-pl-char-ąźńćńół" "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe"... everything is good with service name, ... | TITLE:
StandardInputEncoding for ProcessStartInfo?
QUESTION:
When i am adding service to windows manually by typing in CMD something like this: "C:\Program Files (x86)\Windows Resource Kits\Tools\instsrv.exe" "some-pl-char-ąźńćńół" "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe"... everything is good w... | [
"c#",
"windows-services"
] | 9 | 9 | 3,621 | 2 | 0 | 2011-06-08T17:41:27.717000 | 2011-06-08T18:21:02.143000 |
6,282,967 | 6,283,007 | .htacces implemented - URL not correctly refreshing | I am using.htaccess. I have a rule: RewriteRule ^pg/([a-zA-Z0-9/_-]+)?$ index.php?page=$1 [QSA] One of my page has a URL: http://domain.com/pg/page1 In this page there is a meta refresh tag: Now, when this page get refresh..the new url which is formed is: http://domain.com/pg/pg/page2 i.e. pg is coming twice. I have al... | Make sure you start the path with a forward slash ( '/' ), e.g. '/pg/page1' | .htacces implemented - URL not correctly refreshing I am using.htaccess. I have a rule: RewriteRule ^pg/([a-zA-Z0-9/_-]+)?$ index.php?page=$1 [QSA] One of my page has a URL: http://domain.com/pg/page1 In this page there is a meta refresh tag: Now, when this page get refresh..the new url which is formed is: http://domai... | TITLE:
.htacces implemented - URL not correctly refreshing
QUESTION:
I am using.htaccess. I have a rule: RewriteRule ^pg/([a-zA-Z0-9/_-]+)?$ index.php?page=$1 [QSA] One of my page has a URL: http://domain.com/pg/page1 In this page there is a meta refresh tag: Now, when this page get refresh..the new url which is forme... | [
"php",
"refresh"
] | 0 | 1 | 75 | 1 | 0 | 2011-06-08T17:42:19.210000 | 2011-06-08T17:45:30.847000 |
6,282,976 | 6,283,603 | Download / Parse Email with Python | I am working on an email client and have run into a small problem. I am unsure of how to download the email messages and save them to the local HDD. I am able to connect to the server using IMAP4 SSL (with the code below). import imaplib server = imaplib.IMAP4_SSL('imap.gmail.com') server.login('USER', 'PASS') | You can list directories in your mailbox with IMAP4.list. To actually get messages out of a directory use IMAP4.select, and then use IMAP4.search, and iterate over the list of id's it returns. In your case you could do something like this: server.select('[Gmail]/All Mail') resp, items = server.search(None, "(UNSEEN)") ... | Download / Parse Email with Python I am working on an email client and have run into a small problem. I am unsure of how to download the email messages and save them to the local HDD. I am able to connect to the server using IMAP4 SSL (with the code below). import imaplib server = imaplib.IMAP4_SSL('imap.gmail.com') se... | TITLE:
Download / Parse Email with Python
QUESTION:
I am working on an email client and have run into a small problem. I am unsure of how to download the email messages and save them to the local HDD. I am able to connect to the server using IMAP4 SSL (with the code below). import imaplib server = imaplib.IMAP4_SSL('i... | [
"python",
"email",
"download",
"email-client",
"gmail-imap"
] | 3 | 8 | 10,967 | 2 | 0 | 2011-06-08T17:42:53.283000 | 2011-06-08T18:41:16.220000 |
6,282,979 | 6,283,601 | Class variable scope problem, cross data contamination | So I have a main class that calls another singleton class but when running multiple threads (or concurrent threads) I get cross data contamination. This is a very simple version to explain the problem. All the variable setter/getters are in the Singleton and are called and set by the main class. class A {
public funct... | You write in your question that test1 and test2 are two separate processes. From the example code you give I can not see that both scripts exchange data (not code) in a way that allows to be cross-process exchanged (e.g. via a file, session whatever). However from the symptoms it looks like that when you execute test2,... | Class variable scope problem, cross data contamination So I have a main class that calls another singleton class but when running multiple threads (or concurrent threads) I get cross data contamination. This is a very simple version to explain the problem. All the variable setter/getters are in the Singleton and are ca... | TITLE:
Class variable scope problem, cross data contamination
QUESTION:
So I have a main class that calls another singleton class but when running multiple threads (or concurrent threads) I get cross data contamination. This is a very simple version to explain the problem. All the variable setter/getters are in the Si... | [
"php",
"class",
"design-patterns",
"scope"
] | 3 | 3 | 422 | 2 | 0 | 2011-06-08T17:43:06.230000 | 2011-06-08T18:41:10.103000 |
6,282,991 | 6,283,083 | ASP.NET application using the wrong file path when publishing to a windows server 2008 machine | I have an asp.net application that i am modifying. I setup visual studio 2010 to publish to are development server which is running windows server 2008 RC 2 (dont think it matters). I added a new webform to the application through visual studios "add new item" feature and it works on my local computer. When i publish t... | You have to use MapPath("{relativePath/FileName}"). This will return a physical path. filename = MapPath("/images/logo.jpg") Would something along the lines of "C:\inetpub\webroot\images\logo.jpg" | ASP.NET application using the wrong file path when publishing to a windows server 2008 machine I have an asp.net application that i am modifying. I setup visual studio 2010 to publish to are development server which is running windows server 2008 RC 2 (dont think it matters). I added a new webform to the application th... | TITLE:
ASP.NET application using the wrong file path when publishing to a windows server 2008 machine
QUESTION:
I have an asp.net application that i am modifying. I setup visual studio 2010 to publish to are development server which is running windows server 2008 RC 2 (dont think it matters). I added a new webform to ... | [
"c#",
"asp.net",
"visual-studio-2010",
"windows-server-2008-r2"
] | 0 | 1 | 2,499 | 2 | 0 | 2011-06-08T17:43:45.260000 | 2011-06-08T17:53:40.470000 |
6,283,009 | 6,283,077 | What database to use for a single-user sample ASP.NET application? | I have a sample ASP.NET application that I will use in classroom setting. Each student will be running the application independently and it run only on their local machine. The application needs a database, but I'd love it if the students didn't need to install any extra specific database software. Just allowing the st... | I would suggest to use the SQL Server CE, which is just a few DLL's. For SQL Server Express you need to install the server and configure it. This is not suitable in your case. SQL CE is good for local use and good integrated in VS. Resources: http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx | What database to use for a single-user sample ASP.NET application? I have a sample ASP.NET application that I will use in classroom setting. Each student will be running the application independently and it run only on their local machine. The application needs a database, but I'd love it if the students didn't need to... | TITLE:
What database to use for a single-user sample ASP.NET application?
QUESTION:
I have a sample ASP.NET application that I will use in classroom setting. Each student will be running the application independently and it run only on their local machine. The application needs a database, but I'd love it if the stude... | [
"c#",
"asp.net",
"database",
"visual-studio"
] | 0 | 2 | 264 | 6 | 0 | 2011-06-08T17:45:40.030000 | 2011-06-08T17:53:25.517000 |
6,283,012 | 6,283,115 | Simple Numbers to string issue Objective C | So, this might be a little bit messy for me to explain, but here it goes. I have, what i think are, numbers stored in core data and i am trying to convert them into strings so that i can use them as labels for table cells, maybe dumb but please bear with me. I pump the core data items into an array and am trying to get... | There's a few ways of checking what objects contain or whether they are of a certain type; either the [myObject class]; check - if you break on a line after it you can see the class. With your NSNumber though, it will either be a number or have nothing inside it, ie if (myNSNumber!= nil) // then it must hold a value Fi... | Simple Numbers to string issue Objective C So, this might be a little bit messy for me to explain, but here it goes. I have, what i think are, numbers stored in core data and i am trying to convert them into strings so that i can use them as labels for table cells, maybe dumb but please bear with me. I pump the core da... | TITLE:
Simple Numbers to string issue Objective C
QUESTION:
So, this might be a little bit messy for me to explain, but here it goes. I have, what i think are, numbers stored in core data and i am trying to convert them into strings so that i can use them as labels for table cells, maybe dumb but please bear with me. ... | [
"iphone",
"objective-c",
"xcode",
"core-data"
] | 0 | 2 | 126 | 3 | 0 | 2011-06-08T17:45:44.980000 | 2011-06-08T17:56:12.927000 |
6,283,017 | 6,283,243 | one image over the other on mouse hover | I am developing a system, where each user can send personal messages to other users of the system. He can send the same message to any number of users at a time. When he selects more than one user as the target, their profile pictures are displayed below. What I need is, whenever the user hovers his mouse over one of t... | @thirtydot I dont want to use absolute positioning because i have many such pictures and i may have them at many different places on the site using absolute positioning would mean using javascript or jquery to calculate the current position of the hovered element and using that position to assign the position of the ne... | one image over the other on mouse hover I am developing a system, where each user can send personal messages to other users of the system. He can send the same message to any number of users at a time. When he selects more than one user as the target, their profile pictures are displayed below. What I need is, whenever... | TITLE:
one image over the other on mouse hover
QUESTION:
I am developing a system, where each user can send personal messages to other users of the system. He can send the same message to any number of users at a time. When he selects more than one user as the target, their profile pictures are displayed below. What I... | [
"javascript",
"jquery",
"css",
"html"
] | 1 | 2 | 1,535 | 5 | 0 | 2011-06-08T17:46:08.760000 | 2011-06-08T18:08:19.817000 |
6,283,026 | 6,283,226 | How to prevent auto character encoding in .NET | Using VB.NET in Visual Studio 2010, I have two files: "test2.aspx" and "test2.aspx.vb". The aspx file is basically as follows: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="App_test2" %> The vb file is basically like this: meta1.Attributes("charset") = "UTF-8" meta1.Attributes("conte... | You don't. If it didn't convert those characters, the browser would incorrectly interpret them as commands instead of data. It shouldn't be an issue for you because it is always converted back to the character data in code. text2.Text would contain the values you want, not the escaped data. | How to prevent auto character encoding in .NET Using VB.NET in Visual Studio 2010, I have two files: "test2.aspx" and "test2.aspx.vb". The aspx file is basically as follows: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="App_test2" %> The vb file is basically like this: meta1.Attribut... | TITLE:
How to prevent auto character encoding in .NET
QUESTION:
Using VB.NET in Visual Studio 2010, I have two files: "test2.aspx" and "test2.aspx.vb". The aspx file is basically as follows: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="App_test2" %> The vb file is basically like th... | [
"vb.net",
"character-encoding"
] | 0 | 1 | 625 | 1 | 0 | 2011-06-08T17:47:37.247000 | 2011-06-08T18:06:03.833000 |
6,283,037 | 6,283,145 | set maxItemsInObjectGraph in client config | I am specifying maxItemsInObjectGraph in the server config file but while creating client config file, this attribute is ignored and i have to manually add it in the endpointBehaviors section. Is there a way i can make some changes in the config file so that everytime i generate client config and proxy via Svcutil.exe,... | No, that is another behavior which is configured per participant. Each client has control over this property and service doesn't expose this property because it could be considered as security issue. If your problem is mainly about development (where you don't want to modify your behavior every time you refresh the ref... | set maxItemsInObjectGraph in client config I am specifying maxItemsInObjectGraph in the server config file but while creating client config file, this attribute is ignored and i have to manually add it in the endpointBehaviors section. Is there a way i can make some changes in the config file so that everytime i genera... | TITLE:
set maxItemsInObjectGraph in client config
QUESTION:
I am specifying maxItemsInObjectGraph in the server config file but while creating client config file, this attribute is ignored and i have to manually add it in the endpointBehaviors section. Is there a way i can make some changes in the config file so that ... | [
"wcf",
"wcf-binding"
] | 5 | 7 | 8,344 | 2 | 0 | 2011-06-08T17:48:36.757000 | 2011-06-08T17:59:20.773000 |
6,283,042 | 6,283,054 | HTML sends x y POST data with no inputs - how is this possible? | I am trying to logging using php's curl. I am using LiveHTTPHeaders to see what headers are sent. When I login through form it sends action=autorize&login=myname&pass=mypass&x=14&y=10 I can see action, login, pass. The problem is - there are no x and y inputs. And they are random all the time. I searched all html, but ... | The x and y inputs are from an image input. From W3C: An INPUT element with 'TYPE=IMAGE' specifies an image resource to display, and allows input of two form fields: the x and y coordinate of a pixel chosen from the image. The names of the fields are the name of the field with '.x' and '.y' appended. 'TYPE=IMAGE' impli... | HTML sends x y POST data with no inputs - how is this possible? I am trying to logging using php's curl. I am using LiveHTTPHeaders to see what headers are sent. When I login through form it sends action=autorize&login=myname&pass=mypass&x=14&y=10 I can see action, login, pass. The problem is - there are no x and y inp... | TITLE:
HTML sends x y POST data with no inputs - how is this possible?
QUESTION:
I am trying to logging using php's curl. I am using LiveHTTPHeaders to see what headers are sent. When I login through form it sends action=autorize&login=myname&pass=mypass&x=14&y=10 I can see action, login, pass. The problem is - there ... | [
"http",
"curl"
] | 4 | 7 | 3,417 | 3 | 0 | 2011-06-08T17:49:05.077000 | 2011-06-08T17:50:22.497000 |
6,283,085 | 6,283,176 | getline seems to not working correctly | Please tell me what am I doing wrong here. What I want to do is this: 1.Having txt file with four numbers and each of this numbers has 15 digits: std::ifstream file("numbers.txt",std::ios::binary); I'm trying to read those numbers into my array: char num[4][15]; And what I'm thinking I'm doing is: for as long as you do... | Do not use the eof() function! The canonical way to read lines is: while( getline( cin, line ) ) { // do something with line } | getline seems to not working correctly Please tell me what am I doing wrong here. What I want to do is this: 1.Having txt file with four numbers and each of this numbers has 15 digits: std::ifstream file("numbers.txt",std::ios::binary); I'm trying to read those numbers into my array: char num[4][15]; And what I'm think... | TITLE:
getline seems to not working correctly
QUESTION:
Please tell me what am I doing wrong here. What I want to do is this: 1.Having txt file with four numbers and each of this numbers has 15 digits: std::ifstream file("numbers.txt",std::ios::binary); I'm trying to read those numbers into my array: char num[4][15]; ... | [
"c++",
"fstream",
"getline"
] | 0 | 6 | 4,664 | 5 | 0 | 2011-06-08T17:53:43.627000 | 2011-06-08T18:01:24.450000 |
6,283,086 | 6,283,152 | is "select count(*) from..." more reliable than @@ROWCOUNT? | I have a proc that inserts records to a temp table. In pseudocode it looks like this: Create temp table a. Insert rows into temp table based on stringent criteria b. if no rows were inserted, insert based on less stringent criteria c. if there are still no rows, try again with even less stringent criteria select from t... | @@rowcount is the better solution. The work is already done. Selecting count(*) causes the database to do more work. You need to make sure you are not doing something that will affect the value of @@rowcount before checking the value of @@rowcount. It is usually best to check @@rowcount immediately after performing the... | is "select count(*) from..." more reliable than @@ROWCOUNT? I have a proc that inserts records to a temp table. In pseudocode it looks like this: Create temp table a. Insert rows into temp table based on stringent criteria b. if no rows were inserted, insert based on less stringent criteria c. if there are still no row... | TITLE:
is "select count(*) from..." more reliable than @@ROWCOUNT?
QUESTION:
I have a proc that inserts records to a temp table. In pseudocode it looks like this: Create temp table a. Insert rows into temp table based on stringent criteria b. if no rows were inserted, insert based on less stringent criteria c. if ther... | [
"sql",
"sql-server"
] | 1 | 4 | 9,060 | 3 | 0 | 2011-06-08T17:53:44.047000 | 2011-06-08T17:59:34.423000 |
6,283,093 | 6,283,141 | how to change the <header> background color? | I'm using theme "b" for my header tag. I tried to change the color But didn't seem to work..ui-bar-b{ background: #054066; background-image: -moz-linear-gradient(top, #054066, #00578e); background-image: -webkit-gradient(linear,left top,left bottom, color-stop(0, #054066), color-stop(1, #00578e)); -ms-filter: "progid:D... | Where does the ui-bar-b class go? This seems to work. Jquery would be $('.ui-bar-b').css('background-image', '-moz-linear-gradient(top, #00009d, #00578e);'); I would layer the header classes inside a relative position div To avoid the head aches of different browsers and browser vs browser issues. | how to change the <header> background color? I'm using theme "b" for my header tag. I tried to change the color But didn't seem to work..ui-bar-b{ background: #054066; background-image: -moz-linear-gradient(top, #054066, #00578e); background-image: -webkit-gradient(linear,left top,left bottom, color-stop(0, #054066), c... | TITLE:
how to change the <header> background color?
QUESTION:
I'm using theme "b" for my header tag. I tried to change the color But didn't seem to work..ui-bar-b{ background: #054066; background-image: -moz-linear-gradient(top, #054066, #00578e); background-image: -webkit-gradient(linear,left top,left bottom, color-s... | [
"jquery",
"jquery-mobile"
] | 0 | 1 | 6,256 | 2 | 0 | 2011-06-08T17:54:14.663000 | 2011-06-08T17:59:03.703000 |
6,283,107 | 6,283,429 | JAXB marshaller to marshal super-class as root-element and use xsi:type | I'm trying to marshal a sub-class as super-class with xsi:type information as the XML Root element attributes. Currently this is what I have (let's say..): XMLDOCUMENTTYPE is a super class of XMLINVOICETYPE marshalling XMLINVOICETYPE will give me Casting XMLINVOICETYPE instance to XMLDOCUMENTTYPE instance and then mars... | Try marshalling: new JAXBElement(new QName("XMLDOCUMENTTYPE"), XMLDOCUMENTTYPE.class, xmlInfoiceTypeInstance) | JAXB marshaller to marshal super-class as root-element and use xsi:type I'm trying to marshal a sub-class as super-class with xsi:type information as the XML Root element attributes. Currently this is what I have (let's say..): XMLDOCUMENTTYPE is a super class of XMLINVOICETYPE marshalling XMLINVOICETYPE will give me C... | TITLE:
JAXB marshaller to marshal super-class as root-element and use xsi:type
QUESTION:
I'm trying to marshal a sub-class as super-class with xsi:type information as the XML Root element attributes. Currently this is what I have (let's say..): XMLDOCUMENTTYPE is a super class of XMLINVOICETYPE marshalling XMLINVOICET... | [
"java",
"xml",
"jaxb",
"xsi"
] | 0 | 2 | 1,310 | 2 | 0 | 2011-06-08T17:55:29.907000 | 2011-06-08T18:25:48.440000 |
6,283,114 | 6,283,159 | Piping output to a text file in C# | I have a method here, although I would like to pipe the output from it to a file e.g. output.txt, how could I do this in this context? foreach (string tmpLine in File.ReadAllLines(@"c:\filename.txt")) { if (File.Exists(tmpLine)) { //output } } | That's it: var file = File.AppendText(@"c:\output.txt");
foreach (string tmpLine in File.ReadAllLines(@"c:\filename.txt")) { if (File.Exists(tmpLine)) { file.WriteLine(tmpLine); } }
file.Close(); | Piping output to a text file in C# I have a method here, although I would like to pipe the output from it to a file e.g. output.txt, how could I do this in this context? foreach (string tmpLine in File.ReadAllLines(@"c:\filename.txt")) { if (File.Exists(tmpLine)) { //output } } | TITLE:
Piping output to a text file in C#
QUESTION:
I have a method here, although I would like to pipe the output from it to a file e.g. output.txt, how could I do this in this context? foreach (string tmpLine in File.ReadAllLines(@"c:\filename.txt")) { if (File.Exists(tmpLine)) { //output } }
ANSWER:
That's it: var... | [
"c#",
".net",
"windows"
] | 1 | 1 | 1,212 | 2 | 0 | 2011-06-08T17:56:07.923000 | 2011-06-08T18:00:01.960000 |
6,283,116 | 6,283,517 | Issue with adding hours to Gregorian Calendar | I have a Grails application I created a Gregorian Calendar GMT date. The time of day was 11:00:00 PM GMT. I added 3 hours to the Gregorian Calendar object and it changed the time of day to 2:00:00 AM but it did not increment the day of the year. I had to check for the case when I add hours to the calender and if that n... | Works for me: final DateFormat format = SimpleDateFormat.getDateTimeInstance(); format.setTimeZone(DateUtils.UTC_TIME_ZONE);
final GregorianCalendar cal = new GregorianCalendar(DateUtils.UTC_TIME_ZONE); cal.set(2011, Calendar.JUNE, 1, 23, 30, 0); System.out.println(format.format(cal.getTime())); cal.add(Calendar.HOUR_... | Issue with adding hours to Gregorian Calendar I have a Grails application I created a Gregorian Calendar GMT date. The time of day was 11:00:00 PM GMT. I added 3 hours to the Gregorian Calendar object and it changed the time of day to 2:00:00 AM but it did not increment the day of the year. I had to check for the case ... | TITLE:
Issue with adding hours to Gregorian Calendar
QUESTION:
I have a Grails application I created a Gregorian Calendar GMT date. The time of day was 11:00:00 PM GMT. I added 3 hours to the Gregorian Calendar object and it changed the time of day to 2:00:00 AM but it did not increment the day of the year. I had to c... | [
"grails",
"groovy",
"gregorian-calendar"
] | 2 | 4 | 3,698 | 1 | 0 | 2011-06-08T17:56:19.277000 | 2011-06-08T18:33:09.153000 |
6,283,120 | 6,283,514 | How can I find the maximum value from a multi value parameter? | I have a multi select parameter ( @month ) that lists all 12 months. The label is the abbreviation ( Jan, Feb ), the value is the integer for the month ( 1, 2 ). I have another parameter ( @maxmonth ) that is internal that I want to store the maximum month that was selected in. So if the user selected January and March... | In your stored procedure, you'll need to set @maxmonth to the last value of @month. Since SQL Server treats multi-value parameters as a comma-delimited string, the following will help you to get the last value. -- Check to see if only one value was selected IF CHARINDEX(',', @month) = 0 BEGIN SET @maxmonth = @month END... | How can I find the maximum value from a multi value parameter? I have a multi select parameter ( @month ) that lists all 12 months. The label is the abbreviation ( Jan, Feb ), the value is the integer for the month ( 1, 2 ). I have another parameter ( @maxmonth ) that is internal that I want to store the maximum month ... | TITLE:
How can I find the maximum value from a multi value parameter?
QUESTION:
I have a multi select parameter ( @month ) that lists all 12 months. The label is the abbreviation ( Jan, Feb ), the value is the integer for the month ( 1, 2 ). I have another parameter ( @maxmonth ) that is internal that I want to store ... | [
"sql-server",
"reporting-services",
"reporting"
] | 1 | 2 | 748 | 1 | 0 | 2011-06-08T17:56:31.497000 | 2011-06-08T18:33:02.143000 |
6,283,126 | 6,283,506 | How do you bind a variable to a function in as3 | I have this code: for each(var tool in tools){ tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){ trace(tool); //Always the last tool }); } How do I bind the value of tool to the function so that it's accessible on callback? | You have to use a function inside a function to properly bind the scope. It's kind of a hack in AS3. It's better not to go down that rabbit hole if you can help it. If you must, though... for(var tool:Tool in _tools){ var getHandler(scope:Tool):Function{ var t:Tool = scope; return function(e:MouseEvent):void{trace(t)} ... | How do you bind a variable to a function in as3 I have this code: for each(var tool in tools){ tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){ trace(tool); //Always the last tool }); } How do I bind the value of tool to the function so that it's accessible on callback? | TITLE:
How do you bind a variable to a function in as3
QUESTION:
I have this code: for each(var tool in tools){ tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){ trace(tool); //Always the last tool }); } How do I bind the value of tool to the function so that it's accessible on callback?
ANSWER:
You have to us... | [
"flash",
"actionscript-3",
"function",
"binding"
] | 2 | 6 | 2,337 | 5 | 0 | 2011-06-08T17:57:37.577000 | 2011-06-08T18:32:31.883000 |
6,283,129 | 6,286,932 | How would I implement RESTful PUT URLs if the primary key is unknown before the resource is created? | I can see how this would work: /user/456 with GET, POST, and DELETE but not with PUT unless the caller somehow knows the next primary key or they provide it themselves... how is this done? I am going by what I read here: PUT vs POST in REST The PUT method requests that the enclosed entity be stored under the supplied R... | The client should send a POST request to /user to create the resource. The server should then return a 201 CREATED response, with the URI of the resource in the Location header. The client can then GET / PUT / DELETE from the URI it's been given to read/update/delete the resource. | How would I implement RESTful PUT URLs if the primary key is unknown before the resource is created? I can see how this would work: /user/456 with GET, POST, and DELETE but not with PUT unless the caller somehow knows the next primary key or they provide it themselves... how is this done? I am going by what I read here... | TITLE:
How would I implement RESTful PUT URLs if the primary key is unknown before the resource is created?
QUESTION:
I can see how this would work: /user/456 with GET, POST, and DELETE but not with PUT unless the caller somehow knows the next primary key or they provide it themselves... how is this done? I am going b... | [
"http",
"url",
"rest",
"put"
] | 3 | 7 | 1,533 | 1 | 0 | 2011-06-08T17:58:01.607000 | 2011-06-09T00:45:43.470000 |
6,283,135 | 6,296,492 | How do you copy an Excel worksheet into a new workbook AND bring all the charts, images, etc.? | Our application has distribution functionality. It takes several Excel 2007 spreadsheets, copies them into a single sheet, then emails them to the users. The problem is that images and charts are not copying over. I have tried everything I can find on here and various other sources, but sadly nothing seems to work. Our... | You'll need to check the WORKSHEET object of the worksheet you're looking to copy, then run through all the "*Objects" properties, and, for each of those collections, write code to manually copy all the elements in that collection to the new sheet. For example, you've got: ChartObjects ListObjects OleObjects Shapes (Wh... | How do you copy an Excel worksheet into a new workbook AND bring all the charts, images, etc.? Our application has distribution functionality. It takes several Excel 2007 spreadsheets, copies them into a single sheet, then emails them to the users. The problem is that images and charts are not copying over. I have trie... | TITLE:
How do you copy an Excel worksheet into a new workbook AND bring all the charts, images, etc.?
QUESTION:
Our application has distribution functionality. It takes several Excel 2007 spreadsheets, copies them into a single sheet, then emails them to the users. The problem is that images and charts are not copying... | [
"c#",
"excel",
"vsto",
"openxml"
] | 4 | 2 | 8,046 | 4 | 0 | 2011-06-08T17:58:39.683000 | 2011-06-09T16:56:31.333000 |
6,283,137 | 6,284,411 | HtmlAgilityPack skip or remove nested table | I’m using HtmlAgilityPack in order to retrieve the following html (notice the nested table): abc def info 1 info 2 info 3 Now, I’m trying to find a clever way to obtain some information from the parent table and some information from the nested table… So far I have the following: var parentTable = document.DocumentNode... | // is an XPATH expression that means "scan all nodes and sub nodes". That's why //tr gets all tr below the root one. If you just do parentTable.SelectNodes("tr") (or "./tr" which is equivalent), you will select all TR below the root one. If you want to skip the first one, then you can add an XPATH filter on element's p... | HtmlAgilityPack skip or remove nested table I’m using HtmlAgilityPack in order to retrieve the following html (notice the nested table): abc def info 1 info 2 info 3 Now, I’m trying to find a clever way to obtain some information from the parent table and some information from the nested table… So far I have the follow... | TITLE:
HtmlAgilityPack skip or remove nested table
QUESTION:
I’m using HtmlAgilityPack in order to retrieve the following html (notice the nested table): abc def info 1 info 2 info 3 Now, I’m trying to find a clever way to obtain some information from the parent table and some information from the nested table… So far... | [
"html-agility-pack"
] | 0 | 0 | 2,302 | 1 | 0 | 2011-06-08T17:58:53.713000 | 2011-06-08T19:53:19.700000 |
6,283,144 | 6,283,308 | How is it possible to reduce the background height such that my image base and the bottom border are at same level? | I've added an image to a div and the height has been adjusted automatically.Then, I floated the image to the left and move the image to the top using relative positioning..However, the bg height remains the same. How can I decrease the height automatically? CSS(4) | Try using a negative top margin on the image instead of the top: #bg img { float: right; margin-top: -50px; } For example: http://jsfiddle.net/ambiguous/k2Rq7/1/ Setting top on a relatively positioned element doesn't move the element's box, it just adjusts where the element is displayed with respect to that box: For re... | How is it possible to reduce the background height such that my image base and the bottom border are at same level? I've added an image to a div and the height has been adjusted automatically.Then, I floated the image to the left and move the image to the top using relative positioning..However, the bg height remains t... | TITLE:
How is it possible to reduce the background height such that my image base and the bottom border are at same level?
QUESTION:
I've added an image to a div and the height has been adjusted automatically.Then, I floated the image to the left and move the image to the top using relative positioning..However, the b... | [
"html",
"css"
] | 0 | 1 | 796 | 1 | 0 | 2011-06-08T17:59:13.100000 | 2011-06-08T18:15:31.107000 |
6,283,148 | 6,283,254 | Getting strange touch coordinates | I'm trying to detect pinch using multitouch in onTouchEvent of the activity. But the coordinates I'm getting are behaving erratically sometimes. For example I'm getting the following coordinates one after another and as you can see X value jumps suddenly: 06-08 20:48:38.625: DEBUG/(1989): X0:300.6635,Y0:655.4612 06-08 ... | The Nexus One has a defective multi touch sensor/software. It seems that whenever your two fingers cross on an axis, the coordinates can get messed up. This app will help demonstrate the problem on your phone. The good news is that this is a problem exclusive to the N1 so you can still make the application as you want,... | Getting strange touch coordinates I'm trying to detect pinch using multitouch in onTouchEvent of the activity. But the coordinates I'm getting are behaving erratically sometimes. For example I'm getting the following coordinates one after another and as you can see X value jumps suddenly: 06-08 20:48:38.625: DEBUG/(198... | TITLE:
Getting strange touch coordinates
QUESTION:
I'm trying to detect pinch using multitouch in onTouchEvent of the activity. But the coordinates I'm getting are behaving erratically sometimes. For example I'm getting the following coordinates one after another and as you can see X value jumps suddenly: 06-08 20:48:... | [
"android",
"multi-touch"
] | 1 | 2 | 266 | 1 | 0 | 2011-06-08T17:59:21.737000 | 2011-06-08T18:09:38.943000 |
6,283,150 | 6,287,728 | Ektron Content APIs and ASP.NET MVC | To get the core question out of the way first: has anyone used the Ektron content APIs and can comment on using them to get Ektron CMS content instead of using native Ektron controls? I'd like to use these APIs in an ASP.NET MVC site. Now the background: we have a client with an existing site that is a fusion of Ektron... | I coded a site with a large proportion of non-Ektron controls, but I used Webforms.MVP rather than MVC. This allowed me to mix-and-match MVP controls with the Ektron controls. Ektron has got a couple APIs - there is an older web service based API which should be accessible from a non-Webforms project. I am not sure if ... | Ektron Content APIs and ASP.NET MVC To get the core question out of the way first: has anyone used the Ektron content APIs and can comment on using them to get Ektron CMS content instead of using native Ektron controls? I'd like to use these APIs in an ASP.NET MVC site. Now the background: we have a client with an exis... | TITLE:
Ektron Content APIs and ASP.NET MVC
QUESTION:
To get the core question out of the way first: has anyone used the Ektron content APIs and can comment on using them to get Ektron CMS content instead of using native Ektron controls? I'd like to use these APIs in an ASP.NET MVC site. Now the background: we have a c... | [
"asp.net",
"asp.net-mvc",
"ektron"
] | 3 | 3 | 1,874 | 1 | 0 | 2011-06-08T17:59:23.720000 | 2011-06-09T03:14:40.383000 |
6,283,160 | 6,284,696 | Chrome and IE8 vs the others | I am in the process of creating a web page in which I wish to replace a element with a new element. The original element is (for example):;Abbreviation;The definition The form of the supplied string is. The separator is supplied to insure that any special characters in either the first or the second string will not cau... | In IE8, there are two parts to the failure. The first is that the HTTP headers include this line: x-ua-compatible: IE=EmulateIE7 which is putting the browser into IE7 mode. The second part is that the GreenLinkTest.js contains getAttribute("class") which doesn't work in IE7. See getAttribute cannot return class in IE7?... | Chrome and IE8 vs the others I am in the process of creating a web page in which I wish to replace a element with a new element. The original element is (for example):;Abbreviation;The definition The form of the supplied string is. The separator is supplied to insure that any special characters in either the first or t... | TITLE:
Chrome and IE8 vs the others
QUESTION:
I am in the process of creating a web page in which I wish to replace a element with a new element. The original element is (for example):;Abbreviation;The definition The form of the supplied string is. The separator is supplied to insure that any special characters in eit... | [
"javascript",
"css",
"xhtml",
"internet-explorer-8"
] | 3 | 0 | 182 | 2 | 0 | 2011-06-08T18:00:08.887000 | 2011-06-08T20:15:19.247000 |
6,283,161 | 6,283,217 | Fast/low-memory method to parse first two columns in a large csv file using c# | I'm parsing a large csv files - about 500 meg (many rows, many columns). I only need the first two columns (so up to the second comma on each line). Also, multiple threads need access to this file at the same time, so I can't take an exclusive lock. What's the fastest/least memory consuming approach to this problem? Wh... | If you want low memory, you'll probably use a StreamReader and ReadLine by line. In a similar case the other day, I was able to skip the first 20,000,000 lines in a 500 MB file and build a string (using StringBuilder) for the next 1,000,000 lines in about 7 seconds. | Fast/low-memory method to parse first two columns in a large csv file using c# I'm parsing a large csv files - about 500 meg (many rows, many columns). I only need the first two columns (so up to the second comma on each line). Also, multiple threads need access to this file at the same time, so I can't take an exclusi... | TITLE:
Fast/low-memory method to parse first two columns in a large csv file using c#
QUESTION:
I'm parsing a large csv files - about 500 meg (many rows, many columns). I only need the first two columns (so up to the second comma on each line). Also, multiple threads need access to this file at the same time, so I can... | [
"c#",
".net",
".net-4.0",
"csv",
"text-parsing"
] | 1 | 4 | 520 | 2 | 0 | 2011-06-08T18:00:09.123000 | 2011-06-08T18:05:10.973000 |
6,283,166 | 6,283,538 | java setText in loop | Hi im trying to setText to JTextArea in loop but I want to do it, thtat in each loop every line will be seen in frame. I have tryied with Thread.sleep(500), becouse I thought loop is too fast to set each line, but its didnt help. Is it possible?? to do it? I want to do it to show to user progress with downloading files... | the nature of event-based singlethreaded guis makes it so that the changes are only visible once the event is fully handled (returned from the event handler) blocking the event dispatch thread won't help (and even makes the entire app unresponsive ) you should use a timer to simulate the adding one at the time with a d... | java setText in loop Hi im trying to setText to JTextArea in loop but I want to do it, thtat in each loop every line will be seen in frame. I have tryied with Thread.sleep(500), becouse I thought loop is too fast to set each line, but its didnt help. Is it possible?? to do it? I want to do it to show to user progress w... | TITLE:
java setText in loop
QUESTION:
Hi im trying to setText to JTextArea in loop but I want to do it, thtat in each loop every line will be seen in frame. I have tryied with Thread.sleep(500), becouse I thought loop is too fast to set each line, but its didnt help. Is it possible?? to do it? I want to do it to show ... | [
"java",
"loops",
"sleep"
] | 1 | 2 | 2,262 | 2 | 0 | 2011-06-08T18:00:38.047000 | 2011-06-08T18:34:42.360000 |
6,283,168 | 6,283,213 | 'foo' was not declared in this scope c++ | I'm just learning c++ (first day looking at it since I took a 1 week summer camp years ago) I was converting a program I'm working on in Java to C++: #ifndef ADD_H #define ADD_H #define _USE_MATH_DEFINES #include #include using namespace std;
class Evaluatable { public: virtual double evaluate(double x); };
class Ske... | In C++ you are supposed to declare functions before you can use them. In your code integrate is not declared before the point of the first call to integrate. The same applies to sum. Hence the error. Either reorder your definitions so that function definition precedes the first call to that function, or introduce a [fo... | 'foo' was not declared in this scope c++ I'm just learning c++ (first day looking at it since I took a 1 week summer camp years ago) I was converting a program I'm working on in Java to C++: #ifndef ADD_H #define ADD_H #define _USE_MATH_DEFINES #include #include using namespace std;
class Evaluatable { public: virtual... | TITLE:
'foo' was not declared in this scope c++
QUESTION:
I'm just learning c++ (first day looking at it since I took a 1 week summer camp years ago) I was converting a program I'm working on in Java to C++: #ifndef ADD_H #define ADD_H #define _USE_MATH_DEFINES #include #include using namespace std;
class Evaluatable... | [
"c++",
"function"
] | 41 | 58 | 292,364 | 3 | 0 | 2011-06-08T18:00:45.080000 | 2011-06-08T18:04:55.237000 |
6,283,172 | 6,283,509 | UIWebView cannot click link | I am pretty sure that I understand how to catch a click on a UIWebView using the webView:shouldStartLoadWithRequest:navigationType: method, but my webView does not even allow me to click the link. I am using: UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(12, top, boundsSize.width - 40.0, 400.0f)]; we... | The reason for the UIWebView not responding to touch events is most probably this line: webView.opaque = NO; Try setting opaque to YES. My understanding is that for a view to respond to touch events, that view has to be returned by the call to hitTest:withEvent: during the view hierarchy traversal performed by the even... | UIWebView cannot click link I am pretty sure that I understand how to catch a click on a UIWebView using the webView:shouldStartLoadWithRequest:navigationType: method, but my webView does not even allow me to click the link. I am using: UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(12, top, boundsSiz... | TITLE:
UIWebView cannot click link
QUESTION:
I am pretty sure that I understand how to catch a click on a UIWebView using the webView:shouldStartLoadWithRequest:navigationType: method, but my webView does not even allow me to click the link. I am using: UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(... | [
"iphone",
"ios",
"uiwebview"
] | 6 | 2 | 9,616 | 2 | 0 | 2011-06-08T18:01:01.020000 | 2011-06-08T18:32:39.747000 |
6,283,202 | 6,283,246 | C# bool arrays, COM interop, and access violations | I have a COM component written in C++. One of the MIDL interfaces has a function defined like: HRESULT __stdcall GetValues( int length, [ref, size_is(*length)] VARIANT_BOOL out[]); GetValues just populates the out array with values: for (int i = 0; i < length; ++i) out[i] = (i % 2)!= 0; I've tried to call it from C# us... | VARIANT_BOOL is indeed a 2-byte value: http://blogs.msdn.com/b/oldnewthing/archive/2004/12/22/329884.aspx So when you marshal it as UnmanagedType.VariantBool, you're not changing anything because you're marshalling it in as exactly the same thing that's being returned anyway. What I would try first is UnmanagedType.U1.... | C# bool arrays, COM interop, and access violations I have a COM component written in C++. One of the MIDL interfaces has a function defined like: HRESULT __stdcall GetValues( int length, [ref, size_is(*length)] VARIANT_BOOL out[]); GetValues just populates the out array with values: for (int i = 0; i < length; ++i) out... | TITLE:
C# bool arrays, COM interop, and access violations
QUESTION:
I have a COM component written in C++. One of the MIDL interfaces has a function defined like: HRESULT __stdcall GetValues( int length, [ref, size_is(*length)] VARIANT_BOOL out[]); GetValues just populates the out array with values: for (int i = 0; i ... | [
".net",
"boolean",
"marshalling",
"com-interop"
] | 2 | 1 | 994 | 1 | 0 | 2011-06-08T18:03:20.733000 | 2011-06-08T18:08:49.193000 |
6,283,208 | 6,283,248 | "void value not ignored as it ought to be" error | I am getting an error "void value not ignored as it ought to be" on the line: home = [[Home alloc] initWithPhoto:imageView.image]; Please help. | Your Home class' -initWithPhoto: function is probably returning void. Initializer functions are supposed to return id. | "void value not ignored as it ought to be" error I am getting an error "void value not ignored as it ought to be" on the line: home = [[Home alloc] initWithPhoto:imageView.image]; Please help. | TITLE:
"void value not ignored as it ought to be" error
QUESTION:
I am getting an error "void value not ignored as it ought to be" on the line: home = [[Home alloc] initWithPhoto:imageView.image]; Please help.
ANSWER:
Your Home class' -initWithPhoto: function is probably returning void. Initializer functions are supp... | [
"iphone",
"objective-c",
"void"
] | 2 | 4 | 1,536 | 3 | 0 | 2011-06-08T18:03:52.983000 | 2011-06-08T18:08:55.907000 |
6,283,227 | 6,296,424 | Using CSS, How can I stack two spans between two floating divs? | At the top of a page I've got two divs, one floated to the left and one to the right. I can place text with a border between them, however, I now need to stack two such areas of text between them. Here's a Fiddle illustrating my problem: http://jsfiddle.net/TcRxp/ I need the orange box under the green box, with each ce... | I got it by putting together many different sources. Alex Coles' solution was closest right off the bat but the middle wasn't centered. It was much cleaner than my mess too. I started with the code from this post: Hello Left Hello Right Hello Middle ( fiddle for above ) I took the elements Alex cleaned up which got me ... | Using CSS, How can I stack two spans between two floating divs? At the top of a page I've got two divs, one floated to the left and one to the right. I can place text with a border between them, however, I now need to stack two such areas of text between them. Here's a Fiddle illustrating my problem: http://jsfiddle.ne... | TITLE:
Using CSS, How can I stack two spans between two floating divs?
QUESTION:
At the top of a page I've got two divs, one floated to the left and one to the right. I can place text with a border between them, however, I now need to stack two such areas of text between them. Here's a Fiddle illustrating my problem: ... | [
"html",
"css-float",
"quirks-mode",
"css"
] | 0 | 0 | 1,662 | 5 | 0 | 2011-06-08T18:06:21.507000 | 2011-06-09T16:50:46.333000 |
6,283,229 | 6,292,030 | Generator Function Performance | I'm trying to understand the performance of a generator function. I've used cProfile and the pstats module to collect and inspect profiling data. The function in question is this: def __iter__(self): delimiter = None inData = self.inData lenData = len(inData) cursor = 0 while cursor < lenData: if delimiter: mo = self.s... | This is actually the answer of Dunes, who unfortunately only gave it as a comment and doesn't seem to be inclined to put it in a proper answer. The main performance culprit were the string slices. Some timing measurements showed that slicing performance degrades perceivably with big slices (meaning taking a big slice f... | Generator Function Performance I'm trying to understand the performance of a generator function. I've used cProfile and the pstats module to collect and inspect profiling data. The function in question is this: def __iter__(self): delimiter = None inData = self.inData lenData = len(inData) cursor = 0 while cursor < len... | TITLE:
Generator Function Performance
QUESTION:
I'm trying to understand the performance of a generator function. I've used cProfile and the pstats module to collect and inspect profiling data. The function in question is this: def __iter__(self): delimiter = None inData = self.inData lenData = len(inData) cursor = 0 ... | [
"python",
"performance",
"profiling",
"generator"
] | 6 | 2 | 772 | 2 | 0 | 2011-06-08T18:07:05.593000 | 2011-06-09T11:25:16.153000 |
6,283,233 | 6,283,451 | Is Facebook's /me/permissions an undocumented Graph API call? | After looking for ways to check if a user has a given permission, I stumbled upon some obscure reference to /me/permissions, which, lo and behold, works! For the life of me, I can't find the documentation on the Facebook Documentation - is it deprecated, or simply undocumented? Given how often facebook changes things, ... | They blogged about that: As part of our efforts to transition functionality from legacy REST APIs to the Graph API, we added the ability to retrieve the list of permissions users have granted your app by adding the permissions connection to the User object. And is part of the docs on the User object, under connections. | Is Facebook's /me/permissions an undocumented Graph API call? After looking for ways to check if a user has a given permission, I stumbled upon some obscure reference to /me/permissions, which, lo and behold, works! For the life of me, I can't find the documentation on the Facebook Documentation - is it deprecated, or ... | TITLE:
Is Facebook's /me/permissions an undocumented Graph API call?
QUESTION:
After looking for ways to check if a user has a given permission, I stumbled upon some obscure reference to /me/permissions, which, lo and behold, works! For the life of me, I can't find the documentation on the Facebook Documentation - is ... | [
"facebook",
"facebook-graph-api"
] | 5 | 9 | 3,339 | 1 | 0 | 2011-06-08T18:07:14.193000 | 2011-06-08T18:27:42.157000 |
6,283,237 | 6,283,379 | NSXMLParser : requesting guidance with making grouped tables from an RSS/XML feed | Im making a group table that is populated from an XML/RSS feed, ive managed to parse the data to the table just fine, but im stuck on how to make the table grouped? ie, i want an events listing, and i want to organise the events in groups, using the Month for each group, how would i achieve this? below is my XML struct... | NSMutableSet doesn't store the duplicate values,it only stores distinct ones.So at the time of parsing,you can use NSMutableSet to store the 'month' value of each xml element and set the number of sections in a tableview to the count of your NSMutableSet. | NSXMLParser : requesting guidance with making grouped tables from an RSS/XML feed Im making a group table that is populated from an XML/RSS feed, ive managed to parse the data to the table just fine, but im stuck on how to make the table grouped? ie, i want an events listing, and i want to organise the events in groups... | TITLE:
NSXMLParser : requesting guidance with making grouped tables from an RSS/XML feed
QUESTION:
Im making a group table that is populated from an XML/RSS feed, ive managed to parse the data to the table just fine, but im stuck on how to make the table grouped? ie, i want an events listing, and i want to organise th... | [
"iphone",
"cocoa-touch",
"ios",
"uitableview",
"nsxmlparser"
] | 0 | 0 | 93 | 1 | 0 | 2011-06-08T18:07:39.587000 | 2011-06-08T18:22:13.687000 |
6,283,255 | 6,283,431 | Determine if a string is a valid jQuery selector? | Does jQuery have a method to determine if an argument passed to function is a selector? I am making a template for some jQuery plugins and I need to be able to check if the argument passed in is a jQuery selector. I want to allow for other data types and perform different methods based on what data type is passed. Dete... | Lots of strings can technically be a selector like $('blah') could select custom elements! There isn't any good way of knowing the intent of what to do with the argument passed to your function, so it's best to have a well defined structure like Gaby has commented. Selector: yourFunction({ selector: 'div' }); Or yourFu... | Determine if a string is a valid jQuery selector? Does jQuery have a method to determine if an argument passed to function is a selector? I am making a template for some jQuery plugins and I need to be able to check if the argument passed in is a jQuery selector. I want to allow for other data types and perform differe... | TITLE:
Determine if a string is a valid jQuery selector?
QUESTION:
Does jQuery have a method to determine if an argument passed to function is a selector? I am making a template for some jQuery plugins and I need to be able to check if the argument passed in is a jQuery selector. I want to allow for other data types a... | [
"javascript",
"jquery",
"jquery-selectors"
] | 15 | 5 | 11,075 | 5 | 0 | 2011-06-08T18:09:46.950000 | 2011-06-08T18:26:02.900000 |
6,283,259 | 6,283,384 | Simple refactoring sql query | I have the table with rows: ID CountryCode Status ----------- ----------- ----------- 2 PL 1 3 PL 2 4 EN 1 5 EN 1 and by the query SELECT * FROM [TestTable] WHERE Status = 1 AND CountryCode NOT IN (SELECT CountryCode FROM [TestTable] WHERE Status!= 1) I get all countrycodes which hasn't status value = 2 ID CountryCode ... | First: Never use SELECT * in often used code. Especially in production. Call out your columns. Soap-Box over. Note: i haven't tried this, and I don't currently have the management studio installed, so I can't test it. But I think you want something like this: Select Id, CountryCode, Status From [TestTable] t Where Stat... | Simple refactoring sql query I have the table with rows: ID CountryCode Status ----------- ----------- ----------- 2 PL 1 3 PL 2 4 EN 1 5 EN 1 and by the query SELECT * FROM [TestTable] WHERE Status = 1 AND CountryCode NOT IN (SELECT CountryCode FROM [TestTable] WHERE Status!= 1) I get all countrycodes which hasn't sta... | TITLE:
Simple refactoring sql query
QUESTION:
I have the table with rows: ID CountryCode Status ----------- ----------- ----------- 2 PL 1 3 PL 2 4 EN 1 5 EN 1 and by the query SELECT * FROM [TestTable] WHERE Status = 1 AND CountryCode NOT IN (SELECT CountryCode FROM [TestTable] WHERE Status!= 1) I get all countrycode... | [
"sql",
"sql-server-2005",
"refactoring"
] | 3 | 7 | 154 | 4 | 0 | 2011-06-08T18:10:25.797000 | 2011-06-08T18:22:28.043000 |
6,283,264 | 6,283,498 | Get data from sqlite database per day DATE TIME | I have a sqlite database. I have three columns:_id, date, value. I now want to extract a count of the _id:s depending on the day in the date, and calculate an average of the int value. This is for an Android app. So I want to "select the day in date and for each day ( for sixty days), count how many _id:s there are for... | You'll want to use a GROUP BY expression to aggregate the entries by date. It's not quite clear whether you're looking for the last 60 days of entries in the database, or the entries from the last 60 real days (which would only be the same if you can assume that there are entries every day). For the former (last 60 day... | Get data from sqlite database per day DATE TIME I have a sqlite database. I have three columns:_id, date, value. I now want to extract a count of the _id:s depending on the day in the date, and calculate an average of the int value. This is for an Android app. So I want to "select the day in date and for each day ( for... | TITLE:
Get data from sqlite database per day DATE TIME
QUESTION:
I have a sqlite database. I have three columns:_id, date, value. I now want to extract a count of the _id:s depending on the day in the date, and calculate an average of the int value. This is for an Android app. So I want to "select the day in date and ... | [
"android",
"sqlite",
"datetime"
] | 4 | 5 | 7,421 | 2 | 0 | 2011-06-08T18:11:12.567000 | 2011-06-08T18:31:41.297000 |
6,283,267 | 6,283,327 | How can I filter results of one LINQ query based on another? | Given the following: DP_DatabaseTableAdapters.EmployeeTableAdapter employeetableAdapter = new DP_DatabaseTableAdapters.EmployeeTableAdapter(); DP_Database.EmployeeDataTable employeeTable = employeetableAdapter.GetData();
var leadEmployees = from e in employeeTable where e.IsLead == true select e;
DP_DatabaseTableAdap... | The contains will only want a whole EmployeeRow if you are selecting whole employee roles. You can either: leadEmployees.Select(e => e.id).contains OR leadEmployees.Count(e => e.id == l.id) > 0 Both will work. (Excuse slightly rushed lack of consideration for syntax accuracies). | How can I filter results of one LINQ query based on another? Given the following: DP_DatabaseTableAdapters.EmployeeTableAdapter employeetableAdapter = new DP_DatabaseTableAdapters.EmployeeTableAdapter(); DP_Database.EmployeeDataTable employeeTable = employeetableAdapter.GetData();
var leadEmployees = from e in employe... | TITLE:
How can I filter results of one LINQ query based on another?
QUESTION:
Given the following: DP_DatabaseTableAdapters.EmployeeTableAdapter employeetableAdapter = new DP_DatabaseTableAdapters.EmployeeTableAdapter(); DP_Database.EmployeeDataTable employeeTable = employeetableAdapter.GetData();
var leadEmployees =... | [
"c#",
"linq",
"filtering"
] | 2 | 3 | 3,558 | 2 | 0 | 2011-06-08T18:11:28.460000 | 2011-06-08T18:17:10.253000 |
6,283,277 | 6,286,751 | StructureMap constructor injection with named maps | In my object factory initialization, I have something like this: ObjectFactory.Initialize(factory=> { factory.For ().Add((IContext context) => (User)Session["Current"]).Named("CurrentUser"); factory.For ().Add((IContext context) => new User()).Named("NewUser"); }); Then in my controllers, I want to be able to do someth... | There is no good way to do it with StructureMap, but I would argue that you probably shouldn't do it with StructureMap. MyOtherController should just create the User instance itself (or delegate to an IUserSource if there is more involved). | StructureMap constructor injection with named maps In my object factory initialization, I have something like this: ObjectFactory.Initialize(factory=> { factory.For ().Add((IContext context) => (User)Session["Current"]).Named("CurrentUser"); factory.For ().Add((IContext context) => new User()).Named("NewUser"); }); The... | TITLE:
StructureMap constructor injection with named maps
QUESTION:
In my object factory initialization, I have something like this: ObjectFactory.Initialize(factory=> { factory.For ().Add((IContext context) => (User)Session["Current"]).Named("CurrentUser"); factory.For ().Add((IContext context) => new User()).Named("... | [
"asp.net-mvc-3",
"structuremap"
] | 2 | 2 | 713 | 1 | 0 | 2011-06-08T18:12:16.247000 | 2011-06-09T00:17:12.627000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.