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,271,397 | 6,271,591 | How do I get two lists together in R? | I am generating two tables using the table command in R. I want to make a table/dataframe/matrix such that all the names from both the tables are represented and proper 'zero' counts are included in the output. e.g. The data I currently have looks something as follows Table 1 A B C 1 2 4 Table 2 C D E 3 4 4 I would lik... | without reshape: t1 <- table(c("A", rep("B", 2), rep("C", 4))) t2 <- table(c(rep("C", 3), rep("D", 4), rep("E", 4)))
ndf <- merge(t1, t2, by = "Var1", all = TRUE) ndf[is.na(ndf)] <- 0 ndf Var1 Freq.x Freq.y 1 A 1 0 2 B 2 0 3 C 4 3 4 D 0 4 5 E 0 4 | How do I get two lists together in R? I am generating two tables using the table command in R. I want to make a table/dataframe/matrix such that all the names from both the tables are represented and proper 'zero' counts are included in the output. e.g. The data I currently have looks something as follows Table 1 A B C... | TITLE:
How do I get two lists together in R?
QUESTION:
I am generating two tables using the table command in R. I want to make a table/dataframe/matrix such that all the names from both the tables are represented and proper 'zero' counts are included in the output. e.g. The data I currently have looks something as fol... | [
"r",
"dataframe"
] | 2 | 5 | 300 | 3 | 0 | 2011-06-07T20:44:08.300000 | 2011-06-07T21:00:04.103000 |
6,271,398 | 6,271,629 | onmouseover triggered at onmousemove | Question: I got a Picture on the website (as ) and a div which i want to move over it with the mouse. This works quite good, but something does not work: If I enter the image, the onmouseover event takes place, but if I move the mouse, there is always the event onmousemove AND onmouseover triggered, which is not correc... | Here is an example that I made, it's actually doing the zooming too. I only used onmousemove and check every move if the cursor is still in the area of the image. If this is not the case, the zoom box is hidden. I added borders to both the zoom box and the images, so that you can see that it effectively works with bord... | onmouseover triggered at onmousemove Question: I got a Picture on the website (as ) and a div which i want to move over it with the mouse. This works quite good, but something does not work: If I enter the image, the onmouseover event takes place, but if I move the mouse, there is always the event onmousemove AND onmou... | TITLE:
onmouseover triggered at onmousemove
QUESTION:
Question: I got a Picture on the website (as ) and a div which i want to move over it with the mouse. This works quite good, but something does not work: If I enter the image, the onmouseover event takes place, but if I move the mouse, there is always the event onm... | [
"javascript",
"dom-events"
] | 1 | 1 | 686 | 2 | 0 | 2011-06-07T20:44:15.493000 | 2011-06-07T21:03:17.173000 |
6,271,399 | 6,271,808 | Would this cause a memory leak? | Okay, so I am having somewhat of a disagreement with someone else, and I was hoping someone who knows more about c++ than either of us can clear this up. Say we have this block of code somewhere inside a function(for a tilemap engine): void loadTiles() { Tile* tile = new Tile(); Level->addTile(x, y, tile); //x and y ar... | Let's look at each piece of code. 1) Allocating memory Tile* tile = new Tile(); This creates a new Tile object on the heap and stores the memory address in the variable tile. Keep in mind that the variable tile is only a pointer, not the object itself. 2) Copying the reference void Level::addTile(int x, int y, Tile *ti... | Would this cause a memory leak? Okay, so I am having somewhat of a disagreement with someone else, and I was hoping someone who knows more about c++ than either of us can clear this up. Say we have this block of code somewhere inside a function(for a tilemap engine): void loadTiles() { Tile* tile = new Tile(); Level->a... | TITLE:
Would this cause a memory leak?
QUESTION:
Okay, so I am having somewhat of a disagreement with someone else, and I was hoping someone who knows more about c++ than either of us can clear this up. Say we have this block of code somewhere inside a function(for a tilemap engine): void loadTiles() { Tile* tile = ne... | [
"c++",
"memory",
"pointers",
"memory-leaks",
"allocation"
] | 0 | 8 | 331 | 9 | 0 | 2011-06-07T20:44:16.403000 | 2011-06-07T21:21:58.073000 |
6,271,405 | 6,271,756 | Comparing part of a string | I got a problem with Delphi. I have to compare a string of 4 char, with data in database which is 6 char long (postal code(netherlands)). What I have now is: procedure Tfmpostcode.Button1Click(Sender: TObject); var postcode: string; target: string; begin postcode:= ePostcode.text; target:= leftStr(postcode,4); dm.atinl... | I think you need to quote the string. Use QuotedStr. dm.atinlog.filter:= 'postcode = ' + QuotedStr(target); If you need a wild-card match you can do dm.atinlog.filter:= 'postcode like ' + QuotedStr(target+'%'); | Comparing part of a string I got a problem with Delphi. I have to compare a string of 4 char, with data in database which is 6 char long (postal code(netherlands)). What I have now is: procedure Tfmpostcode.Button1Click(Sender: TObject); var postcode: string; target: string; begin postcode:= ePostcode.text; target:= le... | TITLE:
Comparing part of a string
QUESTION:
I got a problem with Delphi. I have to compare a string of 4 char, with data in database which is 6 char long (postal code(netherlands)). What I have now is: procedure Tfmpostcode.Button1Click(Sender: TObject); var postcode: string; target: string; begin postcode:= ePostcode... | [
"delphi"
] | 2 | 6 | 1,203 | 3 | 0 | 2011-06-07T20:44:58.673000 | 2011-06-07T21:15:21.283000 |
6,271,416 | 6,271,516 | search for location using maps api android sdk | I am lacking the knowledge of how to search for a location using an EditText and button when the person enters the longitude and latitude or even just an address into the EditText section an pushes the Button I want the map to go to that location. If anyone has any info on how to do so or even a tutorial it would be mu... | String uri = "geo:"+ latitude + "," + longitude;
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri))); or with an adress: geo:latitude,longitude geo:latitude,longitude?z=zoom geo:0,0?q=my+street+address geo:0,0?q=business+near+city http://developer.android.com/guide/appendix/g-app-intents.html... | search for location using maps api android sdk I am lacking the knowledge of how to search for a location using an EditText and button when the person enters the longitude and latitude or even just an address into the EditText section an pushes the Button I want the map to go to that location. If anyone has any info on... | TITLE:
search for location using maps api android sdk
QUESTION:
I am lacking the knowledge of how to search for a location using an EditText and button when the person enters the longitude and latitude or even just an address into the EditText section an pushes the Button I want the map to go to that location. If anyo... | [
"android",
"search",
"google-maps"
] | 2 | 2 | 1,149 | 1 | 0 | 2011-06-07T20:46:19.960000 | 2011-06-07T20:53:28.307000 |
6,271,417 | 6,271,460 | Java - get the current class name? | All I am trying to do is to get the current class name, and java appends a useless non-sense $1 to the end of my class name. How can I get rid of it and only return the actual class name? String className = this.getClass().getName(); | The "$1" is not "useless non-sense". If your class is anonymous, a number is appended. If you don't want the class itself, but its declaring class, then you can use getEnclosingClass(). For example: Class enclosingClass = getClass().getEnclosingClass(); if (enclosingClass!= null) { System.out.println(enclosingClass.get... | Java - get the current class name? All I am trying to do is to get the current class name, and java appends a useless non-sense $1 to the end of my class name. How can I get rid of it and only return the actual class name? String className = this.getClass().getName(); | TITLE:
Java - get the current class name?
QUESTION:
All I am trying to do is to get the current class name, and java appends a useless non-sense $1 to the end of my class name. How can I get rid of it and only return the actual class name? String className = this.getClass().getName();
ANSWER:
The "$1" is not "useless... | [
"java",
"class",
"classname"
] | 367 | 293 | 788,589 | 12 | 0 | 2011-06-07T20:46:22.270000 | 2011-06-07T20:49:27.270000 |
6,271,453 | 6,271,541 | Mysql JDBC driver ClassNotFoundException | I can't register Mysql JDBC driver in my desktop APP I download mysql-connector-java-5.1.16.zip Unzip mysql-connector-java-5.1.16-bin.jar and put it into lib folder in my app Add this jar file into Build Path in Eclipse But Class.forName("com.mysql.jdbc.Driver") throws ClassNotFoundException Whats wrong? | try this: public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); } The issue is that Class.forName(String) throws an checked exception. With a checked exception, you can either: Catch the exception. Declare that your method throws the exception. (which is what I suggested abov... | Mysql JDBC driver ClassNotFoundException I can't register Mysql JDBC driver in my desktop APP I download mysql-connector-java-5.1.16.zip Unzip mysql-connector-java-5.1.16-bin.jar and put it into lib folder in my app Add this jar file into Build Path in Eclipse But Class.forName("com.mysql.jdbc.Driver") throws ClassNotF... | TITLE:
Mysql JDBC driver ClassNotFoundException
QUESTION:
I can't register Mysql JDBC driver in my desktop APP I download mysql-connector-java-5.1.16.zip Unzip mysql-connector-java-5.1.16-bin.jar and put it into lib folder in my app Add this jar file into Build Path in Eclipse But Class.forName("com.mysql.jdbc.Driver"... | [
"java",
"mysql"
] | 1 | 2 | 2,587 | 3 | 0 | 2011-06-07T20:49:12.603000 | 2011-06-07T20:55:45.987000 |
6,271,458 | 6,271,487 | & with variable | Possible Duplicate: Why passing &error instead of error in Cocoa programming? I have a question for which I cannot seem to find an answer... I am using the SBJsonParser and there is a line of code I find puzzling: NSError *error; self.jsonData = [jsonParser objectWithString:responseString error:&error]; What is the & i... | In Objective-C, just like in C, & is the "address-of operator" and it returns the address of its argument. To find out more about it, I recommend you read this short chapter from The C Book. Here's an example of how the operator is used, to get a better idea: #include // define a function that takes a pointer to an int... | & with variable Possible Duplicate: Why passing &error instead of error in Cocoa programming? I have a question for which I cannot seem to find an answer... I am using the SBJsonParser and there is a line of code I find puzzling: NSError *error; self.jsonData = [jsonParser objectWithString:responseString error:&error];... | TITLE:
& with variable
QUESTION:
Possible Duplicate: Why passing &error instead of error in Cocoa programming? I have a question for which I cannot seem to find an answer... I am using the SBJsonParser and there is a line of code I find puzzling: NSError *error; self.jsonData = [jsonParser objectWithString:responseStr... | [
"objective-c",
"cocoa-touch"
] | 0 | 7 | 3,297 | 3 | 0 | 2011-06-07T20:49:17.733000 | 2011-06-07T20:51:24.387000 |
6,271,468 | 6,271,740 | jQuery Mobile Navbar wrapping on 4 (not 5) elements | I'm working with the the jQuery Mobile and according to the documentation the navbar will wrap on five elements. However, in my working with it, it's wrapping at only 4 elements. Is this expected behavior? The code <%= @disease.name %> Add Images will be here. Images Symptoms Treatments Notes | I noticed you're using the test site for documentation. Do you use the test CSS/JS as well or are you using jQM a4.1? Using your code and jQM a4.1 it seems to work fine for me. Live Example: http://jsfiddle.net/Dnqn9/1/ Docs: http://jquerymobile.com/demos/1.0a4.1/ | jQuery Mobile Navbar wrapping on 4 (not 5) elements I'm working with the the jQuery Mobile and according to the documentation the navbar will wrap on five elements. However, in my working with it, it's wrapping at only 4 elements. Is this expected behavior? The code <%= @disease.name %> Add Images will be here. Images ... | TITLE:
jQuery Mobile Navbar wrapping on 4 (not 5) elements
QUESTION:
I'm working with the the jQuery Mobile and according to the documentation the navbar will wrap on five elements. However, in my working with it, it's wrapping at only 4 elements. Is this expected behavior? The code <%= @disease.name %> Add Images wil... | [
"jquery",
"html",
"css",
"jquery-mobile"
] | 4 | 1 | 1,241 | 1 | 0 | 2011-06-07T20:50:06.080000 | 2011-06-07T21:13:06.620000 |
6,271,474 | 6,271,609 | What is the difference between cat_id and term_id? | I'm building my own nav menu using custom taxonomies and the get_categories() method and I notice when I'm trying to pull my link for the category I can choose between cat_id and term_id. Is there a difference between the two? Which one should I be using? Here's an example of my code using the term_id foreach ($subcate... | The two mean the same. Term_id is the actual field name in the wp_terms database table, cat_id is a frontend abbreviation, perhaps more easily understood by those working from the front end only. | What is the difference between cat_id and term_id? I'm building my own nav menu using custom taxonomies and the get_categories() method and I notice when I'm trying to pull my link for the category I can choose between cat_id and term_id. Is there a difference between the two? Which one should I be using? Here's an exa... | TITLE:
What is the difference between cat_id and term_id?
QUESTION:
I'm building my own nav menu using custom taxonomies and the get_categories() method and I notice when I'm trying to pull my link for the category I can choose between cat_id and term_id. Is there a difference between the two? Which one should I be us... | [
"php",
"wordpress"
] | 8 | 10 | 12,164 | 2 | 0 | 2011-06-07T20:50:32.477000 | 2011-06-07T21:01:42.440000 |
6,271,490 | 6,272,877 | Django: How to remove fields from the admin form for specific users? | My admin looks like this (with no exclude variable): class MovieAdmin(models.ModelAdmin) fields = ('name', 'slug', 'imdb_link', 'start', 'finish', 'added_by') list_display = ('name', 'finish', 'added_by') list_filter = ('finish',) ordering = ('-finish',) prepopulated_fields = {'slug': ('name',)}
form = MovieAdminForm
... | You're probably getting that error when list_display is evaluated. You can't show a field that's excluded. The version with added_by removed also needs a corresponding list_display. def get_form(self, request, obj=None, **kwargs): current_user = request.user if not current_user.profile.is_manager: self.exclude = ('adde... | Django: How to remove fields from the admin form for specific users? My admin looks like this (with no exclude variable): class MovieAdmin(models.ModelAdmin) fields = ('name', 'slug', 'imdb_link', 'start', 'finish', 'added_by') list_display = ('name', 'finish', 'added_by') list_filter = ('finish',) ordering = ('-finish... | TITLE:
Django: How to remove fields from the admin form for specific users?
QUESTION:
My admin looks like this (with no exclude variable): class MovieAdmin(models.ModelAdmin) fields = ('name', 'slug', 'imdb_link', 'start', 'finish', 'added_by') list_display = ('name', 'finish', 'added_by') list_filter = ('finish',) or... | [
"django",
"forms",
"django-admin"
] | 5 | 15 | 12,491 | 1 | 0 | 2011-06-07T20:51:32.960000 | 2011-06-07T23:55:17.077000 |
6,271,498 | 6,271,626 | hot-replace debugging with maven on jboss | I'm currently using jboss/maven/eclipse to debug a web app. I've enabled remote debugging in the jboss run.conf file and then use mvn war:inplace to compile and with that I can successfully add a breakpoint and step through code. However I remember a while back using Tomcat I was able to hotswap or hot-replace a java c... | You can try JBoss Tools Eclipse plugin, or if all else fails, JRebel (however, its not free). | hot-replace debugging with maven on jboss I'm currently using jboss/maven/eclipse to debug a web app. I've enabled remote debugging in the jboss run.conf file and then use mvn war:inplace to compile and with that I can successfully add a breakpoint and step through code. However I remember a while back using Tomcat I w... | TITLE:
hot-replace debugging with maven on jboss
QUESTION:
I'm currently using jboss/maven/eclipse to debug a web app. I've enabled remote debugging in the jboss run.conf file and then use mvn war:inplace to compile and with that I can successfully add a breakpoint and step through code. However I remember a while bac... | [
"java",
"eclipse",
"jboss",
"maven"
] | 0 | 0 | 1,094 | 1 | 0 | 2011-06-07T20:51:53.990000 | 2011-06-07T21:02:59.710000 |
6,271,504 | 6,277,067 | MPMediaLibraryDidChangeNotification called twice? | My app uses the iPodMusicPlayer and, when suspended, the user might go out and make changes in Apple's Music App, for example creating or modifying a Playlist, then return to my App. I receive the expected MPMediaLibraryDidChangeNotification, which is fine and I deal with it updating my references etc., but I receive a... | if(!self.lastModifiedDate ) self.lastModifiedDate = [[NSDate alloc] init]; if( [self.lastModifiedDate compare:[[MPMediaLibrary defaultMediaLibrary] lastModifiedDate]] == NSOrderedSame ) return; self.lastModifiedDate = [[MPMediaLibrary defaultMediaLibrary] lastModifiedDate]; The above lines in my notification handler me... | MPMediaLibraryDidChangeNotification called twice? My app uses the iPodMusicPlayer and, when suspended, the user might go out and make changes in Apple's Music App, for example creating or modifying a Playlist, then return to my App. I receive the expected MPMediaLibraryDidChangeNotification, which is fine and I deal wi... | TITLE:
MPMediaLibraryDidChangeNotification called twice?
QUESTION:
My app uses the iPodMusicPlayer and, when suspended, the user might go out and make changes in Apple's Music App, for example creating or modifying a Playlist, then return to my App. I receive the expected MPMediaLibraryDidChangeNotification, which is ... | [
"iphone",
"notifications",
"ipod"
] | 3 | 0 | 2,039 | 5 | 0 | 2011-06-07T20:52:17.610000 | 2011-06-08T10:00:48.443000 |
6,271,513 | 6,271,674 | silverlight databinding programmatically to list property? | i'm populating a datagrid programmatically but before setting the itemsource, i'm also programmatically adding the datagrid columns. DataGridTextColumn col = new DataGridTextColumn(); col.Header = "MyCol"; col.Binding = new Binding("PropertyOFObject"); dataGrid.Columns.Add(col); it's easy to set the binding to the prop... | If you want to bind the items of the child property to columns you can create a foreach loop which creates dynamic bindings, in one WPF question i gave an example for arrays this should be rather similar. The key is to use a for -loop over the length of the list and creating property-paths with injected indexer: new Bi... | silverlight databinding programmatically to list property? i'm populating a datagrid programmatically but before setting the itemsource, i'm also programmatically adding the datagrid columns. DataGridTextColumn col = new DataGridTextColumn(); col.Header = "MyCol"; col.Binding = new Binding("PropertyOFObject"); dataGrid... | TITLE:
silverlight databinding programmatically to list property?
QUESTION:
i'm populating a datagrid programmatically but before setting the itemsource, i'm also programmatically adding the datagrid columns. DataGridTextColumn col = new DataGridTextColumn(); col.Header = "MyCol"; col.Binding = new Binding("PropertyOF... | [
"c#",
"silverlight",
"data-binding",
"datagrid"
] | 0 | 1 | 691 | 1 | 0 | 2011-06-07T20:52:48.327000 | 2011-06-07T21:06:46.853000 |
6,271,522 | 6,276,147 | SVG elements are not shown in a browser | I have faced to a quite strange situation. I have a script which draws some lines using jQuery SVG plugin. It is working in a separate html file. But once I copy that script and insert into another html file it stops showing SVG elements in a browser. It works perfectly, because when I see the source code of the page a... | The problem is solved. I didn't notice that in the new page where SVG elements were not shown, the DIV element where I was drawing SVG elements had been wrapped by another DIV. And in the CSS file the wrapper DIV had an attribute display: table;. I removed that attribute and now SVG elements are shown. Thanks guys for ... | SVG elements are not shown in a browser I have faced to a quite strange situation. I have a script which draws some lines using jQuery SVG plugin. It is working in a separate html file. But once I copy that script and insert into another html file it stops showing SVG elements in a browser. It works perfectly, because ... | TITLE:
SVG elements are not shown in a browser
QUESTION:
I have faced to a quite strange situation. I have a script which draws some lines using jQuery SVG plugin. It is working in a separate html file. But once I copy that script and insert into another html file it stops showing SVG elements in a browser. It works p... | [
"javascript",
"jquery",
"svg"
] | 0 | 0 | 2,811 | 3 | 0 | 2011-06-07T20:53:55.630000 | 2011-06-08T08:31:11.637000 |
6,271,523 | 6,271,557 | Setting the value of a textbox to a user entered value | How can I set the value of a textbox to user entered value. For ex If the user enters "3" then it should become All I want is that when I process the textbox for value in a servlet, I should be able to get the value 3 for that textbox. well, there is more to it as David says. The textbox is part of a cart application a... | The value in the textbox is automatically transferred to the server when you submit the form as somename=3 (or whatever value). However, if you want to actually update the value attribute of the element, you could use jQuery to do something like: HTML jQuery $('#name').change(function(){ $(this).attr('value',$(this).va... | Setting the value of a textbox to a user entered value How can I set the value of a textbox to user entered value. For ex If the user enters "3" then it should become All I want is that when I process the textbox for value in a servlet, I should be able to get the value 3 for that textbox. well, there is more to it as ... | TITLE:
Setting the value of a textbox to a user entered value
QUESTION:
How can I set the value of a textbox to user entered value. For ex If the user enters "3" then it should become All I want is that when I process the textbox for value in a servlet, I should be able to get the value 3 for that textbox. well, there... | [
"textbox"
] | 0 | 2 | 1,817 | 1 | 0 | 2011-06-07T20:54:02.017000 | 2011-06-07T20:57:03.923000 |
6,271,556 | 6,275,950 | JqGrid MultiSearch dialog add button hidden | with code like this: $gird.navGrid("#pager", {"add":false,"edit":false,"del":false,"view":false}, {},{},{},{},{"multipleSearch":true,"overlay":false} If I click the 'find' icon, the add button for adding a rule is hidden. IE here is the HTML from firebug: AND OR If I add this: $gird.searchGrid({"multipleSearch":true,"o... | Sometimes things which look very strange can be solved very easy. The problem is that the searchGrid parameters {"multipleSearch":true,"overlay":false} are in another position of navGrid. Currently the settings will be interpret as prmView and not as prmSearch. You should remove one {} parameter: $gird.jqGrid('navGrid'... | JqGrid MultiSearch dialog add button hidden with code like this: $gird.navGrid("#pager", {"add":false,"edit":false,"del":false,"view":false}, {},{},{},{},{"multipleSearch":true,"overlay":false} If I click the 'find' icon, the add button for adding a rule is hidden. IE here is the HTML from firebug: AND OR If I add this... | TITLE:
JqGrid MultiSearch dialog add button hidden
QUESTION:
with code like this: $gird.navGrid("#pager", {"add":false,"edit":false,"del":false,"view":false}, {},{},{},{},{"multipleSearch":true,"overlay":false} If I click the 'find' icon, the add button for adding a rule is hidden. IE here is the HTML from firebug: AN... | [
"jqgrid"
] | 0 | 1 | 882 | 1 | 0 | 2011-06-07T20:57:03.573000 | 2011-06-08T08:14:24.713000 |
6,271,577 | 6,271,605 | Looking to develop an icon only application | I am looking to develop a Cocoa application that will only have a icon at top menu. Not sure what this is officially called. This is very similar to the DropBox application. Any direction is helpful. Thanks | That icon is called a 'status item', and you can learn more about creating an application like this by reading up on the NSStatusItem Class Reference and the Status Bar Programming document. | Looking to develop an icon only application I am looking to develop a Cocoa application that will only have a icon at top menu. Not sure what this is officially called. This is very similar to the DropBox application. Any direction is helpful. Thanks | TITLE:
Looking to develop an icon only application
QUESTION:
I am looking to develop a Cocoa application that will only have a icon at top menu. Not sure what this is officially called. This is very similar to the DropBox application. Any direction is helpful. Thanks
ANSWER:
That icon is called a 'status item', and y... | [
"objective-c",
"cocoa"
] | 0 | 1 | 58 | 1 | 0 | 2011-06-07T20:58:43.193000 | 2011-06-07T21:01:00.623000 |
6,271,585 | 6,271,648 | Which screen resolution when designing an app? | When I design Android apps, I use HVGA resolution in the emulator. I saw (on YouTube and other videocasts) that some developer use higher resolution like WVGA or similar. Which resolution is best for designing nowadays Android apps? Why? | Why restrict yourself to one resolution? You are perfectly able to customize the design for all screen resolutions. See this page in the developer docs: Supporting Multiple Screens It tells you how to support multiple screen sizes and how to test them. | Which screen resolution when designing an app? When I design Android apps, I use HVGA resolution in the emulator. I saw (on YouTube and other videocasts) that some developer use higher resolution like WVGA or similar. Which resolution is best for designing nowadays Android apps? Why? | TITLE:
Which screen resolution when designing an app?
QUESTION:
When I design Android apps, I use HVGA resolution in the emulator. I saw (on YouTube and other videocasts) that some developer use higher resolution like WVGA or similar. Which resolution is best for designing nowadays Android apps? Why?
ANSWER:
Why rest... | [
"android",
"screen-resolution"
] | 1 | 8 | 5,975 | 6 | 0 | 2011-06-07T20:59:33.870000 | 2011-06-07T21:04:36.497000 |
6,271,602 | 6,271,664 | MySQL: Transform "LIKE" search to fulltext? | I have a pretty simple LIKE search for MySQL that i'd like to transform into a fulltext. The problem is i need to be able to implement it so that it starts with X. Like the example below: SELECT column FROM table WHERE column LIKE "startswith%" as you can see that query returns all results that begins with "startswith"... | No, that isn't how fulltext works (it's actually just a list with loose words underneath, no information about location relative to the string) but there's no reason why you can't have that LIKE... as an extra WHERE clause. FULLTEXT can still help to get a smaller subset of results if you haven't got another key on col... | MySQL: Transform "LIKE" search to fulltext? I have a pretty simple LIKE search for MySQL that i'd like to transform into a fulltext. The problem is i need to be able to implement it so that it starts with X. Like the example below: SELECT column FROM table WHERE column LIKE "startswith%" as you can see that query retur... | TITLE:
MySQL: Transform "LIKE" search to fulltext?
QUESTION:
I have a pretty simple LIKE search for MySQL that i'd like to transform into a fulltext. The problem is i need to be able to implement it so that it starts with X. Like the example below: SELECT column FROM table WHERE column LIKE "startswith%" as you can se... | [
"mysql",
"search",
"full-text-search",
"transform",
"sql-like"
] | 1 | 2 | 572 | 2 | 0 | 2011-06-07T21:00:50.073000 | 2011-06-07T21:05:52.773000 |
6,271,615 | 6,271,631 | Any way to prevent dynamic allocation of a class? | I'm using a C++ base class and subclasses (let's call them A and B for the sake of clarity) in my embedded system. It's time- and space-critical, so I really need it to be kind of minimal. The compiler complains about lack of a virtual destructor, which I understand, because that can get you into trouble if you allocat... | You can poison operator new in just the same way as you can a copy constructor. Just be sure not to poison placement new. A virtual destructor would still be a fine recommendation. int main() { char data[sizeof(Derived)]; if (condition) new (data) Derived(); else new (data) Base(); Base* ptr = reinterpret_cast (&data[0... | Any way to prevent dynamic allocation of a class? I'm using a C++ base class and subclasses (let's call them A and B for the sake of clarity) in my embedded system. It's time- and space-critical, so I really need it to be kind of minimal. The compiler complains about lack of a virtual destructor, which I understand, be... | TITLE:
Any way to prevent dynamic allocation of a class?
QUESTION:
I'm using a C++ base class and subclasses (let's call them A and B for the sake of clarity) in my embedded system. It's time- and space-critical, so I really need it to be kind of minimal. The compiler complains about lack of a virtual destructor, whic... | [
"c++",
"dynamic-allocation"
] | 7 | 9 | 2,796 | 3 | 0 | 2011-06-07T21:01:52.683000 | 2011-06-07T21:03:31.987000 |
6,271,652 | 6,271,687 | How to count and sum elements in a multi-dimensional array? | i have a array that returns some numbers. and i want to add those numbers together and also count them. here is what i have so far: $values){ $totalRatings1 = $values['rating']; }?> what i am trying to do is to sum the $values['rating'] together and also count them. So that: $totalRatings = sum_array($values['rating'])... | $values){ $totalRatings += (int) $values['rating']; $totalRated++; }?> $totalRatings will have the aggregated sum of all ratings, $totalRated will be the count of how many ratings there are. | How to count and sum elements in a multi-dimensional array? i have a array that returns some numbers. and i want to add those numbers together and also count them. here is what i have so far: $values){ $totalRatings1 = $values['rating']; }?> what i am trying to do is to sum the $values['rating'] together and also count... | TITLE:
How to count and sum elements in a multi-dimensional array?
QUESTION:
i have a array that returns some numbers. and i want to add those numbers together and also count them. here is what i have so far: $values){ $totalRatings1 = $values['rating']; }?> what i am trying to do is to sum the $values['rating'] toget... | [
"php",
"arrays",
"count",
"sum"
] | 0 | 2 | 2,190 | 2 | 0 | 2011-06-07T21:05:05.033000 | 2011-06-07T21:08:07.663000 |
6,271,655 | 6,271,675 | Way to "flatten" Rails migrations? | I'm working on deploying my first Rails application right now, and somewhere along the way, I botched a migration. When I try to push my application to the production server and run rake db:migrate, it fails somewhere with an error. Now, I am way too lazy to work through my migrations individually to find out what went... | This is what the db/schema.rb file is for. If you've only got structural changes in your migrations you will be able to run rake db:schema:load rather than running rake db:migrate to get the absolute structure for your tables. | Way to "flatten" Rails migrations? I'm working on deploying my first Rails application right now, and somewhere along the way, I botched a migration. When I try to push my application to the production server and run rake db:migrate, it fails somewhere with an error. Now, I am way too lazy to work through my migrations... | TITLE:
Way to "flatten" Rails migrations?
QUESTION:
I'm working on deploying my first Rails application right now, and somewhere along the way, I botched a migration. When I try to push my application to the production server and run rake db:migrate, it fails somewhere with an error. Now, I am way too lazy to work thr... | [
"ruby-on-rails",
"migration"
] | 12 | 15 | 1,822 | 2 | 0 | 2011-06-07T21:05:08.727000 | 2011-06-07T21:06:48.397000 |
6,271,665 | 6,271,688 | Object's structure overriding defined methods? | I have a class called Object: class Object { public: Vector pos; float emittance; Vector diffuse;
virtual float intersection(Ray&) {}; virtual Vector getNormal(Vector&) {}; }; And another class which inherits it: class Sphere: public Object { public: float radius;
virtual float intersection(Ray &ray) { Vector distanc... | You did not declare the function as virtual and make sure that the method signature matches. Change it to: class Object{ virtual float intersection(Ray) {}; virtual Vector getNormal(Vector) {}; }
class Sphere: public Object {... virtual float intersection(Ray ray) {... | Object's structure overriding defined methods? I have a class called Object: class Object { public: Vector pos; float emittance; Vector diffuse;
virtual float intersection(Ray&) {}; virtual Vector getNormal(Vector&) {}; }; And another class which inherits it: class Sphere: public Object { public: float radius;
virtua... | TITLE:
Object's structure overriding defined methods?
QUESTION:
I have a class called Object: class Object { public: Vector pos; float emittance; Vector diffuse;
virtual float intersection(Ray&) {}; virtual Vector getNormal(Vector&) {}; }; And another class which inherits it: class Sphere: public Object { public: flo... | [
"c++",
"class"
] | 1 | 0 | 434 | 2 | 0 | 2011-06-07T21:05:56.660000 | 2011-06-07T21:08:08.117000 |
6,271,681 | 6,271,723 | Simple UIView drawRect not being called | I can't figure out what the problem is here. I have a very simple UIViewController with a very simple viewDidLoad method: -(void)viewDidLoad {
NSLog(@"making game view"); GameView *v = [[GameView alloc] initWithFrame:CGRectMake(0,0,320,460)];
[self.view addSubview:v];
[super viewDidLoad]; } And my GameView is initia... | Have you tried specifying the frame in the initialization of the view? Because you are creating a custom UIView, you need to specify the frame for the view before the drawing method is called. Try changing your viewDidLoad to the following: NSLog(@"making game view"); GameView *v = [[GameView alloc] initWithFrame:CGRec... | Simple UIView drawRect not being called I can't figure out what the problem is here. I have a very simple UIViewController with a very simple viewDidLoad method: -(void)viewDidLoad {
NSLog(@"making game view"); GameView *v = [[GameView alloc] initWithFrame:CGRectMake(0,0,320,460)];
[self.view addSubview:v];
[super v... | TITLE:
Simple UIView drawRect not being called
QUESTION:
I can't figure out what the problem is here. I have a very simple UIViewController with a very simple viewDidLoad method: -(void)viewDidLoad {
NSLog(@"making game view"); GameView *v = [[GameView alloc] initWithFrame:CGRectMake(0,0,320,460)];
[self.view addSub... | [
"ios",
"uiview"
] | 7 | 12 | 11,767 | 4 | 0 | 2011-06-07T21:07:30.893000 | 2011-06-07T21:11:49.127000 |
6,271,704 | 6,271,751 | Array substring in deferred execution | Is there any way in LINQ to get a subset of an array in deferred execution (meaning copy at enumeration time, not build time)? | Well, a simple way of taking a part of LINQ expression is Skip(n).Take(m). | Array substring in deferred execution Is there any way in LINQ to get a subset of an array in deferred execution (meaning copy at enumeration time, not build time)? | TITLE:
Array substring in deferred execution
QUESTION:
Is there any way in LINQ to get a subset of an array in deferred execution (meaning copy at enumeration time, not build time)?
ANSWER:
Well, a simple way of taking a part of LINQ expression is Skip(n).Take(m). | [
"c#",
"linq"
] | 5 | 5 | 122 | 1 | 0 | 2011-06-07T21:10:07.307000 | 2011-06-07T21:14:40.370000 |
6,271,707 | 6,271,724 | How does this code snippet work? | The code is just very simple, yet I scratch my head at the results. I am just playing pointer arithmetics and want to print out the array but I get the numbers of the array plus 3 more. Where do those 3 extra come from? #include int my_array[] = {1,3,5,6,73,343,34};
int *pointer_numeros;
int main (void) { int i = 0; ... | *pointer_numeros does not evaluate to false at the end of the array; it will carry on walking through memory until it hits an address whose contents are zero (but this is undefined behaviour ). You can terminate your array in a zero, as others have suggested. But in general, you will still have a problem: what if some ... | How does this code snippet work? The code is just very simple, yet I scratch my head at the results. I am just playing pointer arithmetics and want to print out the array but I get the numbers of the array plus 3 more. Where do those 3 extra come from? #include int my_array[] = {1,3,5,6,73,343,34};
int *pointer_numero... | TITLE:
How does this code snippet work?
QUESTION:
The code is just very simple, yet I scratch my head at the results. I am just playing pointer arithmetics and want to print out the array but I get the numbers of the array plus 3 more. Where do those 3 extra come from? #include int my_array[] = {1,3,5,6,73,343,34};
i... | [
"c",
"pointers"
] | 1 | 3 | 144 | 3 | 0 | 2011-06-07T21:10:09.787000 | 2011-06-07T21:11:50.160000 |
6,271,708 | 6,271,772 | How to open a pdf document from JSP | How do I open a PDF document from JSP? I have many links to PDF files. In Eclipse, when I click on the link, the PDF opens in PDF reader. But in a webbrowser like Firefox and Chrome, nothing happens. I am generating the links to PDF files as F:\....\...pdf the following way: <% while (iter.hasNext()) { element = iter.n... | The links have to point to an URL, not to a local disk file system path or something. The average webbrowser doesn't swallow this due to security restrictions. And even then when it did, it would not work in production environment when the webbrowser runs at a physically different machine than the webserver and thus do... | How to open a pdf document from JSP How do I open a PDF document from JSP? I have many links to PDF files. In Eclipse, when I click on the link, the PDF opens in PDF reader. But in a webbrowser like Firefox and Chrome, nothing happens. I am generating the links to PDF files as F:\....\...pdf the following way: <% while... | TITLE:
How to open a pdf document from JSP
QUESTION:
How do I open a PDF document from JSP? I have many links to PDF files. In Eclipse, when I click on the link, the PDF opens in PDF reader. But in a webbrowser like Firefox and Chrome, nothing happens. I am generating the links to PDF files as F:\....\...pdf the follo... | [
"java",
"jsp",
"pdf",
"browser"
] | 2 | 7 | 14,333 | 1 | 0 | 2011-06-07T21:10:20.177000 | 2011-06-07T21:17:08.207000 |
6,271,731 | 6,271,805 | What's the best way to return a pair of values in Java? | This is a small issue, as I could easily whip up a pair class to do the job. I don't really want to do this though, and I feel like there should be some simple, built-in, java-like way of returning two values. What do you guys is the best, simplest way of doing this? Arrays? Some other data structure? | As far as I know, there is unfortunately no built-in representation of a pair in Java (and I certainly wish there was). Personally, when I code a project where I find that a pair class often would be useful, I create a generic Pair class (which is probably what you were thinking of). Returning an array is a fast and si... | What's the best way to return a pair of values in Java? This is a small issue, as I could easily whip up a pair class to do the job. I don't really want to do this though, and I feel like there should be some simple, built-in, java-like way of returning two values. What do you guys is the best, simplest way of doing th... | TITLE:
What's the best way to return a pair of values in Java?
QUESTION:
This is a small issue, as I could easily whip up a pair class to do the job. I don't really want to do this though, and I feel like there should be some simple, built-in, java-like way of returning two values. What do you guys is the best, simple... | [
"java",
"data-structures"
] | 55 | 43 | 66,053 | 9 | 0 | 2011-06-07T21:12:12.603000 | 2011-06-07T21:21:34.367000 |
6,271,779 | 6,271,811 | Are Redis updates synchronous? | If I push something onto a list in Redis, then pop from that list, is it guaranteed that I will get the item I pushed earlier or is it possible for the read to happen before the write? | Redis runs in a single thread (with the exception of forking when doing background saves, but that doesn't matter), so any request that you send later will necessarily run later. Thus, you will see the value that you pushed. (Though, on a second thought, it is probably possible to provoke a failure, if you are ill incl... | Are Redis updates synchronous? If I push something onto a list in Redis, then pop from that list, is it guaranteed that I will get the item I pushed earlier or is it possible for the read to happen before the write? | TITLE:
Are Redis updates synchronous?
QUESTION:
If I push something onto a list in Redis, then pop from that list, is it guaranteed that I will get the item I pushed earlier or is it possible for the read to happen before the write?
ANSWER:
Redis runs in a single thread (with the exception of forking when doing backg... | [
"redis"
] | 5 | 4 | 993 | 1 | 0 | 2011-06-07T21:17:46.910000 | 2011-06-07T21:22:22.900000 |
6,271,796 | 6,271,810 | Issues of saving a matrix to a csv file | I am trying to save an integer matrix to the csv file. My code is listed as follows. try { FileWriter writer = new FileWriter("test.csv"); for(int i = 0; i < row; i++) { for (int j=0; j<(column-1); j++) { writer.append(Matrix[i][j]); writer.append(','); } writer.append(Matrix[i][j]); writer.append('\n'); writer.flush()... | Change your calls to append(Matrix[i][j]) to append(String.valueOf(Matrix[i][j]) or append("" + Matrix[i][j]). The problem (as the error message points out) is that you are attempting to append an integer, but the append method only take a CharSequence (i.e. a String). Both of the solutions I present coerce the integer... | Issues of saving a matrix to a csv file I am trying to save an integer matrix to the csv file. My code is listed as follows. try { FileWriter writer = new FileWriter("test.csv"); for(int i = 0; i < row; i++) { for (int j=0; j<(column-1); j++) { writer.append(Matrix[i][j]); writer.append(','); } writer.append(Matrix[i][... | TITLE:
Issues of saving a matrix to a csv file
QUESTION:
I am trying to save an integer matrix to the csv file. My code is listed as follows. try { FileWriter writer = new FileWriter("test.csv"); for(int i = 0; i < row; i++) { for (int j=0; j<(column-1); j++) { writer.append(Matrix[i][j]); writer.append(','); } writer... | [
"java",
"eclipse",
"csv"
] | 0 | 6 | 1,454 | 3 | 0 | 2011-06-07T21:20:29.390000 | 2011-06-07T21:22:14.570000 |
6,272,826 | 6,273,149 | Does this way of pre-loading a database in Android work for 2.2 and up? | I have seen this question here, and was wondering if the same method of "pre-loading" a database for an android application still works. I will be developing my application on the 2.2 platform, but I want to make sure that going forward I will not have to completely redesign if I use this method. Secondly, is this the ... | Yes, the pre-loading method mentioned in the blogpost that article links to ( http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ ) still works for me after some tweaks prompted by a number of force closes from users. There were some issues with the database not being found on the De... | Does this way of pre-loading a database in Android work for 2.2 and up? I have seen this question here, and was wondering if the same method of "pre-loading" a database for an android application still works. I will be developing my application on the 2.2 platform, but I want to make sure that going forward I will not ... | TITLE:
Does this way of pre-loading a database in Android work for 2.2 and up?
QUESTION:
I have seen this question here, and was wondering if the same method of "pre-loading" a database for an android application still works. I will be developing my application on the 2.2 platform, but I want to make sure that going f... | [
"android",
"database"
] | 0 | 3 | 188 | 2 | 0 | 2011-06-07T23:44:50.647000 | 2011-06-08T00:49:35.470000 |
6,272,829 | 6,272,879 | Some basic questions after looking at the CI sourcecode | I was just looking at the CodeIgniter source code and I came across a couple of things that I can't seem to figure out; I'm not sure what they mean, and since they're mostly like one or two symbols it makes it hard to search on both google and stackoverflow for them. One thing that I came across quite a lot is this: $t... | The & operator there is assigning a value by reference, meaning further use of this variable will reference the original value, not the assigned one. Reference (no pun intended): http://php.net/manual/en/language.references.php The comments are phpdoc style, they aren't generated themselves, but can be handy in creatin... | Some basic questions after looking at the CI sourcecode I was just looking at the CodeIgniter source code and I came across a couple of things that I can't seem to figure out; I'm not sure what they mean, and since they're mostly like one or two symbols it makes it hard to search on both google and stackoverflow for th... | TITLE:
Some basic questions after looking at the CI sourcecode
QUESTION:
I was just looking at the CodeIgniter source code and I came across a couple of things that I can't seem to figure out; I'm not sure what they mean, and since they're mostly like one or two symbols it makes it hard to search on both google and st... | [
"php",
"codeigniter"
] | 6 | 2 | 164 | 3 | 0 | 2011-06-07T23:45:09.600000 | 2011-06-07T23:56:03.277000 |
6,272,831 | 6,275,553 | Help with EF Code First, many to many relationship | Person and EHR(electronic health record) are one to one related. Person has EHRId nullable and EHR has PersonId not nullable. At the same time EHR and Person must be many to many related. Because a person can have many medics (represented by person entity) and a medic can have many EHRs. I would like to have extra attr... | Person and EHR are not one-to-one related and they cannot be in EF. What you have defined is bidirectional one-to-many. You have also declared both relations as required because FK's are not nullable. Real one-to-one can be defined in EF only if EHR's PK (Id) is also FK to Person. Once you define this the part with man... | Help with EF Code First, many to many relationship Person and EHR(electronic health record) are one to one related. Person has EHRId nullable and EHR has PersonId not nullable. At the same time EHR and Person must be many to many related. Because a person can have many medics (represented by person entity) and a medic ... | TITLE:
Help with EF Code First, many to many relationship
QUESTION:
Person and EHR(electronic health record) are one to one related. Person has EHRId nullable and EHR has PersonId not nullable. At the same time EHR and Person must be many to many related. Because a person can have many medics (represented by person en... | [
"entity-framework",
"mapping",
"entity-framework-4.1",
"ef-code-first"
] | 1 | 2 | 678 | 1 | 0 | 2011-06-07T23:45:40.460000 | 2011-06-08T07:34:34.003000 |
6,272,842 | 6,282,693 | getting JQuery .height() after appending to another div returns 0 | I am trying to create a div that is scrollable only when it's above a certain height after appending text to it. I check the height using jquery and it returns zero every time. Any suggestions? HelpOverlay.prototype.buildContent = function(helpMappings){ this.content = $(' '); var table = $(' '); table.append($(' Key C... | In reference to this line: this.helpOverlay.append(this.content); Is this.helpOverlay already part of the DOM? Any element that is not inserted into the DOM will return 0 for height and width until it is inserted. Edit: this.content.css( 'display', 'none' ).appendTo( 'body' ); var dims = { 'height': this.content.height... | getting JQuery .height() after appending to another div returns 0 I am trying to create a div that is scrollable only when it's above a certain height after appending text to it. I check the height using jquery and it returns zero every time. Any suggestions? HelpOverlay.prototype.buildContent = function(helpMappings){... | TITLE:
getting JQuery .height() after appending to another div returns 0
QUESTION:
I am trying to create a div that is scrollable only when it's above a certain height after appending text to it. I check the height using jquery and it returns zero every time. Any suggestions? HelpOverlay.prototype.buildContent = funct... | [
"javascript",
"jquery",
"html"
] | 2 | 2 | 4,632 | 2 | 0 | 2011-06-07T23:47:15.427000 | 2011-06-08T17:21:32.417000 |
6,272,845 | 6,272,870 | Dialog unresponsive to layout weights, needs recesitation | The following dialog is unaffected by weight parameters. Could someone explain why? extensible markup language: java: dialog = new Dialog(GameActivity.this); dialog.setContentView(R.layout.dialog); TextView textdialog = (TextView) dialog.findViewById(R.id.dialogtext); textdialog.setText("i dont care what size you want ... | I suspect you need to make the width of the outer LinearLayout set to match_parent. Otherwise, the LinearLayout will make itself just wide enough to hold its children, which in turn are just wide enough to show themselves. Result being no extra width to distribute with the weights. | Dialog unresponsive to layout weights, needs recesitation The following dialog is unaffected by weight parameters. Could someone explain why? extensible markup language: java: dialog = new Dialog(GameActivity.this); dialog.setContentView(R.layout.dialog); TextView textdialog = (TextView) dialog.findViewById(R.id.dialog... | TITLE:
Dialog unresponsive to layout weights, needs recesitation
QUESTION:
The following dialog is unaffected by weight parameters. Could someone explain why? extensible markup language: java: dialog = new Dialog(GameActivity.this); dialog.setContentView(R.layout.dialog); TextView textdialog = (TextView) dialog.findVi... | [
"android",
"user-interface",
"dialog"
] | 0 | 3 | 728 | 1 | 0 | 2011-06-07T23:48:19.287000 | 2011-06-07T23:53:36.197000 |
6,272,859 | 6,272,951 | Getting the pixel color value of a point on an Android View that includes a Bitmap-backed Canvas | I'm trying to figure out the best way to get the pixel color value at a given point on a View. There are three ways that I write to the View: I set a background image with View.setBackgroundDrawable(...). I write text, draw lines, etc., with Canvas.drawText(...), Canvas.drawLine(...), etc., to a Bitmap-backed Canvas. I... | How about load the view to a bitmap (at some point after all your drawing/sprites etc is done), then get the pixel color from the bitmap? public static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888); Canvas c = new Canv... | Getting the pixel color value of a point on an Android View that includes a Bitmap-backed Canvas I'm trying to figure out the best way to get the pixel color value at a given point on a View. There are three ways that I write to the View: I set a background image with View.setBackgroundDrawable(...). I write text, draw... | TITLE:
Getting the pixel color value of a point on an Android View that includes a Bitmap-backed Canvas
QUESTION:
I'm trying to figure out the best way to get the pixel color value at a given point on a View. There are three ways that I write to the View: I set a background image with View.setBackgroundDrawable(...). ... | [
"android",
"graphics",
"view",
"android-canvas"
] | 16 | 30 | 17,197 | 1 | 0 | 2011-06-07T23:51:08.517000 | 2011-06-08T00:09:32.137000 |
6,272,861 | 6,272,885 | how to prevent SQL Injection in JSP? | Just last week, I was doing some PHP stuff. I worked a little solution to prevent SQL injections. PHP has been always my man, it has readily 3 solutions for use (maybe more). One is to enable "magic queries" using stripslashes() function. Another one (the recommended) is to use mysql_real_escape_string() function. That... | Just use PreparedStatement instead of Statement. I.e. use String sql = "INSERT INTO tbl (col1, col2, col3) VALUES (?,?,?)"; preparedStatement = connection.prepareStatement(sql); preparedStatement.setString(1, col1); preparedStatement.setString(2, col2); preparedStatement.setString(3, col3); preparedStatement.executeUpd... | how to prevent SQL Injection in JSP? Just last week, I was doing some PHP stuff. I worked a little solution to prevent SQL injections. PHP has been always my man, it has readily 3 solutions for use (maybe more). One is to enable "magic queries" using stripslashes() function. Another one (the recommended) is to use mysq... | TITLE:
how to prevent SQL Injection in JSP?
QUESTION:
Just last week, I was doing some PHP stuff. I worked a little solution to prevent SQL injections. PHP has been always my man, it has readily 3 solutions for use (maybe more). One is to enable "magic queries" using stripslashes() function. Another one (the recommend... | [
"java",
"jsp",
"jdbc",
"sql-injection",
"prepared-statement"
] | 9 | 24 | 17,667 | 1 | 0 | 2011-06-07T23:51:24.577000 | 2011-06-07T23:57:17.363000 |
6,272,866 | 6,272,886 | If I wanted to attach additional data to an element for JS retrieval | I have a list of products that I generate with PHP. I would like to store each product's weight in each element somehow so that I can retrieve it later with Javascript. I would like to print the data in the element (as opposed to adding it with Javascript). Something like this. bar This seems to work with IE, but not F... | You can use data- attributes and retrieve their values with jquery.data() function: bar --- JS:
alert($('your option').data('weight')); ==> 25 | If I wanted to attach additional data to an element for JS retrieval I have a list of products that I generate with PHP. I would like to store each product's weight in each element somehow so that I can retrieve it later with Javascript. I would like to print the data in the element (as opposed to adding it with Javasc... | TITLE:
If I wanted to attach additional data to an element for JS retrieval
QUESTION:
I have a list of products that I generate with PHP. I would like to store each product's weight in each element somehow so that I can retrieve it later with Javascript. I would like to print the data in the element (as opposed to add... | [
"javascript",
"jquery",
"html"
] | 1 | 2 | 47 | 2 | 0 | 2011-06-07T23:52:51.407000 | 2011-06-07T23:57:20.777000 |
6,272,889 | 6,272,912 | JQuery: return div to initial height | I am trying to get a few divs to react to my mouseOver and mouseOut. I'm trying to build something similar to the the Vimeo-style volume bar. I am getting the bars to react to the mouseOver, but I want them to return to their original height after the mouseOut. Each bar is a different height. It works when it is hard-c... | Store the initial height as data for each element: var totalHeight = '100%', $bwc = $('div#barWrap').children();
$bwc.each(function(i,el) { $(this).data('height', $(this).height()); });
$bwc.mouseover(function() { $(this).animate({ height: totalHeight}, 100); });
$bwc.mouseout(function() { $(this).animate({ height: ... | JQuery: return div to initial height I am trying to get a few divs to react to my mouseOver and mouseOut. I'm trying to build something similar to the the Vimeo-style volume bar. I am getting the bars to react to the mouseOver, but I want them to return to their original height after the mouseOut. Each bar is a differe... | TITLE:
JQuery: return div to initial height
QUESTION:
I am trying to get a few divs to react to my mouseOver and mouseOut. I'm trying to build something similar to the the Vimeo-style volume bar. I am getting the bars to react to the mouseOver, but I want them to return to their original height after the mouseOut. Eac... | [
"jquery",
"height"
] | 1 | 4 | 2,905 | 4 | 0 | 2011-06-07T23:57:35.840000 | 2011-06-08T00:02:12.683000 |
6,272,893 | 6,272,944 | How to do a Stupid IfLessThan in Django? | So Django apparently has a "smart if " in later versions, but our version is apparently not so smart. How do you do a stupid version of if a < b in Django (for the lack of a better word)? | Use the standalone smart_if templatetag. This was the base code that got merged into trunk. | How to do a Stupid IfLessThan in Django? So Django apparently has a "smart if " in later versions, but our version is apparently not so smart. How do you do a stupid version of if a < b in Django (for the lack of a better word)? | TITLE:
How to do a Stupid IfLessThan in Django?
QUESTION:
So Django apparently has a "smart if " in later versions, but our version is apparently not so smart. How do you do a stupid version of if a < b in Django (for the lack of a better word)?
ANSWER:
Use the standalone smart_if templatetag. This was the base code ... | [
"django",
"if-statement"
] | 0 | 1 | 121 | 2 | 0 | 2011-06-07T23:58:12.340000 | 2011-06-08T00:08:11.830000 |
6,272,904 | 6,273,008 | Database Design: private chat, group chat, and emails | The communication between Facebook users seem to be stored in one long "conversation." So, emails sent and private chat messages exchanged all seem to be part of one long ongoing conversation. I think this implementation works well for users (at least it does for me). I assume the table design for this part could be im... | I believe a message should be an entity, regardless of platform or sender/receiver, with id, message, timestamp fields, and a message relation table - like you suggested - with id, message_id, from_id, to_id. Then, if you are showing a single user to user conversation, you can show every message between them. For group... | Database Design: private chat, group chat, and emails The communication between Facebook users seem to be stored in one long "conversation." So, emails sent and private chat messages exchanged all seem to be part of one long ongoing conversation. I think this implementation works well for users (at least it does for me... | TITLE:
Database Design: private chat, group chat, and emails
QUESTION:
The communication between Facebook users seem to be stored in one long "conversation." So, emails sent and private chat messages exchanged all seem to be part of one long ongoing conversation. I think this implementation works well for users (at le... | [
"mysql",
"database",
"database-design"
] | 12 | 7 | 11,736 | 2 | 0 | 2011-06-08T00:00:29.323000 | 2011-06-08T00:19:39.690000 |
6,272,925 | 6,272,959 | C++ Object Deserialization - Where to start | I have a chunk of bytes taken from a recording file that represents a C++ object. I've been given the class definition for the object. How do I convert the data(chunk of bytes) to an object? I keep seeing references to boost but don't think I can use it since it was not used to serialize the object to begin with. Anyon... | You're correct -- Boost.Serialization can't help you deserialize an object it didn't serialize. You'll need to do unformatted input with std::ifstream (calling its read member function to extract byte ranges). Be sure to open the stream in binary mode. | C++ Object Deserialization - Where to start I have a chunk of bytes taken from a recording file that represents a C++ object. I've been given the class definition for the object. How do I convert the data(chunk of bytes) to an object? I keep seeing references to boost but don't think I can use it since it was not used ... | TITLE:
C++ Object Deserialization - Where to start
QUESTION:
I have a chunk of bytes taken from a recording file that represents a C++ object. I've been given the class definition for the object. How do I convert the data(chunk of bytes) to an object? I keep seeing references to boost but don't think I can use it sinc... | [
"c++",
"boost",
"deserialization"
] | 0 | 0 | 194 | 1 | 0 | 2011-06-08T00:03:47.607000 | 2011-06-08T00:11:34.293000 |
6,272,932 | 6,272,965 | Mixing rangeinput from jQuery Tools and draggable from jQuery UI | I currently use the rangeinput plugin from jQuery Tools in various places. But I now have to implement some other functionality using draggable from jQuery UI and it turns out the draggables are not working when there's a rangeinput in the page, which in my case is inevitable. I am willing to change any of the librarie... | I think you have the right idea by replacing the jQuery Tools part of your code with something else. jQuery Tools is terribly out of date (not updated since jQuery 1.4.2) and poorly supported in their own community. Have you looked at these? http://www.newmediacampaigns.com/files/posts/nmcdateranger/index.html http://w... | Mixing rangeinput from jQuery Tools and draggable from jQuery UI I currently use the rangeinput plugin from jQuery Tools in various places. But I now have to implement some other functionality using draggable from jQuery UI and it turns out the draggables are not working when there's a rangeinput in the page, which in ... | TITLE:
Mixing rangeinput from jQuery Tools and draggable from jQuery UI
QUESTION:
I currently use the rangeinput plugin from jQuery Tools in various places. But I now have to implement some other functionality using draggable from jQuery UI and it turns out the draggables are not working when there's a rangeinput in t... | [
"jquery",
"jquery-ui",
"jquery-tools"
] | 0 | 1 | 620 | 1 | 0 | 2011-06-08T00:05:20.470000 | 2011-06-08T00:12:17.300000 |
6,272,935 | 6,273,030 | How does one implement a .Net WebService that does not encapsulate response in XML? | I am writing an series of web interfaces to some data. I have WebMethods to return the data in DataSet and XmlDataDocument format (The XmlDataDocument removes all the schema overhead.) [WebMethod] public XmlDataDocument Search_XML( string query ) { return new XmlDataDocument( Search_DataSet( query ) ); } [WebMethod] pu... | If you need an HTTP endpoint that processes an HttpContext and returns a custom response, then using IHttpHandler via a Generic Web handler (*.ashx) would be the correct approach to take. You would read the values from the request query string and then process the request. Your generic handler would use the HttpContext... | How does one implement a .Net WebService that does not encapsulate response in XML? I am writing an series of web interfaces to some data. I have WebMethods to return the data in DataSet and XmlDataDocument format (The XmlDataDocument removes all the schema overhead.) [WebMethod] public XmlDataDocument Search_XML( stri... | TITLE:
How does one implement a .Net WebService that does not encapsulate response in XML?
QUESTION:
I am writing an series of web interfaces to some data. I have WebMethods to return the data in DataSet and XmlDataDocument format (The XmlDataDocument removes all the schema overhead.) [WebMethod] public XmlDataDocumen... | [
"c#",
".net",
"web-services"
] | 2 | 3 | 325 | 3 | 0 | 2011-06-08T00:06:16.220000 | 2011-06-08T00:25:03.180000 |
6,272,936 | 6,273,274 | MySQL Drop INDEX and REPLICATION | In a MySQL MASTER MASTER scenario using InnoDB When dropping an index on one instance will the same table on the other instance be available? What is the sequence of activities? I assume the following sequence: DROP INDEX on 1st instance Added to the binary log DROP INDEX on 2nd instance Can anyone confirm? | I believe the following will happen: Your DROP INDEX (which really runs an ALTER TABLE... DROP INDEX ) runs on the master If the ALTER completes successfully the statement will then be added to the binlog and will be run on the slave This means that the ALTER TABLE on the other machine won't start until the ALTER TABLE... | MySQL Drop INDEX and REPLICATION In a MySQL MASTER MASTER scenario using InnoDB When dropping an index on one instance will the same table on the other instance be available? What is the sequence of activities? I assume the following sequence: DROP INDEX on 1st instance Added to the binary log DROP INDEX on 2nd instanc... | TITLE:
MySQL Drop INDEX and REPLICATION
QUESTION:
In a MySQL MASTER MASTER scenario using InnoDB When dropping an index on one instance will the same table on the other instance be available? What is the sequence of activities? I assume the following sequence: DROP INDEX on 1st instance Added to the binary log DROP IN... | [
"mysql",
"indexing",
"innodb",
"database-replication",
"sql-drop"
] | 0 | 0 | 2,560 | 2 | 0 | 2011-06-08T00:06:22.490000 | 2011-06-08T01:18:27.687000 |
6,272,943 | 6,272,964 | Minesweeper program recursion error | I am creating a mine sweeper program in java for school, and am having trouble with the clearing of squares that don't have any mines next to them, the square is supposed to be disabled, and all surrounding squares revealed, if there is another square that is touching no bombs, it will perform the same operation. I am ... | private void doClear(int y, int x, JButton[][] bArray2, int gridy,int gridx) { if (...already cleared...) { return; }... } Without that check, cell A will clear neighbour cell B, which will clear neighbour cell A, which will clear neighbour cell B, which... The code you posted can be replaced with the following: privat... | Minesweeper program recursion error I am creating a mine sweeper program in java for school, and am having trouble with the clearing of squares that don't have any mines next to them, the square is supposed to be disabled, and all surrounding squares revealed, if there is another square that is touching no bombs, it wi... | TITLE:
Minesweeper program recursion error
QUESTION:
I am creating a mine sweeper program in java for school, and am having trouble with the clearing of squares that don't have any mines next to them, the square is supposed to be disabled, and all surrounding squares revealed, if there is another square that is touchi... | [
"java",
"recursion",
"stack-overflow"
] | 3 | 4 | 967 | 1 | 0 | 2011-06-08T00:07:34.960000 | 2011-06-08T00:12:08.980000 |
6,272,945 | 6,272,972 | How can I get a message bundle string from inside a managed bean? | I would like to be able to retrieve a string from a message bundle from inside a JSF 2 managed bean. This would be done in situations where the string is used as the summary or details parameter in a FacesMessage or as the message in a thrown exception. I want to make sure that the managed bean loads the correct messag... | You can get the full qualified bundle name of by Application#getMessageBundle(). You can get the current locale by UIViewRoot#getLocale(). You can get a ResourceBundle out of a full qualified bundle name and the locale by ResourceBundle#getBundle(). So, summarized: FacesContext facesContext = FacesContext.getCurrentIns... | How can I get a message bundle string from inside a managed bean? I would like to be able to retrieve a string from a message bundle from inside a JSF 2 managed bean. This would be done in situations where the string is used as the summary or details parameter in a FacesMessage or as the message in a thrown exception. ... | TITLE:
How can I get a message bundle string from inside a managed bean?
QUESTION:
I would like to be able to retrieve a string from a message bundle from inside a JSF 2 managed bean. This would be done in situations where the string is used as the summary or details parameter in a FacesMessage or as the message in a ... | [
"jsf",
"jsf-2",
"managed-bean",
"message-bundle"
] | 32 | 55 | 67,296 | 3 | 0 | 2011-06-08T00:08:22.603000 | 2011-06-08T00:13:31.843000 |
6,272,946 | 6,272,960 | Rectangles in StackPanel | I'm trying to insert multiple rectangles in a stackpanel but I keep getting the error 'Element is already the child of another element.'. Same thing happens if I use a canvas. Example: List recList = new List ();...put some rectangles in the list StackPanel stack = new StackPanel();
foreach(var item in recList) stack.... | Seems like you are adding the same rectangle more than once. If you need to add different rectangles than the code would be like this: var list = new List (); for (int i = 0; i < 10; i++) { list.Add(new Rectangle()); }
var panel = new StackPanel(); foreach (var rectangle in list) { panel.Children.Add(rectangle); } Thi... | Rectangles in StackPanel I'm trying to insert multiple rectangles in a stackpanel but I keep getting the error 'Element is already the child of another element.'. Same thing happens if I use a canvas. Example: List recList = new List ();...put some rectangles in the list StackPanel stack = new StackPanel();
foreach(va... | TITLE:
Rectangles in StackPanel
QUESTION:
I'm trying to insert multiple rectangles in a stackpanel but I keep getting the error 'Element is already the child of another element.'. Same thing happens if I use a canvas. Example: List recList = new List ();...put some rectangles in the list StackPanel stack = new StackPa... | [
"c#",
"silverlight",
"windows-phone-7",
"stackpanel",
"rectangles"
] | 3 | 1 | 1,684 | 1 | 0 | 2011-06-08T00:08:37.180000 | 2011-06-08T00:11:37.680000 |
6,272,948 | 6,272,967 | About clarity and javadoc | Opinions divided on this one... Guys, say you have a method defined as public static String getTestName(JsonElement e) throws ParserException; As a wanna-do-the-the-right-thing developer I'd like to document this appropriately. Original thought was to say: "Returns String representation of a Test name" "Or really? It r... | I would put the "String" in there for clarity's sake. In fact, I would consider making the wording more like "human-readable String" (if it is designed to be human-readable), or otherwise describe the formatting of the String if it is designed to be parsed or interpreted by other software. The best way would be to thin... | About clarity and javadoc Opinions divided on this one... Guys, say you have a method defined as public static String getTestName(JsonElement e) throws ParserException; As a wanna-do-the-the-right-thing developer I'd like to document this appropriately. Original thought was to say: "Returns String representation of a T... | TITLE:
About clarity and javadoc
QUESTION:
Opinions divided on this one... Guys, say you have a method defined as public static String getTestName(JsonElement e) throws ParserException; As a wanna-do-the-the-right-thing developer I'd like to document this appropriately. Original thought was to say: "Returns String rep... | [
"documentation",
"coding-style",
"conventions",
"doc"
] | 0 | 2 | 35 | 1 | 0 | 2011-06-08T00:08:44.160000 | 2011-06-08T00:12:54.580000 |
6,272,954 | 6,272,978 | Does swallowing an exception remove the performance-hit of throwing it? | After running into some un-handled exceptions when using Response.Redirect(), I read it up, and it appears several people are recommending to use ApplicationInstance.CompleteRequest() instead, to avoid an unhandled ThreadAbortException for each redirect, and thereby avoiding a performance hit. But let's say you catch t... | The exception is still being thrown, so all of the overhead of generating the exception and catching it is still present. | Does swallowing an exception remove the performance-hit of throwing it? After running into some un-handled exceptions when using Response.Redirect(), I read it up, and it appears several people are recommending to use ApplicationInstance.CompleteRequest() instead, to avoid an unhandled ThreadAbortException for each red... | TITLE:
Does swallowing an exception remove the performance-hit of throwing it?
QUESTION:
After running into some un-handled exceptions when using Response.Redirect(), I read it up, and it appears several people are recommending to use ApplicationInstance.CompleteRequest() instead, to avoid an unhandled ThreadAbortExce... | [
"c#",
"asp.net",
"performance",
"exception"
] | 2 | 5 | 267 | 2 | 0 | 2011-06-08T00:10:10.543000 | 2011-06-08T00:13:57.643000 |
6,272,957 | 6,272,996 | MySQL Query for obtaining count per hour | I need to obtain a count of how many actions occur on an hourly basis. My database keeps a log by timestamp of the actions. I understand that I could do a SELECT table.time COUNT(table.time) from table t group by t.time However, there are periods of time where no actions take place. For example if I have 10 actions dur... | you can solve this by creating a table that will contain 24 values for hours (00:00, 01:00 etc) and perform a left (or right) join with it and your table allowing nulls so you will have all 24 rows even if your table contains 0 rows at all, then group by should work fine. Dont forget to truncate everything but hour fro... | MySQL Query for obtaining count per hour I need to obtain a count of how many actions occur on an hourly basis. My database keeps a log by timestamp of the actions. I understand that I could do a SELECT table.time COUNT(table.time) from table t group by t.time However, there are periods of time where no actions take pl... | TITLE:
MySQL Query for obtaining count per hour
QUESTION:
I need to obtain a count of how many actions occur on an hourly basis. My database keeps a log by timestamp of the actions. I understand that I could do a SELECT table.time COUNT(table.time) from table t group by t.time However, there are periods of time where ... | [
"mysql"
] | 5 | 4 | 9,757 | 3 | 0 | 2011-06-08T00:10:45.833000 | 2011-06-08T00:17:27.117000 |
6,272,958 | 6,273,045 | Stored Procedure Where Clause Parameters | I've got an ASP.net search page where the user can enter one or more search criteria. The page calls a stored procedure to query a MS SQL Server 2008 db. Part of the search criteria is single date or date range. If the user supplies Date1, we search on a single date. If the user supplies Date1 and Date2, we search on a... | CREATE PROCEDURE BLABLABLA( @DATE1 DATETIME = NULL, @DATE2 DATETIME = NULL ) AS BEGIN SELECT COL1, COL2 FROM THE_TABLE WHERE THE_TABLE.DATETIMEFIELD BETWEEN ISNULL(@DATE1, THE_TABLE.DATETIMEFIELD) AND COALESCE(@DATE2, @DATE1, THE_TABLE.DATETIMEFIELD) END Another choice, losing some expressiveness but likely using index... | Stored Procedure Where Clause Parameters I've got an ASP.net search page where the user can enter one or more search criteria. The page calls a stored procedure to query a MS SQL Server 2008 db. Part of the search criteria is single date or date range. If the user supplies Date1, we search on a single date. If the user... | TITLE:
Stored Procedure Where Clause Parameters
QUESTION:
I've got an ASP.net search page where the user can enter one or more search criteria. The page calls a stored procedure to query a MS SQL Server 2008 db. Part of the search criteria is single date or date range. If the user supplies Date1, we search on a single... | [
"asp.net",
"sql-server",
"t-sql",
"stored-procedures",
"where-clause"
] | 4 | 4 | 2,526 | 2 | 0 | 2011-06-08T00:11:30.263000 | 2011-06-08T00:27:49.567000 |
6,272,966 | 6,272,987 | Problem with getting multiple random numbers | Possible Duplicate: Recommended way to initialize srand? I am extracting frames from AVI. I want the user to choose wether he wants to get all frames from user given range or get all frames available or get user given number of random frames. First two functions work just fine. But with random frames I always get only ... | You are initializing the pseudorandom number generator with the same seed. Initialize it just once, and with a semi-random (v.g., milliseconds in the system clock) number. | Problem with getting multiple random numbers Possible Duplicate: Recommended way to initialize srand? I am extracting frames from AVI. I want the user to choose wether he wants to get all frames from user given range or get all frames available or get user given number of random frames. First two functions work just fi... | TITLE:
Problem with getting multiple random numbers
QUESTION:
Possible Duplicate: Recommended way to initialize srand? I am extracting frames from AVI. I want the user to choose wether he wants to get all frames from user given range or get all frames available or get user given number of random frames. First two func... | [
"c++",
"winapi",
"random"
] | 0 | 1 | 244 | 1 | 0 | 2011-06-08T00:12:48.563000 | 2011-06-08T00:16:05.267000 |
6,272,971 | 6,273,019 | Add dynamic classes to an unordered list with PHP | I'm trying to add consecutive classes to all list-items in a list with the class of 'nav'. Essentially, I want every list-item to have a class of 'nthChild-x', where x represents its position in the list. I'm a major noob to PHP, so be easy. Here is the current markup: Blah Blah Uno Blah Blah Dos Blah Blah Tres I want ... | You can use DOMDocument for that. This one will work with existing classes and won't add the same class twice. $dom = new DOMDocument;
$dom->loadHTML($html);
$lists = $dom->getElementsByTagName('ul');
foreach($lists as $list) { $index = 1; foreach($list->childNodes as $node) { if ($node->nodeName!= 'li') { continue;... | Add dynamic classes to an unordered list with PHP I'm trying to add consecutive classes to all list-items in a list with the class of 'nav'. Essentially, I want every list-item to have a class of 'nthChild-x', where x represents its position in the list. I'm a major noob to PHP, so be easy. Here is the current markup: ... | TITLE:
Add dynamic classes to an unordered list with PHP
QUESTION:
I'm trying to add consecutive classes to all list-items in a list with the class of 'nav'. Essentially, I want every list-item to have a class of 'nthChild-x', where x represents its position in the list. I'm a major noob to PHP, so be easy. Here is th... | [
"php",
"html",
"dom",
"html-lists"
] | 1 | 1 | 1,193 | 3 | 0 | 2011-06-08T00:13:27.310000 | 2011-06-08T00:22:50.893000 |
6,272,985 | 6,273,112 | Stretch scrollview between two objects vertically | Good Afternoon, I have a list being generated gradually on the users screen, (right now the list is sitting in a scrollview but that might not be the final resting place.) Above the scrollview are a few buttons, and below the scrollview are a few buttons. Scrollview takes up whole middle of the screen. Right now, as th... | If you're talking about what I think you are, try adding a margin to the bottom of the scrollview, and a negative margin to the top of the linear layout. For instance: As for scrolling to the bottom of the scrollview when a new item is added, look at How to scroll to bottom in a ScrollView on activity startup. Note: Th... | Stretch scrollview between two objects vertically Good Afternoon, I have a list being generated gradually on the users screen, (right now the list is sitting in a scrollview but that might not be the final resting place.) Above the scrollview are a few buttons, and below the scrollview are a few buttons. Scrollview tak... | TITLE:
Stretch scrollview between two objects vertically
QUESTION:
Good Afternoon, I have a list being generated gradually on the users screen, (right now the list is sitting in a scrollview but that might not be the final resting place.) Above the scrollview are a few buttons, and below the scrollview are a few butto... | [
"android",
"xml",
"layout",
"scrollview"
] | 0 | 2 | 2,472 | 2 | 0 | 2011-06-08T00:15:42.947000 | 2011-06-08T00:37:35.600000 |
6,272,986 | 6,273,031 | Run a function with another (Non OOP __call) | so I'm pretty much wanting to make my code cleaner, and all of my functions return values, and I would like to avoid using classes/objects for this. I've experimented with __call() and pretty much copied the way Magento does it, and modified my methods so I can run displayThisFunction() - and it echos the output of thi... | php has no built-in metaprogramming tools. Either you write them all per hand or invent a kind of generator script that creates the stuff for you. Whether you actually need separate functions just to echo something is another story. | Run a function with another (Non OOP __call) so I'm pretty much wanting to make my code cleaner, and all of my functions return values, and I would like to avoid using classes/objects for this. I've experimented with __call() and pretty much copied the way Magento does it, and modified my methods so I can run displayTh... | TITLE:
Run a function with another (Non OOP __call)
QUESTION:
so I'm pretty much wanting to make my code cleaner, and all of my functions return values, and I would like to avoid using classes/objects for this. I've experimented with __call() and pretty much copied the way Magento does it, and modified my methods so I... | [
"php",
"return-value",
"call",
"echo"
] | 0 | 1 | 104 | 1 | 0 | 2011-06-08T00:15:48.650000 | 2011-06-08T00:25:12.547000 |
6,272,991 | 6,273,321 | Windows Service not completely starting | I made this small windows service in c# and I believe I may have done something wrong with my ThreadPool code that prevents my Windows Service from completely starting. If you must know, the windows service seems to be running perfectly only that when looked upon the Services console, it still states that it is "starti... | I think you could wrap the logic inside OnStart in a thread. This thread would be closed when you received an OnStop event. Something like this: Thread _ServiceThread; protected override void OnStart(string[] args) { _ServiceThread = new Thread(() => { /* your current OnStart logic here...*/ }); _ServiceThread.Start();... | Windows Service not completely starting I made this small windows service in c# and I believe I may have done something wrong with my ThreadPool code that prevents my Windows Service from completely starting. If you must know, the windows service seems to be running perfectly only that when looked upon the Services con... | TITLE:
Windows Service not completely starting
QUESTION:
I made this small windows service in c# and I believe I may have done something wrong with my ThreadPool code that prevents my Windows Service from completely starting. If you must know, the windows service seems to be running perfectly only that when looked upo... | [
"c#",
"windows-services",
"threadpool",
"queueuserworkitem"
] | 3 | 2 | 918 | 2 | 0 | 2011-06-08T00:16:29.390000 | 2011-06-08T01:26:57.287000 |
6,273,001 | 6,286,827 | PHPUnit mocking - fail immediately when method called x times | With PHPUnit, I am testing a sequence of method calls using ->at(), like so: $mock->expects($this->at(0))->method('execute')->will($this->returnValue('foo')); $mock->expects($this->at(1))->method('execute')->will($this->returnValue('bar')); $mock->expects($this->at(2))->method('execute')->will($this->returnValue('baz')... | I managed to find a solution in the end. I used a comination of $this->returnCallback() and passing the PHPUnit matcher to keep track of the invocation count. You can then throw a PHPUnit exception so that you get nice output too: $matcher = $this->any(); $mock ->expects($matcher) ->method('execute') ->will($this->retu... | PHPUnit mocking - fail immediately when method called x times With PHPUnit, I am testing a sequence of method calls using ->at(), like so: $mock->expects($this->at(0))->method('execute')->will($this->returnValue('foo')); $mock->expects($this->at(1))->method('execute')->will($this->returnValue('bar')); $mock->expects($t... | TITLE:
PHPUnit mocking - fail immediately when method called x times
QUESTION:
With PHPUnit, I am testing a sequence of method calls using ->at(), like so: $mock->expects($this->at(0))->method('execute')->will($this->returnValue('foo')); $mock->expects($this->at(1))->method('execute')->will($this->returnValue('bar'));... | [
"php",
"unit-testing",
"mocking",
"phpunit"
] | 5 | 11 | 3,033 | 4 | 0 | 2011-06-08T00:18:23.493000 | 2011-06-09T00:31:05.827000 |
6,273,002 | 6,273,036 | Generic/type safe ICommand implementation? | I recently started using WPF and the MVVM framework, one thing that I have wanted to do is to have a type safe implementation of ICommand so I do not have to cast all the command paramaters. Does anyone know of a way to do this? | Not using that syntax, as you probably found: error CS0701: ``System.Func`' is not a valid constraint. A constraint must be an interface, a non-sealed class or a type parameter Your best bet is to encapsulate the Func semantics in an interface, like: interface IFunctor { bool Execute(E value); } and then use this inter... | Generic/type safe ICommand implementation? I recently started using WPF and the MVVM framework, one thing that I have wanted to do is to have a type safe implementation of ICommand so I do not have to cast all the command paramaters. Does anyone know of a way to do this? | TITLE:
Generic/type safe ICommand implementation?
QUESTION:
I recently started using WPF and the MVVM framework, one thing that I have wanted to do is to have a type safe implementation of ICommand so I do not have to cast all the command paramaters. Does anyone know of a way to do this?
ANSWER:
Not using that syntax... | [
"c#",
"wpf",
"generics",
"mvvm",
".net-4.0"
] | 12 | 14 | 8,961 | 2 | 0 | 2011-06-08T00:18:31.623000 | 2011-06-08T00:26:27.727000 |
6,273,009 | 6,275,899 | Setting TextBox.Text after Selecting a Date on an Ajax CalendarExtender | On an ASP.NET page, I have a pair of CalendarExtender (AJAX Control Toolkit for ASP.NET 4.0) controls on a page acting as a date range. What I want to do is, after the user has selected the value for TextCheckInDate, populate TextCheckOutDate with TextCheckInDate+ 1 if TextCheckOutDate is empty. Regrettably, my jQuery ... | Can you prohibit to enter text into date textboxes? If so, you can use following approach: in PreRender method add code below: TextCheckInDate.Attributes.Add("readOnly", "readonly"); TextCheckOutDate.Attributes.Add("readOnly", "readonly"); | Setting TextBox.Text after Selecting a Date on an Ajax CalendarExtender On an ASP.NET page, I have a pair of CalendarExtender (AJAX Control Toolkit for ASP.NET 4.0) controls on a page acting as a date range. What I want to do is, after the user has selected the value for TextCheckInDate, populate TextCheckOutDate with ... | TITLE:
Setting TextBox.Text after Selecting a Date on an Ajax CalendarExtender
QUESTION:
On an ASP.NET page, I have a pair of CalendarExtender (AJAX Control Toolkit for ASP.NET 4.0) controls on a page acting as a date range. What I want to do is, after the user has selected the value for TextCheckInDate, populate Text... | [
"jquery",
"asp.net",
"textbox",
"calendarextender"
] | 0 | 3 | 6,074 | 2 | 0 | 2011-06-08T00:19:42.167000 | 2011-06-08T08:08:14.903000 |
6,273,014 | 6,273,027 | Name of backquote character in VB | In System.Windows.Forms.Keys, what is the name of the backquote (`) character? Is backquote not its proper name, or is it just a quirk of VS? Or, otherwise, what is its numeric value? | The KeyValue for the character is 223. To check, you can just handle a textbox's keydown event like this: Private Sub TextBox1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown MessageBox.Show(e.KeyValue.ToString()) End Sub and press the (`) key. If you want to compare th... | Name of backquote character in VB In System.Windows.Forms.Keys, what is the name of the backquote (`) character? Is backquote not its proper name, or is it just a quirk of VS? Or, otherwise, what is its numeric value? | TITLE:
Name of backquote character in VB
QUESTION:
In System.Windows.Forms.Keys, what is the name of the backquote (`) character? Is backquote not its proper name, or is it just a quirk of VS? Or, otherwise, what is its numeric value?
ANSWER:
The KeyValue for the character is 223. To check, you can just handle a text... | [
"vb.net",
"visual-studio-2010"
] | 2 | 5 | 287 | 1 | 0 | 2011-06-08T00:21:04.397000 | 2011-06-08T00:24:40.310000 |
6,273,020 | 6,273,225 | Keep NSThread alive and run NSRunLoop on it | So I'm starting a new NSThread that I want to be able to use later by calling performSelector:onThread:.... From how I understand it calling that methods add that call to the runloop on that thread, so on its next iteration it will pop all these calls and subsequently call them until there is nothing left to call. So I... | A run loop requires at least one "input source" to run. The main run loop does, but you have to add a source manually to get a secondary run loop's -run method to do anything. There's some documentation on this here. One naïve way to get this to work would be just to put [[NSRunLoop currentRunLoop] run] in an infinite ... | Keep NSThread alive and run NSRunLoop on it So I'm starting a new NSThread that I want to be able to use later by calling performSelector:onThread:.... From how I understand it calling that methods add that call to the runloop on that thread, so on its next iteration it will pop all these calls and subsequently call th... | TITLE:
Keep NSThread alive and run NSRunLoop on it
QUESTION:
So I'm starting a new NSThread that I want to be able to use later by calling performSelector:onThread:.... From how I understand it calling that methods add that call to the runloop on that thread, so on its next iteration it will pop all these calls and su... | [
"objective-c",
"cocoa",
"nsthread",
"foundation",
"nsrunloop"
] | 23 | 15 | 15,909 | 2 | 0 | 2011-06-08T00:22:54.007000 | 2011-06-08T01:06:13.190000 |
6,273,023 | 6,273,096 | Data duplication in DataGrid. Problem with LINQ query | I have such a query but it gives me wrong output. I have two data collections abcdata && xyzdata. each collection consists of an anonymous objects that have Group, Name properties. What I need to do is to get resulting collection with merged groups from abcdata and xyzdata respectively. if(this.AbcDataGrid.ItemsSource!... | I believe that what you are trying to do is join both data collections. The linq query that you are doing is returning the correct results as what you are asking with it is: for every element of abcdata, and for every element of xyzdata, return the object you are constructing. So, if abcdata has 3 elements and xyzdata ... | Data duplication in DataGrid. Problem with LINQ query I have such a query but it gives me wrong output. I have two data collections abcdata && xyzdata. each collection consists of an anonymous objects that have Group, Name properties. What I need to do is to get resulting collection with merged groups from abcdata and ... | TITLE:
Data duplication in DataGrid. Problem with LINQ query
QUESTION:
I have such a query but it gives me wrong output. I have two data collections abcdata && xyzdata. each collection consists of an anonymous objects that have Group, Name properties. What I need to do is to get resulting collection with merged groups... | [
"c#",
"wpf",
"linq",
"datagrid"
] | 1 | 5 | 210 | 1 | 0 | 2011-06-08T00:23:50.570000 | 2011-06-08T00:35:00.343000 |
6,273,025 | 6,273,103 | php mysql time elapsed calculation | I have an app [iphone], that sends to a server some times [using json], so the times look like hh:mm 24 hour format, the time gets saved in the db as varchar, I need to calculate the elapsed time = endTime - startTime but my problem is that I have the time in the db as varchar!, no time stamp, so how to calculate the e... | Easy: $start_time = '11:10'; $end_time = '18:55';
$start_time = explode(':', $start_time); $end_time = explode(':', $end_time);
$elapsed_time = $end_time[0]*60+$end_time[1]-$start_time[0]*60-$start_time[1]; // in minutes. $elapsed_hours = floor($elapsed_time/60); $elapsed_minutes = $elapsed_time-$elapsed_hours*60;
p... | php mysql time elapsed calculation I have an app [iphone], that sends to a server some times [using json], so the times look like hh:mm 24 hour format, the time gets saved in the db as varchar, I need to calculate the elapsed time = endTime - startTime but my problem is that I have the time in the db as varchar!, no ti... | TITLE:
php mysql time elapsed calculation
QUESTION:
I have an app [iphone], that sends to a server some times [using json], so the times look like hh:mm 24 hour format, the time gets saved in the db as varchar, I need to calculate the elapsed time = endTime - startTime but my problem is that I have the time in the db ... | [
"php",
"mysql",
"database",
"elapsedtime"
] | 3 | 2 | 875 | 3 | 0 | 2011-06-08T00:24:28.437000 | 2011-06-08T00:36:28.857000 |
6,273,026 | 6,273,172 | Implementing recursion with a deep copy | How can I implement recursion in a deep copy function object? This is the relevant code (if you want more then please ask): PS: I would like the recursion to iterate through a filtered list of references. The goal is to download and insert any missing objects. copy.py from put import putter
class copier: def __init__(... | Check out the documentation for copy.deepcopy, if you can implement what you want with __getinitargs__(), __getstate__() and __setstate__(), then that will save you a lot of grief. Otherwise, you will need to reimplement it yourself, it should look something like: def deepcopyif(obj, shouldcopyprop): copied = {} # Reme... | Implementing recursion with a deep copy How can I implement recursion in a deep copy function object? This is the relevant code (if you want more then please ask): PS: I would like the recursion to iterate through a filtered list of references. The goal is to download and insert any missing objects. copy.py from put im... | TITLE:
Implementing recursion with a deep copy
QUESTION:
How can I implement recursion in a deep copy function object? This is the relevant code (if you want more then please ask): PS: I would like the recursion to iterate through a filtered list of references. The goal is to download and insert any missing objects. c... | [
"python",
"pickle",
"distributed-computing",
"deep-copy"
] | 2 | 2 | 3,502 | 1 | 0 | 2011-06-08T00:24:30.773000 | 2011-06-08T00:54:10.727000 |
6,273,032 | 6,273,075 | How to get rid of the whitespace at the bottom? | Can someone please help me eliminate the extra whitespace at the bottom of this website? http://www.vonlay.com/ This image shows what I am trying to remove: http://img691.imageshack.us/img691/8837/screenshot20110607at715.png Here is how I have the footer setup. html, body { height: 100%; } body > #wrapper { height: aut... | You should add: #footer.content p { margin-bottom: 0 } I actually wrote another answer before that one that explains what's going on properly, with an alternative fix, here it is: You should add overflow: hidden to #footer. This will resolve the problem, which is that the margin on the p element inside is collapsing th... | How to get rid of the whitespace at the bottom? Can someone please help me eliminate the extra whitespace at the bottom of this website? http://www.vonlay.com/ This image shows what I am trying to remove: http://img691.imageshack.us/img691/8837/screenshot20110607at715.png Here is how I have the footer setup. html, body... | TITLE:
How to get rid of the whitespace at the bottom?
QUESTION:
Can someone please help me eliminate the extra whitespace at the bottom of this website? http://www.vonlay.com/ This image shows what I am trying to remove: http://img691.imageshack.us/img691/8837/screenshot20110607at715.png Here is how I have the footer... | [
"html",
"css"
] | 0 | 11 | 32,985 | 7 | 0 | 2011-06-08T00:25:30.440000 | 2011-06-08T00:33:13.240000 |
6,273,035 | 6,273,052 | Is it possible to run Chrome as an external tool on Eclipse 3.6 on Mac OS X? | I'm trying to set up Chrome to run as an external tool in Eclipse on the Mac. I've entered the path to Chrome as the Location variable: "/Applications/Chrome.app/Contents/MacOS/Google\ Chrome" I've got some arguments to pass in to Chrome, but that's not so important - I can't seem to get it started from Eclipse as an E... | Does this similar SO post help you? Running external tools in Eclipse on Mac OS X | Is it possible to run Chrome as an external tool on Eclipse 3.6 on Mac OS X? I'm trying to set up Chrome to run as an external tool in Eclipse on the Mac. I've entered the path to Chrome as the Location variable: "/Applications/Chrome.app/Contents/MacOS/Google\ Chrome" I've got some arguments to pass in to Chrome, but ... | TITLE:
Is it possible to run Chrome as an external tool on Eclipse 3.6 on Mac OS X?
QUESTION:
I'm trying to set up Chrome to run as an external tool in Eclipse on the Mac. I've entered the path to Chrome as the Location variable: "/Applications/Chrome.app/Contents/MacOS/Google\ Chrome" I've got some arguments to pass ... | [
"eclipse",
"google-chrome"
] | 0 | 1 | 1,098 | 1 | 0 | 2011-06-08T00:26:19.520000 | 2011-06-08T00:28:46.690000 |
6,273,038 | 6,287,723 | installing the GD 2 library on fedora linux | Hi was trying the code igniter image manipulation and I saw that I needed GD2 library so I went ahead and installed it but I could not see it in phpinfo. Could anyone please help me with this. Any efforts will be appreciated thanks | You also need the php-gd extension. There's probably a package for your OS with almost exactly that name. | installing the GD 2 library on fedora linux Hi was trying the code igniter image manipulation and I saw that I needed GD2 library so I went ahead and installed it but I could not see it in phpinfo. Could anyone please help me with this. Any efforts will be appreciated thanks | TITLE:
installing the GD 2 library on fedora linux
QUESTION:
Hi was trying the code igniter image manipulation and I saw that I needed GD2 library so I went ahead and installed it but I could not see it in phpinfo. Could anyone please help me with this. Any efforts will be appreciated thanks
ANSWER:
You also need the... | [
"codeigniter",
"gd",
"fedora"
] | 0 | 1 | 261 | 1 | 0 | 2011-06-08T00:26:39.103000 | 2011-06-09T03:13:20.617000 |
6,273,048 | 6,273,080 | what's the syntax for selecting several ids into a variable, and then using that in an IN | I'm unable to figure out how to do the following... I'm pretty sure it's possible but am getting bad syntax errors... /*pseudo*/ set @ids = select id from table_a limit 1,10; select * from table_b where table_a_id in (@ids); I would just put the select in the in() but mySQL says it's not willing to do a subselect in an... | you can do this: select table_b.* from table_b join (select id from table_a limit 1,10) As table_a on table_b.table_a_id = table_a.id | what's the syntax for selecting several ids into a variable, and then using that in an IN I'm unable to figure out how to do the following... I'm pretty sure it's possible but am getting bad syntax errors... /*pseudo*/ set @ids = select id from table_a limit 1,10; select * from table_b where table_a_id in (@ids); I wou... | TITLE:
what's the syntax for selecting several ids into a variable, and then using that in an IN
QUESTION:
I'm unable to figure out how to do the following... I'm pretty sure it's possible but am getting bad syntax errors... /*pseudo*/ set @ids = select id from table_a limit 1,10; select * from table_b where table_a_i... | [
"mysql"
] | 2 | 4 | 88 | 3 | 0 | 2011-06-08T00:28:09.020000 | 2011-06-08T00:33:47.917000 |
6,273,054 | 6,273,182 | Should I make this a Different Module in HMVC Codeigniter? | I'm just getting started using HMVC in Codeigniter. The main module is a news/blog site called 'blog'. I want users to be able to log in to comment, so I have authentication files (tank auth actually). Now I also want the users to have their own profile pages which shows their posting stats and personal info. Users can... | It really depends, and it's up to you. If you want the comment system to apply to other modules some day, definitely make it it's own module. If it's only related to blogs, you could leave it in the blogs modules as it's own controller. This is also where modules::run() and $this->load->module() can come in handy, call... | Should I make this a Different Module in HMVC Codeigniter? I'm just getting started using HMVC in Codeigniter. The main module is a news/blog site called 'blog'. I want users to be able to log in to comment, so I have authentication files (tank auth actually). Now I also want the users to have their own profile pages w... | TITLE:
Should I make this a Different Module in HMVC Codeigniter?
QUESTION:
I'm just getting started using HMVC in Codeigniter. The main module is a news/blog site called 'blog'. I want users to be able to log in to comment, so I have authentication files (tank auth actually). Now I also want the users to have their o... | [
"php",
"model-view-controller",
"codeigniter",
"kohana",
"hmvc"
] | 4 | 1 | 1,354 | 1 | 0 | 2011-06-08T00:28:56.887000 | 2011-06-08T00:56:29.287000 |
6,273,059 | 6,273,119 | C# - Ping server with ICMP disabled | I am trying to ping a series of servers frequently using the PingReply class. Most of the time this is fine, but other times I get failed pings. I'm guessing this has something to do with ICMP being disabled on the remote server(s). Is there any way to get a ping to from a server even if ICMP is disabled? | If the remote server won't respond to an ICMP ECHO request, it won't work with the Ping command. Odds are there is some difference between the packet you're sending and the one Ping is sending. You can use something like Network Monitor or Wireshark to see the packets and compare them. Odds are you're sending a packet ... | C# - Ping server with ICMP disabled I am trying to ping a series of servers frequently using the PingReply class. Most of the time this is fine, but other times I get failed pings. I'm guessing this has something to do with ICMP being disabled on the remote server(s). Is there any way to get a ping to from a server eve... | TITLE:
C# - Ping server with ICMP disabled
QUESTION:
I am trying to ping a series of servers frequently using the PingReply class. Most of the time this is fine, but other times I get failed pings. I'm guessing this has something to do with ICMP being disabled on the remote server(s). Is there any way to get a ping to... | [
"c#",
".net-2.0",
"icmp"
] | 3 | 2 | 1,549 | 2 | 0 | 2011-06-08T00:30:16.337000 | 2011-06-08T00:39:27.127000 |
6,273,073 | 6,273,117 | php working locally and remotely on own hosting, but not remotely on client's hosting | I'm not good with PHP, so please bear with me. I have the following code: ". $_GET['d_name']. " ";?> "; while($rec_qry = mysql_fetch_array($rs_qry)) { $cate_name = str_replace('_',' ',$rec_qry['own_category']);
//print_r($cate_name[1]); if($rec_qry["own_category"]!= $_GET['catName']) echo " ".strtoupper($cate_name)." ... | That's hard to tell. It's very obviously something with the clients setup. Taking a wild guess, that client is still running PHP4. Because after line 73 you have a call to str_ireplace which wasn't available for that. You would likely get a fatal error for this one. And this is the right avenue for investigation here. ... | php working locally and remotely on own hosting, but not remotely on client's hosting I'm not good with PHP, so please bear with me. I have the following code: ". $_GET['d_name']. " ";?> "; while($rec_qry = mysql_fetch_array($rs_qry)) { $cate_name = str_replace('_',' ',$rec_qry['own_category']);
//print_r($cate_name[1... | TITLE:
php working locally and remotely on own hosting, but not remotely on client's hosting
QUESTION:
I'm not good with PHP, so please bear with me. I have the following code: ". $_GET['d_name']. " ";?> "; while($rec_qry = mysql_fetch_array($rs_qry)) { $cate_name = str_replace('_',' ',$rec_qry['own_category']);
//pr... | [
"php",
"mysql"
] | 1 | 5 | 95 | 3 | 0 | 2011-06-08T00:32:51.193000 | 2011-06-08T00:39:03.147000 |
6,273,090 | 6,273,173 | JAXB marshaller using Java member variable convention | I'm currently trying to figure out why JAXB marshaller uses Java member variable convention as opposed to follow the XmlType annotation. Here's the situation: Third-party gave us XSD We use JDK tools to generate Java classes The generated Java classes produced correct annotation: @XmlType(name = "XML_DOCUMENT_TYPE") Bu... | UPDATE (based on comment by xandross You can use @XmlRootElement to control the root element name: @XmlRootElement(name="XML_DOCUMENT_TYPE") public class Foo {... } Alternatively you can wrap the root object in an instance of JAXBElement to supply root element information. UPDATE (based on comment by Mohamed Mansour) I... | JAXB marshaller using Java member variable convention I'm currently trying to figure out why JAXB marshaller uses Java member variable convention as opposed to follow the XmlType annotation. Here's the situation: Third-party gave us XSD We use JDK tools to generate Java classes The generated Java classes produced corre... | TITLE:
JAXB marshaller using Java member variable convention
QUESTION:
I'm currently trying to figure out why JAXB marshaller uses Java member variable convention as opposed to follow the XmlType annotation. Here's the situation: Third-party gave us XSD We use JDK tools to generate Java classes The generated Java clas... | [
"java",
"xml",
"xsd",
"jaxb"
] | 2 | 4 | 765 | 1 | 0 | 2011-06-08T00:34:36.997000 | 2011-06-08T00:54:35.170000 |
6,273,094 | 6,273,115 | Reading data from response header of NSURLConnection | How can I read the data from the header sent by in the server response. I am using NSURLConnection to send the request. | If the URL is an HTTP URL, then the NSURLResponse that you receive in your connection's delegate's -connection:didReceiveResponse: method (or via another method) will be an NSHTTPURLResponse, which has an -allHeaderFields method that lets you access the headers. NSURLResponse* response = // the response, from somewhere... | Reading data from response header of NSURLConnection How can I read the data from the header sent by in the server response. I am using NSURLConnection to send the request. | TITLE:
Reading data from response header of NSURLConnection
QUESTION:
How can I read the data from the header sent by in the server response. I am using NSURLConnection to send the request.
ANSWER:
If the URL is an HTTP URL, then the NSURLResponse that you receive in your connection's delegate's -connection:didReceiv... | [
"iphone",
"objective-c",
"cocoa-touch",
"nsurlconnection"
] | 32 | 78 | 20,617 | 2 | 0 | 2011-06-08T00:34:57.240000 | 2011-06-08T00:38:49.667000 |
6,273,095 | 6,273,120 | Disable caching in Fire Fox in ASP.NET and C# | I have developed a web application that processes credit card payments and when a user hits the back button in Fire Fox after they received the payment confirmation page, it post a duplicate payment. I have put the following code in both the payment form and confirmation page and it still posts duplicate payments: Resp... | rerun has a good point in the comments. With regards to this problem, try this code ( source ): Response.ClearHeaders(); Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1 Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1 Response.... | Disable caching in Fire Fox in ASP.NET and C# I have developed a web application that processes credit card payments and when a user hits the back button in Fire Fox after they received the payment confirmation page, it post a duplicate payment. I have put the following code in both the payment form and confirmation pa... | TITLE:
Disable caching in Fire Fox in ASP.NET and C#
QUESTION:
I have developed a web application that processes credit card payments and when a user hits the back button in Fire Fox after they received the payment confirmation page, it post a duplicate payment. I have put the following code in both the payment form a... | [
"c#",
"asp.net",
"firefox",
"caching"
] | 1 | 2 | 1,875 | 2 | 0 | 2011-06-08T00:34:58.687000 | 2011-06-08T00:39:31.930000 |
6,273,116 | 6,273,151 | Best way to dynamically schedule reminder email? Anything better than cron? | Greetings, I am developing a web app. One piece of it will allow users to schedule a "reminder" email to be sent to them at a particular time of day. What is the best way to accomplish this? Basically, all the solutions I've come up with operate on a "polling" pattern when what I want is an "interrupt" pattern. Here ar... | Use first variant. it may take over a minute to send out all the emails Check, if file_exists('mailing.q'); If still exists - terminate execution. Create file mailing.q send emails unlink('mailing.q'); And don't think about overhead - not in this case. | Best way to dynamically schedule reminder email? Anything better than cron? Greetings, I am developing a web app. One piece of it will allow users to schedule a "reminder" email to be sent to them at a particular time of day. What is the best way to accomplish this? Basically, all the solutions I've come up with operat... | TITLE:
Best way to dynamically schedule reminder email? Anything better than cron?
QUESTION:
Greetings, I am developing a web app. One piece of it will allow users to schedule a "reminder" email to be sent to them at a particular time of day. What is the best way to accomplish this? Basically, all the solutions I've c... | [
"php",
"linux",
"cron",
"lamp"
] | 6 | 2 | 3,779 | 5 | 0 | 2011-06-08T00:38:55.003000 | 2011-06-08T00:49:38.013000 |
6,273,122 | 6,273,192 | Fluent mongo Count() performance | Given this wrapper: public MongoCollection GetQuery () where TEntity: class { var query = DataBase.GetCollection (typeof(TEntity).Name + "s"); return query; }
public long Count (System.Linq.Expressions.Expression > criteria) where TEntity: class { return this.GetQuery ().AsQueryable().Count(criteria); } If I call Coun... | Yes. It will get executed server-side. You can verify this by turning the profiling up on your mongodb server and seeing what gets executed. | Fluent mongo Count() performance Given this wrapper: public MongoCollection GetQuery () where TEntity: class { var query = DataBase.GetCollection (typeof(TEntity).Name + "s"); return query; }
public long Count (System.Linq.Expressions.Expression > criteria) where TEntity: class { return this.GetQuery ().AsQueryable().... | TITLE:
Fluent mongo Count() performance
QUESTION:
Given this wrapper: public MongoCollection GetQuery () where TEntity: class { var query = DataBase.GetCollection (typeof(TEntity).Name + "s"); return query; }
public long Count (System.Linq.Expressions.Expression > criteria) where TEntity: class { return this.GetQuery... | [
"linq",
"mongodb"
] | 3 | 3 | 555 | 1 | 0 | 2011-06-08T00:39:58.907000 | 2011-06-08T00:59:11.550000 |
6,273,130 | 6,277,839 | Better way to generate models from yaml in Doctrine1.2? | Hello Ive been working with doctrine 1.2 lately and do aliot of work from the command line. The problem is that when Im working on a project I change my schema alot at first. This would be fine but when i run the generate-models-from-yaml, it overwrites my model classes, and alot of time I have code inside the model cl... | One way of addressing this is to keep your custom code away from the often-rewritten classes, and place it in a different class that either extends the base model or that uses the model in question. So if you have a BlogModel that gets rewritten all the time, you can always have a class BlogWrapper extends BlogModel{ f... | Better way to generate models from yaml in Doctrine1.2? Hello Ive been working with doctrine 1.2 lately and do aliot of work from the command line. The problem is that when Im working on a project I change my schema alot at first. This would be fine but when i run the generate-models-from-yaml, it overwrites my model c... | TITLE:
Better way to generate models from yaml in Doctrine1.2?
QUESTION:
Hello Ive been working with doctrine 1.2 lately and do aliot of work from the command line. The problem is that when Im working on a project I change my schema alot at first. This would be fine but when i run the generate-models-from-yaml, it ove... | [
"doctrine",
"doctrine-1.2"
] | 0 | 0 | 356 | 1 | 0 | 2011-06-08T00:43:54.363000 | 2011-06-08T11:12:24.743000 |
6,273,131 | 6,273,163 | Beginner with Android/Java - help with Intent and adding two numbers | i've been working on this for several days and i'm just out of ideas. i've searched everywhere and have the book ProAndroid2. i'm trying to do something simple (i thought) which was have two text boxes where a user enters a number in each, then pushes a button and the sum of the numbers will display. i found this on st... | you should get your editTexts from the content of your activity like this: //gets numbers from user number1 = (EditText)findViewById(R.id.number1); number2 = (EditText)findViewById(R.id.number2); and then on your onClick method: you dont need to start your activity because you are already on it: try this: @Override pub... | Beginner with Android/Java - help with Intent and adding two numbers i've been working on this for several days and i'm just out of ideas. i've searched everywhere and have the book ProAndroid2. i'm trying to do something simple (i thought) which was have two text boxes where a user enters a number in each, then pushes... | TITLE:
Beginner with Android/Java - help with Intent and adding two numbers
QUESTION:
i've been working on this for several days and i'm just out of ideas. i've searched everywhere and have the book ProAndroid2. i'm trying to do something simple (i thought) which was have two text boxes where a user enters a number in... | [
"java",
"android",
"nullpointerexception",
"parseint"
] | 0 | 1 | 8,233 | 2 | 0 | 2011-06-08T00:44:01.523000 | 2011-06-08T00:52:23.073000 |
6,273,140 | 6,273,227 | How do I store a reference to a generic type created based on an expression passed to the method? | I have the following method, which returns a generic object of type INamedProperty based on the return type of a defined expression. I need to store a reference to the object that is returned by this method for future processing. What type should I store it as? Would Object be OK? How would I cast it back to the approp... | I would try to implement a generic, uhh, non -generic INamedProperty that could implement the operations you need: interface INamedProperty { // Informational Type ContainingType { get; } string Name { get; } Type ReturnType { get; }
// Operations (for example) void CopyTo(object obj, INamedProperty property); } Then ... | How do I store a reference to a generic type created based on an expression passed to the method? I have the following method, which returns a generic object of type INamedProperty based on the return type of a defined expression. I need to store a reference to the object that is returned by this method for future proc... | TITLE:
How do I store a reference to a generic type created based on an expression passed to the method?
QUESTION:
I have the following method, which returns a generic object of type INamedProperty based on the return type of a defined expression. I need to store a reference to the object that is returned by this meth... | [
"c#",
"generics",
"expression"
] | 3 | 2 | 414 | 2 | 0 | 2011-06-08T00:45:53.380000 | 2011-06-08T01:06:34.597000 |
6,273,146 | 6,273,576 | Java NIO Issue/Misunderstanding of how isReadable works | I've found that the NIO is poorly documented at best except for the simplistic case. Even so, I've been through the tutorials and several refactors and ultimately pushed back to the simplest case and I'm still occasionally having isReadable firing off with a 0 byte SocketChannel read. It's not happening every execution... | I recall that spurious selector wakeup is possible. While it's funny that there's nothing to read when you are just told there's something to read, it is usually not a problem for programs. A program typically should expect arbitrary number of bytes when reading a TCP stream; and the case of 0 byte usually doesn't need... | Java NIO Issue/Misunderstanding of how isReadable works I've found that the NIO is poorly documented at best except for the simplistic case. Even so, I've been through the tutorials and several refactors and ultimately pushed back to the simplest case and I'm still occasionally having isReadable firing off with a 0 byt... | TITLE:
Java NIO Issue/Misunderstanding of how isReadable works
QUESTION:
I've found that the NIO is poorly documented at best except for the simplistic case. Even so, I've been through the tutorials and several refactors and ultimately pushed back to the simplest case and I'm still occasionally having isReadable firin... | [
"java",
"sockets",
"nio",
"socketchannel"
] | 0 | 2 | 3,804 | 1 | 0 | 2011-06-08T00:47:24.987000 | 2011-06-08T02:27:22.707000 |
6,273,150 | 6,273,160 | How to find the row Id using jQuery? | Guys I asked a similar question like this earlier since I was unable to solve my problem I decided to ask a detailed question.Please referrer to my image As i mentioned on the image I need to identify the particular table row index value or the number of the index field to enable the particular capacity,unit price,qty ... | Supposing you put this as a callback of $('td').click(): $(this).parent().find('td:first').text() or $(this).closest('tr').find('td:first').text() Here is jsfiddle sample | How to find the row Id using jQuery? Guys I asked a similar question like this earlier since I was unable to solve my problem I decided to ask a detailed question.Please referrer to my image As i mentioned on the image I need to identify the particular table row index value or the number of the index field to enable th... | TITLE:
How to find the row Id using jQuery?
QUESTION:
Guys I asked a similar question like this earlier since I was unable to solve my problem I decided to ask a detailed question.Please referrer to my image As i mentioned on the image I need to identify the particular table row index value or the number of the index ... | [
"javascript",
"jquery",
"ajax"
] | 1 | 8 | 4,286 | 7 | 0 | 2011-06-08T00:49:35.950000 | 2011-06-08T00:51:25.813000 |
6,273,162 | 6,273,178 | Email passed to Mail_mimeDecode() from MySQL query has goofed up characters for attachments | We have a database with stored mbox formatted emails, attachments in their native base64 format in the mailbox format. We can retrieve and access/parse all information...except for the attachments. In short, I can go into MySQL and actually see base64_encoded attachment data, but for whatever reason Mail_mimeDecode() s... | Surprise! Mail_mimeDecode actually, well, I hesitate to say it, decodes the attachment. BTW: longtext holding most email messages is an understatement I hope, that's 4GB, would hate to receive a mail bigger than that:) | Email passed to Mail_mimeDecode() from MySQL query has goofed up characters for attachments We have a database with stored mbox formatted emails, attachments in their native base64 format in the mailbox format. We can retrieve and access/parse all information...except for the attachments. In short, I can go into MySQL ... | TITLE:
Email passed to Mail_mimeDecode() from MySQL query has goofed up characters for attachments
QUESTION:
We have a database with stored mbox formatted emails, attachments in their native base64 format in the mailbox format. We can retrieve and access/parse all information...except for the attachments. In short, I ... | [
"php",
"mysql",
"base64",
"mime"
] | 0 | 1 | 514 | 1 | 0 | 2011-06-08T00:52:02.003000 | 2011-06-08T00:56:12.157000 |
6,273,175 | 6,273,266 | Problem using jQuery-AJAX to submit form to PHP and display new content in div without refreshing | I am trying to use jQuery-AJAX to submit the data in my form to my controller (index.php) where it is processed by PHP and inserted via PDO into the database if valid. Once the code is inserted into the database, the div where the form previously existed should be replaced by the contents of another page (newpage.php).... | Give this a try: $("#yourForm").submit(function(){
// Could use just this line and not vars below //dataString = $("#yourForm").serialize();
// vars are being set by selecting inputs by id but id not set in form fields var action= $('#action').val(); // value of id='action' var data = $('#data').val(); // value of id... | Problem using jQuery-AJAX to submit form to PHP and display new content in div without refreshing I am trying to use jQuery-AJAX to submit the data in my form to my controller (index.php) where it is processed by PHP and inserted via PDO into the database if valid. Once the code is inserted into the database, the div w... | TITLE:
Problem using jQuery-AJAX to submit form to PHP and display new content in div without refreshing
QUESTION:
I am trying to use jQuery-AJAX to submit the data in my form to my controller (index.php) where it is processed by PHP and inserted via PDO into the database if valid. Once the code is inserted into the d... | [
"php",
"forms",
"jquery",
"pdo"
] | 1 | 2 | 3,489 | 2 | 0 | 2011-06-08T00:55:24.233000 | 2011-06-08T01:15:50.793000 |
6,273,176 | 6,273,465 | What exactly is "broken" with Microsoft Visual C++'s two-phase template instantiation? | Reading questions, comments and answers on SO, I hear all the time that MSVC doesn't implement two-phase template lookup / instantiation correctly. From what I understand so far, MSVC++ is only doing a basic syntax check on template classes and functions and doesn't check that names used in the template have atleast be... | I'll just copy an example from my "notebook" int foo(void*);
template struct S { S() { int i = foo(0); } // A standard-compliant compiler is supposed to // resolve the 'foo(0)' call here (i.e. early) and // bind it to 'foo(void*)' };
void foo(int);
int main() { S s; // VS2005 will resolve the 'foo(0)' call here (i.e... | What exactly is "broken" with Microsoft Visual C++'s two-phase template instantiation? Reading questions, comments and answers on SO, I hear all the time that MSVC doesn't implement two-phase template lookup / instantiation correctly. From what I understand so far, MSVC++ is only doing a basic syntax check on template ... | TITLE:
What exactly is "broken" with Microsoft Visual C++'s two-phase template instantiation?
QUESTION:
Reading questions, comments and answers on SO, I hear all the time that MSVC doesn't implement two-phase template lookup / instantiation correctly. From what I understand so far, MSVC++ is only doing a basic syntax ... | [
"c++",
"templates",
"visual-c++",
"instantiation"
] | 39 | 44 | 6,096 | 5 | 0 | 2011-06-08T00:56:01.393000 | 2011-06-08T02:02:32.843000 |
6,273,185 | 6,273,268 | Getting cursor position on Mac OS X | I want to get the cursor position. Is there any standard function for this? I'm trying to make my program in C++. I'd like to avoid Cocoa. Not that I have anything against it, but I'd like to make my program cross-platform. | You can use the following Core Graphics API, in CGEvent.h: CGEventRef event = CGEventCreate(NULL); CGPoint cursor = CGEventGetLocation(event); CFRelease(event); (Note that you can still use Cocoa in a cross-platform program, you just need to separate platform-specific code into different files instead of using #define ... | Getting cursor position on Mac OS X I want to get the cursor position. Is there any standard function for this? I'm trying to make my program in C++. I'd like to avoid Cocoa. Not that I have anything against it, but I'd like to make my program cross-platform. | TITLE:
Getting cursor position on Mac OS X
QUESTION:
I want to get the cursor position. Is there any standard function for this? I'm trying to make my program in C++. I'd like to avoid Cocoa. Not that I have anything against it, but I'd like to make my program cross-platform.
ANSWER:
You can use the following Core Gr... | [
"c++",
"macos",
"position",
"cross-platform",
"mouse-cursor"
] | 8 | 15 | 5,940 | 1 | 0 | 2011-06-08T00:57:45.197000 | 2011-06-08T01:17:07.980000 |
6,273,196 | 6,273,344 | nodejs - util.inspect clarification on showHidden | In nodejs documentation for the util.inspect function, the documentation states that "If showHidden is true, then the object's non-enumerable properties will be shown too." Does non-enumerable properties refer to prototypes only? Or are there other non-enumerable properties I haven't considered? Link to documentation i... | Enumerable properties and prototype properties are unrelated. It just happens that most (all?) of the prototype properties on native objects are non-enumerable. To show that both prototype and instance properties can be both enumerable or non-enumerable: You can create non-enumerable properties on your own objects with... | nodejs - util.inspect clarification on showHidden In nodejs documentation for the util.inspect function, the documentation states that "If showHidden is true, then the object's non-enumerable properties will be shown too." Does non-enumerable properties refer to prototypes only? Or are there other non-enumerable proper... | TITLE:
nodejs - util.inspect clarification on showHidden
QUESTION:
In nodejs documentation for the util.inspect function, the documentation states that "If showHidden is true, then the object's non-enumerable properties will be shown too." Does non-enumerable properties refer to prototypes only? Or are there other non... | [
"javascript",
"node.js"
] | 2 | 2 | 1,620 | 1 | 0 | 2011-06-08T01:01:20.997000 | 2011-06-08T01:31:31.483000 |
6,273,197 | 6,273,236 | how to move messages from one Gmail account to another | I would like to create a backup of a Gmail account into another Gmail account. There could be many reasons why would someone like to do this, but in my case my Gmail account got full but instead of deleting messages would like to archive them in another account. I was thinking about using POP3 / all / fetch from anothe... | Gmail itself can do that, as in associating an account with another and automatically grabbing the emails from one account to the other. Go to ' Mail Settings ' --> ' Accounts and Import ' tab. You should see: Import mail and contacts: Import from Yahoo!, Hotmail, AOL or other webmail or POP3 accounts. which does that ... | how to move messages from one Gmail account to another I would like to create a backup of a Gmail account into another Gmail account. There could be many reasons why would someone like to do this, but in my case my Gmail account got full but instead of deleting messages would like to archive them in another account. I ... | TITLE:
how to move messages from one Gmail account to another
QUESTION:
I would like to create a backup of a Gmail account into another Gmail account. There could be many reasons why would someone like to do this, but in my case my Gmail account got full but instead of deleting messages would like to archive them in a... | [
"gmail",
"imap",
"thunderbird"
] | 2 | 0 | 13,706 | 1 | 0 | 2011-06-08T01:01:28.513000 | 2011-06-08T01:07:29.983000 |
6,273,200 | 6,283,540 | CreateProcess and installshield's uninstall strings | I'm calling pInvoke to call the Kernel's CreateProcess() and passing it the UninstallString of some app I'd like to uninstall. This UninstallString is the same thing Add/Remove Programs executes when you try to Uninstall an application. This call to CreateProcess() seems to work for all MSI UninstallStrings such as: Ms... | My problem was that I was passing in the uninstall string via c# command line args. But when the uninstall string contained quotes (like setup.exe "c\program files...") these quotes were removed by the compiler. So in order to work around my problem, I am replacing them before passing them in with triples. str.Replace(... | CreateProcess and installshield's uninstall strings I'm calling pInvoke to call the Kernel's CreateProcess() and passing it the UninstallString of some app I'd like to uninstall. This UninstallString is the same thing Add/Remove Programs executes when you try to Uninstall an application. This call to CreateProcess() se... | TITLE:
CreateProcess and installshield's uninstall strings
QUESTION:
I'm calling pInvoke to call the Kernel's CreateProcess() and passing it the UninstallString of some app I'd like to uninstall. This UninstallString is the same thing Add/Remove Programs executes when you try to Uninstall an application. This call to ... | [
"c#"
] | 1 | 0 | 1,006 | 2 | 0 | 2011-06-08T01:01:53.637000 | 2011-06-08T18:34:54.987000 |
6,273,204 | 6,273,627 | XSLT NOT WORKING... for Attribute | i have this XSLT and XML payload that i am wanting to transform. but the output xml does not contain the attribute for element engine. any help would be appreciated? this is my xslt?> this is my input xml this is my output where the attribute are lost..... | Seems that what you need is this simple and short transformation: when applied to the provided XML document: the wanted result is produced: Explanation: Just one template, matching engine -- with all necessary literal-result-elements as the simplest way to have them in the desired new namespaces and to get rid of the o... | XSLT NOT WORKING... for Attribute i have this XSLT and XML payload that i am wanting to transform. but the output xml does not contain the attribute for element engine. any help would be appreciated? this is my xslt?> this is my input xml this is my output where the attribute are lost..... | TITLE:
XSLT NOT WORKING... for Attribute
QUESTION:
i have this XSLT and XML payload that i am wanting to transform. but the output xml does not contain the attribute for element engine. any help would be appreciated? this is my xslt?> this is my input xml this is my output where the attribute are lost.....
ANSWER:
Se... | [
"xml",
"xslt"
] | 3 | 0 | 3,230 | 3 | 0 | 2011-06-08T01:02:26.037000 | 2011-06-08T02:36:40.147000 |
6,273,205 | 6,273,846 | Using RSpec2 to test a controller's show action | I have a fairly simple Rails 3 project where I've defined a custom route: get 'factions/:name' => 'factions#show',:as =>:factions get 'factions' => 'factions#index'... which when running rails s gives me the expected page ( http://localhost:3000/factions/xyz is HTTP 200 with the app/views/factions/show.html.haml being ... | Change: before { get '/xyz' } To: before { get:show,:name => 'xyz' } | Using RSpec2 to test a controller's show action I have a fairly simple Rails 3 project where I've defined a custom route: get 'factions/:name' => 'factions#show',:as =>:factions get 'factions' => 'factions#index'... which when running rails s gives me the expected page ( http://localhost:3000/factions/xyz is HTTP 200 w... | TITLE:
Using RSpec2 to test a controller's show action
QUESTION:
I have a fairly simple Rails 3 project where I've defined a custom route: get 'factions/:name' => 'factions#show',:as =>:factions get 'factions' => 'factions#index'... which when running rails s gives me the expected page ( http://localhost:3000/factions... | [
"ruby",
"ruby-on-rails-3",
"routes",
"rspec2"
] | 0 | 1 | 630 | 1 | 0 | 2011-06-08T01:02:41.673000 | 2011-06-08T03:19:26.400000 |
6,273,208 | 6,273,222 | MySQL single row with multiple records | I have a table with contains multiple rows that define "amenities" for a particular resort. I need to return the resortID if there are rows containing whatever "amenOptionID" I define. My issue comes in where I'm looking to see if a resort has two or more amenities. For example: I want to return resortIDs that have BOT... | SELECT `resortID` WHERE `amenOptionID` IN (1, 4) GROUP BY `resortID` HAVING COUNT(*) = 2 | MySQL single row with multiple records I have a table with contains multiple rows that define "amenities" for a particular resort. I need to return the resortID if there are rows containing whatever "amenOptionID" I define. My issue comes in where I'm looking to see if a resort has two or more amenities. For example: I... | TITLE:
MySQL single row with multiple records
QUESTION:
I have a table with contains multiple rows that define "amenities" for a particular resort. I need to return the resortID if there are rows containing whatever "amenOptionID" I define. My issue comes in where I'm looking to see if a resort has two or more ameniti... | [
"mysql",
"row",
"records",
"multiple-records"
] | 0 | 2 | 762 | 2 | 0 | 2011-06-08T01:03:30.460000 | 2011-06-08T01:05:47.440000 |
6,273,210 | 6,273,273 | How to create image from java applet visual output? | Is there anyway to create an image from the visual output of a java applet? Alternatively, an array of rgb values would suffice. It needs to be similar to Java Robot class' "createScreenCapture(Rectangle screenRect)" except it needs to work even when the applet is not visible. | simply save the buffer with ImageIO.write(...); You are using a buffer right? if you post the source ill write a saveOutput() method for you | How to create image from java applet visual output? Is there anyway to create an image from the visual output of a java applet? Alternatively, an array of rgb values would suffice. It needs to be similar to Java Robot class' "createScreenCapture(Rectangle screenRect)" except it needs to work even when the applet is not... | TITLE:
How to create image from java applet visual output?
QUESTION:
Is there anyway to create an image from the visual output of a java applet? Alternatively, an array of rgb values would suffice. It needs to be similar to Java Robot class' "createScreenCapture(Rectangle screenRect)" except it needs to work even when... | [
"java",
"image",
"applet",
"image-recognition"
] | 0 | 1 | 707 | 1 | 0 | 2011-06-08T01:03:51.987000 | 2011-06-08T01:18:12.493000 |
6,273,221 | 6,273,238 | Open a text file in the default text editor... via Java? | OK. Simple question. Maybe not so simple answer, though: I have a file I downloaded in Java, and I know that it's a text file. Is there any way that I can use Java to open that text file in whatever the default text editor is? It has to work for all OS's, otherwise I would just make it open with Notepad.:\ I guess that... | You can do that with: java.awt.Desktop.getDesktop().edit(file); This links to the tutorial article on java.awt.Desktop: Java™ Standard Edition version 6 narrows the gap between performance and integration of native applications and Java applications. Along with the new system tray functionality, splash screen support, ... | Open a text file in the default text editor... via Java? OK. Simple question. Maybe not so simple answer, though: I have a file I downloaded in Java, and I know that it's a text file. Is there any way that I can use Java to open that text file in whatever the default text editor is? It has to work for all OS's, otherwi... | TITLE:
Open a text file in the default text editor... via Java?
QUESTION:
OK. Simple question. Maybe not so simple answer, though: I have a file I downloaded in Java, and I know that it's a text file. Is there any way that I can use Java to open that text file in whatever the default text editor is? It has to work for... | [
"java",
"download",
"text-files"
] | 25 | 38 | 23,438 | 3 | 0 | 2011-06-08T01:05:40.420000 | 2011-06-08T01:07:48.033000 |
6,273,224 | 6,273,246 | Running background jobs in Rails 3 | How is the best way to run a background job to convert video formats in Rails 3. I am using FFmpeg. I would like for the script to execute immediately after the video model is saved. Thanks in advance. | delayed_job is one of the more popular methods. I would recommend it. Video: http://railscasts.com/episodes/171-delayed-job | Running background jobs in Rails 3 How is the best way to run a background job to convert video formats in Rails 3. I am using FFmpeg. I would like for the script to execute immediately after the video model is saved. Thanks in advance. | TITLE:
Running background jobs in Rails 3
QUESTION:
How is the best way to run a background job to convert video formats in Rails 3. I am using FFmpeg. I would like for the script to execute immediately after the video model is saved. Thanks in advance.
ANSWER:
delayed_job is one of the more popular methods. I would ... | [
"ruby-on-rails",
"ruby-on-rails-3"
] | 2 | 5 | 4,220 | 3 | 0 | 2011-06-08T01:06:13.187000 | 2011-06-08T01:09:36.500000 |
6,273,234 | 6,273,285 | How to get the character location of a XmlElement? | Let's say in my C# code I have retrieved a XmlElement (or XElement ) from a XmlDocument (or XDocument ). How do I get the character location of this XmlElement in the XML file? In other words, I want to be told "Your element starts on the 176th character in the text file containing the XML", not "Your 'book' element is... | I'm not sure if this is possible to determine the char number, but you can find line number and position inside of the line: var document = XDocument.Load(fileName, LoadOptions.SetLineInfo); var element = document.Descendants("nodeName").FirstOrDefault(); var xmlLineInfo = (IXmlLineInfo)element; Console.WriteLine("Line... | How to get the character location of a XmlElement? Let's say in my C# code I have retrieved a XmlElement (or XElement ) from a XmlDocument (or XDocument ). How do I get the character location of this XmlElement in the XML file? In other words, I want to be told "Your element starts on the 176th character in the text fi... | TITLE:
How to get the character location of a XmlElement?
QUESTION:
Let's say in my C# code I have retrieved a XmlElement (or XElement ) from a XmlDocument (or XDocument ). How do I get the character location of this XmlElement in the XML file? In other words, I want to be told "Your element starts on the 176th charac... | [
"c#",
"xml",
"location",
"character"
] | 5 | 6 | 2,296 | 1 | 0 | 2011-06-08T01:07:18.183000 | 2011-06-08T01:20:31.183000 |
6,273,244 | 6,273,264 | Unexpected character is displayed in the textbox | I have a very simple.NET program. It's just to write a string to the textbox. There is a strange character appearing at the end of my string. This happens only on my 32-bit XP box. The same program works fine on another 64bit Windows 2008 machine. The program is as simple as this. private void Form1_Load(object sender,... | Standard end-of-line sequence in Windows is \r\n. The text box isn't recognising the \n as a new-line without the preceding carriage return ( \r ). | Unexpected character is displayed in the textbox I have a very simple.NET program. It's just to write a string to the textbox. There is a strange character appearing at the end of my string. This happens only on my 32-bit XP box. The same program works fine on another 64bit Windows 2008 machine. The program is as simpl... | TITLE:
Unexpected character is displayed in the textbox
QUESTION:
I have a very simple.NET program. It's just to write a string to the textbox. There is a strange character appearing at the end of my string. This happens only on my 32-bit XP box. The same program works fine on another 64bit Windows 2008 machine. The p... | [
"c#",
".net",
"winforms"
] | 4 | 6 | 1,177 | 2 | 0 | 2011-06-08T01:09:19.870000 | 2011-06-08T01:15:10.597000 |
6,273,256 | 6,273,260 | Chrome Rending Extra Whitespace at the End of Web Page | I seem to be getting some extra white-space at the bottom of my page in chrome (IE, FF and safari all work) I can replicate the issue in Firefox by setting both the and elements to height: 100%; I can get rid of the issue by setting overflow: hidden; but this won't work because if the document grows past the height of ... | It's said to be a webkit bug that you can solve by html {background-color: #000;} with the color of your choice. | Chrome Rending Extra Whitespace at the End of Web Page I seem to be getting some extra white-space at the bottom of my page in chrome (IE, FF and safari all work) I can replicate the issue in Firefox by setting both the and elements to height: 100%; I can get rid of the issue by setting overflow: hidden; but this won't... | TITLE:
Chrome Rending Extra Whitespace at the End of Web Page
QUESTION:
I seem to be getting some extra white-space at the bottom of my page in chrome (IE, FF and safari all work) I can replicate the issue in Firefox by setting both the and elements to height: 100%; I can get rid of the issue by setting overflow: hidd... | [
"html",
"css",
"google-chrome"
] | 0 | 0 | 882 | 1 | 0 | 2011-06-08T01:11:45.833000 | 2011-06-08T01:14:13.473000 |
6,273,262 | 6,273,292 | Change Text In Div After E-Mail Has Been Sent? | I have created an HTML E-Mail Contact Form, which has a mail handler in PHP. And, what I basically want to do is replace the text in the input form instead of the browser redirecting to the PHP File, which has no design attributes. You can see what I have made here... http://www.noxinnovations.com/portfolio/thecommonwe... | One way to do this would be to submit your form using AJAX and then once your AJAX call has completed, replace the innerHtml of your div ("Click to Inquire") to say what you want. If you are into jQuery, Ajaxify is a plugin what would turn almost any form submitting a standard request to a AJAX request. | Change Text In Div After E-Mail Has Been Sent? I have created an HTML E-Mail Contact Form, which has a mail handler in PHP. And, what I basically want to do is replace the text in the input form instead of the browser redirecting to the PHP File, which has no design attributes. You can see what I have made here... http... | TITLE:
Change Text In Div After E-Mail Has Been Sent?
QUESTION:
I have created an HTML E-Mail Contact Form, which has a mail handler in PHP. And, what I basically want to do is replace the text in the input form instead of the browser redirecting to the PHP File, which has no design attributes. You can see what I have... | [
"php",
"javascript",
"html",
"css",
"contact-form"
] | 0 | 2 | 919 | 3 | 0 | 2011-06-08T01:14:49.450000 | 2011-06-08T01:21:48.950000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.