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,298,400 | 6,298,557 | Class.getResource and ClassLoader.getSystemResource: is there a reason to prefer one to another? | I saw both Class.getResource and ClassLoader.getSystemResource used to locate a resource in Java. Is there any reason to prefer one to another? | There are several ways to load resources, each with a slightly different meaning - ClassLoader::getSystemResource() uses the system classloader. This uses the classpath that was used to start the program. If you are in a web container such as tomcat, this will NOT pick up resources from your WAR file. Class #getResourc... | Class.getResource and ClassLoader.getSystemResource: is there a reason to prefer one to another? I saw both Class.getResource and ClassLoader.getSystemResource used to locate a resource in Java. Is there any reason to prefer one to another? | TITLE:
Class.getResource and ClassLoader.getSystemResource: is there a reason to prefer one to another?
QUESTION:
I saw both Class.getResource and ClassLoader.getSystemResource used to locate a resource in Java. Is there any reason to prefer one to another?
ANSWER:
There are several ways to load resources, each with ... | [
"java",
"resources"
] | 41 | 51 | 42,994 | 4 | 0 | 2011-06-09T19:49:09.550000 | 2011-06-09T20:02:44.980000 |
6,298,420 | 6,298,495 | Can i run html/Javascript files in IPAD | i have a folder having an html in a folder and javascript files, can i run that html page without internet, just from file system and without internet, in ipad? Is it possible? Also let me know, can i run some wamp like server on ipad to run html and php files? | Serversman HD Try it out, it does both of the stuff you asked for and it's free. EDIT: It seems that someone answered a second before me, sorry for the duplicate | Can i run html/Javascript files in IPAD i have a folder having an html in a folder and javascript files, can i run that html page without internet, just from file system and without internet, in ipad? Is it possible? Also let me know, can i run some wamp like server on ipad to run html and php files? | TITLE:
Can i run html/Javascript files in IPAD
QUESTION:
i have a folder having an html in a folder and javascript files, can i run that html page without internet, just from file system and without internet, in ipad? Is it possible? Also let me know, can i run some wamp like server on ipad to run html and php files?
... | [
"javascript",
"iphone",
"html",
"ipad"
] | 4 | 1 | 9,291 | 3 | 0 | 2011-06-09T19:51:20.717000 | 2011-06-09T19:56:51.933000 |
6,298,423 | 6,298,805 | How to search the App Store programmatically and return App information | I would like to search the Apple App Store from within my app, and return App information such as Icon, Description, Name, etc. I found some examples using URL's. But from what I understand, they cause your app to pause as it opens either the App Store or the browser. If I am mistaken, please may you provide me with an... | I don't think there is an API available to do what you are describing directly in the iOS device. However, you could hack something together using the search API available from apple. Check it out at here. You could do this behind the scenes rather then using the browser. It's not a simple task, but it is doable. Besk ... | How to search the App Store programmatically and return App information I would like to search the Apple App Store from within my app, and return App information such as Icon, Description, Name, etc. I found some examples using URL's. But from what I understand, they cause your app to pause as it opens either the App S... | TITLE:
How to search the App Store programmatically and return App information
QUESTION:
I would like to search the Apple App Store from within my app, and return App information such as Icon, Description, Name, etc. I found some examples using URL's. But from what I understand, they cause your app to pause as it open... | [
"ios",
"ios4",
"app-store"
] | 2 | 3 | 1,305 | 1 | 0 | 2011-06-09T19:51:29.447000 | 2011-06-09T20:24:48.197000 |
6,298,426 | 6,298,815 | Problems with Rake and Ruby on Rails | I have been trying to run rake but it seems that ever since I updated ruby gems rake is failing. This morning I ran: gem update --system And ever since, rake has been failing with the following error: $ rake db:migrate rake aborted! undefined method `specifications' for "/usr/lib/ruby/gems/1.9.1":String /home/cknadler/... | I would suggest using the bundled binary version of rake to avoid this issue. bundle exec rake db:migrate If you installed your bundle using binstubs ( bundle install --binstubs ) then you can also use the bin version of rake which is equivalent to the bundle exec rake command: bin/rake db:migrate P.S: I would also rec... | Problems with Rake and Ruby on Rails I have been trying to run rake but it seems that ever since I updated ruby gems rake is failing. This morning I ran: gem update --system And ever since, rake has been failing with the following error: $ rake db:migrate rake aborted! undefined method `specifications' for "/usr/lib/ru... | TITLE:
Problems with Rake and Ruby on Rails
QUESTION:
I have been trying to run rake but it seems that ever since I updated ruby gems rake is failing. This morning I ran: gem update --system And ever since, rake has been failing with the following error: $ rake db:migrate rake aborted! undefined method `specifications... | [
"ruby-on-rails",
"database",
"rubygems",
"rake",
"rakefile"
] | 1 | 4 | 4,139 | 2 | 0 | 2011-06-09T19:51:44.610000 | 2011-06-09T20:25:43.140000 |
6,298,438 | 6,298,602 | RelativeLayout, Include and layout_alignParentBottom doesn't work | How do I let my include exactly at the end of the screen? At the time he gets to the end of the content. | The problem is that your ScrollerView has a layout_height="fill_parent". RelativeLayout will make that view fill the entire space. A LinearLayout will work better in your case:... The key here is to have the height of the ScrollerView set to 0dp and the weight set to 1 (or any number really). LinearLayout will then str... | RelativeLayout, Include and layout_alignParentBottom doesn't work How do I let my include exactly at the end of the screen? At the time he gets to the end of the content. | TITLE:
RelativeLayout, Include and layout_alignParentBottom doesn't work
QUESTION:
How do I let my include exactly at the end of the screen? At the time he gets to the end of the content.
ANSWER:
The problem is that your ScrollerView has a layout_height="fill_parent". RelativeLayout will make that view fill the entir... | [
"android",
"xml",
"user-interface"
] | 2 | 4 | 2,308 | 1 | 0 | 2011-06-09T19:52:43.363000 | 2011-06-09T20:06:33.197000 |
6,298,443 | 6,298,499 | SQL Syntax for default constraint in MySQL | I want to add a default constraint to a existing table. So i use this SQL query. Is there any wrong with this? It generates a error message. Please can anyone give me the correct syntax or tell me what is the error. I have a book and according to its syntax this is correct. ALTER TABLE dbo.customer ADD CONSTRAINT df_co... | If you are trying to add a default value for a column, this would be the correct syntax: ALTER TABLE dbo.customer ALTER COLUMN contactname SET DEFAULT 'Unknown' | SQL Syntax for default constraint in MySQL I want to add a default constraint to a existing table. So i use this SQL query. Is there any wrong with this? It generates a error message. Please can anyone give me the correct syntax or tell me what is the error. I have a book and according to its syntax this is correct. AL... | TITLE:
SQL Syntax for default constraint in MySQL
QUESTION:
I want to add a default constraint to a existing table. So i use this SQL query. Is there any wrong with this? It generates a error message. Please can anyone give me the correct syntax or tell me what is the error. I have a book and according to its syntax t... | [
"mysql",
"sql"
] | 2 | 4 | 4,965 | 1 | 0 | 2011-06-09T19:53:06.077000 | 2011-06-09T19:57:12.660000 |
6,298,453 | 6,298,522 | Android Local Service Architecture | I'm trying to implement a service to handle the communication with the server for the following code. I don't know much about the design architecture for these. Here is my service class public class BgService extends Service { private static final String TAG = BgService.class.getSimpleName(); private Timer timer; SendJ... | You can use a broadcast receiver. This is a way to have your code start at certain times indicated by Android OS - for example, you can have it start when Android finished booting up (this is where I run my services usually. The best way is to use the AlarmManager class, and tell your service how often to run. Tell us ... | Android Local Service Architecture I'm trying to implement a service to handle the communication with the server for the following code. I don't know much about the design architecture for these. Here is my service class public class BgService extends Service { private static final String TAG = BgService.class.getSimpl... | TITLE:
Android Local Service Architecture
QUESTION:
I'm trying to implement a service to handle the communication with the server for the following code. I don't know much about the design architecture for these. Here is my service class public class BgService extends Service { private static final String TAG = BgServ... | [
"android",
"service"
] | 0 | 0 | 478 | 1 | 0 | 2011-06-09T19:54:09.780000 | 2011-06-09T19:59:39.653000 |
6,298,455 | 6,298,626 | Update instead of delete | I'm developing a webapp with Ruby 1.8.7 and Rails 2.3.5, which will manage some industrial process. One of the requirements is that, when someone wants to delete a registry, the delete task will have to make an update to one of the fields of the DB table. This field establishes if a record is active or not. I have modi... | You should use update_attributes in your case update_attributes(attributes) public Updates all the attributes from the passed-in Hash and saves the record. If the object is invalid, the saving will fail and false will be returned. example: @user.update_attributes(:status => 'active') or @alarma.update_attribute(:estado... | Update instead of delete I'm developing a webapp with Ruby 1.8.7 and Rails 2.3.5, which will manage some industrial process. One of the requirements is that, when someone wants to delete a registry, the delete task will have to make an update to one of the fields of the DB table. This field establishes if a record is a... | TITLE:
Update instead of delete
QUESTION:
I'm developing a webapp with Ruby 1.8.7 and Rails 2.3.5, which will manage some industrial process. One of the requirements is that, when someone wants to delete a registry, the delete task will have to make an update to one of the fields of the DB table. This field establishe... | [
"ruby-on-rails",
"ruby",
"postgresql"
] | 0 | 0 | 198 | 1 | 0 | 2011-06-09T19:54:13.103000 | 2011-06-09T20:08:30.810000 |
6,298,458 | 6,298,506 | C++ template partial specialization question | I'm having compile time trouble with the following code: template > class C> bool is_in(const C & a, const C & b);
template // HERE bool is_in(const std::vector & a, const std::vector & b) { return false; // implementation tbd }...
vector a, b;
cout << is_in(a,b) << endl; The error message is (on the line marked "HE... | The partial specialization of a function template is not allowed by the Standard. A simple solution is: use overload. template bool is_in(const std::vector & a, const std::vector & b) { return false; // implementation tbd } This is overloaded function template. Its NOT partial specialization. Or, you could do this: nam... | C++ template partial specialization question I'm having compile time trouble with the following code: template > class C> bool is_in(const C & a, const C & b);
template // HERE bool is_in(const std::vector & a, const std::vector & b) { return false; // implementation tbd }...
vector a, b;
cout << is_in(a,b) << endl;... | TITLE:
C++ template partial specialization question
QUESTION:
I'm having compile time trouble with the following code: template > class C> bool is_in(const C & a, const C & b);
template // HERE bool is_in(const std::vector & a, const std::vector & b) { return false; // implementation tbd }...
vector a, b;
cout << i... | [
"c++",
"templates",
"template-specialization"
] | 5 | 6 | 2,646 | 3 | 0 | 2011-06-09T19:54:21.897000 | 2011-06-09T19:58:23.740000 |
6,298,469 | 6,298,700 | LINQ to SQL where collection contains collection | I have a problem:( I have a many-many table between two tables(1&2), via a mapping table(3): (1)Trees / (2)Insects
TreeID <- (3)TreeInsects -> InsectID And then a one to many relationship: Trees.ID -> Leaves.TreeID And I would like to perform a query which will give me all the Leaves for a collection of insects (via t... | I'm bad with sql-like syntax so I'll write with extensions. ctx.Leaves.Where(l => ctx.TreeInsects.Where( ti => list_with_insects.Select(lwi => lwi.InsectID).Contains( ti.InsectID ) ).Any( ti => ti.TreeID == l.TreeID ) ); | LINQ to SQL where collection contains collection I have a problem:( I have a many-many table between two tables(1&2), via a mapping table(3): (1)Trees / (2)Insects
TreeID <- (3)TreeInsects -> InsectID And then a one to many relationship: Trees.ID -> Leaves.TreeID And I would like to perform a query which will give me ... | TITLE:
LINQ to SQL where collection contains collection
QUESTION:
I have a problem:( I have a many-many table between two tables(1&2), via a mapping table(3): (1)Trees / (2)Insects
TreeID <- (3)TreeInsects -> InsectID And then a one to many relationship: Trees.ID -> Leaves.TreeID And I would like to perform a query w... | [
"c#",
"sql-server-2008",
"linq-to-sql"
] | 6 | 1 | 4,559 | 5 | 0 | 2011-06-09T19:55:13.710000 | 2011-06-09T20:13:47.957000 |
6,298,474 | 6,298,836 | Select an image from JPanel | I am working on a small project which requires me to load images into a window and then move them around at will. Thus far I can load images onto a JPanel simply by using a graphics object to draw them to the JPanel. Now I'm faced with the challenge of figuring out how to differentiate between the various images I've l... | If you use a JLabel for each image, and make the JLabels subcomponents of the JPanel, it'll automatically draw the image, and you can add MouseListener s to each of them to be able to drag them around the screen. | Select an image from JPanel I am working on a small project which requires me to load images into a window and then move them around at will. Thus far I can load images onto a JPanel simply by using a graphics object to draw them to the JPanel. Now I'm faced with the challenge of figuring out how to differentiate betwe... | TITLE:
Select an image from JPanel
QUESTION:
I am working on a small project which requires me to load images into a window and then move them around at will. Thus far I can load images onto a JPanel simply by using a graphics object to draw them to the JPanel. Now I'm faced with the challenge of figuring out how to d... | [
"java"
] | 0 | 2 | 368 | 2 | 0 | 2011-06-09T19:55:28.720000 | 2011-06-09T20:27:21.603000 |
6,298,479 | 6,298,530 | Listen to port via a Java socket | A server software my client communicates with regularly sends transaction messages on port 4000. I need to print those messages to the console line by line. (Eventually I will have to write those values to a table, but I’m saving that for later.) I tried this code but it doesn’t output anything: package merchanttransac... | You need to use a ServerSocket. You can find an explanation here. | Listen to port via a Java socket A server software my client communicates with regularly sends transaction messages on port 4000. I need to print those messages to the console line by line. (Eventually I will have to write those values to a table, but I’m saving that for later.) I tried this code but it doesn’t output ... | TITLE:
Listen to port via a Java socket
QUESTION:
A server software my client communicates with regularly sends transaction messages on port 4000. I need to print those messages to the console line by line. (Eventually I will have to write those values to a table, but I’m saving that for later.) I tried this code but ... | [
"java",
"sockets"
] | 27 | 28 | 117,584 | 3 | 0 | 2011-06-09T19:55:47.433000 | 2011-06-09T20:00:32.957000 |
6,298,480 | 6,298,505 | BroadcastReceiver Life Cycle | My Application has registered one receiver in Manifest file. What will happen to the Broadcast Receiver if my application process dies. Will it still be available and call my BroadcastReceiver class when the specified intent triggers? | Yes, your BroadcastReceiver will continue to receive broadcasts even if your Activity is killed off. | BroadcastReceiver Life Cycle My Application has registered one receiver in Manifest file. What will happen to the Broadcast Receiver if my application process dies. Will it still be available and call my BroadcastReceiver class when the specified intent triggers? | TITLE:
BroadcastReceiver Life Cycle
QUESTION:
My Application has registered one receiver in Manifest file. What will happen to the Broadcast Receiver if my application process dies. Will it still be available and call my BroadcastReceiver class when the specified intent triggers?
ANSWER:
Yes, your BroadcastReceiver w... | [
"android",
"broadcastreceiver"
] | 0 | 2 | 776 | 1 | 0 | 2011-06-09T19:55:47.730000 | 2011-06-09T19:58:14 |
6,298,485 | 6,298,676 | working build ant - mac | For example:
where, basedir: /Users/xxx/Documents/wspace/myappEar how to use return parent directory to use like this: /Users/xxx/Documents/wspace/ To do this i've tried and does not work in my mac os. Any Idea what is the problem? Regardles Mugo | with vanilla ant you have to use = or alternatively use the Ant Plugin Flaka = working.dir => #{project.baseDir.parent} working.dir:= project.baseDir.parent $${working.dir} = ${working.dir} | working build ant - mac For example:
where, basedir: /Users/xxx/Documents/wspace/myappEar how to use return parent directory to use like this: /Users/xxx/Documents/wspace/ To do this i've tried and does not work in my mac os. Any Idea what is the problem? Regardles Mugo | TITLE:
working build ant - mac
QUESTION:
For example:
where, basedir: /Users/xxx/Documents/wspace/myappEar how to use return parent directory to use like this: /Users/xxx/Documents/wspace/ To do this i've tried and does not work in my mac os. Any Idea what is the problem? Regardles Mugo
ANSWER:
with vanilla ant you ... | [
"apache",
"macos",
"ant",
"operating-system",
"flaka"
] | 1 | 1 | 218 | 1 | 0 | 2011-06-09T19:56:17.917000 | 2011-06-09T20:11:49.203000 |
6,298,494 | 6,298,632 | getting grandchildren from xml in java | I need to print out the contents of an xml file into some txt file. Here is a sample of the type of xml i want to print out: SOMEGUY SOME DATE asdf/asdf/adsf/asdf.zip blahblahblah I can get all the information I need, except for the path tag... this is what I've done: FileWriter fstream = new FileWriter("c:\\work\\outp... | You can iterate over the paths children:... List pathsChilds = node.getChildren("paths"); if(pathsChilds.size() > 0){ Element paths = (Element) pathsChilds.get(0); List pathChilds = paths.getChildren("path"); for (int j=0; j< pathChilds.size(); j++) { Element path = (Element) pathChilds.get(j); out.write("Path: \n" + p... | getting grandchildren from xml in java I need to print out the contents of an xml file into some txt file. Here is a sample of the type of xml i want to print out: SOMEGUY SOME DATE asdf/asdf/adsf/asdf.zip blahblahblah I can get all the information I need, except for the path tag... this is what I've done: FileWriter f... | TITLE:
getting grandchildren from xml in java
QUESTION:
I need to print out the contents of an xml file into some txt file. Here is a sample of the type of xml i want to print out: SOMEGUY SOME DATE asdf/asdf/adsf/asdf.zip blahblahblah I can get all the information I need, except for the path tag... this is what I've ... | [
"java",
"xml",
"jdom"
] | 5 | 1 | 2,278 | 2 | 0 | 2011-06-09T19:56:44.457000 | 2011-06-09T20:09:10.950000 |
6,298,518 | 6,298,955 | Is there any solution to upgrade an app with new keystore | We want to update an existing Application but unfortunately we have a problem. Our keystore to sign up the app is not the same as the one we used in the previous version of the application. Therefore we can´t upgrade our existing app in the market. Is there any way to get the old key (certificate) from our previous ver... | http://www.google.com/support/androidmarket/bin/request.py?contact_type=contact_policy&policy=apps I would email the Android Market guys, they have provided fixes for people before, they have moved whole apps over to a new account for people, so they may be able to help you with your issue. If not the post above is the... | Is there any solution to upgrade an app with new keystore We want to update an existing Application but unfortunately we have a problem. Our keystore to sign up the app is not the same as the one we used in the previous version of the application. Therefore we can´t upgrade our existing app in the market. Is there any ... | TITLE:
Is there any solution to upgrade an app with new keystore
QUESTION:
We want to update an existing Application but unfortunately we have a problem. Our keystore to sign up the app is not the same as the one we used in the previous version of the application. Therefore we can´t upgrade our existing app in the mar... | [
"android",
"google-play"
] | 3 | 1 | 6,520 | 3 | 0 | 2011-06-09T19:59:32.410000 | 2011-06-09T20:39:53.923000 |
6,298,524 | 6,298,897 | Expression creation on instance method without instance | I have a generic class that has a method 'Call' on it with a generic return type and a lambda expression as a parameter. This has to be generated with reflection, and since the types are unknown, I need to create the lambda expression the long way. I have a working solution listed below, but I do not like having to get... | If you used lambda instead of expressions, your current code would look like this: var serviceInstance = …; // retrieve using reflection proxy.Call(i => serviceInstance.CallMethod(parameters)); Note that the lambda takes the parameter i, but doesn't use it. I assume you want to call the method directly on i, i.e. somet... | Expression creation on instance method without instance I have a generic class that has a method 'Call' on it with a generic return type and a lambda expression as a parameter. This has to be generated with reflection, and since the types are unknown, I need to create the lambda expression the long way. I have a workin... | TITLE:
Expression creation on instance method without instance
QUESTION:
I have a generic class that has a method 'Call' on it with a generic return type and a lambda expression as a parameter. This has to be generated with reflection, and since the types are unknown, I need to create the lambda expression the long wa... | [
".net",
"reflection",
"c#-4.0",
"lambda"
] | 0 | 3 | 1,987 | 2 | 0 | 2011-06-09T19:59:43.980000 | 2011-06-09T20:35:10.613000 |
6,298,532 | 6,298,651 | for each link change color based on array | I have an array containing the hrefs of colours and I want to go though each link in my nav and apply a different colour based on the order of the array. I think this is possible but i'm missing something. Here is my code var colourValue = [ "fff", "000", "FF6600", "FF00FF", "FFFF00" ]; //this is how console displays t... | Try this: var yourArray = ["#fff", "#000", "#FF6600", "#FF00FF", "#FFFF00"]; $('.nav a').each(function(i) { $(this).css("color", yourArray[i]); }); You can really cut down the code this way, you don't need the $.each. Also, doing a selector the way you were is not only going to return the wrong results, but will also g... | for each link change color based on array I have an array containing the hrefs of colours and I want to go though each link in my nav and apply a different colour based on the order of the array. I think this is possible but i'm missing something. Here is my code var colourValue = [ "fff", "000", "FF6600", "FF00FF", "F... | TITLE:
for each link change color based on array
QUESTION:
I have an array containing the hrefs of colours and I want to go though each link in my nav and apply a different colour based on the order of the array. I think this is possible but i'm missing something. Here is my code var colourValue = [ "fff", "000", "FF6... | [
"javascript",
"jquery",
"each"
] | 0 | 1 | 899 | 4 | 0 | 2011-06-09T20:00:41.963000 | 2011-06-09T20:10:20.263000 |
6,298,556 | 6,298,664 | Ensure WPF Taskbar Window Preview is actualized | How can I ensure that the hower preview of my WPF application (.net 4) is refreshed when the user places the mouse over the taskbar icon. I have an app that visualizes some status values. If the app window is minimized and the user hovers over the taskbar button, the preview window that is shown shows the last view of ... | I believe you'd need to customize the preview, as described here (under the Customizing Preview section). Which leverages the Windows API Code Pack for Microsoft®.NET Framework. An example can be found here, but looks like: TabbedThumbnail preview = new TabbedThumbnail(parentForm.Handle, childForm.Handle); TaskbarManag... | Ensure WPF Taskbar Window Preview is actualized How can I ensure that the hower preview of my WPF application (.net 4) is refreshed when the user places the mouse over the taskbar icon. I have an app that visualizes some status values. If the app window is minimized and the user hovers over the taskbar button, the prev... | TITLE:
Ensure WPF Taskbar Window Preview is actualized
QUESTION:
How can I ensure that the hower preview of my WPF application (.net 4) is refreshed when the user places the mouse over the taskbar icon. I have an app that visualizes some status values. If the app window is minimized and the user hovers over the taskba... | [
"wpf",
"windows-7",
"taskbar"
] | 6 | 6 | 2,173 | 2 | 0 | 2011-06-09T20:02:43.683000 | 2011-06-09T20:11:07.363000 |
6,298,567 | 6,298,690 | MySQL error: `query': Duplicate entry '' for key 3 (Mysql2::Error) on a Ruby file | This is the code I am using # update db client = Mysql2::Client.new(:host => "localhost",:username => "jo151",:password => "password",:database => "jo151")
details.each do |d| if d[:sku]!= "" price = d[:price].split
if price[1] == "D" currency = 144 else currency = 168 end
cost = price[0].gsub(",", "").to_f
if d[:q... | Putting in raw SQL statements with arbitrary strings inlined like this is extremely dangerous. You absolutely must escape any values put into them for your application to work at all. The first description you get with an apostrophe will cause your SQL to fail. In this case you would use client.quote on each and every ... | MySQL error: `query': Duplicate entry '' for key 3 (Mysql2::Error) on a Ruby file This is the code I am using # update db client = Mysql2::Client.new(:host => "localhost",:username => "jo151",:password => "password",:database => "jo151")
details.each do |d| if d[:sku]!= "" price = d[:price].split
if price[1] == "D" c... | TITLE:
MySQL error: `query': Duplicate entry '' for key 3 (Mysql2::Error) on a Ruby file
QUESTION:
This is the code I am using # update db client = Mysql2::Client.new(:host => "localhost",:username => "jo151",:password => "password",:database => "jo151")
details.each do |d| if d[:sku]!= "" price = d[:price].split
if... | [
"mysql",
"ruby",
"insert",
"key"
] | 0 | 1 | 1,076 | 1 | 0 | 2011-06-09T20:03:09.900000 | 2011-06-09T20:12:47.477000 |
6,298,572 | 6,298,604 | Eclipse + Subclipse: SVN can't open local repository | I have created initial import of my eclipse project to local file like this: $svn import /home/miso/workspace/DatabaseManager/ file:///home/miso/svn/dbman -m 'Initial import' Now I'd like to add this SVN repository to my Eclipse project (inside Eclipse itself). When I try to add new repository via SVN Reposistory Persp... | This error happens when you use a version of Subclipse that is not compatible with the version of Subversion that created the repository. This link should shed more light on it, basically just make sure your version of Subclipse can interface with whatever version of SVN you created the repository with. EDIT I just did... | Eclipse + Subclipse: SVN can't open local repository I have created initial import of my eclipse project to local file like this: $svn import /home/miso/workspace/DatabaseManager/ file:///home/miso/svn/dbman -m 'Initial import' Now I'd like to add this SVN repository to my Eclipse project (inside Eclipse itself). When ... | TITLE:
Eclipse + Subclipse: SVN can't open local repository
QUESTION:
I have created initial import of my eclipse project to local file like this: $svn import /home/miso/workspace/DatabaseManager/ file:///home/miso/svn/dbman -m 'Initial import' Now I'd like to add this SVN repository to my Eclipse project (inside Ecli... | [
"eclipse",
"svn",
"subclipse"
] | 4 | 4 | 4,397 | 1 | 0 | 2011-06-09T20:03:24.080000 | 2011-06-09T20:06:37.307000 |
6,298,582 | 6,298,675 | C# Generics: What is generic constraining interface? | On MSDN - C# Programming guide Constraints on Type Parameters, it says: where T: interface_name The type argument must be or implement the specified interface. Multiple interface constraints can be specified. The constraining interface can also be generic. Could somebody kindly explain, what it means to have a generic ... | An example of a generic interface is IEnumerable. It represents some collection you can enumerate. The type of the items in the collection is not relevant to the interface, so it allows you to specify that with a generic parameter. You can for example create a class like this: class Foo where T: IEnumerable { } This wa... | C# Generics: What is generic constraining interface? On MSDN - C# Programming guide Constraints on Type Parameters, it says: where T: interface_name The type argument must be or implement the specified interface. Multiple interface constraints can be specified. The constraining interface can also be generic. Could some... | TITLE:
C# Generics: What is generic constraining interface?
QUESTION:
On MSDN - C# Programming guide Constraints on Type Parameters, it says: where T: interface_name The type argument must be or implement the specified interface. Multiple interface constraints can be specified. The constraining interface can also be g... | [
"c#",
"generics"
] | 4 | 2 | 1,365 | 4 | 0 | 2011-06-09T20:03:56.840000 | 2011-06-09T20:11:33.010000 |
6,298,584 | 6,309,133 | Installing Qt Quick Components for Desktop for use with Qt Creator | I'm trying to use Qt Quick Components for Desktop from http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ I can build and install it just fine into it's own folder, and view the qmls with qmlviewer, but how do I use these qml components from my other projects in Qt Creator? For example, I'd like to be able... | I used the instructions from the answer for this question: Qt How to make and install plugins? and was able to successfully use the qt quick desktop components within qt creator qml files. Here are more detailed instructions that I made: Download the tar.gz from http://qt.gitorious.org/qt-components/desktop/trees/maste... | Installing Qt Quick Components for Desktop for use with Qt Creator I'm trying to use Qt Quick Components for Desktop from http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ I can build and install it just fine into it's own folder, and view the qmls with qmlviewer, but how do I use these qml components fro... | TITLE:
Installing Qt Quick Components for Desktop for use with Qt Creator
QUESTION:
I'm trying to use Qt Quick Components for Desktop from http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ I can build and install it just fine into it's own folder, and view the qmls with qmlviewer, but how do I use these ... | [
"qt",
"qt-creator",
"qml"
] | 7 | 8 | 16,764 | 3 | 0 | 2011-06-09T20:04:10.760000 | 2011-06-10T16:11:26.747000 |
6,298,593 | 6,298,624 | Null Pointer exception in JavaScript | var Obj = {
StateValues: ['AL','AK','AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA', 'KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND', 'OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY'],
getItemRow: function(itemVal... | var Obj = new function(){
var StateValues = ['AL','AK','AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA', 'KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND', 'OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY'];
this.getI... | Null Pointer exception in JavaScript var Obj = {
StateValues: ['AL','AK','AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA', 'KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND', 'OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI'... | TITLE:
Null Pointer exception in JavaScript
QUESTION:
var Obj = {
StateValues: ['AL','AK','AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA', 'KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND', 'OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','... | [
"javascript"
] | 0 | 2 | 10,315 | 2 | 0 | 2011-06-09T20:05:22.530000 | 2011-06-09T20:08:26.543000 |
6,298,599 | 6,298,652 | JQuery $.each() JSON array object iteration | I am having some real difficulty attempting to solve a JQuery $.each() iteration This is my array, limiting results for convenience [{"GROUP_ID":"143", "GROUP_TYPE":"2011 Season", "EVENTS":[ {"EVENT_ID":"374","SHORT_DESC":"Wake Forest"}, {"EVENT_ID":"376","SHORT_DESC":"Yale"}, {"EVENT_ID":"377","SHORT_DESC":"Michigan S... | Assign the second variable for the $.each function() as well, makes it lot easier as it'll provide you the data (so you won't have to work with the indicies). $.each(json, function(arrayID,group) { console.log(' '); $.each(group.EVENTS, function(eventID,eventData) { console.log(' '+eventData.SHORT_DESC+' '); }); }); Sh... | JQuery $.each() JSON array object iteration I am having some real difficulty attempting to solve a JQuery $.each() iteration This is my array, limiting results for convenience [{"GROUP_ID":"143", "GROUP_TYPE":"2011 Season", "EVENTS":[ {"EVENT_ID":"374","SHORT_DESC":"Wake Forest"}, {"EVENT_ID":"376","SHORT_DESC":"Yale"}... | TITLE:
JQuery $.each() JSON array object iteration
QUESTION:
I am having some real difficulty attempting to solve a JQuery $.each() iteration This is my array, limiting results for convenience [{"GROUP_ID":"143", "GROUP_TYPE":"2011 Season", "EVENTS":[ {"EVENT_ID":"374","SHORT_DESC":"Wake Forest"}, {"EVENT_ID":"376","S... | [
"jquery",
"json",
"each"
] | 19 | 40 | 104,350 | 1 | 0 | 2011-06-09T20:06:14.820000 | 2011-06-09T20:10:22.853000 |
6,298,610 | 6,298,645 | Can I use Visual Studio with Unity? | I've been checking out Unity and it looks quite interesting. In particular after reading you can use C# as the scripting language, I am left wondering if there is some sort of Visual Studio integration to leverage IntelliSense and all that jazz built into VS. | Unity has a wiki page explaining how to do this. It seems that the latest version of Unity should already allow you to create a Visual Studio project (if you're running Windows). However, it seems only VS 2008 is supported natively. You can follow this workaround to get it to work with VS2010 (except VS2010 Express Edi... | Can I use Visual Studio with Unity? I've been checking out Unity and it looks quite interesting. In particular after reading you can use C# as the scripting language, I am left wondering if there is some sort of Visual Studio integration to leverage IntelliSense and all that jazz built into VS. | TITLE:
Can I use Visual Studio with Unity?
QUESTION:
I've been checking out Unity and it looks quite interesting. In particular after reading you can use C# as the scripting language, I am left wondering if there is some sort of Visual Studio integration to leverage IntelliSense and all that jazz built into VS.
ANSWE... | [
"c#",
"visual-studio",
"unity-game-engine"
] | 7 | 5 | 12,888 | 5 | 0 | 2011-06-09T20:07:18.127000 | 2011-06-09T20:09:47.987000 |
6,298,612 | 6,298,699 | Automatically try AJAX request again on Fail | I have seen that you can specify what to do generally if an ajax request fails, is it possible to have it try again in some sort of a loop so that it tries at least x amount of times before it stops? I have used this code before: $.ajaxSetup({ "error":function() { alert("error"); }}); Which will apply to all AJAX reque... | You can try something like this: var attempts; function doAjaxRequest() { attempts = 0; doAjaxRequestLoop(); }
function doAjaxRequestLoop() { attempts += 1; if (attempts > 10) { alert('too many attempts.'); return; }
$.ajax({ // do your request error: function (error) { doAjaxRequestLoop(); } }); } Although I might r... | Automatically try AJAX request again on Fail I have seen that you can specify what to do generally if an ajax request fails, is it possible to have it try again in some sort of a loop so that it tries at least x amount of times before it stops? I have used this code before: $.ajaxSetup({ "error":function() { alert("err... | TITLE:
Automatically try AJAX request again on Fail
QUESTION:
I have seen that you can specify what to do generally if an ajax request fails, is it possible to have it try again in some sort of a loop so that it tries at least x amount of times before it stops? I have used this code before: $.ajaxSetup({ "error":funct... | [
"jquery",
"ajax"
] | 10 | 13 | 7,009 | 1 | 0 | 2011-06-09T20:07:27.927000 | 2011-06-09T20:13:38.353000 |
6,298,623 | 6,298,678 | Spawn a background process in a bash function | I am working on writing a Bash function to start a server that needs to be started from a certain folder, but I don't want starting this server to impact my current work. I've written the following: function startsrv { pushd. cd ${TRUNK} ${SERVERCOMMAND} & popd } My variables are all set, but when this executes, I get ... | What is the value of $SERVERCOMMAND? You must have a semi-colon in it. For what it's worth you can simplify the pushd/cd to one pushd: pushd $TRUNK $SERVERCOMMAND & popd Or create a subshell so the cd only affects the one command: (cd $TRUNK; $SERVERCOMMAND &) | Spawn a background process in a bash function I am working on writing a Bash function to start a server that needs to be started from a certain folder, but I don't want starting this server to impact my current work. I've written the following: function startsrv { pushd. cd ${TRUNK} ${SERVERCOMMAND} & popd } My variabl... | TITLE:
Spawn a background process in a bash function
QUESTION:
I am working on writing a Bash function to start a server that needs to be started from a certain folder, but I don't want starting this server to impact my current work. I've written the following: function startsrv { pushd. cd ${TRUNK} ${SERVERCOMMAND} &... | [
"bash",
"shell",
"unix",
"bash-function"
] | 3 | 11 | 13,969 | 3 | 0 | 2011-06-09T20:08:11.380000 | 2011-06-09T20:11:53.673000 |
6,298,644 | 6,298,695 | In SQL, how do I match specific columns on specific rows? | This might be hard to describe in the title, here's a sample data: id pub_type general_suppl book_suppl catalogue_suppl magazine_suppl 1 book 10 10 0 0 2 book 11 11 0 0 3 catalogue 10 0 10 0 4 magazine 9 0 0 9 5 other 10 0 0 0 6 magazine 8 0 0 10 Each of the item is of a specific publication type with a general supplie... | It's ugly, but you can throw that logic into a CASE structure. SELECT * FROM table WHERE 10 = CASE WHEN pub_type = 'book' THEN book_suppl WHEN pub_type = 'catalogue' THEN catalogue_suppl WHEN pub_type = 'magazine' THEN magazine_suppl ELSE general_suppl END | In SQL, how do I match specific columns on specific rows? This might be hard to describe in the title, here's a sample data: id pub_type general_suppl book_suppl catalogue_suppl magazine_suppl 1 book 10 10 0 0 2 book 11 11 0 0 3 catalogue 10 0 10 0 4 magazine 9 0 0 9 5 other 10 0 0 0 6 magazine 8 0 0 10 Each of the ite... | TITLE:
In SQL, how do I match specific columns on specific rows?
QUESTION:
This might be hard to describe in the title, here's a sample data: id pub_type general_suppl book_suppl catalogue_suppl magazine_suppl 1 book 10 10 0 0 2 book 11 11 0 0 3 catalogue 10 0 10 0 4 magazine 9 0 0 9 5 other 10 0 0 0 6 magazine 8 0 0 ... | [
"sql"
] | 0 | 5 | 81 | 2 | 0 | 2011-06-09T20:09:47.247000 | 2011-06-09T20:13:09.967000 |
6,298,653 | 6,298,863 | Version 1 UUID Node.js binding? | I was trying to export https://github.com/LiosK/UUID.js into a module, but I'm having a rough time - version 4 is worthless to me (use case Cassandra) - does anybody know of a binding for these types of uuids? I can't seem to find one on Google...maybe someone has implemented what's out there? Thanks! | I think you can just use /dist/uuid.core.js with a slight modification as follows: add the following line and save: exports.UUID = UUID; now in another file use: var UUID = require("path/to/the/uuid.core.js"); console.log(UUID.generate()); hope that helps J | Version 1 UUID Node.js binding? I was trying to export https://github.com/LiosK/UUID.js into a module, but I'm having a rough time - version 4 is worthless to me (use case Cassandra) - does anybody know of a binding for these types of uuids? I can't seem to find one on Google...maybe someone has implemented what's out ... | TITLE:
Version 1 UUID Node.js binding?
QUESTION:
I was trying to export https://github.com/LiosK/UUID.js into a module, but I'm having a rough time - version 4 is worthless to me (use case Cassandra) - does anybody know of a binding for these types of uuids? I can't seem to find one on Google...maybe someone has imple... | [
"javascript",
"node.js",
"uuid"
] | 0 | 0 | 612 | 2 | 0 | 2011-06-09T20:10:28.750000 | 2011-06-09T20:29:55.573000 |
6,298,660 | 6,298,849 | jQuery hash attribute | At 4 minutes into the "Scroll Linked Navigation" podcast Posted: Wed, 18 Aug 2010 at jQuery for Designers, Remy uses the hash attribute. Q: Where is the hash attribute documented? | $('a[hash=#foo]') isn't explicitly documented, but it makes sense given the following: A) The Link object has a hash property. B) jQuery's " attribute equals selector " works on properties (not just attributes). | jQuery hash attribute At 4 minutes into the "Scroll Linked Navigation" podcast Posted: Wed, 18 Aug 2010 at jQuery for Designers, Remy uses the hash attribute. Q: Where is the hash attribute documented? | TITLE:
jQuery hash attribute
QUESTION:
At 4 minutes into the "Scroll Linked Navigation" podcast Posted: Wed, 18 Aug 2010 at jQuery for Designers, Remy uses the hash attribute. Q: Where is the hash attribute documented?
ANSWER:
$('a[hash=#foo]') isn't explicitly documented, but it makes sense given the following: A) T... | [
"javascript",
"jquery"
] | 2 | 1 | 1,384 | 2 | 0 | 2011-06-09T20:10:56.107000 | 2011-06-09T20:28:35.387000 |
6,298,679 | 6,298,783 | What's better for creating distinct data structures: HashSet or Linq's Distinct()? | I'm wondering whether I can get a consensus on which method is the better approach to creating a distinct set of elements: a C# HashSet or using IEnumerable's.Distinct(), which is a Linq function? Let's say I'm looping through query results from the DB with DataReader, and my options are to add the objects I construct ... | "Better" is a tricky word to use - it can mean so many different things to different people. For readability, I would go for Distinct() as I personally find this more comprehensible. For performance, I suspect a hand-crafted HashSet implementation might perform mildly quicker - but I doubt it would be very different as... | What's better for creating distinct data structures: HashSet or Linq's Distinct()? I'm wondering whether I can get a consensus on which method is the better approach to creating a distinct set of elements: a C# HashSet or using IEnumerable's.Distinct(), which is a Linq function? Let's say I'm looping through query resu... | TITLE:
What's better for creating distinct data structures: HashSet or Linq's Distinct()?
QUESTION:
I'm wondering whether I can get a consensus on which method is the better approach to creating a distinct set of elements: a C# HashSet or using IEnumerable's.Distinct(), which is a Linq function? Let's say I'm looping ... | [
"linq",
"performance",
"distinct",
"hashset"
] | 48 | 13 | 20,922 | 6 | 0 | 2011-06-09T20:11:57.010000 | 2011-06-09T20:22:24.973000 |
6,298,693 | 6,298,716 | Firefox 3.5 not showing webfonts | I have some @font-face webfonts on my site. The fonts and the CSS code is generated via the Font Squirrel @font-face generator. None of the fonts I embedded are showing in FF 3.5. FF 4 is working without a problem. The fonts are served from the same domain as the calling website. ATM I'm calling the website on a local ... | From: CSS @font-face not working with Firefox, but working with Chrome and IE You could try to add an additional header to see if your problem configures itself as a cross domain issue: it shouldn't, since you are specifying relative paths, but i would give it a try anyway: in your.htaccess file, specify you want to se... | Firefox 3.5 not showing webfonts I have some @font-face webfonts on my site. The fonts and the CSS code is generated via the Font Squirrel @font-face generator. None of the fonts I embedded are showing in FF 3.5. FF 4 is working without a problem. The fonts are served from the same domain as the calling website. ATM I'... | TITLE:
Firefox 3.5 not showing webfonts
QUESTION:
I have some @font-face webfonts on my site. The fonts and the CSS code is generated via the Font Squirrel @font-face generator. None of the fonts I embedded are showing in FF 3.5. FF 4 is working without a problem. The fonts are served from the same domain as the calli... | [
"firefox",
"css",
"font-face",
"webfonts"
] | 1 | 2 | 737 | 1 | 0 | 2011-06-09T20:12:52.190000 | 2011-06-09T20:15:02.753000 |
6,298,697 | 6,298,765 | text in top (status) bar | Some apps (notably Lookout Mobile Security) show a text describing action done for a short time (maybe 1 sec only) on the top (status) bar and then the display goes back to the regular status bar (with a nice animation effect at least on HTC phones). How is this done? I am not talking about notifications! | This is actually part of the Notification. It is called the tickerText. See: http://developer.android.com/reference/android/app/Notification.html#tickerText And, if developing on HoneyComb: http://developer.android.com/reference/android/app/Notification.html#tickerView You can also pass the tickerText into the construc... | text in top (status) bar Some apps (notably Lookout Mobile Security) show a text describing action done for a short time (maybe 1 sec only) on the top (status) bar and then the display goes back to the regular status bar (with a nice animation effect at least on HTC phones). How is this done? I am not talking about not... | TITLE:
text in top (status) bar
QUESTION:
Some apps (notably Lookout Mobile Security) show a text describing action done for a short time (maybe 1 sec only) on the top (status) bar and then the display goes back to the regular status bar (with a nice animation effect at least on HTC phones). How is this done? I am not... | [
"android",
"statusbar"
] | 2 | 5 | 2,238 | 2 | 0 | 2011-06-09T20:13:21.800000 | 2011-06-09T20:19:50.607000 |
6,298,718 | 6,303,081 | windows forms MSN Messenger Login | Ive got a basic questions about windows forms, im designing a app in visual c# express, It needs a login, heres where im stuck, Take msn messenger loads up and you get the use/pass prompt, put the details in and then you get your contacts, How would you replicate something like that in the simpilist form is this 2 sepe... | This is what I'd suggest: Have a central form in your application, you could call it "frmMain" for-the-purpose-of-discussion, and ensure that this form is the first thing that loads up on application start-up - Program { Main() { Application.Run(frmMain()); } } Next, define a central app-level properties management cla... | windows forms MSN Messenger Login Ive got a basic questions about windows forms, im designing a app in visual c# express, It needs a login, heres where im stuck, Take msn messenger loads up and you get the use/pass prompt, put the details in and then you get your contacts, How would you replicate something like that in... | TITLE:
windows forms MSN Messenger Login
QUESTION:
Ive got a basic questions about windows forms, im designing a app in visual c# express, It needs a login, heres where im stuck, Take msn messenger loads up and you get the use/pass prompt, put the details in and then you get your contacts, How would you replicate some... | [
"c#",
"windows",
"winforms",
"visual-studio-2010",
"msn-messenger"
] | 2 | 0 | 740 | 2 | 0 | 2011-06-09T20:15:13.843000 | 2011-06-10T07:06:34.980000 |
6,298,727 | 6,298,810 | Can I change confirm box in Form Observer plugin in Jquery | Form Observer plugin gives the confirm box with our custom message. I haven't understood where they kept the code to show it up. Because I want to change this confirm box to jQuery dialogue. Can I do that. it would be great some can throw some light on this. | If I understood you correctly, you want to replace the standard window.confirm with jquery dialog box? If so, you could do something like this: window.confirm = function(a){ $(' ').appendTo('body').text(a).dialog({close:function(){$(this).remove();}}) } example: http://jsfiddle.net/niklasvh/SDPYb/ | Can I change confirm box in Form Observer plugin in Jquery Form Observer plugin gives the confirm box with our custom message. I haven't understood where they kept the code to show it up. Because I want to change this confirm box to jQuery dialogue. Can I do that. it would be great some can throw some light on this. | TITLE:
Can I change confirm box in Form Observer plugin in Jquery
QUESTION:
Form Observer plugin gives the confirm box with our custom message. I haven't understood where they kept the code to show it up. Because I want to change this confirm box to jQuery dialogue. Can I do that. it would be great some can throw some... | [
"jquery",
"jquery-plugins",
"jquery-dialog"
] | 0 | 0 | 402 | 1 | 0 | 2011-06-09T20:16:21.107000 | 2011-06-09T20:25:14.517000 |
6,298,730 | 6,298,798 | MultiTouch on Emulator | It's possible to test the multi-touch feature into the AVD? I read this thread Android Multitouch - Possible to test in emulator? But it's for 2.0 and maybe this can be added since Jan/2010 | Multi-touch is not supported in the emulator. There is an open issue in the Android issue tracker for multi touch support in the emulator. It's not accepted by Google but you can star it. | MultiTouch on Emulator It's possible to test the multi-touch feature into the AVD? I read this thread Android Multitouch - Possible to test in emulator? But it's for 2.0 and maybe this can be added since Jan/2010 | TITLE:
MultiTouch on Emulator
QUESTION:
It's possible to test the multi-touch feature into the AVD? I read this thread Android Multitouch - Possible to test in emulator? But it's for 2.0 and maybe this can be added since Jan/2010
ANSWER:
Multi-touch is not supported in the emulator. There is an open issue in the Andr... | [
"android",
"android-emulator",
"multi-touch",
"android-virtual-device"
] | 2 | 3 | 2,617 | 1 | 0 | 2011-06-09T20:16:30.350000 | 2011-06-09T20:23:56.783000 |
6,298,731 | 6,298,788 | Sending an e-mail or SMS using CQRS and domain-driven-design | At this moment we are building a new architecture that is based on the principles of CQRS and domain-driven-design. We are now having some discussions about how we should deal with external communication. To make the question more concrete I use the example of sending a SMS notification when a customer creates a order.... | I would think a domain object for the SMS message is not necessary. You just need to report the SMS's sent to the customer, correct? The SMS messages are not used in any domain logic, correct? So I would have the handler send an SMS and then publish another event that says an SMS was sent and have an event handler list... | Sending an e-mail or SMS using CQRS and domain-driven-design At this moment we are building a new architecture that is based on the principles of CQRS and domain-driven-design. We are now having some discussions about how we should deal with external communication. To make the question more concrete I use the example o... | TITLE:
Sending an e-mail or SMS using CQRS and domain-driven-design
QUESTION:
At this moment we are building a new architecture that is based on the principles of CQRS and domain-driven-design. We are now having some discussions about how we should deal with external communication. To make the question more concrete I... | [
"email",
"design-patterns",
"domain-driven-design",
"cqrs"
] | 22 | 2 | 4,431 | 2 | 0 | 2011-06-09T20:16:37.453000 | 2011-06-09T20:22:43.303000 |
6,298,742 | 6,298,887 | f:param tag attribute 'disable' is not work | I try to use tag to build output link URL with parameters depending on some my conditions. When I place this tag inside h:output link and try to set different values for 'disable' I see no effect. Here the my code Link1 I expect to see only one param in url but I see both. | Using disable="true" instead of disable="#{true}" works for me. So, it's either a bug in the tag documentation that it supports ValueExpression or a bug in the UIParameter class that it does not resolve it as a ValueExpression. I have at least reported issue 2102 for this. Update: As a temporary hack/workaround, you co... | f:param tag attribute 'disable' is not work I try to use tag to build output link URL with parameters depending on some my conditions. When I place this tag inside h:output link and try to set different values for 'disable' I see no effect. Here the my code Link1 I expect to see only one param in url but I see both. | TITLE:
f:param tag attribute 'disable' is not work
QUESTION:
I try to use tag to build output link URL with parameters depending on some my conditions. When I place this tag inside h:output link and try to set different values for 'disable' I see no effect. Here the my code Link1 I expect to see only one param in url ... | [
"jsf",
"jsf-2",
"facelets"
] | 6 | 12 | 2,892 | 2 | 0 | 2011-06-09T20:18:04.620000 | 2011-06-09T20:33:46.013000 |
6,298,763 | 6,298,809 | How do I write an extension function to return the average of a custom type? | This is probably very simple, but my attempts (guided by Intellisense and MSDN) have all been off the mark. If I have a class which contains 3 double, how can I get the average of a list of these? class DataPoint { public int time; public int X; public int Y; public int Z; // Constructor omitted }
class Main { List po... | static class DataPointExtensions { public static DataPoint Average (this IEnumerable points) { int sumX=0, sumY=0, sumZ=0, count=0; foreach (var pt in points) { sumX += pt.X; sumY += pt.Y; sumZ += pt.Z; count++; } // also calc average time? if (count == 0) return new DataPoint (); return new DataPoint {X=sumX/count,Y=s... | How do I write an extension function to return the average of a custom type? This is probably very simple, but my attempts (guided by Intellisense and MSDN) have all been off the mark. If I have a class which contains 3 double, how can I get the average of a list of these? class DataPoint { public int time; public int ... | TITLE:
How do I write an extension function to return the average of a custom type?
QUESTION:
This is probably very simple, but my attempts (guided by Intellisense and MSDN) have all been off the mark. If I have a class which contains 3 double, how can I get the average of a list of these? class DataPoint { public int... | [
"c#",
"extension-methods",
"average"
] | 1 | 4 | 522 | 3 | 0 | 2011-06-09T20:19:44.463000 | 2011-06-09T20:25:12.040000 |
6,298,766 | 6,298,855 | Trying to convert string to datetime in a different format than the string | So I had to convert a date in the format of (MM-dd-yyyy) to (dd-MMM-yyyy). What I ended up doing was this... string strProvisionalDate = "04-22-2001"; string strFormat = "MM-dd-yyyy"; DateTime dtProvisional; DateTime.TryParseExact(strProvisionalDate, strFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dtP... | The DateTime object doesn't store date/time as a format, it stores it as a number of ticks since the epoch. There should be no difference between dtProvisional and dtProvisionalConverted DateTime as object (their undelying value should be the same). The string format can always be changed when outputting the DateTime t... | Trying to convert string to datetime in a different format than the string So I had to convert a date in the format of (MM-dd-yyyy) to (dd-MMM-yyyy). What I ended up doing was this... string strProvisionalDate = "04-22-2001"; string strFormat = "MM-dd-yyyy"; DateTime dtProvisional; DateTime.TryParseExact(strProvisional... | TITLE:
Trying to convert string to datetime in a different format than the string
QUESTION:
So I had to convert a date in the format of (MM-dd-yyyy) to (dd-MMM-yyyy). What I ended up doing was this... string strProvisionalDate = "04-22-2001"; string strFormat = "MM-dd-yyyy"; DateTime dtProvisional; DateTime.TryParseEx... | [
"c#",
"string",
"datetime",
"formatting"
] | 3 | 6 | 5,404 | 2 | 0 | 2011-06-09T20:20:00.677000 | 2011-06-09T20:28:56.900000 |
6,298,774 | 6,298,818 | Linq to Entities with two tables | When you are writing a linq query that involves two tables/entities for which you have already defined the relationship in your entity framework data model, do you have to define the join in the query or is there a different syntax that uses the already defined relationship? var q =
from c in categories
join p in pro... | If things are set up correctly you'll have a reference property that represents the foreign key relationship, in which case you should be able to do something like: var q = from c in categories select new {Category = c, Products = c.Products}; | Linq to Entities with two tables When you are writing a linq query that involves two tables/entities for which you have already defined the relationship in your entity framework data model, do you have to define the join in the query or is there a different syntax that uses the already defined relationship? var q =
fr... | TITLE:
Linq to Entities with two tables
QUESTION:
When you are writing a linq query that involves two tables/entities for which you have already defined the relationship in your entity framework data model, do you have to define the join in the query or is there a different syntax that uses the already defined relatio... | [
".net",
"linq",
"entity-framework"
] | 1 | 2 | 881 | 3 | 0 | 2011-06-09T20:21:00.273000 | 2011-06-09T20:26:07.253000 |
6,298,775 | 6,298,801 | How does File.Copy work? | Say I have a console application that runs on Machine1. What is happening in the background if that application copies a file from a network share on Machine2 to a network share on Machine3? Is it going directly from Machine2 to Machine3 or would it have to pass through Machine1 since that is where the application is b... | If you are on Machine1, any standard file copy operation will have to get data from Machine2 and send it over to Machine3 (going over the network twice). FTP is the only protocol I know of that has provisions for copying files between two servers from a third server without the third server having to send and receive t... | How does File.Copy work? Say I have a console application that runs on Machine1. What is happening in the background if that application copies a file from a network share on Machine2 to a network share on Machine3? Is it going directly from Machine2 to Machine3 or would it have to pass through Machine1 since that is w... | TITLE:
How does File.Copy work?
QUESTION:
Say I have a console application that runs on Machine1. What is happening in the background if that application copies a file from a network share on Machine2 to a network share on Machine3? Is it going directly from Machine2 to Machine3 or would it have to pass through Machin... | [
".net",
"performance",
"file-io"
] | 1 | 1 | 630 | 3 | 0 | 2011-06-09T20:21:03.203000 | 2011-06-09T20:24:22.060000 |
6,298,784 | 6,298,842 | sql and getting elements around a specific one | My sql database stores the highscores for the players of a game like this: playerName scores To show the scores I'm trying to create a query that returns for a playerId "joe" the positon of joe as well as one player with more and less points than joe: (rank) (playerName) (scores) 5000 luci 2001 5001 joe 1900 5002 marc ... | You'd ideally want to be using window functions to do this, namely row_number(), lead() and lag(). These are not available in MySQL, but here are a few workarounds (also row_number(), picked up from the same author). Using window functions: with players as ( select row_number() over w as rank, playername, scores from p... | sql and getting elements around a specific one My sql database stores the highscores for the players of a game like this: playerName scores To show the scores I'm trying to create a query that returns for a playerId "joe" the positon of joe as well as one player with more and less points than joe: (rank) (playerName) (... | TITLE:
sql and getting elements around a specific one
QUESTION:
My sql database stores the highscores for the players of a game like this: playerName scores To show the scores I'm trying to create a query that returns for a playerId "joe" the positon of joe as well as one player with more and less points than joe: (ra... | [
"mysql",
"sql-order-by"
] | 0 | 0 | 65 | 2 | 0 | 2011-06-09T20:22:25.600000 | 2011-06-09T20:27:56.200000 |
6,298,792 | 6,298,839 | Google Maps Dead Zones and InfoWIndow Close Button Not Working | Interesting combination of problems with the Googles Maps API when parsing the markers with XML I'm seeing deadzones, everything within is unclickable, including the map itself. InfoWindows won't close clicking the close button (seem to be unclickable) or when clicking outside of the InfoWindows pane. The Deadzone seem... | Set position:relative for the div map_canvas. That will fix the overlay div problem. besides, it is not a zoomlevel problem. As you can see, your hand cursor disappears when you go over a part in the right hand side of the map. EDIT: I tested your code myself, and the deadzone disappears once you set all position attri... | Google Maps Dead Zones and InfoWIndow Close Button Not Working Interesting combination of problems with the Googles Maps API when parsing the markers with XML I'm seeing deadzones, everything within is unclickable, including the map itself. InfoWindows won't close clicking the close button (seem to be unclickable) or w... | TITLE:
Google Maps Dead Zones and InfoWIndow Close Button Not Working
QUESTION:
Interesting combination of problems with the Googles Maps API when parsing the markers with XML I'm seeing deadzones, everything within is unclickable, including the map itself. InfoWindows won't close clicking the close button (seem to be... | [
"xml",
"google-maps",
"google-maps-api-3"
] | 0 | 2 | 962 | 1 | 0 | 2011-06-09T20:23:16.043000 | 2011-06-09T20:27:39.327000 |
6,298,794 | 6,299,095 | Every other click of link in Internet Explorer does not work | I have noticed that when clicking a link in IE that has the href set to a javascript function, the first click will work but the second click sometimes won't. The third will work and the fourth won't. In other words, IE will only trigger the javascript function on every other click. If you put a long pause between clic... | You're probably experiencing double-click events instead. That should do the trick. | Every other click of link in Internet Explorer does not work I have noticed that when clicking a link in IE that has the href set to a javascript function, the first click will work but the second click sometimes won't. The third will work and the fourth won't. In other words, IE will only trigger the javascript functi... | TITLE:
Every other click of link in Internet Explorer does not work
QUESTION:
I have noticed that when clicking a link in IE that has the href set to a javascript function, the first click will work but the second click sometimes won't. The third will work and the fourth won't. In other words, IE will only trigger the... | [
"javascript",
"html",
"internet-explorer"
] | 4 | 4 | 1,978 | 2 | 0 | 2011-06-09T20:23:30.957000 | 2011-06-09T20:50:24.590000 |
6,298,796 | 6,298,845 | Properly parse through JSON from an XML file with jQuery | I'm reading an xml file with PHP and pulling it into jQuery via a.getJSON call, but I can't figure out how to iterate over it. I have the following XML: John Doe 2011-06-05T11:13:00 Message text John Doe 2011-06-05T11:13:00 Message text I'm reading and sending it to the front end with PHP like this: $xml = simplexml_lo... | Without knowing what errors you're getting: $.getJSON('xml.php',function(data) { html = ' '; $.each(data.comment, function(key, comment) { var comment_id = comment['@attributes'].id; html += ' \n'; html += ' '+comment.author+' \n'; html += ' ';
}); html += ' '; $('.comments').replaceWith(html); }); An example. | Properly parse through JSON from an XML file with jQuery I'm reading an xml file with PHP and pulling it into jQuery via a.getJSON call, but I can't figure out how to iterate over it. I have the following XML: John Doe 2011-06-05T11:13:00 Message text John Doe 2011-06-05T11:13:00 Message text I'm reading and sending it... | TITLE:
Properly parse through JSON from an XML file with jQuery
QUESTION:
I'm reading an xml file with PHP and pulling it into jQuery via a.getJSON call, but I can't figure out how to iterate over it. I have the following XML: John Doe 2011-06-05T11:13:00 Message text John Doe 2011-06-05T11:13:00 Message text I'm read... | [
"jquery",
"xml",
"json"
] | 0 | 1 | 632 | 2 | 0 | 2011-06-09T20:23:42.217000 | 2011-06-09T20:28:01.660000 |
6,298,820 | 6,298,905 | Install themeforest theme in wordpress.com | I bought the themeforest.net wordpress theme. I created a blog at wordpress. How to import themeforest theme to wordpress.com Do I need to find the hosting provider, install wordpress on it and then upload the themeforest theme there? I want to install the themeforest theme at wordpress.com, not at the hosting. Please ... | http://en.support.wordpress.com/themes/adding-new-themes/ "Because of the way WordPress.com’s technical infrastructure is designed, we are not able to support uploading of custom WordPress themes on our service." "You can move your WordPress.com blog to a web host that allows editing and uploading of completely custom ... | Install themeforest theme in wordpress.com I bought the themeforest.net wordpress theme. I created a blog at wordpress. How to import themeforest theme to wordpress.com Do I need to find the hosting provider, install wordpress on it and then upload the themeforest theme there? I want to install the themeforest theme at... | TITLE:
Install themeforest theme in wordpress.com
QUESTION:
I bought the themeforest.net wordpress theme. I created a blog at wordpress. How to import themeforest theme to wordpress.com Do I need to find the hosting provider, install wordpress on it and then upload the themeforest theme there? I want to install the th... | [
"php",
"wordpress",
"wordpress.com"
] | 0 | 1 | 1,542 | 2 | 0 | 2011-06-09T20:26:13.470000 | 2011-06-09T20:35:39.847000 |
6,298,823 | 6,298,930 | Easing String not working properly for me. Can someone describe what I'm doing wrong? | Can someone help me w/ this code snippet. I'm animating a block of content and my easing string isn't working correct for me. Can someone quickly point out what I've done wrong? Thanks // JavaScript Document $(document).ready(function() {
$('.learnmore').mouseover(function() { $(this).parent().find('.cover').stop().de... | You're using.animate wrong. The two styles are:.animate([CSS Properties], [Options (Easing/Duration/Complete)]) or.animate([CSS Properties], [Duration], [Easing], [Complete]); http://api.jquery.com/animate/ You want this: $(this).parent().find('.cover').stop().delay(100).animate({ top: '50px' }, { duration: 400, easing... | Easing String not working properly for me. Can someone describe what I'm doing wrong? Can someone help me w/ this code snippet. I'm animating a block of content and my easing string isn't working correct for me. Can someone quickly point out what I've done wrong? Thanks // JavaScript Document $(document).ready(function... | TITLE:
Easing String not working properly for me. Can someone describe what I'm doing wrong?
QUESTION:
Can someone help me w/ this code snippet. I'm animating a block of content and my easing string isn't working correct for me. Can someone quickly point out what I've done wrong? Thanks // JavaScript Document $(docume... | [
"jquery"
] | 2 | 3 | 963 | 2 | 0 | 2011-06-09T20:26:27.920000 | 2011-06-09T20:37:20.727000 |
6,298,828 | 6,298,979 | Formatting an entered time string on the user's behalf | I want to record a user-entered time, but I don't want the user to have to worry about entering things such as ":" or ".". The only times entered will be around 7-8 minutes, and any number of seconds with a possible decimal point, but I would like the user to just be able to enter something like 7234 and have it format... | You can do this with a clever use of – textField:shouldChangeCharactersInRange:replacementString: (see the documentation for the UITextFieldDelegate Protocol ). If you know for certain that the time will always be <10 minutes, then after the first numeric entry, add: and after the next two add.. However, it may be easi... | Formatting an entered time string on the user's behalf I want to record a user-entered time, but I don't want the user to have to worry about entering things such as ":" or ".". The only times entered will be around 7-8 minutes, and any number of seconds with a possible decimal point, but I would like the user to just ... | TITLE:
Formatting an entered time string on the user's behalf
QUESTION:
I want to record a user-entered time, but I don't want the user to have to worry about entering things such as ":" or ".". The only times entered will be around 7-8 minutes, and any number of seconds with a possible decimal point, but I would like... | [
"objective-c",
"ios",
"cocoa-touch",
"formatting",
"datetime-format"
] | 0 | 2 | 88 | 3 | 0 | 2011-06-09T20:26:51.123000 | 2011-06-09T20:41:56.960000 |
6,298,830 | 6,298,946 | Force load an assembly from the /bin and not the GAC? | I have two assemblies, created through conditional compilation (dev and real). The public surface of these assemblies is 100% identical: both are strongly named; both are signed with the same.snk and therefore have the same PublicKeyToken; both have the same culture and the same version. I cannot change this: making th... | GAC is always tried first, when binding assemblies: How the Runtime Locates Assemblies So no, you can't do this. However if you explain why you have such strange requirements there might be a different work around, you have not thought of. | Force load an assembly from the /bin and not the GAC? I have two assemblies, created through conditional compilation (dev and real). The public surface of these assemblies is 100% identical: both are strongly named; both are signed with the same.snk and therefore have the same PublicKeyToken; both have the same culture... | TITLE:
Force load an assembly from the /bin and not the GAC?
QUESTION:
I have two assemblies, created through conditional compilation (dev and real). The public surface of these assemblies is 100% identical: both are strongly named; both are signed with the same.snk and therefore have the same PublicKeyToken; both hav... | [
".net",
"asp.net",
"assemblies"
] | 30 | 15 | 22,347 | 5 | 0 | 2011-06-09T20:26:54 | 2011-06-09T20:39:12.313000 |
6,298,854 | 6,298,898 | How to make jQuery automatically retry a load() if it fails? | I'm doing some content replacement via jquery load() on a number of places on page. On my dev server things work perfectly. On my live server sometimes it gives me a "request is invalid" error which I can see in firebug. I think the server is getting overwhelmed, or perhaps some caching module is getting confused with ... | I wouldn't call it slick, but you could use the callback function of $.load. If the status is error, you can redo the load. | How to make jQuery automatically retry a load() if it fails? I'm doing some content replacement via jquery load() on a number of places on page. On my dev server things work perfectly. On my live server sometimes it gives me a "request is invalid" error which I can see in firebug. I think the server is getting overwhel... | TITLE:
How to make jQuery automatically retry a load() if it fails?
QUESTION:
I'm doing some content replacement via jquery load() on a number of places on page. On my dev server things work perfectly. On my live server sometimes it gives me a "request is invalid" error which I can see in firebug. I think the server i... | [
"jquery"
] | 3 | 1 | 2,771 | 2 | 0 | 2011-06-09T20:28:51.683000 | 2011-06-09T20:35:12.023000 |
6,298,865 | 6,306,751 | How to install Maven into Red Hat Enterprise Linux 6? | I'm working on a Scientific Linux box and am trying to install Maven using the yum command. Scientific Linux for those of you who do not know is based off of Red Hat Linux Enterprise Edition 6. I'd prefer to install Maven in a way that lent itself to easy updating, that is why I have shied away from simply going to the... | The distro agnostic generic repo is what you want. As root, add a couple of the jpackage-generic repos to yum (two snippets below). Then perform a yum update and finally yum install maven2. cat > /etc/yum.repos.d/jpackage-generic-free.repo << EOF [jpackage-generic-free] name=JPackage generic free baseurl=http://mirrors... | How to install Maven into Red Hat Enterprise Linux 6? I'm working on a Scientific Linux box and am trying to install Maven using the yum command. Scientific Linux for those of you who do not know is based off of Red Hat Linux Enterprise Edition 6. I'd prefer to install Maven in a way that lent itself to easy updating, ... | TITLE:
How to install Maven into Red Hat Enterprise Linux 6?
QUESTION:
I'm working on a Scientific Linux box and am trying to install Maven using the yum command. Scientific Linux for those of you who do not know is based off of Red Hat Linux Enterprise Edition 6. I'd prefer to install Maven in a way that lent itself ... | [
"linux",
"maven",
"redhat",
"yum"
] | 20 | 19 | 46,593 | 4 | 0 | 2011-06-09T20:30:15.817000 | 2011-06-10T13:03:47.703000 |
6,298,869 | 6,298,893 | Why doesn't this if statement ever get hit? | foreach (Dictionary dictionary in listOfDictionaries) { if( object.Equals(dictionary, listOfDictionaries.Last() ) { //Do something on last iteration of foreach loop. } } I realized fairly soon on that I wanted a reference equals, but it still brought up the question of how this code could not be hit. Does object.Equals... | There are a couple of ways the body of the if statement could not be hit in this scenario. listOfDictionaries is an empty collection hence the if statement will never be tested. listOfDictionaries could be a generated sequence which returns a new instance of Dictionary every time it's iterated and hence the elements do... | Why doesn't this if statement ever get hit? foreach (Dictionary dictionary in listOfDictionaries) { if( object.Equals(dictionary, listOfDictionaries.Last() ) { //Do something on last iteration of foreach loop. } } I realized fairly soon on that I wanted a reference equals, but it still brought up the question of how th... | TITLE:
Why doesn't this if statement ever get hit?
QUESTION:
foreach (Dictionary dictionary in listOfDictionaries) { if( object.Equals(dictionary, listOfDictionaries.Last() ) { //Do something on last iteration of foreach loop. } } I realized fairly soon on that I wanted a reference equals, but it still brought up the ... | [
"c#"
] | 1 | 4 | 137 | 2 | 0 | 2011-06-09T20:31:28.187000 | 2011-06-09T20:34:46.253000 |
6,298,878 | 6,298,934 | Where is the correct documentation for flash.globalization.DateTimeFormatter? | The docs I can find for flash.globalization.DateTimeFormatter are here. In those docs, the examples show the use of an important method called setDateTimeStyles(). However, there is no such documented method! Same goes for format(). I feel I'm missing something or am looking at dated/incomplete material (or am a comple... | I suppose you haven't chosen right target runtime in the documentation header of your link. Choose at least Flash Player 10.1 and AIR 2.5. | Where is the correct documentation for flash.globalization.DateTimeFormatter? The docs I can find for flash.globalization.DateTimeFormatter are here. In those docs, the examples show the use of an important method called setDateTimeStyles(). However, there is no such documented method! Same goes for format(). I feel I'... | TITLE:
Where is the correct documentation for flash.globalization.DateTimeFormatter?
QUESTION:
The docs I can find for flash.globalization.DateTimeFormatter are here. In those docs, the examples show the use of an important method called setDateTimeStyles(). However, there is no such documented method! Same goes for f... | [
"flash",
"apache-flex",
"actionscript-3"
] | 0 | 1 | 458 | 2 | 0 | 2011-06-09T20:32:15.283000 | 2011-06-09T20:37:32.583000 |
6,298,882 | 6,298,961 | Select rows from MySQL table where PHP timestamp is older than X | I have a user table, where users need to be approved, i want to show users who are not approved and is registered more than 7 days ago. My user_regdate is a timestamp created with php time() function. This is what i try, it does not works: mysql_query("select * from users WHERE user_regdate < now() - interval 7 day AND... | PHP's timstamps are a simple integer, whereas MySQL's now() returns a datetime value. Most likely this will fix up the query: SELECT... WHERE user_regdate < unix_timestamp(now() - interval 7 day))... Basically, without the unix_timstamp() call, you're comparing apples and oranges. | Select rows from MySQL table where PHP timestamp is older than X I have a user table, where users need to be approved, i want to show users who are not approved and is registered more than 7 days ago. My user_regdate is a timestamp created with php time() function. This is what i try, it does not works: mysql_query("se... | TITLE:
Select rows from MySQL table where PHP timestamp is older than X
QUESTION:
I have a user table, where users need to be approved, i want to show users who are not approved and is registered more than 7 days ago. My user_regdate is a timestamp created with php time() function. This is what i try, it does not work... | [
"php",
"mysql",
"timestamp"
] | 6 | 16 | 14,612 | 4 | 0 | 2011-06-09T20:32:33.430000 | 2011-06-09T20:40:28.493000 |
6,298,885 | 6,299,084 | VisualStudio 2010 Designer throws on implemented virtual method | I want to have an abstract UserControl, BaseControl, that implements an interface IBaseControl. However, setting the class to abstract breaks VisualStudio designer (This is a known issue with Visual Studio (e.g., see this StackOverflow posting for more info), and as far as I know, there's no change expected in the near... | The reason that the exception is thrown is because, oddly enough, the designer doesn't compile or instantiate the class your are designing at all! It only compiles and instantiates the base class of the control you are designing. Why this is the case becomes obvious when you realize that adding new subcontrols to the e... | VisualStudio 2010 Designer throws on implemented virtual method I want to have an abstract UserControl, BaseControl, that implements an interface IBaseControl. However, setting the class to abstract breaks VisualStudio designer (This is a known issue with Visual Studio (e.g., see this StackOverflow posting for more inf... | TITLE:
VisualStudio 2010 Designer throws on implemented virtual method
QUESTION:
I want to have an abstract UserControl, BaseControl, that implements an interface IBaseControl. However, setting the class to abstract breaks VisualStudio designer (This is a known issue with Visual Studio (e.g., see this StackOverflow po... | [
"c#",
"visual-studio",
"user-controls",
"abstract-class",
"designer"
] | 6 | 6 | 428 | 1 | 0 | 2011-06-09T20:33:08.697000 | 2011-06-09T20:49:23.350000 |
6,298,888 | 6,298,912 | Quick SQL Syntax Question | I have a standard insert into / select statement that is formatted similar to this: insert into Table (...,...)
select field1, field2, field3, field4, fieldetc from.... etc There are three specific fields in the select statement that will need different values selected depending on another field, let's call it checker... | Take out the IF and the BEGIN / END stuff and it should work. All you need to use is the CASE COALESCE(checker,'A') WHEN 'A' THEN 0 ELSE alternate_value END for each conditional value you want to SELECT EDIT: Using your example: SELECT field1data, CASE WHEN ISNULL(checker) THEN alternate_value1 WHEN checker = 'B' THEN ... | Quick SQL Syntax Question I have a standard insert into / select statement that is formatted similar to this: insert into Table (...,...)
select field1, field2, field3, field4, fieldetc from.... etc There are three specific fields in the select statement that will need different values selected depending on another fi... | TITLE:
Quick SQL Syntax Question
QUESTION:
I have a standard insert into / select statement that is formatted similar to this: insert into Table (...,...)
select field1, field2, field3, field4, fieldetc from.... etc There are three specific fields in the select statement that will need different values selected depen... | [
"sql",
"sql-server",
"syntax"
] | 3 | 3 | 85 | 3 | 0 | 2011-06-09T20:34:02.360000 | 2011-06-09T20:36:18.920000 |
6,298,890 | 6,299,043 | Using setValuesForKeysWithDictionary with child objects and JSON | I have a json string {"name":"test","bar":{"name":"testBar"}} In objective c I have an object @interface Foo: NSObject { } @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) Bar * bar; @end And I just synthesize those properties. And I have a child object with synthesized properties. @interfac... | -setValuesForKeysWithDictionary: isn't smart enough to recognize that the value of the key "bar" should be an instance of Bar. It's assigning an NSDictionary to that property. Thus, when you ask for the property "name," the dictionary can't field that request. However, an NSDictionary does know how to handle -valueForK... | Using setValuesForKeysWithDictionary with child objects and JSON I have a json string {"name":"test","bar":{"name":"testBar"}} In objective c I have an object @interface Foo: NSObject { } @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) Bar * bar; @end And I just synthesize those properties.... | TITLE:
Using setValuesForKeysWithDictionary with child objects and JSON
QUESTION:
I have a json string {"name":"test","bar":{"name":"testBar"}} In objective c I have an object @interface Foo: NSObject { } @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) Bar * bar; @end And I just synthesize... | [
"objective-c",
"key-value-coding"
] | 8 | 6 | 7,773 | 2 | 0 | 2011-06-09T20:34:22.773000 | 2011-06-09T20:46:42.157000 |
6,298,904 | 6,298,989 | ActiveRecord, which comes first? | Simple question really, in the order of processing which will happen first when saving a new item.:before_create:validates | validates goes first. From the docs: (-) save (-) valid (1) before_validation (-) validate (2) after_validation (3) before_save (4) before_create (-) create (5) after_create (6) after_save (7) after_commit | ActiveRecord, which comes first? Simple question really, in the order of processing which will happen first when saving a new item.:before_create:validates | TITLE:
ActiveRecord, which comes first?
QUESTION:
Simple question really, in the order of processing which will happen first when saving a new item.:before_create:validates
ANSWER:
validates goes first. From the docs: (-) save (-) valid (1) before_validation (-) validate (2) after_validation (3) before_save (4) befor... | [
"ruby-on-rails",
"ruby",
"activerecord"
] | 4 | 14 | 730 | 4 | 0 | 2011-06-09T20:35:39.577000 | 2011-06-09T20:42:46.383000 |
6,298,921 | 6,299,128 | How secure are GeoLocation APIs on Mobile Devices? | How easy is it to hack or provide mis-information to a website via a GeoLocation API? I have a need to have users post their position to my server, but I need to ensure that the data is not spoofed. Pin-Point accuracy is not required, but I need to know that the user was at least in the vicinity of where they claim to ... | Are you expecting malice? As with any technology relying on the client, you have to trust the client. With rooted/jailbroken phones, theoretically the data can be manipulated on the phone. If location services are disabled, you might get placeholder data (though you should get an indication that geolocation is disabled... | How secure are GeoLocation APIs on Mobile Devices? How easy is it to hack or provide mis-information to a website via a GeoLocation API? I have a need to have users post their position to my server, but I need to ensure that the data is not spoofed. Pin-Point accuracy is not required, but I need to know that the user w... | TITLE:
How secure are GeoLocation APIs on Mobile Devices?
QUESTION:
How easy is it to hack or provide mis-information to a website via a GeoLocation API? I have a need to have users post their position to my server, but I need to ensure that the data is not spoofed. Pin-Point accuracy is not required, but I need to kn... | [
"android",
"ios",
"security",
"windows-phone-7",
"gis"
] | 3 | 6 | 225 | 1 | 0 | 2011-06-09T20:36:43.977000 | 2011-06-09T20:53:17.263000 |
6,298,923 | 6,299,031 | How can I create a relative Url in a html link element for a web app running on IIS? | Let say I have a web application: www.mymvcsite.com/MyVirtualDirectory/Controller/Action In my view I have a. Problem is the entire Html is coming from from a database! Aha! You thought this was as easy as @Url.Content()... well that doesn't work cause the html is dynamic in fact I have no idea that there is even link ... | You need to store the relative url in a hidden field: All links should be relative to the root of the site and have a common class name: PDF Then when you load it into the page you do: var hiddenHref = document.getElementById('hidPartialUrl').href; var links = document.getElementsByClassName('fixThisLink'); for(var i =... | How can I create a relative Url in a html link element for a web app running on IIS? Let say I have a web application: www.mymvcsite.com/MyVirtualDirectory/Controller/Action In my view I have a. Problem is the entire Html is coming from from a database! Aha! You thought this was as easy as @Url.Content()... well that d... | TITLE:
How can I create a relative Url in a html link element for a web app running on IIS?
QUESTION:
Let say I have a web application: www.mymvcsite.com/MyVirtualDirectory/Controller/Action In my view I have a. Problem is the entire Html is coming from from a database! Aha! You thought this was as easy as @Url.Conten... | [
"html",
"model-view-controller",
"iis",
"href"
] | 0 | 0 | 691 | 1 | 0 | 2011-06-09T20:36:57.227000 | 2011-06-09T20:45:50.617000 |
6,298,937 | 6,299,009 | MySQL join statement | I need to join two tables: countries table country|lang1|lang2|lang3|lang4 Canada |1 |2 |NULL |NULL US |1 |NULL |NULL |NULL and languages table id|language 1 |English 2 |French I want to return the values for both rows in my countries table, with the language names. How do I do that? I tried: SELECT * FROM en_countries... | I think the issue here is with (all_languages.id = en_countries.lang1 AND all_languages.id = en_countries.lang2) rather try SELECT * FROM en_countries LEFT JOIN all_languages ON (all_languages.id = en_countries.lang1 OR all_languages.id = en_countries.lang2) The 'and' implies that one language should be the first and s... | MySQL join statement I need to join two tables: countries table country|lang1|lang2|lang3|lang4 Canada |1 |2 |NULL |NULL US |1 |NULL |NULL |NULL and languages table id|language 1 |English 2 |French I want to return the values for both rows in my countries table, with the language names. How do I do that? I tried: SELEC... | TITLE:
MySQL join statement
QUESTION:
I need to join two tables: countries table country|lang1|lang2|lang3|lang4 Canada |1 |2 |NULL |NULL US |1 |NULL |NULL |NULL and languages table id|language 1 |English 2 |French I want to return the values for both rows in my countries table, with the language names. How do I do th... | [
"mysql"
] | 0 | 1 | 202 | 4 | 0 | 2011-06-09T20:37:55.547000 | 2011-06-09T20:44:21.317000 |
6,298,941 | 6,298,963 | How do I find the CPU and RAM usage using PowerShell? | I am trying to get PowerShell to give me the RAM and CPU usage, but I can't figure out what WMI class to use. My computer has two processors, so it would be useful to have the information for both of them. | Get-WmiObject Win32_Processor | Select LoadPercentage | Format-List This gives you CPU load. Get-WmiObject Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select Average | How do I find the CPU and RAM usage using PowerShell? I am trying to get PowerShell to give me the RAM and CPU usage, but I can't figure out what WMI class to use. My computer has two processors, so it would be useful to have the information for both of them. | TITLE:
How do I find the CPU and RAM usage using PowerShell?
QUESTION:
I am trying to get PowerShell to give me the RAM and CPU usage, but I can't figure out what WMI class to use. My computer has two processors, so it would be useful to have the information for both of them.
ANSWER:
Get-WmiObject Win32_Processor | S... | [
"powershell"
] | 87 | 71 | 375,882 | 6 | 0 | 2011-06-09T20:38:28.530000 | 2011-06-09T20:40:48.090000 |
6,298,948 | 6,298,971 | CSS IE Filter and background image? | Can you use the CSS Filter attribute for IE gradients AND implement a background image? /*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c8bcf', endColorstr='#0068b3');*/ | As far as I know the background has to be "transparent" or none for the gradient filter to work.. perhaps you could wrap the gradient div with another div and put the background image on the outer one? Wait! it does appear to work, glad I checked.. Working Example (IE only) sorry about that I really thought it didn't w... | CSS IE Filter and background image? Can you use the CSS Filter attribute for IE gradients AND implement a background image? /*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c8bcf', endColorstr='#0068b3');*/ | TITLE:
CSS IE Filter and background image?
QUESTION:
Can you use the CSS Filter attribute for IE gradients AND implement a background image? /*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c8bcf', endColorstr='#0068b3');*/
ANSWER:
As far as I know the background has to be "transparent" or none f... | [
"css"
] | 4 | 4 | 5,231 | 2 | 0 | 2011-06-09T20:39:20.560000 | 2011-06-09T20:41:16.300000 |
6,298,998 | 6,299,022 | Java gui layout | How can I make a gui layout in java which is column based? by that i mean: JLabel JTextField JLabel JTextField JLabel JTextField I want them all stacked on to of each other, rather than side by side. In the past I've used FlowLayout which isn't suitable, and gridLayout which makes each component much larger than I requ... | Look at BoxLayout, but more important, go through the layout manager tutorial to get an overview of all the user-friendly layout managers. Edit 1: Also, GridLayout sometimes works well in this situation, but you may want to place your JTextFields inside of JPanels and add the JPanels to the grid, so that the JTextField... | Java gui layout How can I make a gui layout in java which is column based? by that i mean: JLabel JTextField JLabel JTextField JLabel JTextField I want them all stacked on to of each other, rather than side by side. In the past I've used FlowLayout which isn't suitable, and gridLayout which makes each component much la... | TITLE:
Java gui layout
QUESTION:
How can I make a gui layout in java which is column based? by that i mean: JLabel JTextField JLabel JTextField JLabel JTextField I want them all stacked on to of each other, rather than side by side. In the past I've used FlowLayout which isn't suitable, and gridLayout which makes each... | [
"java",
"swing",
"user-interface",
"layout"
] | 1 | 6 | 1,021 | 5 | 0 | 2011-06-09T20:43:20.800000 | 2011-06-09T20:45:15.263000 |
6,299,007 | 6,299,057 | Dynamically populate object properties with dictionary values | In Objective-C, I have a dictionary: firstName -> John lastName -> Smith age -> 34 and an object Person that has corresponding instance variables and properties (that handle memory management appropriately). I'd like to create a convenience initializer that takes a dictionary as an argument and populates all the object... | You can use Key-Value Coding: [obj setValuesForKeysWithDictionary:dict]; See also the documentation for -setValuesForKeysWithDictionary:. | Dynamically populate object properties with dictionary values In Objective-C, I have a dictionary: firstName -> John lastName -> Smith age -> 34 and an object Person that has corresponding instance variables and properties (that handle memory management appropriately). I'd like to create a convenience initializer that ... | TITLE:
Dynamically populate object properties with dictionary values
QUESTION:
In Objective-C, I have a dictionary: firstName -> John lastName -> Smith age -> 34 and an object Person that has corresponding instance variables and properties (that handle memory management appropriately). I'd like to create a convenience... | [
"objective-c",
"dictionary",
"properties",
"initialization",
"populate"
] | 5 | 20 | 6,269 | 1 | 0 | 2011-06-09T20:44:11.097000 | 2011-06-09T20:48:02.843000 |
6,299,012 | 6,299,081 | How to save the command you are about to execute in bash? | Is there a better way to save a command line before it it executed? A number of my /bin/bash scripts construct a very long command line. I generally save the command line to a text file for easier debugging and (sometimes) execution. My code is littered with this idiom: echo >saved.txt cd $NEW_PLACE '&&' command.py --f... | How about creating a helper function which logs and then executes the command? "$@" will expand to whatever command you pass in. log() { echo "$@" >> /tmp/cmd.log "$@" } Use it by simply prepending log to any existing command. It won't handle && or || though, so you'll have to log those commands separately. log cd $NEW... | How to save the command you are about to execute in bash? Is there a better way to save a command line before it it executed? A number of my /bin/bash scripts construct a very long command line. I generally save the command line to a text file for easier debugging and (sometimes) execution. My code is littered with thi... | TITLE:
How to save the command you are about to execute in bash?
QUESTION:
Is there a better way to save a command line before it it executed? A number of my /bin/bash scripts construct a very long command line. I generally save the command line to a text file for easier debugging and (sometimes) execution. My code is... | [
"debugging",
"bash"
] | 1 | 7 | 1,677 | 6 | 0 | 2011-06-09T20:44:25.597000 | 2011-06-09T20:49:10.893000 |
6,299,021 | 6,299,093 | Ajax and status 302 | I'm having a problem with ajax (and/or jQuery ajax) and status 302. This is what I am trying: var xhr = new XMLHttpRequest(); xhr.open("GET", 'some_page_that_I_cant_change.php'); xhr.onreadystatechange = function(){ console.log(xhr.readyState, xhr.status); }; xhr.send(null); The some_page_that_I_cant_change.php redirec... | If you use a HEAD request instead of a GET request, I suspect that will do what you want. You should only see headers in the response, no response body (i.e., no.bin will download). | Ajax and status 302 I'm having a problem with ajax (and/or jQuery ajax) and status 302. This is what I am trying: var xhr = new XMLHttpRequest(); xhr.open("GET", 'some_page_that_I_cant_change.php'); xhr.onreadystatechange = function(){ console.log(xhr.readyState, xhr.status); }; xhr.send(null); The some_page_that_I_can... | TITLE:
Ajax and status 302
QUESTION:
I'm having a problem with ajax (and/or jQuery ajax) and status 302. This is what I am trying: var xhr = new XMLHttpRequest(); xhr.open("GET", 'some_page_that_I_cant_change.php'); xhr.onreadystatechange = function(){ console.log(xhr.readyState, xhr.status); }; xhr.send(null); The so... | [
"javascript",
"ajax",
"jquery",
"http-status-code-302"
] | 3 | 2 | 7,395 | 3 | 0 | 2011-06-09T20:45:13.473000 | 2011-06-09T20:50:18.007000 |
6,299,029 | 6,299,121 | Can C# convert these badly formated month/year tags into a set of datetime objects? | I have the following dropdown of in this case auction instances, but there's no standard for naming them: Jul08Auc Sep08Auc Dec10Auc Apr11Auc Oct08Auc Nov08Auc October 2009 Mar11Auc Jun09Auc Mar10Auc Apr10Auc August 2010 Jun08Auc Jan09Auc March 2009 May 2009 November 2009 May10Auc June 2010 July 2010 Jan11Auc May11Auc ... | I would build a list of formats then call DateTime.TryParseExact for each on. static DateTime Parse(string dateString) { string[] formats = new [] {"MMMYY\A\u\c", "MMMM YYYY"}; DateTime parsedDate = new DateTime(); foreach (string fmt in formats) { if (DateTime.TryParseExact (dateString, fmt, null, DateTimeStyles.Defau... | Can C# convert these badly formated month/year tags into a set of datetime objects? I have the following dropdown of in this case auction instances, but there's no standard for naming them: Jul08Auc Sep08Auc Dec10Auc Apr11Auc Oct08Auc Nov08Auc October 2009 Mar11Auc Jun09Auc Mar10Auc Apr10Auc August 2010 Jun08Auc Jan09A... | TITLE:
Can C# convert these badly formated month/year tags into a set of datetime objects?
QUESTION:
I have the following dropdown of in this case auction instances, but there's no standard for naming them: Jul08Auc Sep08Auc Dec10Auc Apr11Auc Oct08Auc Nov08Auc October 2009 Mar11Auc Jun09Auc Mar10Auc Apr10Auc August 20... | [
"c#",
"datetime",
"drop-down-menu"
] | 0 | 6 | 1,298 | 3 | 0 | 2011-06-09T20:45:42 | 2011-06-09T20:52:52.520000 |
6,299,035 | 6,299,116 | SQL Query Select OR using another Table | How can I make this work? strQuery = " SELECT UNIT_NO,DRIVER1,DRIVER2,PHONENUMBER,PHONENUMBER_2,PHONE1,PHONENUM2 from UNITS where PHONENUMBER=" & objRS("PHONE") & "OR " & PHONENUMBER_2=" & objRS("PHONE") & "OR " & PHONE1=" & objRS("PHONE") & "OR " & PHONENUM2=" & objRS("PHONE")" Thanks for any help... | strQuery = " SELECT UNIT_NO,DRIVER1,DRIVER2,PHONENUMBER,PHONENUMBER_2,PHONE1,PHONENUM2 from UNITS where PHONENUMBER=" & objRS("PHONE") & " OR PHONENUMBER_2=" & objRS("PHONE") & " OR PHONE1=" & objRS("PHONE") & " OR PHONENUM2=" & objRS("PHONE") | SQL Query Select OR using another Table How can I make this work? strQuery = " SELECT UNIT_NO,DRIVER1,DRIVER2,PHONENUMBER,PHONENUMBER_2,PHONE1,PHONENUM2 from UNITS where PHONENUMBER=" & objRS("PHONE") & "OR " & PHONENUMBER_2=" & objRS("PHONE") & "OR " & PHONE1=" & objRS("PHONE") & "OR " & PHONENUM2=" & objRS("PHONE")" ... | TITLE:
SQL Query Select OR using another Table
QUESTION:
How can I make this work? strQuery = " SELECT UNIT_NO,DRIVER1,DRIVER2,PHONENUMBER,PHONENUMBER_2,PHONE1,PHONENUM2 from UNITS where PHONENUMBER=" & objRS("PHONE") & "OR " & PHONENUMBER_2=" & objRS("PHONE") & "OR " & PHONE1=" & objRS("PHONE") & "OR " & PHONENUM2=" ... | [
"sql",
"sql-server-2008"
] | 0 | 1 | 180 | 2 | 0 | 2011-06-09T20:46:00.300000 | 2011-06-09T20:52:37.210000 |
6,299,058 | 6,299,089 | Cleaning up directx, releasing com references properly | I am just learning directx. One typically creates a directx device and several other COM interfaces through a functions calls such as ID3D11CreateDeviceAndSwapChain(....,& device,...); In all tutorial code I have seen, the com interfaces are released using something akin to if (pointer_to_com_object) { pointer_to_com_o... | COM objects are reference counted. When you call Release(), you are effectively decrementing the internal reference count. If another object still owns a reference, it will not get destroyed. If some other part of the application end up having a new reference to a COM object, make sure you call Release() when you are d... | Cleaning up directx, releasing com references properly I am just learning directx. One typically creates a directx device and several other COM interfaces through a functions calls such as ID3D11CreateDeviceAndSwapChain(....,& device,...); In all tutorial code I have seen, the com interfaces are released using somethin... | TITLE:
Cleaning up directx, releasing com references properly
QUESTION:
I am just learning directx. One typically creates a directx device and several other COM interfaces through a functions calls such as ID3D11CreateDeviceAndSwapChain(....,& device,...); In all tutorial code I have seen, the com interfaces are relea... | [
"com",
"directx"
] | 1 | 4 | 3,890 | 1 | 0 | 2011-06-09T20:48:05.060000 | 2011-06-09T20:49:53.393000 |
6,300,605 | 6,300,636 | How can I prevent a user from saving a record with a null value? | I'm very new to database programming and I've got a small database (SQL CE 3.5). It has a "LastName" column that doesn't accept nulls. I'm using the BindingNavigator to get around. Do I have to set an event similar to below for every control on that navigator. Or is there an easier way around it? I'm using C# with.NET ... | There are a couple ways you could do it. The first would be in your SQL code. You could use isnull(lastname, 'something') - http://msdn.microsoft.com/en-us/library/ms184325.aspx Or you could give the column a default value in the database - ALTER TABLE your_table_name ADD CONSTRAINT Name_of_Constraint DEFAULT 'value' F... | How can I prevent a user from saving a record with a null value? I'm very new to database programming and I've got a small database (SQL CE 3.5). It has a "LastName" column that doesn't accept nulls. I'm using the BindingNavigator to get around. Do I have to set an event similar to below for every control on that navig... | TITLE:
How can I prevent a user from saving a record with a null value?
QUESTION:
I'm very new to database programming and I've got a small database (SQL CE 3.5). It has a "LastName" column that doesn't accept nulls. I'm using the BindingNavigator to get around. Do I have to set an event similar to below for every con... | [
"c#",
"sql",
"database",
"winforms"
] | 0 | 1 | 2,031 | 2 | 0 | 2011-06-09T23:58:52.900000 | 2011-06-10T00:04:44.113000 |
6,300,608 | 6,300,744 | How to pass a parcelable object that contains a list of objects? | I have created a Parcelable object below, my object contains a List of Products. In my constructor how do I handle re-creating my Parcelable for the List? I have checked all of the methods available from the parcel and all that is available is readArrayList(ClassLoader). I'm not sure if this is the best approach, your ... | If class Product is compatible with parcelable protocol, following should work according to documentation. products = new ArrayList (); in.readList(products, Product.class.getClassLoader()); | How to pass a parcelable object that contains a list of objects? I have created a Parcelable object below, my object contains a List of Products. In my constructor how do I handle re-creating my Parcelable for the List? I have checked all of the methods available from the parcel and all that is available is readArrayLi... | TITLE:
How to pass a parcelable object that contains a list of objects?
QUESTION:
I have created a Parcelable object below, my object contains a List of Products. In my constructor how do I handle re-creating my Parcelable for the List? I have checked all of the methods available from the parcel and all that is availa... | [
"android",
"android-activity",
"android-intent"
] | 107 | 109 | 87,337 | 9 | 0 | 2011-06-09T23:59:31.070000 | 2011-06-10T00:24:16.880000 |
6,300,612 | 6,309,189 | Using flash-based UI components in Flash Builder 4? | I am trialling Flash Builder 4 Premium. I'd like to know if it is possible to use components designed for Flash (e.g. http://www.oxylusflash.com/membership and http://www.jumpeyecomponents.com/Flash-Components/Various/JC-Collectio n-385/, amongst many others) in Flash Builder 4? How can I import them? By import, I also... | Unless they implement the UIComponent class, they will not conform to the layout and other functionality traits of other "Spark" or MX components. That means you can't use them in states, have them be part of a layout (properly), or assign them styles and skin them easily the same way that you do with a stock component... | Using flash-based UI components in Flash Builder 4? I am trialling Flash Builder 4 Premium. I'd like to know if it is possible to use components designed for Flash (e.g. http://www.oxylusflash.com/membership and http://www.jumpeyecomponents.com/Flash-Components/Various/JC-Collectio n-385/, amongst many others) in Flash... | TITLE:
Using flash-based UI components in Flash Builder 4?
QUESTION:
I am trialling Flash Builder 4 Premium. I'd like to know if it is possible to use components designed for Flash (e.g. http://www.oxylusflash.com/membership and http://www.jumpeyecomponents.com/Flash-Components/Various/JC-Collectio n-385/, amongst man... | [
"apache-flex",
"flex4",
"flash-builder",
"flash-cs5",
"flex4.5"
] | 1 | 1 | 425 | 1 | 0 | 2011-06-10T00:00:06.460000 | 2011-06-10T16:16:03.187000 |
6,300,613 | 6,300,737 | Whats the difference between bundle install --deployment and bundle pack | I know they both put the gems in your app in different locations but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it creates to version control and be done? | Have a look at the description of the two on Bundler's site. Running bundle install --deployment is to be run in the production environment, but will grab the gems from rubygems when run. Read more here under the 'Deploying Your Application' heading for the purpose of the --deployment flag. bundle package is similar to... | Whats the difference between bundle install --deployment and bundle pack I know they both put the gems in your app in different locations but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it creates to version control and be done? | TITLE:
Whats the difference between bundle install --deployment and bundle pack
QUESTION:
I know they both put the gems in your app in different locations but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it creates to version control and be done?
ANSW... | [
"ruby-on-rails",
"ruby-on-rails-3",
"rubygems",
"bundle",
"bundler"
] | 22 | 22 | 25,273 | 3 | 0 | 2011-06-10T00:00:13.687000 | 2011-06-10T00:22:42.637000 |
6,300,621 | 6,300,669 | Can Jquery alternate color of text, | Note, I cannot get into the html to add an id. Also, note, I had already found the jquery zebra strips tutorial but can`t get it to work for this situation. I have a link like this ( I have changed the domain name). submitpics@yourmamaisyourmama.com NOTE the URL will always be the same, because it is the homelink on a ... | EDIT 2 So you can't edit the HTML. Ok. Do this: $(function(){ $('.tab.tab-home.current a').html('submitpics@ your mama... etc'); }); and then update your CSS accordingly. Basically you're just replacing the content with whatever you want. EDIT So it sounds like you're going to know the URL in advance. That's great. If ... | Can Jquery alternate color of text, Note, I cannot get into the html to add an id. Also, note, I had already found the jquery zebra strips tutorial but can`t get it to work for this situation. I have a link like this ( I have changed the domain name). submitpics@yourmamaisyourmama.com NOTE the URL will always be the sa... | TITLE:
Can Jquery alternate color of text,
QUESTION:
Note, I cannot get into the html to add an id. Also, note, I had already found the jquery zebra strips tutorial but can`t get it to work for this situation. I have a link like this ( I have changed the domain name). submitpics@yourmamaisyourmama.com NOTE the URL wil... | [
"jquery"
] | 0 | 2 | 442 | 1 | 0 | 2011-06-10T00:02:24.027000 | 2011-06-10T00:10:04.863000 |
6,300,635 | 6,300,653 | How to make an element transparent to clicks but still visible? | I'm interested in putting an inset box shadow on something like an iframe. While the strategy of overlaying a div over the iframe gives the expected visual display, the div subsequently blocks clicks on the iframe itself. Sample: http://jsfiddle.net/YqXPg/ So is there a way to pull off the inset shadow as a "framing" e... | Yes, there's pointer-events: none. See: http://jsfiddle.net/YqXPg/3/ A version that makes the overlay more obvious: http://jsfiddle.net/YqXPg/4/ Note that this property doesn't work with IE, but if I remember correctly, IE will allow you to click through the transparent parts of the overlay div anyway. | How to make an element transparent to clicks but still visible? I'm interested in putting an inset box shadow on something like an iframe. While the strategy of overlaying a div over the iframe gives the expected visual display, the div subsequently blocks clicks on the iframe itself. Sample: http://jsfiddle.net/YqXPg/... | TITLE:
How to make an element transparent to clicks but still visible?
QUESTION:
I'm interested in putting an inset box shadow on something like an iframe. While the strategy of overlaying a div over the iframe gives the expected visual display, the div subsequently blocks clicks on the iframe itself. Sample: http://j... | [
"html",
"css"
] | 15 | 26 | 4,441 | 1 | 0 | 2011-06-10T00:04:24.690000 | 2011-06-10T00:07:26.593000 |
6,300,648 | 6,300,655 | PHP PDO - Why is the result of a FETCH_ASSO() on a LAST_INSERT_ID() not indexed with the column name? | All, I have some PHP PDO code that looks like this: prepare("SELECT LAST_INSERT_ID()"); $query->execute(); $result=$query->fetch(PDO::FETCH_ASSOC); // returns an array indexed by column name as returned in result set - here column name is "userID" in the DB print_r($result);... When I run this, the result of print_r($r... | Because you are not selecting the column, but the result of that MySQL function. You could use... SELECT LAST_INSERT_ID() AS `userID` | PHP PDO - Why is the result of a FETCH_ASSO() on a LAST_INSERT_ID() not indexed with the column name? All, I have some PHP PDO code that looks like this: prepare("SELECT LAST_INSERT_ID()"); $query->execute(); $result=$query->fetch(PDO::FETCH_ASSOC); // returns an array indexed by column name as returned in result set -... | TITLE:
PHP PDO - Why is the result of a FETCH_ASSO() on a LAST_INSERT_ID() not indexed with the column name?
QUESTION:
All, I have some PHP PDO code that looks like this: prepare("SELECT LAST_INSERT_ID()"); $query->execute(); $result=$query->fetch(PDO::FETCH_ASSOC); // returns an array indexed by column name as return... | [
"php",
"mysql",
"pdo"
] | 1 | 4 | 237 | 2 | 0 | 2011-06-10T00:06:34.347000 | 2011-06-10T00:08:02.710000 |
6,300,661 | 6,300,773 | Android view customization problem | I am trying to organize my view with the following view widgets - TextView (should fill the width of the screen and has a specific height) Custom View Drawn using Draw() (fill the width and should start after the above textview and fill the screen) I am trying to write a board game and hence the custom view drawn. My p... | Try using this I tested a different layout in place of yours and it works fine. It should work with yours as well. RelativeLayout allows you to position items, well, relative to one another. You'll notice the attribute "layout_below" on your custom view where i specify the ID of the view to place it under. | Android view customization problem I am trying to organize my view with the following view widgets - TextView (should fill the width of the screen and has a specific height) Custom View Drawn using Draw() (fill the width and should start after the above textview and fill the screen) I am trying to write a board game an... | TITLE:
Android view customization problem
QUESTION:
I am trying to organize my view with the following view widgets - TextView (should fill the width of the screen and has a specific height) Custom View Drawn using Draw() (fill the width and should start after the above textview and fill the screen) I am trying to wri... | [
"android-layout",
"android"
] | 1 | 0 | 193 | 1 | 0 | 2011-06-10T00:08:41 | 2011-06-10T00:29:15.060000 |
6,300,668 | 6,300,689 | Is the image an attribute or I have to use a regex to get it? | I am trying to get the first image of each post of a feed. An image is always exists inside each as below <p><a href="http://lh5.ggpht.com/-kDNySEwupXc/Tesp_XbEXQI/AAAAAAAAKZY/t5TMtq7SkCs/s1600-h/image%25255B4%25255D.png"><....> I get the title, author and other content as below foreach ($entries as $entry) {
echo " "... | You could do the always reliable method of using a DOM parser. $dom = new DOMDocument;
$dom->loadXML(html_entity_decode($entry->description));
$imageSrc = $dom->getElementsByTagName('a')->item(0)->getAttribute('href'); CodePad. You may want to expand the code a bit to handle missing a element (check lengtg property) ... | Is the image an attribute or I have to use a regex to get it? I am trying to get the first image of each post of a feed. An image is always exists inside each as below <p><a href="http://lh5.ggpht.com/-kDNySEwupXc/Tesp_XbEXQI/AAAAAAAAKZY/t5TMtq7SkCs/s1600-h/image%25255B4%25255D.png"><....> I get the title, author and o... | TITLE:
Is the image an attribute or I have to use a regex to get it?
QUESTION:
I am trying to get the first image of each post of a feed. An image is always exists inside each as below <p><a href="http://lh5.ggpht.com/-kDNySEwupXc/Tesp_XbEXQI/AAAAAAAAKZY/t5TMtq7SkCs/s1600-h/image%25255B4%25255D.png"><....> I get the t... | [
"php",
"xml",
"regex"
] | 4 | 1 | 68 | 1 | 0 | 2011-06-10T00:09:41.453000 | 2011-06-10T00:13:48.480000 |
6,300,674 | 6,300,927 | for with multiple arrays | In Scheme you can iterate over multiple lists in with for-each: > (for-each (lambda (a b) (display (+ a b)) (newline)) '(10 20 30) '(1 2 3)) 11 22 33 > I know that in Perl you can use for to iterate over a single list. What's a good way to iterate over multiple lists as in the Scheme example? I'm interested in answers ... | In Perl 5 you can use the module List::MoreUtils. Either with pairwise or with the iterator returned by each_array (which can take more than two arrays to iterate through in parallel). use 5.12.0; use List::MoreUtils qw(pairwise each_array);
my @one = qw(a b c d e); my @two = qw(q w e r t);
my @three = pairwise {"$a:... | for with multiple arrays In Scheme you can iterate over multiple lists in with for-each: > (for-each (lambda (a b) (display (+ a b)) (newline)) '(10 20 30) '(1 2 3)) 11 22 33 > I know that in Perl you can use for to iterate over a single list. What's a good way to iterate over multiple lists as in the Scheme example? I... | TITLE:
for with multiple arrays
QUESTION:
In Scheme you can iterate over multiple lists in with for-each: > (for-each (lambda (a b) (display (+ a b)) (newline)) '(10 20 30) '(1 2 3)) 11 22 33 > I know that in Perl you can use for to iterate over a single list. What's a good way to iterate over multiple lists as in the... | [
"perl",
"raku"
] | 8 | 9 | 2,172 | 8 | 0 | 2011-06-10T00:11:14.190000 | 2011-06-10T00:59:17.027000 |
6,300,675 | 6,300,701 | Java - Mixed ArrayLists? | Is it possible to store a mixture of object types in an ArrayList? If so how? This is what I have tried so far: List list = new ArrayList ();
list.add(new String("Hello World")); list.add(new Integer(1)); list.add(new Long(1l));
for (i = 0; i < list.size(); i++) { if (list.get(i) instanceof String){ sqlPreparedStatem... | This is what you should have: List list = new ArrayList ();
list.add(new String("Hello World")); list.add(new Integer(1)); list.add(new Long(1l));
for (Object obj: list) { if (obj instanceof String){ sqlPreparedStatement.setString((String) obj); } else if (obj instanceof Integer) { sqlPreparedStatement.setInt((Intege... | Java - Mixed ArrayLists? Is it possible to store a mixture of object types in an ArrayList? If so how? This is what I have tried so far: List list = new ArrayList ();
list.add(new String("Hello World")); list.add(new Integer(1)); list.add(new Long(1l));
for (i = 0; i < list.size(); i++) { if (list.get(i) instanceof S... | TITLE:
Java - Mixed ArrayLists?
QUESTION:
Is it possible to store a mixture of object types in an ArrayList? If so how? This is what I have tried so far: List list = new ArrayList ();
list.add(new String("Hello World")); list.add(new Integer(1)); list.add(new Long(1l));
for (i = 0; i < list.size(); i++) { if (list.g... | [
"java",
"list",
"collections",
"arraylist",
"mixed"
] | 11 | 20 | 26,074 | 3 | 0 | 2011-06-10T00:11:19.160000 | 2011-06-10T00:15:58.463000 |
6,300,678 | 6,300,726 | split row in mysql check for values in between | I have a column with a bunch of rows with values like this. ZIP -------- Value 010-212 -- 8 214-268 -- 9 270-324 -- 7 I am submitting a value like 245 to mysql and trying to figure out a way to grab the associated number, which would be 9 in this case. How would I go about writing a mysql statement and being able to te... | Just for your knowledge select value from table where 245 between substring_index(zip,'-',1) and substring_index(zip,'-',-1) I totally agree with James' advice. | split row in mysql check for values in between I have a column with a bunch of rows with values like this. ZIP -------- Value 010-212 -- 8 214-268 -- 9 270-324 -- 7 I am submitting a value like 245 to mysql and trying to figure out a way to grab the associated number, which would be 9 in this case. How would I go about... | TITLE:
split row in mysql check for values in between
QUESTION:
I have a column with a bunch of rows with values like this. ZIP -------- Value 010-212 -- 8 214-268 -- 9 270-324 -- 7 I am submitting a value like 245 to mysql and trying to figure out a way to grab the associated number, which would be 9 in this case. Ho... | [
"mysql"
] | 0 | 0 | 70 | 1 | 0 | 2011-06-10T00:11:56.733000 | 2011-06-10T00:20:33.567000 |
6,300,683 | 6,300,724 | jQuery UI Autocomplete value after mouse click is old value | I'm using the jQuery UI Autocomplete widget. I need to use the selected text for further processing, direct after change or select. But when a user clicks the suggested value, the typed value gets passed. $( "#autocomplete" ).autocomplete({ source: function( req, resp ) { $.post( "/echo/json/", { json: '["Test1", "Test... | Change this: select: function (event, ui) { alert($(this).val())} To this: select: function (event, ui) {alert(ui.item.value);} New fiddle: http://jsfiddle.net/M3Yur/4/ | jQuery UI Autocomplete value after mouse click is old value I'm using the jQuery UI Autocomplete widget. I need to use the selected text for further processing, direct after change or select. But when a user clicks the suggested value, the typed value gets passed. $( "#autocomplete" ).autocomplete({ source: function( r... | TITLE:
jQuery UI Autocomplete value after mouse click is old value
QUESTION:
I'm using the jQuery UI Autocomplete widget. I need to use the selected text for further processing, direct after change or select. But when a user clicks the suggested value, the typed value gets passed. $( "#autocomplete" ).autocomplete({ s... | [
"jquery",
"jquery-ui",
"autocomplete"
] | 3 | 4 | 5,288 | 2 | 0 | 2011-06-10T00:12:21.523000 | 2011-06-10T00:20:14.903000 |
6,300,695 | 6,300,994 | "Unrolling" a recursive function? | I'm writing a path tracer in C++ and I'd like to try and implement the most resource-intensive code into CUDA or OpenCL (I'm not sure which one to pick). I've heard that my graphics card's version of CUDA doesn't support recursion, which is something my path tracer utilizes heavily. As I have it coded both in Python an... | In a recursive function, each time a recursive call occurs, the state of the caller is saved to a stack, then restored when the recursive call is complete. To convert a recursive function to an iterative one, you need to turn the state of the suspended function into an explicit data structure. Of course, you can create... | "Unrolling" a recursive function? I'm writing a path tracer in C++ and I'd like to try and implement the most resource-intensive code into CUDA or OpenCL (I'm not sure which one to pick). I've heard that my graphics card's version of CUDA doesn't support recursion, which is something my path tracer utilizes heavily. As... | TITLE:
"Unrolling" a recursive function?
QUESTION:
I'm writing a path tracer in C++ and I'd like to try and implement the most resource-intensive code into CUDA or OpenCL (I'm not sure which one to pick). I've heard that my graphics card's version of CUDA doesn't support recursion, which is something my path tracer ut... | [
"python",
"recursion",
"cuda",
"opencl"
] | 18 | 21 | 7,424 | 3 | 0 | 2011-06-10T00:14:37.887000 | 2011-06-10T01:12:06.613000 |
6,300,706 | 6,300,757 | Pascal for loops within repeat loops | you've all been so helpful so far, so heres another annoying problem for you! I've got a basic word guessing game, written in Pascal for a console in Delphi 7, where the guesses (right or wrong) are stored in a fixed array named "guesses" now what i need to do is test to see if they have guessed that letter already. I ... | The code you have written makes no sense. To exit the for loop when you find your guess, add a break below the guessed:= true. Why are you repeating the same logic infinitely using one condition that will always be true, and one condition that might easily be never true? I'm guessing you've shown part of your code insi... | Pascal for loops within repeat loops you've all been so helpful so far, so heres another annoying problem for you! I've got a basic word guessing game, written in Pascal for a console in Delphi 7, where the guesses (right or wrong) are stored in a fixed array named "guesses" now what i need to do is test to see if they... | TITLE:
Pascal for loops within repeat loops
QUESTION:
you've all been so helpful so far, so heres another annoying problem for you! I've got a basic word guessing game, written in Pascal for a console in Delphi 7, where the guesses (right or wrong) are stored in a fixed array named "guesses" now what i need to do is t... | [
"delphi",
"console",
"pascal"
] | 5 | 9 | 2,829 | 2 | 0 | 2011-06-10T00:16:53.853000 | 2011-06-10T00:26:40.520000 |
6,300,734 | 6,300,766 | Why not IO Unique an instance of Show and how to see what it is? | I am trying to use the Data.Unique in Haskell. The newUnique can generate an object, but I want to see what it is. How can I do that? | It generates an opaque, unique object different from all others in your program. You cannot look at it. You are allowed to hash it to an Int though: import Data.Unique
main = do u <- newUnique print (hashUnique u) Like so: *Main> main 1 *Main> main 2 *Main> main 3 *Main> main 4 | Why not IO Unique an instance of Show and how to see what it is? I am trying to use the Data.Unique in Haskell. The newUnique can generate an object, but I want to see what it is. How can I do that? | TITLE:
Why not IO Unique an instance of Show and how to see what it is?
QUESTION:
I am trying to use the Data.Unique in Haskell. The newUnique can generate an object, but I want to see what it is. How can I do that?
ANSWER:
It generates an opaque, unique object different from all others in your program. You cannot lo... | [
"haskell",
"unique",
"monads",
"symbols"
] | 2 | 4 | 227 | 1 | 0 | 2011-06-10T00:22:15.030000 | 2011-06-10T00:27:43.433000 |
6,300,740 | 6,300,860 | How to script SQL server database role? | I need to make a script to copy one particular database role from one SQL server to another. Is there an easy way to generate a script that creates the role and all the role permissions? | You can get what you need with a script like this: declare @RoleName varchar(50) = 'RoleName'
declare @Script varchar(max) = 'CREATE ROLE ' + @RoleName + char(13) select @script = @script + 'GRANT ' + prm.permission_name + ' ON ' + OBJECT_NAME(major_id) + ' TO ' + rol.name + char(13) COLLATE Latin1_General_CI_AS from ... | How to script SQL server database role? I need to make a script to copy one particular database role from one SQL server to another. Is there an easy way to generate a script that creates the role and all the role permissions? | TITLE:
How to script SQL server database role?
QUESTION:
I need to make a script to copy one particular database role from one SQL server to another. Is there an easy way to generate a script that creates the role and all the role permissions?
ANSWER:
You can get what you need with a script like this: declare @RoleNa... | [
"sql",
"sql-server",
"t-sql",
"sql-server-2008"
] | 26 | 32 | 52,786 | 8 | 0 | 2011-06-10T00:23:27.333000 | 2011-06-10T00:47:37.570000 |
6,300,743 | 6,303,101 | How is RDFa used? | I was wondering how RDFa is being used. More specifically, if the Semantic web of data is made up of triplees in RDF, how does a consumer of RDFa content use that data? Does it have to be converted with a tool like GRDDL? Or are there other methods of getting the semantic data from RDFa websites? Thanks, Bruce | One way is to use an RDFa parser to extract the triples from the RDFa document, and then process them in your app. this is what Google and co do in their search engines, I imagine. Alternatively you can tell a SPARQL store (either in memory or persistent) to load the document, either with it's API, or SPARQL 1.1's LOAD... | How is RDFa used? I was wondering how RDFa is being used. More specifically, if the Semantic web of data is made up of triplees in RDF, how does a consumer of RDFa content use that data? Does it have to be converted with a tool like GRDDL? Or are there other methods of getting the semantic data from RDFa websites? Than... | TITLE:
How is RDFa used?
QUESTION:
I was wondering how RDFa is being used. More specifically, if the Semantic web of data is made up of triplees in RDF, how does a consumer of RDFa content use that data? Does it have to be converted with a tool like GRDDL? Or are there other methods of getting the semantic data from R... | [
"rdf",
"semantic-web",
"rdfa"
] | 3 | 3 | 393 | 3 | 0 | 2011-06-10T00:23:50.727000 | 2011-06-10T07:08:36.840000 |
6,300,747 | 6,300,823 | How to securely store a user's passwords in open source software? | I'm writing a piece of open-source client software that can connect to web services on behalf of a user. The user enters his username and password, and the software connects using those credentials. For convenience purposes, I have an option for the software to save the user's credentials so that they don't need to be ... | There's a pretty good treatment of saved passwords in an open-source client by the Pidgin developers; the same reasoning would apply to a web service client. Executive summary: If the app saves passwords itself, leave them in plain text and set the file permissions to be readable only by the user. (This makes it obviou... | How to securely store a user's passwords in open source software? I'm writing a piece of open-source client software that can connect to web services on behalf of a user. The user enters his username and password, and the software connects using those credentials. For convenience purposes, I have an option for the soft... | TITLE:
How to securely store a user's passwords in open source software?
QUESTION:
I'm writing a piece of open-source client software that can connect to web services on behalf of a user. The user enters his username and password, and the software connects using those credentials. For convenience purposes, I have an o... | [
"encryption"
] | 2 | 1 | 1,072 | 1 | 0 | 2011-06-10T00:24:28.227000 | 2011-06-10T00:38:27.023000 |
6,300,749 | 6,300,813 | Is there a way to use max-width and height for a background image? | That simple. Moving my layout into a fluid territory, working on scalable images. Using the img tag and setting max-width to 100% works perfectly, but i'd rather use a div with the image set as its background. The issue I'm running into is that the image doesn't scale to the size of the div it's in the background of. A... | You can do this with background-size: html { background: url(images/bg.jpg) no-repeat center center fixed; background-size: cover; } There are a lot of values other than cover that you can set background-size to, see which one works for you: https://developer.mozilla.org/en-US/docs/Web/CSS/background-size Spec: https:/... | Is there a way to use max-width and height for a background image? That simple. Moving my layout into a fluid territory, working on scalable images. Using the img tag and setting max-width to 100% works perfectly, but i'd rather use a div with the image set as its background. The issue I'm running into is that the imag... | TITLE:
Is there a way to use max-width and height for a background image?
QUESTION:
That simple. Moving my layout into a fluid territory, working on scalable images. Using the img tag and setting max-width to 100% works perfectly, but i'd rather use a div with the image set as its background. The issue I'm running int... | [
"image",
"fluid",
"css"
] | 59 | 29 | 192,365 | 6 | 0 | 2011-06-10T00:25:02.810000 | 2011-06-10T00:36:50.990000 |
6,300,751 | 6,300,943 | Input field, in table row, does not conform to std need to show error in next column of that row | I hope what i want to do makes sense. I have the following form. The fields are in a table. * First Name: 11 22 The fields need to conform to certain standards. This field has the following attribute which gets checked: inputMin="3". If the input length is less then I want to display an error in the 22. My script looks... | $(this).closest('tr').find('td:last span') will give you the span inside the last td of current row. | Input field, in table row, does not conform to std need to show error in next column of that row I hope what i want to do makes sense. I have the following form. The fields are in a table. * First Name: 11 22 The fields need to conform to certain standards. This field has the following attribute which gets checked: inp... | TITLE:
Input field, in table row, does not conform to std need to show error in next column of that row
QUESTION:
I hope what i want to do makes sense. I have the following form. The fields are in a table. * First Name: 11 22 The fields need to conform to certain standards. This field has the following attribute which... | [
"jquery",
"tablerow"
] | 0 | 0 | 197 | 1 | 0 | 2011-06-10T00:25:23.677000 | 2011-06-10T01:02:11.167000 |
6,300,752 | 6,300,767 | What are some good solutions for testing in ie6? | Unfortunately I still have to support ie6. I currently don't have a machine with ie6 on it any longer and would like to here what you all use. Thank you! | Download a virtual machine with XP on it and run IE6 in there! | What are some good solutions for testing in ie6? Unfortunately I still have to support ie6. I currently don't have a machine with ie6 on it any longer and would like to here what you all use. Thank you! | TITLE:
What are some good solutions for testing in ie6?
QUESTION:
Unfortunately I still have to support ie6. I currently don't have a machine with ie6 on it any longer and would like to here what you all use. Thank you!
ANSWER:
Download a virtual machine with XP on it and run IE6 in there! | [
"asp.net",
"testing",
"cross-browser",
"internet-explorer-6"
] | 0 | 2 | 63 | 4 | 0 | 2011-06-10T00:25:42.690000 | 2011-06-10T00:27:44.220000 |
6,300,756 | 6,300,916 | long polling in objective-C | I have an application that uses an API to get real time updates on the website. They use what they call a long-polling technique: Long polling is a variation of the traditional polling technique and allows emulation of an information push from a server to a client. With long polling, the client requests information fro... | This is exactly the sort of use-case that NSURLConnection sendSynchronousRequest is perfect for: - (void) longPoll { //create an autorelease pool for the thread NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
//compose the request NSError* error = nil; NSURLResponse* response = nil; NSURL* requestUrl = [NS... | long polling in objective-C I have an application that uses an API to get real time updates on the website. They use what they call a long-polling technique: Long polling is a variation of the traditional polling technique and allows emulation of an information push from a server to a client. With long polling, the cli... | TITLE:
long polling in objective-C
QUESTION:
I have an application that uses an API to get real time updates on the website. They use what they call a long-polling technique: Long polling is a variation of the traditional polling technique and allows emulation of an information push from a server to a client. With lon... | [
"iphone",
"objective-c",
"ipad"
] | 14 | 20 | 16,125 | 2 | 0 | 2011-06-10T00:26:27.510000 | 2011-06-10T00:57:54.817000 |
6,300,759 | 6,300,799 | Help with using a while loop and if statement | I'm trying to write a program that reads 2 numbers from the user and divides them. Here is the code I have so far: import java.util.Scanner;
public class divideByZero {
public static int quotient(int numerator, int denominator) { return numerator / denominator; }
public static void main(String args[]) { Scanner scan... | This isn't an answer to your question, but you need to convert at least one of those numbers to a double. Right now you'll just be doing integer division, i.e. 5/3 = 1. You can do this with double num = (double) denominator. Second, this is a good use of a do while loop. Keep asking for the number until it isn't a 0. Y... | Help with using a while loop and if statement I'm trying to write a program that reads 2 numbers from the user and divides them. Here is the code I have so far: import java.util.Scanner;
public class divideByZero {
public static int quotient(int numerator, int denominator) { return numerator / denominator; }
public ... | TITLE:
Help with using a while loop and if statement
QUESTION:
I'm trying to write a program that reads 2 numbers from the user and divides them. Here is the code I have so far: import java.util.Scanner;
public class divideByZero {
public static int quotient(int numerator, int denominator) { return numerator / denom... | [
"java",
"if-statement",
"while-loop",
"divide-by-zero"
] | 0 | 4 | 2,218 | 3 | 0 | 2011-06-10T00:26:52.817000 | 2011-06-10T00:34:36.857000 |
6,300,782 | 6,300,800 | How to find all database rows with a time AFTER a specific time | I have a "last_action" column in my users table that updates a unix timestamp every time a user takes an action. I want to select all users in my users table who have made an action on the site after a specific time (probably 15 minutes, the goal here is to make a ghetto users online list). I want to do something like ... | Maybe this will work? User.where("users.last_action >?", 15.minutes.ago) | How to find all database rows with a time AFTER a specific time I have a "last_action" column in my users table that updates a unix timestamp every time a user takes an action. I want to select all users in my users table who have made an action on the site after a specific time (probably 15 minutes, the goal here is t... | TITLE:
How to find all database rows with a time AFTER a specific time
QUESTION:
I have a "last_action" column in my users table that updates a unix timestamp every time a user takes an action. I want to select all users in my users table who have made an action on the site after a specific time (probably 15 minutes, ... | [
"mysql",
"ruby-on-rails"
] | 0 | 1 | 45 | 2 | 0 | 2011-06-10T00:30:43.330000 | 2011-06-10T00:34:40.023000 |
6,300,786 | 6,300,848 | Rails3 confused on active relations | I have checkedout the docs on this but I am still a bit confused. My goal is to return the content field on @mom. But it fails with undefined method `content'. and @goals works. What am I missing about @mom and how can I get that to work? project_controller.rb def show @project = Project.find(params[:id]) @goals = @pro... | Try this in your controller instead (it'll return one record rather than an array with one record): @mom = @project.projectgoals.order("created_at DESC").first | Rails3 confused on active relations I have checkedout the docs on this but I am still a bit confused. My goal is to return the content field on @mom. But it fails with undefined method `content'. and @goals works. What am I missing about @mom and how can I get that to work? project_controller.rb def show @project = Pro... | TITLE:
Rails3 confused on active relations
QUESTION:
I have checkedout the docs on this but I am still a bit confused. My goal is to return the content field on @mom. But it fails with undefined method `content'. and @goals works. What am I missing about @mom and how can I get that to work? project_controller.rb def s... | [
"ruby-on-rails",
"active-relation"
] | 1 | 0 | 185 | 1 | 0 | 2011-06-10T00:31:07.223000 | 2011-06-10T00:44:30.593000 |
6,300,791 | 6,300,831 | Handling OnClick event for canvas in javascript and getting its coordinates | I have a canvas for drawing like that I need to handle the event when clicking on it and get the coordinates on the canvas where it was clicked | You need to get the page x and y coordinates, and then minus the canvas offset to get them relative to the canvas. function q(event) { event = event || window.event;
var canvas = document.getElementById('canvas'), x = event.pageX - canvas.offsetLeft, y = event.pageY - canvas.offsetTop;
alert(x + ' ' + y); } jsFiddle.... | Handling OnClick event for canvas in javascript and getting its coordinates I have a canvas for drawing like that I need to handle the event when clicking on it and get the coordinates on the canvas where it was clicked | TITLE:
Handling OnClick event for canvas in javascript and getting its coordinates
QUESTION:
I have a canvas for drawing like that I need to handle the event when clicking on it and get the coordinates on the canvas where it was clicked
ANSWER:
You need to get the page x and y coordinates, and then minus the canvas o... | [
"javascript",
"canvas",
"event-handling",
"onclick",
"coordinates"
] | 14 | 10 | 18,203 | 3 | 0 | 2011-06-10T00:32:31.573000 | 2011-06-10T00:40:27.810000 |
6,300,797 | 6,300,829 | Zend Auth - Indentities | I have an auth resource in my library that is correctly returning one of the various statuses based on whether or not the user exists, wrong password, or correct password. I'm trying to get the identity into my controllers though. So in the auth resource I return the status along with user. What needs to happen in my c... | If use stored the indentiy with Zend_Auth you can get it everywhere you want with: Zend_Auth::getInstance()->getIdentity() see also Matthews Tutorial on Zend_Auth | Zend Auth - Indentities I have an auth resource in my library that is correctly returning one of the various statuses based on whether or not the user exists, wrong password, or correct password. I'm trying to get the identity into my controllers though. So in the auth resource I return the status along with user. What... | TITLE:
Zend Auth - Indentities
QUESTION:
I have an auth resource in my library that is correctly returning one of the various statuses based on whether or not the user exists, wrong password, or correct password. I'm trying to get the identity into my controllers though. So in the auth resource I return the status alo... | [
"php",
"zend-framework",
"zend-auth"
] | 1 | 2 | 239 | 2 | 0 | 2011-06-10T00:34:29.757000 | 2011-06-10T00:39:51.193000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.