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,233,932 | 6,234,117 | function for creating combinations of strings | I'll do my best to describe what I'm trying to accomplish: Lets say for every letter I have one or more replacements: a = a b = X, Z c = c d = W, V, M e = e If I'm given a string, say 'abcd', I want to create strings with combinatons of replacements, so for example 'abcd' would produce following combinations: aXcW aXcV... | here's a simple recursive solution for you function repl($str, $map) { if(strlen($str) == 0) return array(''); $out = array(); foreach(repl(substr($str, 1), $map) as $r) foreach($map[$str[0]] as $sub) $out[] = $sub. $r; return $out; } use like this $map = array( 'a' => array('1', '2', '3'), 'b' => array('@', '*'), 'c' ... | function for creating combinations of strings I'll do my best to describe what I'm trying to accomplish: Lets say for every letter I have one or more replacements: a = a b = X, Z c = c d = W, V, M e = e If I'm given a string, say 'abcd', I want to create strings with combinatons of replacements, so for example 'abcd' w... | TITLE:
function for creating combinations of strings
QUESTION:
I'll do my best to describe what I'm trying to accomplish: Lets say for every letter I have one or more replacements: a = a b = X, Z c = c d = W, V, M e = e If I'm given a string, say 'abcd', I want to create strings with combinatons of replacements, so fo... | [
"php",
"function"
] | 2 | 1 | 195 | 1 | 0 | 2011-06-04T00:45:26.003000 | 2011-06-04T01:34:21.687000 |
6,233,942 | 6,233,967 | DropDownList error 'does not exist in the in the list of items' ASP.NET C# | I was trying to make a custom application form. I've added some control like TextBox and Button so far everything is fine until I modified some of the TextBox with a DropDownList control. When I click the add button it returns an error: 'categoryDropDownList' has a SelectedValue which is invalid because it does not exi... | Your DropDown is bound to SqlDataSource. When you execute categoryDropDownList.SelectedValue = "", the DropDown is looking for empty value in the data source, but can't find such, so it fails. If might want to run dropDownList.ClearSelection() if this is what you are trying to achieve. Here is simplified code example t... | DropDownList error 'does not exist in the in the list of items' ASP.NET C# I was trying to make a custom application form. I've added some control like TextBox and Button so far everything is fine until I modified some of the TextBox with a DropDownList control. When I click the add button it returns an error: 'categor... | TITLE:
DropDownList error 'does not exist in the in the list of items' ASP.NET C#
QUESTION:
I was trying to make a custom application form. I've added some control like TextBox and Button so far everything is fine until I modified some of the TextBox with a DropDownList control. When I click the add button it returns ... | [
"c#",
"asp.net"
] | 3 | 3 | 7,706 | 2 | 0 | 2011-06-04T00:49:20.550000 | 2011-06-04T00:55:49.507000 |
6,233,943 | 6,233,953 | What's the best way to store elapsed times in a database | I working on a horse racing application and have the need to store elapsed times from races in a table. I will be importing data from a comma delimited file that provides the final time in one format and the interior elapsed times in another. The following is an example: Final Time: 109.39 (1 minute, 9 seconds and 39/1... | Generally timespans are either stored as (1) seconds elapsed or (2) start / end datetime. Seconds elapsed can be an integer or a float / double if you require it. You could be creative / crazy and store all times as milliseconds in which case you'd only need an integer. | What's the best way to store elapsed times in a database I working on a horse racing application and have the need to store elapsed times from races in a table. I will be importing data from a comma delimited file that provides the final time in one format and the interior elapsed times in another. The following is an ... | TITLE:
What's the best way to store elapsed times in a database
QUESTION:
I working on a horse racing application and have the need to store elapsed times from races in a table. I will be importing data from a comma delimited file that provides the final time in one format and the interior elapsed times in another. Th... | [
"database",
"ruby-on-rails-3",
"database-design",
"activerecord",
"time"
] | 2 | 4 | 1,805 | 4 | 0 | 2011-06-04T00:49:31.670000 | 2011-06-04T00:52:21.120000 |
6,233,989 | 6,256,954 | Is it possible to change a ListBox' ItemTemplate from a Storyboard? | I have a behavior that changes the visual state based on the page's orientation (portrait/landscape). I have a ListBox with a somewhat complex DataTemplate for its ItemTemplate. Is it possible to change the ItemTemplate from a VisualState's Storyboard? My XAML karma is low, and Blend doesn't let me do it (it changes th... | I probably didn't get an answer because it was too obvious. I told you my XAML karma was low. Here is the solution. Simply add this ObjectAnimationUsingKeyFrames to your storyboard: I didn't return to Blend yet, to see if the template was editable. Will update below. | Is it possible to change a ListBox' ItemTemplate from a Storyboard? I have a behavior that changes the visual state based on the page's orientation (portrait/landscape). I have a ListBox with a somewhat complex DataTemplate for its ItemTemplate. Is it possible to change the ItemTemplate from a VisualState's Storyboard?... | TITLE:
Is it possible to change a ListBox' ItemTemplate from a Storyboard?
QUESTION:
I have a behavior that changes the visual state based on the page's orientation (portrait/landscape). I have a ListBox with a somewhat complex DataTemplate for its ItemTemplate. Is it possible to change the ItemTemplate from a VisualS... | [
"windows-phone-7",
"silverlight-3.0",
"storyboard"
] | 1 | 1 | 986 | 1 | 0 | 2011-06-04T01:02:03.943000 | 2011-06-06T19:25:11.820000 |
6,233,990 | 6,234,006 | What is wrong with following C++ code (regarding shared_ptr) | I am trying to get up to speed with using shared_ptr, but I can't seem to figure out why the following code wont compile. In the header file, private member declaration: std::map > > *_myMap; In the constructor, trying to instantiate an object of the above: _myMap = new map > >(); The error message: Test.cpp:14:68: err... | You cannot have posted your code verbatim. Your header must say std::map > *_myMap; Are you sure you're building properly? Try a fresh build. | What is wrong with following C++ code (regarding shared_ptr) I am trying to get up to speed with using shared_ptr, but I can't seem to figure out why the following code wont compile. In the header file, private member declaration: std::map > > *_myMap; In the constructor, trying to instantiate an object of the above: _... | TITLE:
What is wrong with following C++ code (regarding shared_ptr)
QUESTION:
I am trying to get up to speed with using shared_ptr, but I can't seem to figure out why the following code wont compile. In the header file, private member declaration: std::map > > *_myMap; In the constructor, trying to instantiate an obje... | [
"c++"
] | 1 | 0 | 230 | 2 | 0 | 2011-06-04T01:02:22.337000 | 2011-06-04T01:07:09.660000 |
6,233,992 | 6,234,009 | T4 Template Transformation Service | We currently have an asp.net website that we use to generate html emails. Basically we pass in some parameters and it spits out an html page that we then send in an email. Essentially ASP.NET is our templating engine. I was looking to for a different way of doing this and I was thinking about using T4 templates instead... | Absolutely. See the following links: http://msdn.microsoft.com/en-us/library/bb126445.aspx http://msdn.microsoft.com/en-us/library/ee844259.aspx There is a command-line utility: TextTransform.exe. http://msdn.microsoft.com/en-us/library/bb126245.aspx | T4 Template Transformation Service We currently have an asp.net website that we use to generate html emails. Basically we pass in some parameters and it spits out an html page that we then send in an email. Essentially ASP.NET is our templating engine. I was looking to for a different way of doing this and I was thinki... | TITLE:
T4 Template Transformation Service
QUESTION:
We currently have an asp.net website that we use to generate html emails. Basically we pass in some parameters and it spits out an html page that we then send in an email. Essentially ASP.NET is our templating engine. I was looking to for a different way of doing thi... | [
".net",
"asp.net",
"c#-4.0",
"code-generation",
"t4"
] | 1 | 1 | 210 | 1 | 0 | 2011-06-04T01:02:49.370000 | 2011-06-04T01:08:05.087000 |
6,234,003 | 6,234,186 | How can I restore my Delphi associations without re-installing the IDE? | Today I lost my Delphi-2007 associations; does any way exist to restore my Delphi file associations (.pas,.dpk, etc) without running the installer of Delphi? | Type assoc /? at a command prompt. This will show you how to associate file extensions with file types. If the basic registry is not corrupted, you can use assoc *.pas BSD.pasfile to reconnect Delphi 2007 with Pascal source files. Repeat the above with the other file types to reconnect them: assoc *.dpk BDS.dpkfile ass... | How can I restore my Delphi associations without re-installing the IDE? Today I lost my Delphi-2007 associations; does any way exist to restore my Delphi file associations (.pas,.dpk, etc) without running the installer of Delphi? | TITLE:
How can I restore my Delphi associations without re-installing the IDE?
QUESTION:
Today I lost my Delphi-2007 associations; does any way exist to restore my Delphi file associations (.pas,.dpk, etc) without running the installer of Delphi?
ANSWER:
Type assoc /? at a command prompt. This will show you how to as... | [
"delphi"
] | 4 | 18 | 2,480 | 4 | 0 | 2011-06-04T01:06:29.637000 | 2011-06-04T01:53:23.013000 |
6,234,004 | 6,246,644 | Django: singleton per request? | We have a wrapper around a suds (SOAP) request, that we use like this throughout our app: from app.wrapper import ByDesign bd = ByDesign() Unfortunately, this instantiation is made at several points per request, causing suds to redownload the WSDL file, and I think we could save some time by making bd = ByDesign() retu... | Check out threading.local(), which is somewhere between pure evil and the only way to get things going. It should probably be something like this: import threading
_local = threading.local()
def ByDesign(): if 'bd' not in _local.__dict__: _local.bd = ByDesignRenamed() return _local.bd Further reading: Why is using th... | Django: singleton per request? We have a wrapper around a suds (SOAP) request, that we use like this throughout our app: from app.wrapper import ByDesign bd = ByDesign() Unfortunately, this instantiation is made at several points per request, causing suds to redownload the WSDL file, and I think we could save some time... | TITLE:
Django: singleton per request?
QUESTION:
We have a wrapper around a suds (SOAP) request, that we use like this throughout our app: from app.wrapper import ByDesign bd = ByDesign() Unfortunately, this instantiation is made at several points per request, causing suds to redownload the WSDL file, and I think we co... | [
"django"
] | 9 | 10 | 3,505 | 1 | 0 | 2011-06-04T01:06:31.600000 | 2011-06-05T23:35:23.040000 |
6,234,005 | 6,234,012 | Bash HTML for version 3.2? | I've been using the bash manual from this link but it is for ver 4.2 and I'm using 3.2. Does anyone know where to find an HTML for 3.2? | If you don't like to use man(1), you can use a tool such as man2html to transform your bash's manual page into HTML. Otherwise, just: man bash. | Bash HTML for version 3.2? I've been using the bash manual from this link but it is for ver 4.2 and I'm using 3.2. Does anyone know where to find an HTML for 3.2? | TITLE:
Bash HTML for version 3.2?
QUESTION:
I've been using the bash manual from this link but it is for ver 4.2 and I'm using 3.2. Does anyone know where to find an HTML for 3.2?
ANSWER:
If you don't like to use man(1), you can use a tool such as man2html to transform your bash's manual page into HTML. Otherwise, ju... | [
"bash",
"manpage"
] | 0 | 1 | 316 | 2 | 0 | 2011-06-04T01:07:02.763000 | 2011-06-04T01:09:34.590000 |
6,234,010 | 6,287,340 | SQL - Informix error leads to another error - hallway of mirrors P.I.T.A | I'm using Informix version 11.50.FC6 via iSql I'm giving the result of a CASE block a virtual name, att_hrs SELECT c.id, CASE WHEN ( c.prog = 'UNDG' AND (c.grd IN (SELECT DISTINCT grd FROM grd_table WHERE att_fctr = 1) OR (c.grd IN ('TR','W','LAB','WC'))) AND c.grd NOT IN ('WM') AND c.stat NOT IN ('X','D')) THEN CAST(S... | I took everyone's advice that it isn't possible and rewrote it using UNION blocks. Table & field name(s) may have varied, but here's the idea: SELECT s.id, SUM(c.hrs) hrs, 'ATT' type FROM expected_contacts s, OUTER stu_crs c WHERE s.id = c.id AND c.prog = 'UNDG' AND c.grd NOT IN ('WM') AND c.stat NOT IN ('X','D') AND (... | SQL - Informix error leads to another error - hallway of mirrors P.I.T.A I'm using Informix version 11.50.FC6 via iSql I'm giving the result of a CASE block a virtual name, att_hrs SELECT c.id, CASE WHEN ( c.prog = 'UNDG' AND (c.grd IN (SELECT DISTINCT grd FROM grd_table WHERE att_fctr = 1) OR (c.grd IN ('TR','W','LAB'... | TITLE:
SQL - Informix error leads to another error - hallway of mirrors P.I.T.A
QUESTION:
I'm using Informix version 11.50.FC6 via iSql I'm giving the result of a CASE block a virtual name, att_hrs SELECT c.id, CASE WHEN ( c.prog = 'UNDG' AND (c.grd IN (SELECT DISTINCT grd FROM grd_table WHERE att_fctr = 1) OR (c.grd ... | [
"sql",
"compiler-errors",
"informix",
"isql"
] | 2 | 0 | 2,733 | 4 | 0 | 2011-06-04T01:08:59.010000 | 2011-06-09T02:08:10.703000 |
6,234,016 | 6,235,921 | Jenkins User on Apt-Get Install Installation | I just installed Jenkins on my Ubuntu server via the debian installation steps (using apt-get install). I want my build to pull from a private git repository on GitHub. With that, I need to use SSH access to get to my repository. Most of my search results have just said to login as the Jenkins user and generate an SSH ... | I'll anticipate that from time to time you'll want to be able to log in as jenkins to do other tasks, and so I'll solve the more general problem. A strict answer to your question is included at the end. Change jenkins' password without knowing it From any account which has sudo permissions, you can reset jenkins' passw... | Jenkins User on Apt-Get Install Installation I just installed Jenkins on my Ubuntu server via the debian installation steps (using apt-get install). I want my build to pull from a private git repository on GitHub. With that, I need to use SSH access to get to my repository. Most of my search results have just said to l... | TITLE:
Jenkins User on Apt-Get Install Installation
QUESTION:
I just installed Jenkins on my Ubuntu server via the debian installation steps (using apt-get install). I want my build to pull from a private git repository on GitHub. With that, I need to use SSH access to get to my repository. Most of my search results h... | [
"ubuntu",
"jenkins",
"continuous-integration",
"apt-get"
] | 55 | 94 | 30,113 | 1 | 0 | 2011-06-04T01:11:13.180000 | 2011-06-04T09:30:00.100000 |
6,234,018 | 6,234,246 | Executing multiple statements in if-else without nullpointer exception | I'm trying to dig a little deeper into clojure and functional programming. At some point of my code I have a (def server (spawn-server)). Now I want a short function for the REPL to check the state of this socket. This is what I have at the moment: (defn status [] (if server ( (println "server is up and running") (prin... | Use do: (defn status [] (if server (do (println "server is up and running") (println "connections:" (connection-count server))) (println "server is down"))) In Lisps, generally, you can't just add parens for grouping. ((println "foo") (println "foo")) Here, the return value of the first (println "foo") will be tried to... | Executing multiple statements in if-else without nullpointer exception I'm trying to dig a little deeper into clojure and functional programming. At some point of my code I have a (def server (spawn-server)). Now I want a short function for the REPL to check the state of this socket. This is what I have at the moment: ... | TITLE:
Executing multiple statements in if-else without nullpointer exception
QUESTION:
I'm trying to dig a little deeper into clojure and functional programming. At some point of my code I have a (def server (spawn-server)). Now I want a short function for the REPL to check the state of this socket. This is what I ha... | [
"clojure"
] | 47 | 74 | 14,179 | 1 | 0 | 2011-06-04T01:12:04.963000 | 2011-06-04T02:10:25.200000 |
6,234,021 | 6,234,036 | Reflection and Private Native Methods | I am using reflection to dynamically call some methods from extended class. Unfortunately one of these methods is declared as private native and as soon as I make the call... I receive the following exception: java.lang.IllegalAccessException: Class com.something.somewhere.MyThing ca n not access a member of class com.... | are you calling setAccessible(true) on the Method before invoking it? | Reflection and Private Native Methods I am using reflection to dynamically call some methods from extended class. Unfortunately one of these methods is declared as private native and as soon as I make the call... I receive the following exception: java.lang.IllegalAccessException: Class com.something.somewhere.MyThing ... | TITLE:
Reflection and Private Native Methods
QUESTION:
I am using reflection to dynamically call some methods from extended class. Unfortunately one of these methods is declared as private native and as soon as I make the call... I receive the following exception: java.lang.IllegalAccessException: Class com.something.... | [
"java",
"reflection"
] | 3 | 6 | 2,288 | 1 | 0 | 2011-06-04T01:12:54.653000 | 2011-06-04T01:17:59.893000 |
6,234,023 | 6,234,419 | Camera intent problem, camera is starting without request | I have a little problem with my camera intent. As I know, when camera orientation is changed, activity is restarted. Okej, I am using the code bellow. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (myApplication)getApplication();
if(savedInstanceState ==null )... | I suspect you want to be using the simpler startActivity() and finish() methods instead of startActivityFromChild() and finishFromChild(). I admit, however, that I'm a bit unclear as to what the use of the ones you are actually for. | Camera intent problem, camera is starting without request I have a little problem with my camera intent. As I know, when camera orientation is changed, activity is restarted. Okej, I am using the code bellow. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (myApp... | TITLE:
Camera intent problem, camera is starting without request
QUESTION:
I have a little problem with my camera intent. As I know, when camera orientation is changed, activity is restarted. Okej, I am using the code bellow. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSt... | [
"android",
"android-camera-intent"
] | 0 | 0 | 896 | 1 | 0 | 2011-06-04T01:13:25.973000 | 2011-06-04T02:57:31.040000 |
6,234,026 | 6,235,920 | Javascript popup in Drupal without redirect? | I am attempting to create a javascript function to create a popup window from my drupal site. function popitup() { newwindow=window.open('popup.html','name','height=200,width=150'); if (window.focus) {newwindow.focus()} return false; } This works fine, except that Drupal redirects the url to the main-page of my module.... | Have you tried to use an absolute link in your function? I think the issue comes from a misunderstanding between your function and Drupal URL Rewriting feature. If it is the case you can simply fix it by using the full absolute url to your html file. Ex: function popitup() { newwindow = window.open('http://www.yoursite... | Javascript popup in Drupal without redirect? I am attempting to create a javascript function to create a popup window from my drupal site. function popitup() { newwindow=window.open('popup.html','name','height=200,width=150'); if (window.focus) {newwindow.focus()} return false; } This works fine, except that Drupal red... | TITLE:
Javascript popup in Drupal without redirect?
QUESTION:
I am attempting to create a javascript function to create a popup window from my drupal site. function popitup() { newwindow=window.open('popup.html','name','height=200,width=150'); if (window.focus) {newwindow.focus()} return false; } This works fine, exce... | [
"php",
"javascript",
"drupal"
] | 0 | 3 | 1,033 | 1 | 0 | 2011-06-04T01:14:39.317000 | 2011-06-04T09:29:55.063000 |
6,234,028 | 6,235,160 | Does the ListBox in MFC framework have limited item length? | Dose the ListBox in MFC framework have limited item length? If so, what is the limit? | There is a limit. For an owner draw one it's probably related to the limits of the GDI coordinate system. However, long before you reach the ListBox limit, you reach the limit of good UI. Wide horizontally scrollable listboxes aren't easy to use. If you have very wide data to expose, consider another UI abstraction, li... | Does the ListBox in MFC framework have limited item length? Dose the ListBox in MFC framework have limited item length? If so, what is the limit? | TITLE:
Does the ListBox in MFC framework have limited item length?
QUESTION:
Dose the ListBox in MFC framework have limited item length? If so, what is the limit?
ANSWER:
There is a limit. For an owner draw one it's probably related to the limits of the GDI coordinate system. However, long before you reach the ListBo... | [
"visual-c++",
"mfc",
"listbox"
] | 0 | 3 | 1,179 | 1 | 0 | 2011-06-04T01:16:08.070000 | 2011-06-04T06:28:58.850000 |
6,234,035 | 6,234,050 | What's the best way to compare variable string equality in PHP/MySQL? | I'm trying to check a string passed through the URL and get back all results from a MySQL database where that string is a match. I send different queries based on the input, but the one in question looks basically like this (it's really much longer): if ($projectsname) {$result = mysql_query("SELECT item FROM items WHE... | if ($projectsname) {$result = mysql_query("SELECT item FROM items WHERE projectname='$projectsname'",$db)} You need to quote strings that you pass to mysql. | What's the best way to compare variable string equality in PHP/MySQL? I'm trying to check a string passed through the URL and get back all results from a MySQL database where that string is a match. I send different queries based on the input, but the one in question looks basically like this (it's really much longer):... | TITLE:
What's the best way to compare variable string equality in PHP/MySQL?
QUESTION:
I'm trying to check a string passed through the URL and get back all results from a MySQL database where that string is a match. I send different queries based on the input, but the one in question looks basically like this (it's re... | [
"php",
"mysql",
"string-comparison"
] | 0 | 4 | 6,669 | 3 | 0 | 2011-06-04T01:17:22.763000 | 2011-06-04T01:22:20.833000 |
6,234,038 | 6,242,739 | Using reflection to specify the type of a delegate (to attach to an event)? | What I effectively want to do is something like this (I realise this is not valid code): // Attach the event. try { EventInfo e = mappings[name]; (e.EventHandlerType) handler = (sender, raw) => { AutoWrapEventArgs args = raw as AutoWrapEventArgs; func.Call(this, args.GetParameters()); };
e.AddEventHandler(this, handle... | Bingo! The trick is to get a reference to the constructor for the delegate type and then invoke it using the following parameters: The target object of the delegate (backend.Target) The delegate's pointer (backend.Method.MethodHandle.GetFunctionPointer()) The actual code that does this looks like (t in this case is the... | Using reflection to specify the type of a delegate (to attach to an event)? What I effectively want to do is something like this (I realise this is not valid code): // Attach the event. try { EventInfo e = mappings[name]; (e.EventHandlerType) handler = (sender, raw) => { AutoWrapEventArgs args = raw as AutoWrapEventArg... | TITLE:
Using reflection to specify the type of a delegate (to attach to an event)?
QUESTION:
What I effectively want to do is something like this (I realise this is not valid code): // Attach the event. try { EventInfo e = mappings[name]; (e.EventHandlerType) handler = (sender, raw) => { AutoWrapEventArgs args = raw a... | [
"c#",
"events",
"reflection",
".net-3.5",
"delegates"
] | 3 | 2 | 1,442 | 2 | 0 | 2011-06-04T01:18:40.387000 | 2011-06-05T11:55:02.630000 |
6,234,044 | 6,234,136 | HTML5 input types kill jQuery validation | The jQuery validation plugin breaks for elements that have a HTML5 type defined. $(document).ready(function(){ $("#myform").validate() });...... Adding the html5 attribute type="email" to the input causes the validation to fail. I want to use type="email" because mobile phones use this attribute to display the proper k... | You might be able to merge this pull request with the main trunk, if you're willing to maintain your own version of the plugin (the patch is quite small and, from a cursory look at the code, seems like the right thing to do, though it would certainly require testing). You may also be able to fallback to just using the ... | HTML5 input types kill jQuery validation The jQuery validation plugin breaks for elements that have a HTML5 type defined. $(document).ready(function(){ $("#myform").validate() });...... Adding the html5 attribute type="email" to the input causes the validation to fail. I want to use type="email" because mobile phones u... | TITLE:
HTML5 input types kill jQuery validation
QUESTION:
The jQuery validation plugin breaks for elements that have a HTML5 type defined. $(document).ready(function(){ $("#myform").validate() });...... Adding the html5 attribute type="email" to the input causes the validation to fail. I want to use type="email" becau... | [
"jquery",
"html",
"jquery-validate"
] | 7 | 8 | 6,187 | 2 | 0 | 2011-06-04T01:20:00.197000 | 2011-06-04T01:39:16.840000 |
6,234,045 | 6,234,383 | How do you access Devise controllers? | Are controllers in devise automatically generated? How do you access them? I know for views you do rails generate devise_views. | Devise uses internal controllers, which you can access and subclass in your own code. They are under the Devise module. For example, to extend the RegistrationsController: class MembershipsController < Devise::RegistrationsController #... end Then all you have to do is configure Devise's routes to use your controller i... | How do you access Devise controllers? Are controllers in devise automatically generated? How do you access them? I know for views you do rails generate devise_views. | TITLE:
How do you access Devise controllers?
QUESTION:
Are controllers in devise automatically generated? How do you access them? I know for views you do rails generate devise_views.
ANSWER:
Devise uses internal controllers, which you can access and subclass in your own code. They are under the Devise module. For exa... | [
"ruby-on-rails",
"devise"
] | 48 | 41 | 55,182 | 5 | 0 | 2011-06-04T01:21:14.457000 | 2011-06-04T02:48:17.490000 |
6,234,047 | 6,234,194 | extract content between all paragraph tags | How do I extract only the content between all of the tags in a given string? I know preg_match or regex but I spent hours already trying to put this stuff together. thought I'd just ask. simple question and a simple answer i hope. Thanks in advance. this would be in PHP, btw. | DOMDocument::loadHTML. Maybe not the fastest option, but should be simple. Something like (it's been a while since I've actually written PHP...): $doc = new DOMDocument(); $doc->loadHTML($string); foreach($doc->getElementsByTagName('p') as $paragraph) { // do something with $paragraph->textContent } | extract content between all paragraph tags How do I extract only the content between all of the tags in a given string? I know preg_match or regex but I spent hours already trying to put this stuff together. thought I'd just ask. simple question and a simple answer i hope. Thanks in advance. this would be in PHP, btw. | TITLE:
extract content between all paragraph tags
QUESTION:
How do I extract only the content between all of the tags in a given string? I know preg_match or regex but I spent hours already trying to put this stuff together. thought I'd just ask. simple question and a simple answer i hope. Thanks in advance. this woul... | [
"php",
"regex",
"string",
"preg-match"
] | 1 | 7 | 3,994 | 1 | 0 | 2011-06-04T01:21:55.220000 | 2011-06-04T01:55:28.587000 |
6,234,049 | 6,234,114 | Little endian Vs Big endian convention in x86 chips | I realised that though intel chips are little endian when it comes to storing data in data segment, but same chips are big endians when it comes to store machine code in code segment. An opcode for MOV AL,57 is B057. B0 is stored in low byte and 57 is stored in next higher byte. Is it that the convention of little or b... | endianess concern itself with how the bytes are stored to make up larger data types, such as whether the least significant byte is stored first or last in memory of e.g. a 16 bit integer. that piece of machine code consists of several individual parts, it's not combined to be treated as an integer, so it doesn't make s... | Little endian Vs Big endian convention in x86 chips I realised that though intel chips are little endian when it comes to storing data in data segment, but same chips are big endians when it comes to store machine code in code segment. An opcode for MOV AL,57 is B057. B0 is stored in low byte and 57 is stored in next h... | TITLE:
Little endian Vs Big endian convention in x86 chips
QUESTION:
I realised that though intel chips are little endian when it comes to storing data in data segment, but same chips are big endians when it comes to store machine code in code segment. An opcode for MOV AL,57 is B057. B0 is stored in low byte and 57 i... | [
"x86",
"intel",
"endianness"
] | 0 | 2 | 4,829 | 2 | 0 | 2011-06-04T01:22:04.627000 | 2011-06-04T01:34:08.433000 |
6,234,052 | 6,234,176 | Minimal Url and view for static pages on django | The app I am creating has many static pages, just like the pages of a website which do not change for some time. Im my model I will have a title field and a text field. I am looking go a way to avoid multiple views and multiple urls for each page. I tried using flatpages, but I was not able to get to work the context p... | If you are having problems with flatpages, it's not hard to write your own version! models.py from markdown import markdown
class CustomFlatPage(models.Model): title = models.CharField(max_length=100) body = models.TextField() slug = models.SlugField(unique=True) urls.py url(r'^(?P [-\w]+)/$','myapp.views.customflatpa... | Minimal Url and view for static pages on django The app I am creating has many static pages, just like the pages of a website which do not change for some time. Im my model I will have a title field and a text field. I am looking go a way to avoid multiple views and multiple urls for each page. I tried using flatpages,... | TITLE:
Minimal Url and view for static pages on django
QUESTION:
The app I am creating has many static pages, just like the pages of a website which do not change for some time. Im my model I will have a title field and a text field. I am looking go a way to avoid multiple views and multiple urls for each page. I trie... | [
"django"
] | 0 | 3 | 362 | 1 | 0 | 2011-06-04T01:23:06.843000 | 2011-06-04T01:50:06.387000 |
6,234,055 | 6,234,101 | Is there a more compact syntax for TryFind? | I am using a using Microsoft.FSharp.Core.Collections.FSharpMap and very often have to write: var oo = world.Entity.TryFind(t); var entity = oo == null? null: oo.Value; And similar. Any suggestions for a better style? | You could write an Extension Method: public static T ValueOrDefault (this FSharpOption option) { return option == null? default(T): option.Value; } Usage: var entity = world.Entity.TryFind(t).ValueOrDefault(); | Is there a more compact syntax for TryFind? I am using a using Microsoft.FSharp.Core.Collections.FSharpMap and very often have to write: var oo = world.Entity.TryFind(t); var entity = oo == null? null: oo.Value; And similar. Any suggestions for a better style? | TITLE:
Is there a more compact syntax for TryFind?
QUESTION:
I am using a using Microsoft.FSharp.Core.Collections.FSharpMap and very often have to write: var oo = world.Entity.TryFind(t); var entity = oo == null? null: oo.Value; And similar. Any suggestions for a better style?
ANSWER:
You could write an Extension Met... | [
"c#",
"f#",
"coding-style"
] | 2 | 6 | 745 | 1 | 0 | 2011-06-04T01:24:10.250000 | 2011-06-04T01:32:38.817000 |
6,234,057 | 6,234,070 | mysql order by serialized data? | I need to query a single field and order it by serialized data, is that even possible? my table fields are: ********************************************* | meta_id | user_id | meta_key | meta_value | ********************************************* my query looks like this SELECT user_id FROM $wpdb->usermeta WHERE meta_ke... | No, it is not possible. The only possible case when serialized data is acceptable is when you don't need to search or order by through that data. In all other cases - store your data as a separated fields. | mysql order by serialized data? I need to query a single field and order it by serialized data, is that even possible? my table fields are: ********************************************* | meta_id | user_id | meta_key | meta_value | ********************************************* my query looks like this SELECT user_id FR... | TITLE:
mysql order by serialized data?
QUESTION:
I need to query a single field and order it by serialized data, is that even possible? my table fields are: ********************************************* | meta_id | user_id | meta_key | meta_value | ********************************************* my query looks like this... | [
"mysql",
"serialization",
"sql-order-by"
] | 2 | 6 | 2,275 | 1 | 0 | 2011-06-04T01:24:42.280000 | 2011-06-04T01:27:42.483000 |
6,234,067 | 6,234,079 | creating a join table problem! | I have 3 tables customer, menu, and order. The order table is suppose to join the customer and menu tables, and contains the primary keys of both. Here's how I tried to create the order table on phpmyadmin. create table order( customerID int not null, itemID int not null, primary key (customerID, itemID), foreign key(c... | order is a reserved word, try another name, or quote it, like create table `order`( customerID int not null, itemID int not null, primary key (customerID, itemID), foreign key(customerID) reference customer(ID), foreign key(itemID) reference menu(itemID) ) | creating a join table problem! I have 3 tables customer, menu, and order. The order table is suppose to join the customer and menu tables, and contains the primary keys of both. Here's how I tried to create the order table on phpmyadmin. create table order( customerID int not null, itemID int not null, primary key (cus... | TITLE:
creating a join table problem!
QUESTION:
I have 3 tables customer, menu, and order. The order table is suppose to join the customer and menu tables, and contains the primary keys of both. Here's how I tried to create the order table on phpmyadmin. create table order( customerID int not null, itemID int not null... | [
"php",
"mysql",
"sql",
"phpmyadmin"
] | 1 | 4 | 114 | 2 | 0 | 2011-06-04T01:26:57.250000 | 2011-06-04T01:29:21.067000 |
6,234,071 | 6,237,170 | Access Nested Backbone Model Attributes from Mustache Template | I have one Backbone model which has an attribute that is a reference to another Backbone model. For example, a Person has a reference to an Address object. Person FirstName LastName Address Street City State Zip These are classes that extend the Backbone model. So, then if I construct an object like the following... va... | Try using Handlebars, a templating engine based on Mustache with nested properties support. Then it would be as easy as {{Address/City}}. If you don't want to change your templating engine, you can flatten results from Address object and pass them as properties directly on the Person. | Access Nested Backbone Model Attributes from Mustache Template I have one Backbone model which has an attribute that is a reference to another Backbone model. For example, a Person has a reference to an Address object. Person FirstName LastName Address Street City State Zip These are classes that extend the Backbone mo... | TITLE:
Access Nested Backbone Model Attributes from Mustache Template
QUESTION:
I have one Backbone model which has an attribute that is a reference to another Backbone model. For example, a Person has a reference to an Address object. Person FirstName LastName Address Street City State Zip These are classes that exte... | [
"backbone.js",
"mustache",
"model-associations"
] | 12 | 5 | 8,556 | 4 | 0 | 2011-06-04T01:27:46.597000 | 2011-06-04T14:05:19.850000 |
6,234,073 | 6,234,103 | Javascript replace hypens with space | I am getting this value from DatePicker var datepickr = 'Jun-29-2011'; I want to replace underscores(-) with space. I tried this way, but it isn't working var b = datepickr.replace("-",' '); | .replace is supposed to take a regular expression: var b = datepickr.replace(/-/g,' '); I'll leave it as an exercise to the reader to research regular expressions to the full. (The important bit here, though, is the flag /g — global search ) | Javascript replace hypens with space I am getting this value from DatePicker var datepickr = 'Jun-29-2011'; I want to replace underscores(-) with space. I tried this way, but it isn't working var b = datepickr.replace("-",' '); | TITLE:
Javascript replace hypens with space
QUESTION:
I am getting this value from DatePicker var datepickr = 'Jun-29-2011'; I want to replace underscores(-) with space. I tried this way, but it isn't working var b = datepickr.replace("-",' ');
ANSWER:
.replace is supposed to take a regular expression: var b = datepi... | [
"javascript"
] | 0 | 2 | 173 | 6 | 0 | 2011-06-04T01:28:32.810000 | 2011-06-04T01:32:47.130000 |
6,234,076 | 6,234,277 | Activation error occured while trying to get instance of type ICacheManager, key "Cache Manager" | I seem to have hit a wall here and would appreciate some help from anyone who is able to on this one. I am not exactly sure what the error message below means. I am using the Caching Block of Enterprise Pattern Services but I keep running in to the problem below. I downloaded the latest version and tried stepping throu... | The Caching Application Block requires some configuration information to be present in the app/web.config before it can be used (AFAIK, unfortunately it is tough to find documentation stating otherwise). Without that configuration info, the following code will cause that same exception to be thrown as you are seeing: v... | Activation error occured while trying to get instance of type ICacheManager, key "Cache Manager" I seem to have hit a wall here and would appreciate some help from anyone who is able to on this one. I am not exactly sure what the error message below means. I am using the Caching Block of Enterprise Pattern Services but... | TITLE:
Activation error occured while trying to get instance of type ICacheManager, key "Cache Manager"
QUESTION:
I seem to have hit a wall here and would appreciate some help from anyone who is able to on this one. I am not exactly sure what the error message below means. I am using the Caching Block of Enterprise Pa... | [
"c#",
".net",
"caching",
"unity-container",
"enterprise-library"
] | 9 | 19 | 34,020 | 1 | 0 | 2011-06-04T01:28:59.190000 | 2011-06-04T02:18:22.997000 |
6,234,087 | 6,234,134 | Queue ForEach loop throwing InvalidOperationException | I haven't used Queues to any real degree before, so I might be missing something obvious. I'm trying to iterate through a Queue like this (every frame): foreach (var e in qEnemy) { //enemy AI code } When an enemy dies, the enemy user control raises an event I've subscribed to and I do this (the first enemy in the queue... | You are modifying queue inside of foreach loop. This is what causes the exception. Simplified code to demonstrate the issue: var queue = new Queue (); queue.Enqueue(1); queue.Enqueue(2);
foreach (var i in queue) { queue.Dequeue(); } Possible solution is to add ToList(), like this: foreach (var i in queue.ToList()) { q... | Queue ForEach loop throwing InvalidOperationException I haven't used Queues to any real degree before, so I might be missing something obvious. I'm trying to iterate through a Queue like this (every frame): foreach (var e in qEnemy) { //enemy AI code } When an enemy dies, the enemy user control raises an event I've sub... | TITLE:
Queue ForEach loop throwing InvalidOperationException
QUESTION:
I haven't used Queues to any real degree before, so I might be missing something obvious. I'm trying to iterate through a Queue like this (every frame): foreach (var e in qEnemy) { //enemy AI code } When an enemy dies, the enemy user control raises... | [
"c#",
".net",
"silverlight",
"queue",
"invalidoperationexception"
] | 18 | 22 | 36,700 | 6 | 0 | 2011-06-04T01:30:39.837000 | 2011-06-04T01:37:51.233000 |
6,234,090 | 6,241,337 | Few basic doubts regarding caches | Please bear with me, these questions may be very basic. I am just trying to understand the fundamentals. Are the cache eviction algorithms such as LRU are implemented by the OS?? if so, how can we find out the current algorithm being used and is it possible for the programer to change it? Since cache is along with proc... | Just one answer? Well 1.) No hardware implemented. They should be documented by the vendor, if not then microbenchmarking is an option. 2.) Hardware 3.) As pointed out above L1 cache has separate caches for data and instruction. There is also TLB for virtual memory. 4.) I attended a course last semester which covers th... | Few basic doubts regarding caches Please bear with me, these questions may be very basic. I am just trying to understand the fundamentals. Are the cache eviction algorithms such as LRU are implemented by the OS?? if so, how can we find out the current algorithm being used and is it possible for the programer to change ... | TITLE:
Few basic doubts regarding caches
QUESTION:
Please bear with me, these questions may be very basic. I am just trying to understand the fundamentals. Are the cache eviction algorithms such as LRU are implemented by the OS?? if so, how can we find out the current algorithm being used and is it possible for the pr... | [
"algorithm",
"caching"
] | 3 | 0 | 106 | 2 | 0 | 2011-06-04T01:31:03.823000 | 2011-06-05T06:17:13.547000 |
6,234,096 | 6,234,109 | MySQL On Duplicate Key Update | It is only allowing me to update resulting in a total of 2 Heres my Table CREATE TABLE `cart` ( `id` int(7) NOT NULL AUTO_INCREMENT, `User` int(7) DEFAULT NULL, `Product` varchar(100) DEFAULT NULL, `Quantity` int(7) DEFAULT NULL, UNIQUE KEY `id` (`id`), UNIQUE KEY `Quantity` (`Quantity`) ) Then, my code to insert the d... | You probably don't want this line: UNIQUE KEY `Quantity` (`Quantity`) That creates a unique constraint on the quantity field, which is why your second insert is failing. I can't think of any reason why you would want that. P.S. If you remove that line, make sure to remove the comma (,) from the previous line. | MySQL On Duplicate Key Update It is only allowing me to update resulting in a total of 2 Heres my Table CREATE TABLE `cart` ( `id` int(7) NOT NULL AUTO_INCREMENT, `User` int(7) DEFAULT NULL, `Product` varchar(100) DEFAULT NULL, `Quantity` int(7) DEFAULT NULL, UNIQUE KEY `id` (`id`), UNIQUE KEY `Quantity` (`Quantity`) )... | TITLE:
MySQL On Duplicate Key Update
QUESTION:
It is only allowing me to update resulting in a total of 2 Heres my Table CREATE TABLE `cart` ( `id` int(7) NOT NULL AUTO_INCREMENT, `User` int(7) DEFAULT NULL, `Product` varchar(100) DEFAULT NULL, `Quantity` int(7) DEFAULT NULL, UNIQUE KEY `id` (`id`), UNIQUE KEY `Quanti... | [
"mysql",
"duplicates"
] | 0 | 2 | 1,325 | 1 | 0 | 2011-06-04T01:31:50.677000 | 2011-06-04T01:33:29.173000 |
6,234,104 | 6,234,229 | vim regex to match inline comments | Assuming the following sample inline comment: /* function newMethodName (int bar, String s) { int i = 123; } s/\ How would I match and replace such that it would, essentially, become uncommented. I got this far before giving up.:%s/\/\*\(\_.\)*\*\//\1/ Solution:%s/\/\*\(\_.*\)\*\//\1/ | Your capture group ( ) is capturing one character or newline. Put the following * inside so that \1 replacement gets the whole string rather than just the first character. | vim regex to match inline comments Assuming the following sample inline comment: /* function newMethodName (int bar, String s) { int i = 123; } s/\ How would I match and replace such that it would, essentially, become uncommented. I got this far before giving up.:%s/\/\*\(\_.\)*\*\//\1/ Solution:%s/\/\*\(\_.*\)\*\//\1/ | TITLE:
vim regex to match inline comments
QUESTION:
Assuming the following sample inline comment: /* function newMethodName (int bar, String s) { int i = 123; } s/\ How would I match and replace such that it would, essentially, become uncommented. I got this far before giving up.:%s/\/\*\(\_.\)*\*\//\1/ Solution:%s/\/... | [
"regex",
"vim",
"comments"
] | 1 | 1 | 610 | 1 | 0 | 2011-06-04T01:32:54.563000 | 2011-06-04T02:04:05.363000 |
6,234,105 | 6,242,272 | How to connect SproutCore to CouchDB in Mac OSX | I am using SproutCore to query a CouchDB database on Mac OSX (10.6.7), from a tutorial on NetTuts+ premium. The database name is microblog. The query resolve to this string: "http://localhost:5984/microblog/_design/posts/_view/posts?descending=true" If I type this query directly in the browser's address bar, I get a ni... | Because of Javascript cross-domain regulations you are not allowed to query any arbitrary URL from your browser. If you loaded your sproutcore page from localhost:4020, it's forbidden to contact any other host or port on the same host. To overcome this problem you usually make your sproutcore host proxy to the backend.... | How to connect SproutCore to CouchDB in Mac OSX I am using SproutCore to query a CouchDB database on Mac OSX (10.6.7), from a tutorial on NetTuts+ premium. The database name is microblog. The query resolve to this string: "http://localhost:5984/microblog/_design/posts/_view/posts?descending=true" If I type this query d... | TITLE:
How to connect SproutCore to CouchDB in Mac OSX
QUESTION:
I am using SproutCore to query a CouchDB database on Mac OSX (10.6.7), from a tutorial on NetTuts+ premium. The database name is microblog. The query resolve to this string: "http://localhost:5984/microblog/_design/posts/_view/posts?descending=true" If I... | [
"couchdb",
"sproutcore",
"http-status-code-405"
] | 2 | 4 | 642 | 1 | 0 | 2011-06-04T01:32:57.820000 | 2011-06-05T10:13:22.317000 |
6,234,115 | 6,234,149 | Sum from field values and output the result inside div | I did this before with javascript, and have no idea to make it using jquery. I hope you can help me! I tried the next: The div resultado should change the content. Not happening:/ | Try the blur event, not the mouseout $('.field').blur(function() { var sum = 0; $('.field').each(function() { sum += Number($(this).val()); }); $("#resultado").html(sum.toFixed(2)); }); http://jsfiddle.net/syJ9g/1/ or bind to all kinds of events $('.field').bind("mouseout blur click", function() { var sum = 0; $('.fiel... | Sum from field values and output the result inside div I did this before with javascript, and have no idea to make it using jquery. I hope you can help me! I tried the next: The div resultado should change the content. Not happening:/ | TITLE:
Sum from field values and output the result inside div
QUESTION:
I did this before with javascript, and have no idea to make it using jquery. I hope you can help me! I tried the next: The div resultado should change the content. Not happening:/
ANSWER:
Try the blur event, not the mouseout $('.field').blur(func... | [
"javascript",
"jquery"
] | 1 | 1 | 478 | 1 | 0 | 2011-06-04T01:34:09.550000 | 2011-06-04T01:42:03.353000 |
6,234,119 | 6,234,156 | VB.Net Replacing Specific Values in a Large Text File | I have some large csv files (1.5gb each) where I need to replace specific values. The method I'm currently using is terribly slow and I'm fairly certain that there should be a way to speed this up but I'm just not experienced enough to know what I should be doing. This is my first post and I tried searching through to ... | You are splitting and the combining, which can take some time. Why not just read the line of text. Then replace any occurance of "5MM+" and "1MM+" with the approiate value and then write the line. Do While... s = strRead.ReadLine(); s = s.Replace("5MM+", "5000000") s = s.Replace("1MM+", "1000000") strWrite(s); Loop | VB.Net Replacing Specific Values in a Large Text File I have some large csv files (1.5gb each) where I need to replace specific values. The method I'm currently using is terribly slow and I'm fairly certain that there should be a way to speed this up but I'm just not experienced enough to know what I should be doing. T... | TITLE:
VB.Net Replacing Specific Values in a Large Text File
QUESTION:
I have some large csv files (1.5gb each) where I need to replace specific values. The method I'm currently using is terribly slow and I'm fairly certain that there should be a way to speed this up but I'm just not experienced enough to know what I ... | [
"vb.net",
"streamwriter"
] | 2 | 2 | 7,122 | 1 | 0 | 2011-06-04T01:34:25.297000 | 2011-06-04T01:43:07.183000 |
6,234,123 | 6,234,217 | Basic Velocity Algorithm? | Given the following dataset for a single article on my site: Article 1 2/1/2010 100 2/2/2010 80 2/3/2010 60
Article 2 2/1/2010 20000 2/2/2010 25000 2/3/2010 23000 where column 1 is the date and column 2 is the number of pageviews for an article. What is a basic velocity calculation that can be done to determine if thi... | update: Your data actually already is a list of velocities (pageviews/day). The following answer simply shows how to find the average velocity over the past three days. See my other answer for how to calculate pageview acceleration, which is the real statistic you are probably looking for. Velocity is simply the change... | Basic Velocity Algorithm? Given the following dataset for a single article on my site: Article 1 2/1/2010 100 2/2/2010 80 2/3/2010 60
Article 2 2/1/2010 20000 2/2/2010 25000 2/3/2010 23000 where column 1 is the date and column 2 is the number of pageviews for an article. What is a basic velocity calculation that can b... | TITLE:
Basic Velocity Algorithm?
QUESTION:
Given the following dataset for a single article on my site: Article 1 2/1/2010 100 2/2/2010 80 2/3/2010 60
Article 2 2/1/2010 20000 2/2/2010 25000 2/3/2010 23000 where column 1 is the date and column 2 is the number of pageviews for an article. What is a basic velocity calc... | [
"algorithm",
"computer-science"
] | 1 | 3 | 1,330 | 3 | 0 | 2011-06-04T01:35:49.493000 | 2011-06-04T02:01:32.353000 |
6,234,129 | 6,234,199 | Need help with Jquery and javascript | I have bunch of employees, each employee have 7 days for their work schedule. I created the following form using php and would like get data from here to JavaScript for verification and then submit it to SQL database using ajax. My problem is how can I dynamically create these forms and then get values from their input... | add a 'name' attribute and give it a value for example 'day' Then try the following javascript (untested) var employees = new Array();
$('table td input[name="day"]').each(function(i){ employees[i] = $(this).val(); }); | Need help with Jquery and javascript I have bunch of employees, each employee have 7 days for their work schedule. I created the following form using php and would like get data from here to JavaScript for verification and then submit it to SQL database using ajax. My problem is how can I dynamically create these forms... | TITLE:
Need help with Jquery and javascript
QUESTION:
I have bunch of employees, each employee have 7 days for their work schedule. I created the following form using php and would like get data from here to JavaScript for verification and then submit it to SQL database using ajax. My problem is how can I dynamically ... | [
"php",
"javascript",
"jquery"
] | 0 | 1 | 291 | 1 | 0 | 2011-06-04T01:37:24.813000 | 2011-06-04T01:56:24.663000 |
6,234,138 | 6,234,157 | How to get the file name under a folder? | Suppose I have a directory look like: ABC |_ a1.txt |_ a2.txt |_ a3.txt |_ a4.txt |_ a5.txt How can I use PHP to get these file names to an array, limited to a specific file extension and ignoring directories? | You can use the glob() function: Example 01: Example 02: Example 03: Using RecursiveIteratorIterator | How to get the file name under a folder? Suppose I have a directory look like: ABC |_ a1.txt |_ a2.txt |_ a3.txt |_ a4.txt |_ a5.txt How can I use PHP to get these file names to an array, limited to a specific file extension and ignoring directories? | TITLE:
How to get the file name under a folder?
QUESTION:
Suppose I have a directory look like: ABC |_ a1.txt |_ a2.txt |_ a3.txt |_ a4.txt |_ a5.txt How can I use PHP to get these file names to an array, limited to a specific file extension and ignoring directories?
ANSWER:
You can use the glob() function: Example 0... | [
"php",
"file"
] | 7 | 14 | 16,871 | 7 | 0 | 2011-06-04T01:39:39.463000 | 2011-06-04T01:43:25.577000 |
6,234,148 | 6,234,748 | jquery re-establish img src in .load() function | I'm trying to figure out how to re-establish the img src if the image src path is invalid or no image is found. I have a dynamically created img src path that may sometimes be pointing to a directory with no actual images. In this case I need to change the src to img/missing.jpg. I have done this with no luck: $('.imgC... | The key to the problem is that the 'load' event only fires on images when the image is successfully loaded - so if you specify an invalid path, the load event will never take place. You want the 'error' handler instead, like this: var img = $(" ").error(function(){ $(this).attr({src: 'img/missing.jpg'}).css({width:'100... | jquery re-establish img src in .load() function I'm trying to figure out how to re-establish the img src if the image src path is invalid or no image is found. I have a dynamically created img src path that may sometimes be pointing to a directory with no actual images. In this case I need to change the src to img/miss... | TITLE:
jquery re-establish img src in .load() function
QUESTION:
I'm trying to figure out how to re-establish the img src if the image src path is invalid or no image is found. I have a dynamically created img src path that may sometimes be pointing to a directory with no actual images. In this case I need to change t... | [
"jquery",
"image",
"path",
"load",
"src"
] | 2 | 3 | 1,021 | 1 | 0 | 2011-06-04T01:41:36.077000 | 2011-06-04T04:45:03.623000 |
6,234,151 | 6,234,173 | Java: How to issue an http request asynchronously? | I've been searching around trying to find a straightforward solution to submitting an http request asynchronously in java, but haven't had any luck. I actually don't even care about the response back, I just want my client to issue the request and move on. I thought about kicking off another thread, issuing the request... | Start another thread. You don't need to kill it, once request is done it will just exit. Use threadpool if you have too many of those requests. | Java: How to issue an http request asynchronously? I've been searching around trying to find a straightforward solution to submitting an http request asynchronously in java, but haven't had any luck. I actually don't even care about the response back, I just want my client to issue the request and move on. I thought ab... | TITLE:
Java: How to issue an http request asynchronously?
QUESTION:
I've been searching around trying to find a straightforward solution to submitting an http request asynchronously in java, but haven't had any luck. I actually don't even care about the response back, I just want my client to issue the request and mov... | [
"java",
"http",
"asynchronous",
"request"
] | 1 | 2 | 1,546 | 2 | 0 | 2011-06-04T01:42:05.297000 | 2011-06-04T01:47:38.283000 |
6,234,159 | 6,234,170 | CodeIgniter: can't access $this within function in view | I'm using CodeIgniter and one of my views got pretty large so I moved some of the code in a function in the same file: function html_stuff() { $posts = $this->db->query('select * from posts'); } When I run this code I get the following error: Fatal error: Using $this when not in object context in /somepath/view.php | You could either pass the function $this function html_stuff($ci) { $ci->db->query('select * from posts'); } html_stuff($this); Or use get_instance() function html_stuff() { $ci = &get_instance(); $ci->db->query('select * from posts'); } See: https://www.codeigniter.com/user_guide/general/creating_libraries.html | CodeIgniter: can't access $this within function in view I'm using CodeIgniter and one of my views got pretty large so I moved some of the code in a function in the same file: function html_stuff() { $posts = $this->db->query('select * from posts'); } When I run this code I get the following error: Fatal error: Using $t... | TITLE:
CodeIgniter: can't access $this within function in view
QUESTION:
I'm using CodeIgniter and one of my views got pretty large so I moved some of the code in a function in the same file: function html_stuff() { $posts = $this->db->query('select * from posts'); } When I run this code I get the following error: Fat... | [
"php",
"codeigniter"
] | 3 | 7 | 3,776 | 1 | 0 | 2011-06-04T01:43:50.257000 | 2011-06-04T01:47:15.683000 |
6,234,162 | 6,234,433 | setLastModified on jsp UploadFile | I need help how to set the last modified time on a file uploaded (on jsp). I need to know the time when the file uploaded. This is my code but eclipse says "The method setLastModified(Date) is undefined for the type UploadFile". Code: UploadFile file = (UploadFile) files.get("uploadfile");
fName =file.getFileName();
... | I think that the method you are trying to use is a method in the java.io.File API. Change file.setLastModified(getthetime()); to new File(fName).setLastModified(getthetime()); For what it is worth, I'm surprised that this would be necessary. I'd have thought that a file uploader would automatically set the modified tim... | setLastModified on jsp UploadFile I need help how to set the last modified time on a file uploaded (on jsp). I need to know the time when the file uploaded. This is my code but eclipse says "The method setLastModified(Date) is undefined for the type UploadFile". Code: UploadFile file = (UploadFile) files.get("uploadfil... | TITLE:
setLastModified on jsp UploadFile
QUESTION:
I need help how to set the last modified time on a file uploaded (on jsp). I need to know the time when the file uploaded. This is my code but eclipse says "The method setLastModified(Date) is undefined for the type UploadFile". Code: UploadFile file = (UploadFile) fi... | [
"java",
"jsp",
"last-modified",
"file-upload"
] | 0 | 2 | 505 | 2 | 0 | 2011-06-04T01:45:15.437000 | 2011-06-04T03:01:33.807000 |
6,234,164 | 6,234,537 | How would I use a different row layout in custom CursorAdapter based on Cursor data? | Background: I'm trying to implement a messenging system in my app, and I'm writing a custom CursorAdapter to display the messages in a ListView in the chat window. I want to use a different row layout for incoming and outgoing messages (information that is saved in the SQLite row in the cursor). Each row has the same e... | Here are two possible solutions: (1) Use a single layout for all items, which you can adjust when binding to show as desired. The most straight-forward way would just to have the root view be a FrameLayout which contains N children for each of the different states, and you make one of them visible and all others gone w... | How would I use a different row layout in custom CursorAdapter based on Cursor data? Background: I'm trying to implement a messenging system in my app, and I'm writing a custom CursorAdapter to display the messages in a ListView in the chat window. I want to use a different row layout for incoming and outgoing messages... | TITLE:
How would I use a different row layout in custom CursorAdapter based on Cursor data?
QUESTION:
Background: I'm trying to implement a messenging system in my app, and I'm writing a custom CursorAdapter to display the messages in a ListView in the chat window. I want to use a different row layout for incoming and... | [
"android",
"listview",
"android-cursoradapter"
] | 0 | 5 | 1,862 | 2 | 0 | 2011-06-04T01:45:36.350000 | 2011-06-04T03:40:00.317000 |
6,234,174 | 6,237,002 | Why does my Azure application still point to default.aspx? | I have created a PivotViewer application with an Azure Web role, and it deploys on my local machine perfectly. When I deploy it to azure, the standard default.aspx "My ASP.NET" application is the loaded page. I can not seem to find a solution in all of the tutorials. If I point the browser to http://solution.cloudapp.n... | Determining which page to load if none is explicitly specified is a function of the web server. Without configuration changes, the web server is never going to expect to look for your custom page. Can you not simply rename your desired start page default.aspx? That would be the simplest approach. | Why does my Azure application still point to default.aspx? I have created a PivotViewer application with an Azure Web role, and it deploys on my local machine perfectly. When I deploy it to azure, the standard default.aspx "My ASP.NET" application is the loaded page. I can not seem to find a solution in all of the tuto... | TITLE:
Why does my Azure application still point to default.aspx?
QUESTION:
I have created a PivotViewer application with an Azure Web role, and it deploys on my local machine perfectly. When I deploy it to azure, the standard default.aspx "My ASP.NET" application is the loaded page. I can not seem to find a solution ... | [
"silverlight",
"visual-studio-2010",
"azure"
] | 0 | 0 | 181 | 2 | 0 | 2011-06-04T01:47:41.560000 | 2011-06-04T13:29:13.930000 |
6,234,179 | 6,234,214 | Features of reset password functionality (one-click, one-use, 24 hours, ???) | We're setting up a feature to enable users to reset their password when they can't get access ot their account. We ask for their email address (which they use for logging into the site), send them an email with a unique link. The questions are: Should the link expire on first-click or should the link expire on first-us... | The link should expire after they have reset their password successfully. If somehow the user ended up needing guidance on a password reset and wanted to return later, they should be able to. That being said the reset should expire eventually, 48 hours? Yes they should be logged in after a password reset, otherwise the... | Features of reset password functionality (one-click, one-use, 24 hours, ???) We're setting up a feature to enable users to reset their password when they can't get access ot their account. We ask for their email address (which they use for logging into the site), send them an email with a unique link. The questions are... | TITLE:
Features of reset password functionality (one-click, one-use, 24 hours, ???)
QUESTION:
We're setting up a feature to enable users to reset their password when they can't get access ot their account. We ask for their email address (which they use for logging into the site), send them an email with a unique link.... | [
"passwords",
"reset",
"forgot-password"
] | 1 | 1 | 2,225 | 2 | 0 | 2011-06-04T01:50:21.130000 | 2011-06-04T02:00:37.143000 |
6,234,185 | 6,234,384 | How to map a Map<Calendar,Boolean> with jpa/hibernate | i've got 2 tables: Seat(roomID,seatID,...) SeatState(roomID,seatID,date,state) i wanna create a seat class and i would like this class to have a Map attribute. does somebody know how to map this thing? | Hibernate supports using 'Map's as collections. If you are using hbm.xml files, you can use the tag for this purpose. Take a look at http://docs.jboss.org/hibernate/core/3.3/reference/en/html/collections.html for a reference. Also Hibernate supports mapping Calendar fields to TIMESTAMP fields. So if you are using XML, ... | How to map a Map<Calendar,Boolean> with jpa/hibernate i've got 2 tables: Seat(roomID,seatID,...) SeatState(roomID,seatID,date,state) i wanna create a seat class and i would like this class to have a Map attribute. does somebody know how to map this thing? | TITLE:
How to map a Map<Calendar,Boolean> with jpa/hibernate
QUESTION:
i've got 2 tables: Seat(roomID,seatID,...) SeatState(roomID,seatID,date,state) i wanna create a seat class and i would like this class to have a Map attribute. does somebody know how to map this thing?
ANSWER:
Hibernate supports using 'Map's as co... | [
"java",
"hibernate",
"jpa",
"hibernate-mapping"
] | 1 | 0 | 510 | 1 | 0 | 2011-06-04T01:53:06.480000 | 2011-06-04T02:48:17.960000 |
6,234,193 | 6,234,249 | ImageView in RelativeView causes crash? | Whenever I create an ImageView in my XML the emulator crashes. | You are missing the + in a few of your id references, and layout_alignRight will accept "true" or "false" only (you are probably looking for layout_ToRightOf)toTherightOf! AND an ImageView needs height and width set to something. You should definitely look at your LogCat for the exact error, but your XML should look li... | ImageView in RelativeView causes crash? Whenever I create an ImageView in my XML the emulator crashes. | TITLE:
ImageView in RelativeView causes crash?
QUESTION:
Whenever I create an ImageView in my XML the emulator crashes.
ANSWER:
You are missing the + in a few of your id references, and layout_alignRight will accept "true" or "false" only (you are probably looking for layout_ToRightOf)toTherightOf! AND an ImageView n... | [
"android",
"crash",
"imageview"
] | 1 | 2 | 536 | 1 | 0 | 2011-06-04T01:55:22.703000 | 2011-06-04T02:11:42.103000 |
6,234,195 | 6,234,360 | Get vertical position of scrollbar for a webpage on pageload when the url contains an anchor | I am using jQuery's scrollTop() method to get the vertical position of the scroll bar on pageload. I need to get this value after the anchor in the url is executed (ex url: www.domainname.com#foo). I can use the following code and it works in Firefox and IE: ex url: www.domainname.com#foo $(document).ready(function() {... | You might just want to do something quick-and-dirty like setTimeout for however many milliseconds it takes to get it from Chrome or Safari reliably var MAX_CHECKS = 5; // adjust these values var WAIT_IN_MILLISECONDS = 100; // however works best var checks = 0;
function checkScroll() { if ($(this).scrollTop() > 0) { //... | Get vertical position of scrollbar for a webpage on pageload when the url contains an anchor I am using jQuery's scrollTop() method to get the vertical position of the scroll bar on pageload. I need to get this value after the anchor in the url is executed (ex url: www.domainname.com#foo). I can use the following code ... | TITLE:
Get vertical position of scrollbar for a webpage on pageload when the url contains an anchor
QUESTION:
I am using jQuery's scrollTop() method to get the vertical position of the scroll bar on pageload. I need to get this value after the anchor in the url is executed (ex url: www.domainname.com#foo). I can use t... | [
"javascript",
"jquery",
"scrolltop"
] | 3 | 4 | 1,074 | 1 | 0 | 2011-06-04T01:55:51.990000 | 2011-06-04T02:40:50.610000 |
6,234,202 | 6,234,275 | Skinning Entire Eclipse GUI, Not Just Code Window | I have found some nice dark themes for editing code in Eclipse (screenshot below), but they only apply to the code window itself. The package explorer and outline view are still white background. It would be great if there was some way to make everything dark, even the toolbar at the top. Is this possible? Thanks, Jona... | You can customise the user interface by creating a new appearance. This functionality is integrated into Eclipse, and comes with the 'classic' VS as well as the modern one by default. See http://andrei.gmxhome.de/skins/index.html for a custom appearance. You can probably change the colours of the component backgrounds ... | Skinning Entire Eclipse GUI, Not Just Code Window I have found some nice dark themes for editing code in Eclipse (screenshot below), but they only apply to the code window itself. The package explorer and outline view are still white background. It would be great if there was some way to make everything dark, even the ... | TITLE:
Skinning Entire Eclipse GUI, Not Just Code Window
QUESTION:
I have found some nice dark themes for editing code in Eclipse (screenshot below), but they only apply to the code window itself. The package explorer and outline view are still white background. It would be great if there was some way to make everythi... | [
"java",
"eclipse"
] | 2 | 3 | 2,499 | 3 | 0 | 2011-06-04T01:56:48.540000 | 2011-06-04T02:17:50.787000 |
6,234,210 | 6,234,212 | PHP print_r shows array and not plain text only | I am once again looking for some help. I have found this stopwords script - I basically remove all common words from a string. tag’s keyword attribute is not the page rank panacea it once was back in the prehistoric days of Internet search. It was abused far too much and lost most of its cachet. But there’s no need to ... | Use implode() on the resulting array. $myString = implode( ', ', $myArray ); // Results in Item1, Item2, Item3, etc... | PHP print_r shows array and not plain text only I am once again looking for some help. I have found this stopwords script - I basically remove all common words from a string. tag’s keyword attribute is not the page rank panacea it once was back in the prehistoric days of Internet search. It was abused far too much and ... | TITLE:
PHP print_r shows array and not plain text only
QUESTION:
I am once again looking for some help. I have found this stopwords script - I basically remove all common words from a string. tag’s keyword attribute is not the page rank panacea it once was back in the prehistoric days of Internet search. It was abused... | [
"php"
] | 3 | 10 | 5,480 | 1 | 0 | 2011-06-04T01:58:45.967000 | 2011-06-04T01:59:47.650000 |
6,234,221 | 6,234,234 | Need SQL help returning a dynamic dataset | I've got three tables I would like to query for a single dataset. Here is what I've got so far: SELECT u.Name, r.Description from Users u JOIN UserRoleMembership m ON m.UserID = u.UserID JOIN UserRoles r ON r.RoleID = m.RoleID GROUP BY u.UserID The problem is that the above query only returns the first Role. How can I ... | Group by the fields you want to see. In this case, group by u.name, r.description instead of grouping by userid. It is a would-be-handy feature from MySQL, which is actually very confusing I think. Most DBs wouldn't even allow this query. You should not be able to have fields in your select that are not in the group by... | Need SQL help returning a dynamic dataset I've got three tables I would like to query for a single dataset. Here is what I've got so far: SELECT u.Name, r.Description from Users u JOIN UserRoleMembership m ON m.UserID = u.UserID JOIN UserRoles r ON r.RoleID = m.RoleID GROUP BY u.UserID The problem is that the above que... | TITLE:
Need SQL help returning a dynamic dataset
QUESTION:
I've got three tables I would like to query for a single dataset. Here is what I've got so far: SELECT u.Name, r.Description from Users u JOIN UserRoleMembership m ON m.UserID = u.UserID JOIN UserRoles r ON r.RoleID = m.RoleID GROUP BY u.UserID The problem is ... | [
"mysql"
] | 0 | 1 | 42 | 1 | 0 | 2011-06-04T02:02:42.720000 | 2011-06-04T02:06:14.630000 |
6,234,225 | 6,234,285 | how to detect if user click no or yes on window default alert? | I wrote the following code to set the site as the homepage: document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.abc.com'); When the user clicks this, an alert box appears asking the user whether or not he wants to set the site as his homepage. How can I detect which choice the u... | You can't because there's no return value...... on browsers that support it, which I believe is just certain versions of IE, and apparently that support is sketchy...... but you really shouldn't, because it's extremely annoying when a site asks a user that (the answer is almost always no ). | how to detect if user click no or yes on window default alert? I wrote the following code to set the site as the homepage: document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.abc.com'); When the user clicks this, an alert box appears asking the user whether or not he wants to se... | TITLE:
how to detect if user click no or yes on window default alert?
QUESTION:
I wrote the following code to set the site as the homepage: document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.abc.com'); When the user clicks this, an alert box appears asking the user whether or ... | [
"javascript"
] | 0 | 2 | 301 | 2 | 0 | 2011-06-04T02:03:23.273000 | 2011-06-04T02:20:47.250000 |
6,234,231 | 6,234,375 | Identify data to cache in which layer - PHP/MySQL | Think you are the proud owner of Facebook, then which data you want to store in app layer [memcached/ APC] and which data in MySQL cache? Please explain also why you think so. [I want to have an idea on which data to cache where] | For memcache, store session data. You have to typically query from a large table or from the filesystem to get it, depending on how it's stored. Putting that on memory removes hitting the disk for a relatively small amount data (that is typically critical to one's web application). For your database cache, put stuff in... | Identify data to cache in which layer - PHP/MySQL Think you are the proud owner of Facebook, then which data you want to store in app layer [memcached/ APC] and which data in MySQL cache? Please explain also why you think so. [I want to have an idea on which data to cache where] | TITLE:
Identify data to cache in which layer - PHP/MySQL
QUESTION:
Think you are the proud owner of Facebook, then which data you want to store in app layer [memcached/ APC] and which data in MySQL cache? Please explain also why you think so. [I want to have an idea on which data to cache where]
ANSWER:
For memcache,... | [
"php",
"mysql",
"memcached",
"apc"
] | 0 | 1 | 121 | 1 | 0 | 2011-06-04T02:04:43.943000 | 2011-06-04T02:46:13.643000 |
6,234,242 | 6,234,412 | Passing static JSON to Django Template - best practices? | I have a JSON data file that is part of my application (version controlled, etc.), and several of our templates need the data in this file to render properly. What are the pros and cons of various ways of making this JSON data available to the templates? Let's start with the fairly simple option of storing the JSON dat... | The simplest and probably fastest thing to do is to just parse the json in your views.py outside of the actual view: mydata = simplejson.loads(json_file)
def foo(request):... return render(request, 'template.html', {"mydata": mydata}, content_type="application/xhtml+xml") The json will only be parsed the first time a ... | Passing static JSON to Django Template - best practices? I have a JSON data file that is part of my application (version controlled, etc.), and several of our templates need the data in this file to render properly. What are the pros and cons of various ways of making this JSON data available to the templates? Let's st... | TITLE:
Passing static JSON to Django Template - best practices?
QUESTION:
I have a JSON data file that is part of my application (version controlled, etc.), and several of our templates need the data in this file to render properly. What are the pros and cons of various ways of making this JSON data available to the t... | [
"python",
"django",
"json"
] | 2 | 1 | 3,584 | 2 | 0 | 2011-06-04T02:08:34.367000 | 2011-06-04T02:55:18.613000 |
6,234,251 | 6,235,177 | Can the OpenRasta, ServiceStack and RestCake API's be used on frameworks other than .NET? | I know these API's are used for doing something easier than WCF (in terms of config and performance) for.NET, but I wanted to know if these API's can be used on other frameworks too? Thanks, Thothathri | All web service frameworks just serve JSON/XML/SOAP over HTTP - this is the path of greatest interoperability. As for all ServiceStack demos, they're all consumed live with HTML/JavaScript, so no.NET on the client to speak of. Of course if you use ServiceStack's C# clients you get the benefit of a strong-typed sync and... | Can the OpenRasta, ServiceStack and RestCake API's be used on frameworks other than .NET? I know these API's are used for doing something easier than WCF (in terms of config and performance) for.NET, but I wanted to know if these API's can be used on other frameworks too? Thanks, Thothathri | TITLE:
Can the OpenRasta, ServiceStack and RestCake API's be used on frameworks other than .NET?
QUESTION:
I know these API's are used for doing something easier than WCF (in terms of config and performance) for.NET, but I wanted to know if these API's can be used on other frameworks too? Thanks, Thothathri
ANSWER:
A... | [
".net",
"wcf",
"api",
"openrasta",
"servicestack"
] | 2 | 2 | 775 | 1 | 0 | 2011-06-04T02:12:16.690000 | 2011-06-04T06:33:35.320000 |
6,234,260 | 6,236,722 | WebGL: missing triangles when moving camera | I am rendering a complex scene in WebGL (180 meshes) corresponding to a car model (Nissan GTX). However when I move the camera around, it seems as if triangles were missing, These 'missing triangles' seem to jump randomly over the surface. Can this be a depth buffer problem or a normal calculation problem? I have no id... | I guess, you have a wireframe mesh directly on top of (or very near) a solid mesh and this is just a depth buffer problem. It works when zooming in, because the depth buffer precision is higher in the near area of the viewing frustum. Try adjusting the screen space depth by working with the polygon offset (or a similar... | WebGL: missing triangles when moving camera I am rendering a complex scene in WebGL (180 meshes) corresponding to a car model (Nissan GTX). However when I move the camera around, it seems as if triangles were missing, These 'missing triangles' seem to jump randomly over the surface. Can this be a depth buffer problem o... | TITLE:
WebGL: missing triangles when moving camera
QUESTION:
I am rendering a complex scene in WebGL (180 meshes) corresponding to a car model (Nissan GTX). However when I move the camera around, it seems as if triangles were missing, These 'missing triangles' seem to jump randomly over the surface. Can this be a dept... | [
"opengl-es",
"3d",
"webgl"
] | 1 | 4 | 902 | 2 | 0 | 2011-06-04T02:14:11.893000 | 2011-06-04T12:23:41.070000 |
6,234,261 | 6,248,009 | Silverlight Memory Usage: Task Manager vs ANTS vs SciTech | Task Manager says that IE is using over 500MB of private working set. Both ANTS Memory Profiler and SciTech.NET Memory profiler say I'm running between 50 and 75 MB. How do I explain the difference? | This doesn't directly answer your question as to what the difference is, but it is a great video around your first statement http://channel9.msdn.com/events/MIX/MIX11/MED07 | Silverlight Memory Usage: Task Manager vs ANTS vs SciTech Task Manager says that IE is using over 500MB of private working set. Both ANTS Memory Profiler and SciTech.NET Memory profiler say I'm running between 50 and 75 MB. How do I explain the difference? | TITLE:
Silverlight Memory Usage: Task Manager vs ANTS vs SciTech
QUESTION:
Task Manager says that IE is using over 500MB of private working set. Both ANTS Memory Profiler and SciTech.NET Memory profiler say I'm running between 50 and 75 MB. How do I explain the difference?
ANSWER:
This doesn't directly answer your qu... | [
"silverlight",
"memory-leaks"
] | 2 | 1 | 513 | 1 | 0 | 2011-06-04T02:14:21.333000 | 2011-06-06T05:12:39.457000 |
6,234,267 | 6,234,294 | How can I see the details about the object in server log? | I am trying to debug the user object created by writing ruby code like puts user which then I can check it on the server log. Apparently, the server log says something like # but it does not show details about the user object. (for example, its name or email values) How should I modify the code so that the detail infor... | Try using the Object.inspect method: puts user.inspect Here's the documentation: http://www.ruby-doc.org/core/classes/Object.html#M001025 | How can I see the details about the object in server log? I am trying to debug the user object created by writing ruby code like puts user which then I can check it on the server log. Apparently, the server log says something like # but it does not show details about the user object. (for example, its name or email val... | TITLE:
How can I see the details about the object in server log?
QUESTION:
I am trying to debug the user object created by writing ruby code like puts user which then I can check it on the server log. Apparently, the server log says something like # but it does not show details about the user object. (for example, its... | [
"ruby-on-rails",
"ruby"
] | 1 | 3 | 75 | 2 | 0 | 2011-06-04T02:16:27.693000 | 2011-06-04T02:23:48.163000 |
6,234,268 | 6,234,279 | Grab next numbers in a string | Hi have a arraylist of String and it contains bunch of numbers and I have get the numbers in each "stage". And at but at the second stage it only grabs the 1 instead of 10 is there anyway I can grab the next integers in the string? I got it to work for any numbers less than 10 but after 10 it just goes off. int stage =... | voteOne.split("\\s") will return an array of Strings. Then Integer.parseInt() each of the strings. read the documentation of these 2 methods: http://download.oracle.com/javase/6/docs/api/java/lang/String.html http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html | Grab next numbers in a string Hi have a arraylist of String and it contains bunch of numbers and I have get the numbers in each "stage". And at but at the second stage it only grabs the 1 instead of 10 is there anyway I can grab the next integers in the string? I got it to work for any numbers less than 10 but after 10... | TITLE:
Grab next numbers in a string
QUESTION:
Hi have a arraylist of String and it contains bunch of numbers and I have get the numbers in each "stage". And at but at the second stage it only grabs the 1 instead of 10 is there anyway I can grab the next integers in the string? I got it to work for any numbers less th... | [
"java",
"string",
"arraylist"
] | 0 | 2 | 126 | 3 | 0 | 2011-06-04T02:16:30.107000 | 2011-06-04T02:19:15.620000 |
6,234,269 | 6,234,289 | Jquery remove element from array | This should be fun to solve:) In a text field I have the value Apple,Peach,Banana. Using Jquery I created an array from that CSV. In HTML I have a list of the fruits with a "remove" option next to each one. When I click "remove" I want to remove the corresponding fruit from the list and the text field. I'm missing one ... | You should use JavaScript Splice fruits_array.splice(fruit_index,1); You also need to change: $('#fruits').val(skills_array.join(',')); to $('#fruits').val(fruits_array.join(',')); | Jquery remove element from array This should be fun to solve:) In a text field I have the value Apple,Peach,Banana. Using Jquery I created an array from that CSV. In HTML I have a list of the fruits with a "remove" option next to each one. When I click "remove" I want to remove the corresponding fruit from the list and... | TITLE:
Jquery remove element from array
QUESTION:
This should be fun to solve:) In a text field I have the value Apple,Peach,Banana. Using Jquery I created an array from that CSV. In HTML I have a list of the fruits with a "remove" option next to each one. When I click "remove" I want to remove the corresponding fruit... | [
"javascript",
"jquery",
"arrays"
] | 12 | 25 | 41,882 | 3 | 0 | 2011-06-04T02:16:37.523000 | 2011-06-04T02:22:00.620000 |
6,234,274 | 6,234,296 | mySQL TIME function and Timezone | I want to use the NOW() function with a specific timezone, say GMT+8 for a user and GMT-2 for another user. How can I achieve this? I am guessing that the time for NOW() is related somewhat to the timezone and time of the SQL server, but I want it to be such that FN(GMT+8) always give me the NOW() in GMT+8 irregardless... | The NOW() function provides the current time in the local timezone of the server. If you wish to convert to a different timezone, you can use CONVERT_TZ() UPDATE: You can use a per-connection timezone (that doesn't affect the system timezone) and get the effect you want: mysql> select now(); +---------------------+ | n... | mySQL TIME function and Timezone I want to use the NOW() function with a specific timezone, say GMT+8 for a user and GMT-2 for another user. How can I achieve this? I am guessing that the time for NOW() is related somewhat to the timezone and time of the SQL server, but I want it to be such that FN(GMT+8) always give m... | TITLE:
mySQL TIME function and Timezone
QUESTION:
I want to use the NOW() function with a specific timezone, say GMT+8 for a user and GMT-2 for another user. How can I achieve this? I am guessing that the time for NOW() is related somewhat to the timezone and time of the SQL server, but I want it to be such that FN(GM... | [
"php",
"mysql",
"sql",
"datetime",
"time"
] | 2 | 5 | 639 | 1 | 0 | 2011-06-04T02:17:40.833000 | 2011-06-04T02:23:55.560000 |
6,234,276 | 6,234,401 | pl/sql - to_date not working with execute immediate parameter | i wanna be able to execute my below proc like so: exec procname('29-JAN-2011'); proc code is: PROCEDURE procname(pardate VARCHAR2) IS
vardate DATE:= to_date(pardate, 'DD-MON-YYYY'); SQLS VARCHAR2(4000);
BEGIN
SQLS:= 'SELECT cola, colb FROM tablea WHERE TRUNC(coldate) = TRUNC(TO_DATE('''||pardate||''',''DD/MON/YYYY''... | You declare a variable which casts the input parameter to a date: why not use it? Also, the TRUNC() applied to a date removes the time element. You don't need it here because the value you're passing has no time. So, your code should be: PROCEDURE procname(pardate VARCHAR2) IS
vardate DATE:= to_date(pardate, 'DD-MON-Y... | pl/sql - to_date not working with execute immediate parameter i wanna be able to execute my below proc like so: exec procname('29-JAN-2011'); proc code is: PROCEDURE procname(pardate VARCHAR2) IS
vardate DATE:= to_date(pardate, 'DD-MON-YYYY'); SQLS VARCHAR2(4000);
BEGIN
SQLS:= 'SELECT cola, colb FROM tablea WHERE TR... | TITLE:
pl/sql - to_date not working with execute immediate parameter
QUESTION:
i wanna be able to execute my below proc like so: exec procname('29-JAN-2011'); proc code is: PROCEDURE procname(pardate VARCHAR2) IS
vardate DATE:= to_date(pardate, 'DD-MON-YYYY'); SQLS VARCHAR2(4000);
BEGIN
SQLS:= 'SELECT cola, colb FR... | [
"sql",
"oracle",
"plsql",
"dynamic-sql",
"ora-00904"
] | 1 | 6 | 10,720 | 2 | 0 | 2011-06-04T02:18:07.743000 | 2011-06-04T02:52:59.873000 |
6,234,278 | 6,234,461 | How to find Edges and Vertices of a hand drawn polygon | I would like to make a shape recognition program that would trace a mouse and record it's location at each 1/2 second. How could I use these points to find a rough polygon? In other words, if you just draw a shape resembling a triangle or square, it will more likely be a be a 50-100-gon, how can I simplify it to get th... | For each point along the 100-agon, find the area of the tiny triangle formed by that point and the points on either side. Remove the point that created the smallest triangle. Repeat until the smallest triangle is larger than some threshold. | How to find Edges and Vertices of a hand drawn polygon I would like to make a shape recognition program that would trace a mouse and record it's location at each 1/2 second. How could I use these points to find a rough polygon? In other words, if you just draw a shape resembling a triangle or square, it will more likel... | TITLE:
How to find Edges and Vertices of a hand drawn polygon
QUESTION:
I would like to make a shape recognition program that would trace a mouse and record it's location at each 1/2 second. How could I use these points to find a rough polygon? In other words, if you just draw a shape resembling a triangle or square, ... | [
"algorithm",
"gesture-recognition",
"image-recognition",
"vertices",
"edges"
] | 4 | 1 | 635 | 2 | 0 | 2011-06-04T02:18:51.230000 | 2011-06-04T03:12:08.540000 |
6,234,293 | 6,234,308 | SQL insert a foreach select on same table? | Can I, instead of doing this via PHP, combine this in 1 sql statement? object_ids = "select object_id from `wp_term_relationships` where `term_taxonomy_id` = 14;"; foreach(object_ids as object_id) { "insert into `wp_term_relationships` VALUES (". object_id. ",1597,0);"; } (for WordPress: for every post that has a categ... | INSERT INTO `wp_term_relationships` SELECT object_id, 1597, 0 FROM `wp_term_relationships` WHERE `term_taxonomy_id` = 14; | SQL insert a foreach select on same table? Can I, instead of doing this via PHP, combine this in 1 sql statement? object_ids = "select object_id from `wp_term_relationships` where `term_taxonomy_id` = 14;"; foreach(object_ids as object_id) { "insert into `wp_term_relationships` VALUES (". object_id. ",1597,0);"; } (for... | TITLE:
SQL insert a foreach select on same table?
QUESTION:
Can I, instead of doing this via PHP, combine this in 1 sql statement? object_ids = "select object_id from `wp_term_relationships` where `term_taxonomy_id` = 14;"; foreach(object_ids as object_id) { "insert into `wp_term_relationships` VALUES (". object_id. "... | [
"sql",
"select",
"insert"
] | 1 | 4 | 1,153 | 2 | 0 | 2011-06-04T02:23:35.300000 | 2011-06-04T02:26:47.453000 |
6,234,299 | 6,236,053 | Arranging fieldset elements like a typical table-design | I'm trying to arrange the titles for 3 fieldset elements the same way a typical table looks, but I can't get it the way I want. This comes pretty close, however... Title1 Title2 Title3 Lorem Ipsum I may've used tables if there was a way I didn't have to run an if statement in my PHP code for both the title and the fiel... | what you could do is remove the label 's from the flow so they don't get vertically aligned with the inputs/text.. do this by absolutely positioning them.. this will require a parent element to have position: relative; on it - I presume the overall code above is in a form element but for the sake a demo I've just wrapp... | Arranging fieldset elements like a typical table-design I'm trying to arrange the titles for 3 fieldset elements the same way a typical table looks, but I can't get it the way I want. This comes pretty close, however... Title1 Title2 Title3 Lorem Ipsum I may've used tables if there was a way I didn't have to run an if ... | TITLE:
Arranging fieldset elements like a typical table-design
QUESTION:
I'm trying to arrange the titles for 3 fieldset elements the same way a typical table looks, but I can't get it the way I want. This comes pretty close, however... Title1 Title2 Title3 Lorem Ipsum I may've used tables if there was a way I didn't ... | [
"html",
"css",
"tabular",
"fieldset"
] | 4 | 2 | 26,658 | 2 | 0 | 2011-06-04T02:24:45.440000 | 2011-06-04T09:58:54.087000 |
6,234,300 | 6,234,741 | C++ accessing a function from in a class, receiving functions as a parameter | i have two questions that are fairly small and related so i will put them both in the same question. i have been experimenting with classes and i was attempting to access a class in another file that wasn't in a class so for example. //class 1.cpp void Class1::function1()//another error { function() }
//main.cpp
void... | How to access a function in another file? Depends on the type of function, there can be to cases: 1. Accessing class member functions in another file(Translation Unit): Obviously, you need to include the header file, which has the class declaration in your caller translation unit. Example code: //MyClass.h
class MyCla... | C++ accessing a function from in a class, receiving functions as a parameter i have two questions that are fairly small and related so i will put them both in the same question. i have been experimenting with classes and i was attempting to access a class in another file that wasn't in a class so for example. //class 1... | TITLE:
C++ accessing a function from in a class, receiving functions as a parameter
QUESTION:
i have two questions that are fairly small and related so i will put them both in the same question. i have been experimenting with classes and i was attempting to access a class in another file that wasn't in a class so for ... | [
"c++",
"function"
] | 0 | 2 | 212 | 3 | 0 | 2011-06-04T02:24:46.087000 | 2011-06-04T04:42:41.433000 |
6,234,309 | 6,234,322 | iOs recognizing letters, neural network, ocr, etc | I want to recognize uppercase letters using objective-c. I have an implementation now that uses tesseract OCR but it's just not accurate enough. The sample size is incredibly small. Only letters A-Z all the same font and all uppercase so there has to be an easier solution. I'm going to send this to you guys becuase I'm... | Tesseract is probably your best shot. The default OCR isn't great, but you can train it to work better. We did a project (skip to 3:25) where we trained Tesseract to read credit card numbers from iPhone images of credit cards. | iOs recognizing letters, neural network, ocr, etc I want to recognize uppercase letters using objective-c. I have an implementation now that uses tesseract OCR but it's just not accurate enough. The sample size is incredibly small. Only letters A-Z all the same font and all uppercase so there has to be an easier soluti... | TITLE:
iOs recognizing letters, neural network, ocr, etc
QUESTION:
I want to recognize uppercase letters using objective-c. I have an implementation now that uses tesseract OCR but it's just not accurate enough. The sample size is incredibly small. Only letters A-Z all the same font and all uppercase so there has to b... | [
"ios"
] | 0 | 2 | 1,971 | 1 | 0 | 2011-06-04T02:26:48.717000 | 2011-06-04T02:31:34.617000 |
6,234,315 | 6,234,632 | Help with Ruby & PrinceXML | I'm trying to write a very simple markdown-like converter in ruby, then pass the output to PrinceXML (which is awesome). Prince basically converts html to pdf. Here's my code: #!/usr/bin/ruby # USAGE: command source-file.txt target-file.pdf
# read argument 1 as input text = File.read(ARGV[0])
# wrap paragraphs in par... | It's possible that the file output is being buffered, and not written to disk, because of how you are creating the output file. Try this instead: # create a new temp file for processing File.open('/tmp/sample.html', "w+") do |htmlFile|
# place the transformed text in the new file htmlFile.puts text
end
# run prince ... | Help with Ruby & PrinceXML I'm trying to write a very simple markdown-like converter in ruby, then pass the output to PrinceXML (which is awesome). Prince basically converts html to pdf. Here's my code: #!/usr/bin/ruby # USAGE: command source-file.txt target-file.pdf
# read argument 1 as input text = File.read(ARGV[0]... | TITLE:
Help with Ruby & PrinceXML
QUESTION:
I'm trying to write a very simple markdown-like converter in ruby, then pass the output to PrinceXML (which is awesome). Prince basically converts html to pdf. Here's my code: #!/usr/bin/ruby # USAGE: command source-file.txt target-file.pdf
# read argument 1 as input text =... | [
"ruby",
"princexml"
] | 1 | 1 | 480 | 2 | 0 | 2011-06-04T02:28:43.873000 | 2011-06-04T04:10:33.007000 |
6,234,319 | 6,234,402 | Updating A Small Application | I've made a small application for fun and I want to implement an update feature. I don't really have a remote server or anything. I thought I could use a file hosting site to host my application. So: Does anyone know a good site which I can easily download files from? (not like rapidshare that you have to wait. more li... | You can use Amazon Web Services S3 and CloudFront to host your application files. If you don't want to use ClickOnce, you could simply have the application download a text file that has the latest version number from a predefined update site. Have your program compare it with the current running version and if there is... | Updating A Small Application I've made a small application for fun and I want to implement an update feature. I don't really have a remote server or anything. I thought I could use a file hosting site to host my application. So: Does anyone know a good site which I can easily download files from? (not like rapidshare t... | TITLE:
Updating A Small Application
QUESTION:
I've made a small application for fun and I want to implement an update feature. I don't really have a remote server or anything. I thought I could use a file hosting site to host my application. So: Does anyone know a good site which I can easily download files from? (not... | [
"c#",
"download"
] | 1 | 1 | 130 | 1 | 0 | 2011-06-04T02:30:07.473000 | 2011-06-04T02:53:04.353000 |
6,234,320 | 6,234,342 | How to get values after "\n" character? | I want to take all values after a new line character \n from my string. How can I get those values? | Try this: NSString *substring = nil; NSRange newlineRange = [yourString rangeOfString:@"\n"]; if(newlineRange.location!= NSNotFound) { substring = [yourString substringFromIndex:newlineRange.location]; } | How to get values after "\n" character? I want to take all values after a new line character \n from my string. How can I get those values? | TITLE:
How to get values after "\n" character?
QUESTION:
I want to take all values after a new line character \n from my string. How can I get those values?
ANSWER:
Try this: NSString *substring = nil; NSRange newlineRange = [yourString rangeOfString:@"\n"]; if(newlineRange.location!= NSNotFound) { substring = [yourS... | [
"objective-c",
"cocoa-touch",
"ios",
"nsstring",
"newline"
] | 5 | 8 | 2,407 | 3 | 0 | 2011-06-04T02:30:39.503000 | 2011-06-04T02:36:15.713000 |
6,234,323 | 6,234,369 | Is it possible to create a service to manipulate a webpage DOM dynamically? | Hi I am relatively new to this topic so I have no idea if this is possible. What I want to do is to create a widget which could be attached to the any web page other there dynamically. This widget has nothing to do with any web pages in particular but once the widget is created all the visitor of the web pages should b... | If I have understood your question correctly, you want to have a script that injects onto every webpage the user visits and displays a widget, correct? You could create an add-on, although you would have to create a separate add-on for each browser you plan to support, and they can sometimes be a bit more complicated t... | Is it possible to create a service to manipulate a webpage DOM dynamically? Hi I am relatively new to this topic so I have no idea if this is possible. What I want to do is to create a widget which could be attached to the any web page other there dynamically. This widget has nothing to do with any web pages in particu... | TITLE:
Is it possible to create a service to manipulate a webpage DOM dynamically?
QUESTION:
Hi I am relatively new to this topic so I have no idea if this is possible. What I want to do is to create a widget which could be attached to the any web page other there dynamically. This widget has nothing to do with any we... | [
"javascript",
"dom",
"iframe"
] | 1 | 1 | 56 | 1 | 0 | 2011-06-04T02:31:41.453000 | 2011-06-04T02:44:44.410000 |
6,234,335 | 6,234,664 | finding the bounding box of plotted text | I would like to jitter the text on a plot so as to avoid overplotting. To do so, I assume that I need a bounding box around the text component. Is there a way to get this? For example, in base graphics: plot.new() text(.5,.5,"word") text(.6,.5,"word") #does this overlap? In grid there is a way to drop overlapping text,... | Maybe the strwidth and strheight functions can help here stroverlap <- function(x1,y1,s1, x2,y2,s2) { sh1 <- strheight(s1) sw1 <- strwidth(s1) sh2 <- strheight(s2) sw2 <- strwidth(s2)
overlap <- FALSE if (x1 x2 else overlap <- x2 + sw2 > x1
if (y1 y2) else overlap <- overlap && (y2+sh2>y1)
return(overlap) } stroverl... | finding the bounding box of plotted text I would like to jitter the text on a plot so as to avoid overplotting. To do so, I assume that I need a bounding box around the text component. Is there a way to get this? For example, in base graphics: plot.new() text(.5,.5,"word") text(.6,.5,"word") #does this overlap? In grid... | TITLE:
finding the bounding box of plotted text
QUESTION:
I would like to jitter the text on a plot so as to avoid overplotting. To do so, I assume that I need a bounding box around the text component. Is there a way to get this? For example, in base graphics: plot.new() text(.5,.5,"word") text(.6,.5,"word") #does thi... | [
"r"
] | 14 | 6 | 1,769 | 3 | 0 | 2011-06-04T02:34:44.160000 | 2011-06-04T04:21:02.347000 |
6,234,338 | 6,234,444 | Binary Search Tree Traversal - PreOrder | I m trying to implement Tree Traversal PreOrder using yield return which returns an IEnumerable private IEnumerable Preorder(Node node) {
while(node!= null) { yield return node.Data; yield return node.LeftChild.Data; yield return node.RightChild.Data; }
} In this case, it goes into infinite loop and yes I know that I... | Option #1 Recursive public class Node: IEnumerable { public Node LeftChild { get; set; }
public Node RightChild { get; set; }
public T Data { get; set; }
public IEnumerator GetEnumerator() { yield return Data;
if (LeftChild!= null) { foreach (var child in LeftChild) yield return child; } if (RightChild!= null) { fo... | Binary Search Tree Traversal - PreOrder I m trying to implement Tree Traversal PreOrder using yield return which returns an IEnumerable private IEnumerable Preorder(Node node) {
while(node!= null) { yield return node.Data; yield return node.LeftChild.Data; yield return node.RightChild.Data; }
} In this case, it goes ... | TITLE:
Binary Search Tree Traversal - PreOrder
QUESTION:
I m trying to implement Tree Traversal PreOrder using yield return which returns an IEnumerable private IEnumerable Preorder(Node node) {
while(node!= null) { yield return node.Data; yield return node.LeftChild.Data; yield return node.RightChild.Data; }
} In t... | [
"c#",
".net",
"algorithm",
"tree",
"binary-search-tree"
] | 8 | 5 | 7,628 | 1 | 0 | 2011-06-04T02:34:57.017000 | 2011-06-04T03:04:54.143000 |
6,234,344 | 6,234,786 | Help understanding class method returning singleton | Can someone please help me understand what the following method is doing? + (Game *) shared { static Game *sharedSingleton;
@synchronized(self) { if (!sharedSingleton) { sharedSingleton = [[Game alloc] init]; } }
return sharedSingleton; } | Obviously, the idea behind a singleton is to create only a single instance. The first step in achieving this is to declare a static instance of the class via the line static Game *sharedSingleton;. The second step is to check whether the single instance is already created, and if it isn't, to create it, or if it is, to... | Help understanding class method returning singleton Can someone please help me understand what the following method is doing? + (Game *) shared { static Game *sharedSingleton;
@synchronized(self) { if (!sharedSingleton) { sharedSingleton = [[Game alloc] init]; } }
return sharedSingleton; } | TITLE:
Help understanding class method returning singleton
QUESTION:
Can someone please help me understand what the following method is doing? + (Game *) shared { static Game *sharedSingleton;
@synchronized(self) { if (!sharedSingleton) { sharedSingleton = [[Game alloc] init]; } }
return sharedSingleton; }
ANSWER:
... | [
"objective-c",
"cocoa-touch",
"ios",
"singleton",
"singleton-methods"
] | 12 | 46 | 6,950 | 4 | 0 | 2011-06-04T02:36:22.773000 | 2011-06-04T04:56:42.090000 |
6,234,351 | 6,236,411 | How to test android method with J2SE | I have some dynamically generated Android classes. I need to test some of the methods of those classes (these methods have nothing to do with UI). I hope to integrate this feature into an existing J2SE project. Is this possible to run it on standard VM? If I have to use Dalvik VM, is there any command line interface so... | Is this possible to run it on standard VM? You neglected to explain what "it" is. If "it" is Android, no. If "it" is your "dynamically generated Android classes", assuming that really means "dynamically generated Java classes", then presumably yes. If your objective is for those classes to go "into an existing J2SE pro... | How to test android method with J2SE I have some dynamically generated Android classes. I need to test some of the methods of those classes (these methods have nothing to do with UI). I hope to integrate this feature into an existing J2SE project. Is this possible to run it on standard VM? If I have to use Dalvik VM, i... | TITLE:
How to test android method with J2SE
QUESTION:
I have some dynamically generated Android classes. I need to test some of the methods of those classes (these methods have nothing to do with UI). I hope to integrate this feature into an existing J2SE project. Is this possible to run it on standard VM? If I have t... | [
"java",
"android"
] | 1 | 1 | 216 | 1 | 0 | 2011-06-04T02:38:17.063000 | 2011-06-04T11:15:48.747000 |
6,234,355 | 6,234,951 | Access host class from IronPython script | How do I access a C# class from IronPython script? C#: public class MyClass { }
public enum MyEnum { One, Two }
var engine = Python.CreateEngine(options); var scope = engine.CreateScope(); scope.SetVariable("t", new MyClass()); var src = engine.CreateScriptSourceFromFile(...); src.Execute(scope); IronPython script: c... | You've set t to an instance of MyClass, but you're trying to use it as if it were the class itself. You'll need to either import MyClass from within your IronPython script, or inject some sort of factory method (since classes aren't first-class objects in C#, you can't pass in MyClass directly). Alternatively, you coul... | Access host class from IronPython script How do I access a C# class from IronPython script? C#: public class MyClass { }
public enum MyEnum { One, Two }
var engine = Python.CreateEngine(options); var scope = engine.CreateScope(); scope.SetVariable("t", new MyClass()); var src = engine.CreateScriptSourceFromFile(...);... | TITLE:
Access host class from IronPython script
QUESTION:
How do I access a C# class from IronPython script? C#: public class MyClass { }
public enum MyEnum { One, Two }
var engine = Python.CreateEngine(options); var scope = engine.CreateScope(); scope.SetVariable("t", new MyClass()); var src = engine.CreateScriptSo... | [
"c#",
"ironpython"
] | 5 | 3 | 2,585 | 1 | 0 | 2011-06-04T02:38:57.850000 | 2011-06-04T05:30:38.080000 |
6,234,356 | 6,234,370 | C# Silverlight Equivlant of Windows Form Method? | What is the equivlant of this: while (Offset < packet.Data.Length) { Offset += m_Socket.Receive(packet.Data, Offset, packet.Data.Length - Offset, SocketFlags.None); } In Siliverlight? That is Windows Form and does not work with Silverlight:/ Any helped would be appreciated. Thanks What the function does is, on the "com... | Silverlight does not have synchronous Socket methods. You will need to use Socket.ReceiveAsync Method. Good example here: Pushing Data to a Silverlight Client with Sockets. [Edit] A basic idea to do something like this: var e = new SocketAsyncEventArgs(); e.Completed += SocketReceiveCompleted; Socket.ReceiveAsync(e);
... | C# Silverlight Equivlant of Windows Form Method? What is the equivlant of this: while (Offset < packet.Data.Length) { Offset += m_Socket.Receive(packet.Data, Offset, packet.Data.Length - Offset, SocketFlags.None); } In Siliverlight? That is Windows Form and does not work with Silverlight:/ Any helped would be appreciat... | TITLE:
C# Silverlight Equivlant of Windows Form Method?
QUESTION:
What is the equivlant of this: while (Offset < packet.Data.Length) { Offset += m_Socket.Receive(packet.Data, Offset, packet.Data.Length - Offset, SocketFlags.None); } In Siliverlight? That is Windows Form and does not work with Silverlight:/ Any helped ... | [
"c#",
".net",
"silverlight",
"sockets"
] | 3 | 4 | 158 | 1 | 0 | 2011-06-04T02:39:14.723000 | 2011-06-04T02:44:44.550000 |
6,234,364 | 6,237,803 | Pre-populated database. Now I want to add more data without messing the pre-existing data | I have set up and app which has pre-populated data that copies the database to the project's store. Using the 'CoreDataBooks example' method: Any way to pre populate core data? For application upgrades, I want to add more data to the database but I don't want to change the existing database since new user data is store... | If you change the managed object model itself e.g. add a new entity or change an existing attribute, then you need to use migration to update the existing persistent store. See the Core Data docs for details on migration. If you just want to add new data, then you don't have any choice but to do so "manually." Remember... | Pre-populated database. Now I want to add more data without messing the pre-existing data I have set up and app which has pre-populated data that copies the database to the project's store. Using the 'CoreDataBooks example' method: Any way to pre populate core data? For application upgrades, I want to add more data to ... | TITLE:
Pre-populated database. Now I want to add more data without messing the pre-existing data
QUESTION:
I have set up and app which has pre-populated data that copies the database to the project's store. Using the 'CoreDataBooks example' method: Any way to pre populate core data? For application upgrades, I want to... | [
"iphone",
"objective-c",
"ios",
"core-data"
] | 3 | 0 | 421 | 1 | 0 | 2011-06-04T02:42:57.053000 | 2011-06-04T16:00:30.227000 |
6,234,377 | 6,235,784 | How to read attribute data from the object returned from FB.api? | I have the following code implement to catch the event when a user leaves a comment. It is firing correctly, but the problem is I have no idea how to parse the object that is being passed to my callback function. Looking at the console log in firebug, console.log(response) shows this object: { "http://foo.com": { "data... | You forget your "http://foo.com".. So it should be something like response["http://foo.com"].data[0].id Or response["http://foo.com"].data[0].from.name | How to read attribute data from the object returned from FB.api? I have the following code implement to catch the event when a user leaves a comment. It is firing correctly, but the problem is I have no idea how to parse the object that is being passed to my callback function. Looking at the console log in firebug, con... | TITLE:
How to read attribute data from the object returned from FB.api?
QUESTION:
I have the following code implement to catch the event when a user leaves a comment. It is firing correctly, but the problem is I have no idea how to parse the object that is being passed to my callback function. Looking at the console l... | [
"facebook",
"facebook-graph-api"
] | 3 | 2 | 3,533 | 3 | 0 | 2011-06-04T02:46:44.167000 | 2011-06-04T09:02:38.323000 |
6,234,378 | 6,234,427 | Trying to implement example using HttpExchange | I'm trying to implement the code under "Asynchronous Exchanges" from this link in the jetty documentation: http://wiki.eclipse.org/Jetty/Tutorial/HttpClient#Asynchronous_Exchanges HttpExchange exchange = new HttpExchange();
// Optionally set the HTTP method exchange.setMethod("POST");
exchange.setAddress(new Address(... | It's org.eclipse.jetty.client.HttpExchange, assuming you're using the version from Eclipse. | Trying to implement example using HttpExchange I'm trying to implement the code under "Asynchronous Exchanges" from this link in the jetty documentation: http://wiki.eclipse.org/Jetty/Tutorial/HttpClient#Asynchronous_Exchanges HttpExchange exchange = new HttpExchange();
// Optionally set the HTTP method exchange.setMe... | TITLE:
Trying to implement example using HttpExchange
QUESTION:
I'm trying to implement the code under "Asynchronous Exchanges" from this link in the jetty documentation: http://wiki.eclipse.org/Jetty/Tutorial/HttpClient#Asynchronous_Exchanges HttpExchange exchange = new HttpExchange();
// Optionally set the HTTP met... | [
"java",
"http",
"jetty"
] | 3 | 2 | 1,665 | 1 | 0 | 2011-06-04T02:46:58.103000 | 2011-06-04T02:59:14.617000 |
6,234,379 | 6,234,465 | MySQL Conditional Join | As you can see below, I am checking to see if the current user is in user_a or user_b columns of table friends. Depending on where the current user is located, I want to get his corresponding friend. Somehow I can't get this syntax to work and wonder if anyone can tell me what's wrong (I get an error on line 3 near IF ... | You can do it with a UNION: select f.*, up_a.* from friends f inner join user_profiles up_a on f.user_a=up_a.user_id where f.user_b=2 and f.accepted=1 union select f.*, up_b.* from friends f inner join user_profiles up_b on f.user_b=up_b.user_id where f.user_a=2 and f.accepted=1; | MySQL Conditional Join As you can see below, I am checking to see if the current user is in user_a or user_b columns of table friends. Depending on where the current user is located, I want to get his corresponding friend. Somehow I can't get this syntax to work and wonder if anyone can tell me what's wrong (I get an e... | TITLE:
MySQL Conditional Join
QUESTION:
As you can see below, I am checking to see if the current user is in user_a or user_b columns of table friends. Depending on where the current user is located, I want to get his corresponding friend. Somehow I can't get this syntax to work and wonder if anyone can tell me what's... | [
"mysql",
"sql",
"mysql-error-1064"
] | 5 | 7 | 2,828 | 3 | 0 | 2011-06-04T02:47:06.197000 | 2011-06-04T03:13:28.707000 |
6,234,380 | 6,236,721 | Nodejs : Redirect URL | I'm trying to redirect the url of my app in node.js in this way: // response comes from the http server response.statusCode = 302; response.setHeader("Location", "/page"); response.end(); But the current page is mixed with the new one, it looks strange:| My solution looked totally logical, I don't really know why this ... | Looks like express does it pretty much the way you have. From what I can see the differences are that they push some body content and use an absolute url. See the express response.redirect method: https://github.com/visionmedia/express/blob/master/lib/response.js#L335 // Support text/{plain,html} by default if (req.acc... | Nodejs : Redirect URL I'm trying to redirect the url of my app in node.js in this way: // response comes from the http server response.statusCode = 302; response.setHeader("Location", "/page"); response.end(); But the current page is mixed with the new one, it looks strange:| My solution looked totally logical, I don't... | TITLE:
Nodejs : Redirect URL
QUESTION:
I'm trying to redirect the url of my app in node.js in this way: // response comes from the http server response.statusCode = 302; response.setHeader("Location", "/page"); response.end(); But the current page is mixed with the new one, it looks strange:| My solution looked totall... | [
"url",
"redirect",
"node.js"
] | 14 | 8 | 25,926 | 5 | 0 | 2011-06-04T02:47:11.967000 | 2011-06-04T12:23:32.977000 |
6,234,381 | 6,236,308 | Providing fake data to liquid to render a preview of a template | I have created the ability for users in my system to edit a liquid template that is eventually rendered and turned into a PDF. I would like some ideas as to what the best method would be to create some mock objects to feed the template so as to create a preview for them to see what the final result of their template mo... | I ended up using a YAML file to build up the structure I needed. It seems that liquid will take a hash of values (and other hashes) instead of the actual models with relationships no problem, so I didn't even need to instantiate the models. Will happily post an example if anyone is interested. | Providing fake data to liquid to render a preview of a template I have created the ability for users in my system to edit a liquid template that is eventually rendered and turned into a PDF. I would like some ideas as to what the best method would be to create some mock objects to feed the template so as to create a pr... | TITLE:
Providing fake data to liquid to render a preview of a template
QUESTION:
I have created the ability for users in my system to edit a liquid template that is eventually rendered and turned into a PDF. I would like some ideas as to what the best method would be to create some mock objects to feed the template so... | [
"ruby-on-rails",
"templates",
"preview",
"liquid"
] | 2 | 0 | 491 | 2 | 0 | 2011-06-04T02:47:41.577000 | 2011-06-04T10:54:58.430000 |
6,234,385 | 6,234,499 | Cleaning up with IDisposable issues | I am trying to call these functions to get rid of stuff I don't need, but my code seems to be defeating me in what I am begining to perceive to be a vain struggle. I have tried multiple ways to solve these last two errors, but the IEnumerator is giving me wild cards. errors are on the lines: if (enumerator2 is IDisposa... | You should use a foreach loop as pointed out by others. But, the reason you are getting that error is because when enumerator2 is used in the finally block, the compiler cannot know that it gets set to some value (because it may not be in some exceptional situations). You can fix your code as-is, by doing: IEnumerator ... | Cleaning up with IDisposable issues I am trying to call these functions to get rid of stuff I don't need, but my code seems to be defeating me in what I am begining to perceive to be a vain struggle. I have tried multiple ways to solve these last two errors, but the IEnumerator is giving me wild cards. errors are on th... | TITLE:
Cleaning up with IDisposable issues
QUESTION:
I am trying to call these functions to get rid of stuff I don't need, but my code seems to be defeating me in what I am begining to perceive to be a vain struggle. I have tried multiple ways to solve these last two errors, but the IEnumerator is giving me wild cards... | [
"c#",
"regex",
"idisposable",
"ienumerator",
"dispose"
] | 2 | 2 | 2,451 | 2 | 0 | 2011-06-04T02:48:29.870000 | 2011-06-04T03:27:49.380000 |
6,234,386 | 6,234,455 | How do I sanitize invalid UTF-8 in Perl? | My Perl program takes some text from a disk file as input, wraps it in some XML, then outputs it to STDOUT. The input is nominally UTF-8, but sometimes has junk inserted. I need to sanitize the output such that no invalid UTF-8 octets are emitted, otherwise the downstream consumer (Sphinx) will blow up. At the very lea... | You should read the UTF-8 vs. utf8 vs. UTF8 section of the Encode docs. To summarize, Perl has two different UTF-8 encodings. Its native encoding is called utf8, and basically allows any codepoint, regardless of what the Unicode standard says about that codepoint. The other encoding is called utf-8 (a.k.a. utf-8-strict... | How do I sanitize invalid UTF-8 in Perl? My Perl program takes some text from a disk file as input, wraps it in some XML, then outputs it to STDOUT. The input is nominally UTF-8, but sometimes has junk inserted. I need to sanitize the output such that no invalid UTF-8 octets are emitted, otherwise the downstream consum... | TITLE:
How do I sanitize invalid UTF-8 in Perl?
QUESTION:
My Perl program takes some text from a disk file as input, wraps it in some XML, then outputs it to STDOUT. The input is nominally UTF-8, but sometimes has junk inserted. I need to sanitize the output such that no invalid UTF-8 octets are emitted, otherwise the... | [
"perl",
"utf-8",
"sanitization"
] | 20 | 21 | 12,184 | 2 | 0 | 2011-06-04T02:49:05.897000 | 2011-06-04T03:09:00.947000 |
6,234,388 | 6,235,917 | Validating Select Drop Down Array in PHP | I have the following to generate a state drop down on a form: $states = array('State', 'Alabama', 'Alaska', 'Arizona', 'Arkansas'); echo " \n"; foreach ($states as $key => $state) {echo " $state \n";} echo " "; How would I go about making sure a user 1) only selects one of the options in the array 2) doesn't select the... | I think you're missing some checks. You should never rely on what is exacly posted, and always perform thorough checking: $chosen_state = null;
if (array_key_exists('choose_state', $_POST)) { $choose_state = $_POST['choose_state']; if (array_key_exists($choose_state, $states) && $choose_state > 0) { // Value does actu... | Validating Select Drop Down Array in PHP I have the following to generate a state drop down on a form: $states = array('State', 'Alabama', 'Alaska', 'Arizona', 'Arkansas'); echo " \n"; foreach ($states as $key => $state) {echo " $state \n";} echo " "; How would I go about making sure a user 1) only selects one of the o... | TITLE:
Validating Select Drop Down Array in PHP
QUESTION:
I have the following to generate a state drop down on a form: $states = array('State', 'Alabama', 'Alaska', 'Arizona', 'Arkansas'); echo " \n"; foreach ($states as $key => $state) {echo " $state \n";} echo " "; How would I go about making sure a user 1) only se... | [
"php",
"validation"
] | 3 | 1 | 2,032 | 3 | 0 | 2011-06-04T02:50:21.140000 | 2011-06-04T09:29:47.607000 |
6,234,395 | 6,234,417 | How to print password combination (but with custom constraints for each index) | I am trying to build a dynamic password recovery tool. You can specify a password, and an unknown character list which correspond to unknown password indexes. So, if you remember 90% of your password, and can't remember a few letters, this will do a light weight brute force for you. I am able to combine the user suppli... | Do you mean something like this? >>> import itertools >>> >>> password = 'Dude123' >>> charList = ['d8','vV','','D8','','',''] >>> >>> finalString = [''.join(set((a, b))) for a, b in zip(password, charList)] >>> >>> possibles = list(''.join(poss) for poss in itertools.product(*finalString)) >>> possibles ['Dude123', 'D... | How to print password combination (but with custom constraints for each index) I am trying to build a dynamic password recovery tool. You can specify a password, and an unknown character list which correspond to unknown password indexes. So, if you remember 90% of your password, and can't remember a few letters, this w... | TITLE:
How to print password combination (but with custom constraints for each index)
QUESTION:
I am trying to build a dynamic password recovery tool. You can specify a password, and an unknown character list which correspond to unknown password indexes. So, if you remember 90% of your password, and can't remember a f... | [
"python",
"string",
"loops",
"passwords",
"combinations"
] | 4 | 3 | 517 | 1 | 0 | 2011-06-04T02:51:42.123000 | 2011-06-04T02:56:21.367000 |
6,234,405 | 6,234,491 | Logging uncaught exceptions in Python | How do you cause uncaught exceptions to output via the logging module rather than to stderr? I realize the best way to do this would be: try: raise Exception, 'Throwing a boring exception' except Exception, e: logging.exception(e) But my situation is such that it would be really nice if logging.exception(...) were invo... | As Ned pointed out, sys.excepthook is invoked every time an exception is raised and uncaught. The practical implication of this is that in your code you can override the default behavior of sys.excepthook to do whatever you want (including using logging.exception ). As a straw man example: import sys def foo(exctype, v... | Logging uncaught exceptions in Python How do you cause uncaught exceptions to output via the logging module rather than to stderr? I realize the best way to do this would be: try: raise Exception, 'Throwing a boring exception' except Exception, e: logging.exception(e) But my situation is such that it would be really ni... | TITLE:
Logging uncaught exceptions in Python
QUESTION:
How do you cause uncaught exceptions to output via the logging module rather than to stderr? I realize the best way to do this would be: try: raise Exception, 'Throwing a boring exception' except Exception, e: logging.exception(e) But my situation is such that it ... | [
"python",
"exception",
"logging",
"python-logging"
] | 262 | 178 | 102,406 | 10 | 0 | 2011-06-04T02:53:22.397000 | 2011-06-04T03:26:14.740000 |
6,234,414 | 6,234,432 | How to reload Python module in IDLE? | I'm trying to understand how my workflow can work with Python and IDLE. Suppose I write a function: def hello(): print 'hello!' I save the file as greetings.py. Then in IDLE, I test the function: >>> from greetings import * >>> hello() hello! Then I alter the program, and want to try hello() again. So I reload: >>> rel... | You need to redo this line: >>> from greetings import * after you do >>> reload(greetings) The reason just reloading the module doesn't work is because the * actually imported everything inside the module, so you have to reload those individually. If you did the following it would behave as you expect: >>> import greet... | How to reload Python module in IDLE? I'm trying to understand how my workflow can work with Python and IDLE. Suppose I write a function: def hello(): print 'hello!' I save the file as greetings.py. Then in IDLE, I test the function: >>> from greetings import * >>> hello() hello! Then I alter the program, and want to tr... | TITLE:
How to reload Python module in IDLE?
QUESTION:
I'm trying to understand how my workflow can work with Python and IDLE. Suppose I write a function: def hello(): print 'hello!' I save the file as greetings.py. Then in IDLE, I test the function: >>> from greetings import * >>> hello() hello! Then I alter the progr... | [
"python",
"module",
"reload",
"python-idle"
] | 14 | 12 | 8,596 | 4 | 0 | 2011-06-04T02:56:01.453000 | 2011-06-04T03:01:27.130000 |
6,234,428 | 6,243,917 | Copy Windows Phone 7 project | I have a windows phone 7 app that is released in the MarketPlace. What I want to do is create a variant of that app. So I will have an app that is $1 and an app that is $5. Is there anyway for me to basically copy the entire project without having to essentially copy and paste everything? What would be the best way to ... | I would stay away from making a copy of fiel if you want to maintain any of the same functionality in both projects going forward. If you don't you'll end up having to change code twice and this can lead to mistakes as well as the overhead of the duplicated task. Where I've had to do this or similar previously, I've cr... | Copy Windows Phone 7 project I have a windows phone 7 app that is released in the MarketPlace. What I want to do is create a variant of that app. So I will have an app that is $1 and an app that is $5. Is there anyway for me to basically copy the entire project without having to essentially copy and paste everything? W... | TITLE:
Copy Windows Phone 7 project
QUESTION:
I have a windows phone 7 app that is released in the MarketPlace. What I want to do is create a variant of that app. So I will have an app that is $1 and an app that is $5. Is there anyway for me to basically copy the entire project without having to essentially copy and p... | [
".net",
"windows-phone-7"
] | 1 | 2 | 231 | 3 | 0 | 2011-06-04T02:59:33.960000 | 2011-06-05T15:40:07.877000 |
6,234,435 | 6,236,085 | Where to put OAuth logic? | I'm using Zend Framework in a project, and I'm creating a controller only for authentication. In this project we'll accept that a user signs up through a account of other sites like facebook, twitter, myspace, etc.. For this we will be using OAuth. But I'm having a doubt where I should put the logic for each OAuth site... | JF Austin has a fairly generic OAuth authentication adapter implementation that uses a Zend_Oauth_Consumer. Creating specific subclasses of this for Twitter, Facebook, etc seems to be straightforward from there. He even seems to have a Twitter adapter already. Use of the adapter is described in his blog post about it. ... | Where to put OAuth logic? I'm using Zend Framework in a project, and I'm creating a controller only for authentication. In this project we'll accept that a user signs up through a account of other sites like facebook, twitter, myspace, etc.. For this we will be using OAuth. But I'm having a doubt where I should put the... | TITLE:
Where to put OAuth logic?
QUESTION:
I'm using Zend Framework in a project, and I'm creating a controller only for authentication. In this project we'll accept that a user signs up through a account of other sites like facebook, twitter, myspace, etc.. For this we will be using OAuth. But I'm having a doubt wher... | [
"php",
"zend-framework",
"oauth",
"service-layer",
"actioncontroller"
] | 3 | 1 | 230 | 2 | 0 | 2011-06-04T03:02:11.617000 | 2011-06-04T10:05:56.840000 |
6,234,438 | 6,234,463 | I can't draw a NSRect based on where the user clicks | I am trying to draw a rectangle and let the user create it based on where he clicks and where he drags the mouse. The code I am using to draw the NSRect is: CGFloat width = endPoint.x-startPoint.x; //Width of rectangle. CGFloat height = endPoint.y-startPoint.y; //Height of rectangle. CGFloat rectXPoint = startPoint.x; ... | Probably this line: CGFloat rectYPoint = startPoint.x; //y component of corner of rect | I can't draw a NSRect based on where the user clicks I am trying to draw a rectangle and let the user create it based on where he clicks and where he drags the mouse. The code I am using to draw the NSRect is: CGFloat width = endPoint.x-startPoint.x; //Width of rectangle. CGFloat height = endPoint.y-startPoint.y; //Hei... | TITLE:
I can't draw a NSRect based on where the user clicks
QUESTION:
I am trying to draw a rectangle and let the user create it based on where he clicks and where he drags the mouse. The code I am using to draw the NSRect is: CGFloat width = endPoint.x-startPoint.x; //Width of rectangle. CGFloat height = endPoint.y-s... | [
"cocoa",
"quartz-graphics"
] | 0 | 1 | 234 | 1 | 0 | 2011-06-04T03:03:20.403000 | 2011-06-04T03:12:36.360000 |
6,234,457 | 6,234,481 | Using XML files to store data | If i'm going to use a XML file to store some information, Am I going to need a XML Parser that read/write data? Can i just use string manipulation functions and why not? | You could conceivably use string manipulation functions, as that's what XML libraries end up using anyway. XML documents are just long strings in a special format. However, unless you know a lot about XML (and what is and isn't valid XML), using an XML parser/serializer now will save you a lot of trouble later on. Ther... | Using XML files to store data If i'm going to use a XML file to store some information, Am I going to need a XML Parser that read/write data? Can i just use string manipulation functions and why not? | TITLE:
Using XML files to store data
QUESTION:
If i'm going to use a XML file to store some information, Am I going to need a XML Parser that read/write data? Can i just use string manipulation functions and why not?
ANSWER:
You could conceivably use string manipulation functions, as that's what XML libraries end up ... | [
"c++",
"xml"
] | 5 | 5 | 1,898 | 3 | 0 | 2011-06-04T03:09:38.600000 | 2011-06-04T03:19:55.227000 |
6,234,458 | 6,289,580 | ExtJS4: When to Use Full Namespace VS Just Object Name (Model Associations) | Part of My Item Model: Ext.define('DnD.model.Item', { extend: 'Ext.data.Model', idProperty:'item_number', associations: [{ type: 'belongsTo', model: 'Company', primaryKey: 'id', foreignKey: 'company_id', autoLoad: true }], proxy: { type: 'ajax', url: 'data/items.json', reader: { type: 'json', root: 'items', idProperty:... | BelongsTo association has config options "getterName" and "setterName", you can use them to define your own getter and setter method names. Example: {type: 'belongsTo', model: 'My.model.User', foreignKey: 'userId', getterName: 'getUser'} http://docs.sencha.com/ext-js/4-0/#/api/Ext.data.BelongsToAssociation | ExtJS4: When to Use Full Namespace VS Just Object Name (Model Associations) Part of My Item Model: Ext.define('DnD.model.Item', { extend: 'Ext.data.Model', idProperty:'item_number', associations: [{ type: 'belongsTo', model: 'Company', primaryKey: 'id', foreignKey: 'company_id', autoLoad: true }], proxy: { type: 'ajax'... | TITLE:
ExtJS4: When to Use Full Namespace VS Just Object Name (Model Associations)
QUESTION:
Part of My Item Model: Ext.define('DnD.model.Item', { extend: 'Ext.data.Model', idProperty:'item_number', associations: [{ type: 'belongsTo', model: 'Company', primaryKey: 'id', foreignKey: 'company_id', autoLoad: true }], pro... | [
"javascript",
"model",
"associations",
"extjs4"
] | 0 | 1 | 1,166 | 1 | 0 | 2011-06-04T03:10:58.453000 | 2011-06-09T07:41:39.580000 |
6,234,471 | 6,236,347 | BufferStrategy.getDrawGraphics() sometimes fails after a swap to fullscreen-exclusive mode | I initialize an extended jFrame with a BufferStrategy and so forth, getting a nice animating circle on the screen. I have set a key listener (outside of the update-draw thread) that tells the update-draw thread to change to and from fullscreen exclusive mode, without doing updates or draws until the change is done. Thi... | Verify that you are constructing the GUI on the event dispatch thread. | BufferStrategy.getDrawGraphics() sometimes fails after a swap to fullscreen-exclusive mode I initialize an extended jFrame with a BufferStrategy and so forth, getting a nice animating circle on the screen. I have set a key listener (outside of the update-draw thread) that tells the update-draw thread to change to and f... | TITLE:
BufferStrategy.getDrawGraphics() sometimes fails after a swap to fullscreen-exclusive mode
QUESTION:
I initialize an extended jFrame with a BufferStrategy and so forth, getting a nice animating circle on the screen. I have set a key listener (outside of the update-draw thread) that tells the update-draw thread ... | [
"java"
] | 2 | 2 | 1,476 | 2 | 0 | 2011-06-04T03:15:50.430000 | 2011-06-04T11:02:12.050000 |
6,234,473 | 6,234,575 | Android -- Is there a way to rotate a toast 90 degrees? | Can't think of any more info to provide. Is there a way? | As hackbod said, you would have to have a custom view to display the toast. I found a few classes for you that rotates the label for you: VerticalLabelView and CustomTextView I chose to use the latter, and had this code working in my own app: // Creating a new toast object Toast myToast = new Toast(MyActivity.this); //... | Android -- Is there a way to rotate a toast 90 degrees? Can't think of any more info to provide. Is there a way? | TITLE:
Android -- Is there a way to rotate a toast 90 degrees?
QUESTION:
Can't think of any more info to provide. Is there a way?
ANSWER:
As hackbod said, you would have to have a custom view to display the toast. I found a few classes for you that rotates the label for you: VerticalLabelView and CustomTextView I cho... | [
"android",
"user-interface"
] | 8 | 10 | 3,172 | 2 | 0 | 2011-06-04T03:16:09.477000 | 2011-06-04T03:53:57.587000 |
6,234,476 | 6,237,769 | How do I bind to a ListBox in IronPython? | I am just starting out using IronPython with WPF and I don't quiet understand how binding is supposed to be done. Normally in WPF I would just do something like this: Then in my code behind: MyListBox.ItemsSource = new ObservableCollection () But in IronPython we cannot have an ObservableCollection of objects, only typ... | I worked this out myself, I had a few things wrong and was missing a few key point as well. I hope this answer can help someone else. First was that you need pyevent.py from the tutorial/ directory in your IronPython directory. Second we need a helper class: class NotifyPropertyChangedBase(INotifyPropertyChanged): """I... | How do I bind to a ListBox in IronPython? I am just starting out using IronPython with WPF and I don't quiet understand how binding is supposed to be done. Normally in WPF I would just do something like this: Then in my code behind: MyListBox.ItemsSource = new ObservableCollection () But in IronPython we cannot have an... | TITLE:
How do I bind to a ListBox in IronPython?
QUESTION:
I am just starting out using IronPython with WPF and I don't quiet understand how binding is supposed to be done. Normally in WPF I would just do something like this: Then in my code behind: MyListBox.ItemsSource = new ObservableCollection () But in IronPython... | [
"wpf",
"binding",
"listbox",
"ironpython"
] | 4 | 4 | 3,523 | 3 | 0 | 2011-06-04T03:16:48.160000 | 2011-06-04T15:56:04.550000 |
6,234,483 | 6,234,514 | javascript effect is not correct | The inner iframe page: 女装/女士精品: 连衣裙 T恤 裤子 春夏装 衬衫 蕾丝衫/雪纺衫 半身裙 针织衫 小背心/小吊带 小西装 皮衣 短外套 婚纱/旗袍/礼服 牛仔裤 马夹 羽绒服 卫衣 羽绒背心/棉背心 毛衣 棉衣 风衣 more 男装: 长袖衬衫 长袖T恤 休闲长裤 牛仔裤 卫衣 羽绒服 西服 毛衣/线衣 风衣 more 童装/亲子装: 儿童T恤/吊带衫 儿童裙子 儿童套装 儿童裤子 儿童毛衣 儿童衬衫 其它童装 长裤 儿童卫衣/绒衫 more 女鞋: 帆布鞋 more 服饰配件: 腰带/皮带/腰链 其它配件 帽子 more 男鞋: 休闲皮鞋 运动休闲鞋 日常休闲鞋 凉拖 商务休闲鞋 懒人鞋 休闲皮鞋 ... | It appears that the fifth row's "more" button is being displayed because the height of the is more than 18 pixels, even though there is only one horizontal line of text in that row. If I navigate directly to http://shaojie.me/wp-content/example/buy.php, I don't see the problem. Perhaps you should use a larger threshold... | javascript effect is not correct The inner iframe page: 女装/女士精品: 连衣裙 T恤 裤子 春夏装 衬衫 蕾丝衫/雪纺衫 半身裙 针织衫 小背心/小吊带 小西装 皮衣 短外套 婚纱/旗袍/礼服 牛仔裤 马夹 羽绒服 卫衣 羽绒背心/棉背心 毛衣 棉衣 风衣 more 男装: 长袖衬衫 长袖T恤 休闲长裤 牛仔裤 卫衣 羽绒服 西服 毛衣/线衣 风衣 more 童装/亲子装: 儿童T恤/吊带衫 儿童裙子 儿童套装 儿童裤子 儿童毛衣 儿童衬衫 其它童装 长裤 儿童卫衣/绒衫 more 女鞋: 帆布鞋 more 服饰配件: 腰带/皮带/腰链 其它配件 帽子 more 男鞋: 休闲... | TITLE:
javascript effect is not correct
QUESTION:
The inner iframe page: 女装/女士精品: 连衣裙 T恤 裤子 春夏装 衬衫 蕾丝衫/雪纺衫 半身裙 针织衫 小背心/小吊带 小西装 皮衣 短外套 婚纱/旗袍/礼服 牛仔裤 马夹 羽绒服 卫衣 羽绒背心/棉背心 毛衣 棉衣 风衣 more 男装: 长袖衬衫 长袖T恤 休闲长裤 牛仔裤 卫衣 羽绒服 西服 毛衣/线衣 风衣 more 童装/亲子装: 儿童T恤/吊带衫 儿童裙子 儿童套装 儿童裤子 儿童毛衣 儿童衬衫 其它童装 长裤 儿童卫衣/绒衫 more 女鞋: 帆布鞋 more 服饰配件: 腰带/皮带/腰链 其... | [
"javascript",
"mootools"
] | 0 | 2 | 165 | 1 | 0 | 2011-06-04T03:21:26.713000 | 2011-06-04T03:33:08.080000 |
6,234,486 | 6,241,618 | I want to draw a grid on the Windows Phone 7 using XNA | I am trying to draw a grid on the screen of a Windows Phone; it will help me better position my sprites on the screen rather than guessing locations on the screen. I have found several examples of a grid (2d or 3d) using XNA 3.0, but unfortunately the architectures are different and so the code doesnt work in XNA 4.0 D... | You can download a PrimitiveBatch class here http://create.msdn.com/en-US/education/catalog/sample/primitives and use the code below to generate an appropriate grid as a texture. PrimitiveBatch primitiveBatch; private Texture2D GenerateGrid(Rectangle destRect, int cols, int rows, Color gridColor, int cellSize) { int w ... | I want to draw a grid on the Windows Phone 7 using XNA I am trying to draw a grid on the screen of a Windows Phone; it will help me better position my sprites on the screen rather than guessing locations on the screen. I have found several examples of a grid (2d or 3d) using XNA 3.0, but unfortunately the architectures... | TITLE:
I want to draw a grid on the Windows Phone 7 using XNA
QUESTION:
I am trying to draw a grid on the screen of a Windows Phone; it will help me better position my sprites on the screen rather than guessing locations on the screen. I have found several examples of a grid (2d or 3d) using XNA 3.0, but unfortunately... | [
"windows-phone-7",
"xna",
"xna-4.0"
] | 1 | 2 | 1,066 | 3 | 0 | 2011-06-04T03:21:58.360000 | 2011-06-05T07:47:30.487000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.