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,243,563 | 6,243,593 | regex vs while loops | While reading this SO post - Is there a version of JavaScript's String.indexOf() that allows for regular expressions? ) I ponder which of the following two functions that look for the last (largest) whitespace group in txt run faster (or do they have negligible run-time difference) (function(str) { var result = /\s+(?!... | (function(str) { var result = /\s+(?!.*\s+)/.exec(str); return ((result)? result.index: -1); })(txt); is broken. It will match " \n" because. does not match all space characters. Specifically it does not match the space characters "\r\n\u2028\u2029" which are matched by \s. If you want a good way to match the last (lar... | regex vs while loops While reading this SO post - Is there a version of JavaScript's String.indexOf() that allows for regular expressions? ) I ponder which of the following two functions that look for the last (largest) whitespace group in txt run faster (or do they have negligible run-time difference) (function(str) {... | TITLE:
regex vs while loops
QUESTION:
While reading this SO post - Is there a version of JavaScript's String.indexOf() that allows for regular expressions? ) I ponder which of the following two functions that look for the last (largest) whitespace group in txt run faster (or do they have negligible run-time difference... | [
"javascript",
"regex",
"performance"
] | 5 | 3 | 4,888 | 2 | 0 | 2011-06-05T14:37:34.967000 | 2011-06-05T14:42:54.777000 |
6,243,570 | 6,243,636 | How can i make inverse of IN Syntax? | IF I have a code like $vals = "50,60,40"; IN SQL "SELECT * FROM TABLE WHERE col IN( $vals )" No if i have a value like 50 and i have col in SQL contain "50,40,60" How can i selected it I mean the inverse of IN Syntax if i have table in sql contain values like Firstname | Lastname | Age | Hobbies Ahmed | Ali | 50 | run,... | Check the FIND_IN_SET() function: "SELECT * FROM TABLE WHERE FIND_IN_SET('swim', Hobbies) > 0" | How can i make inverse of IN Syntax? IF I have a code like $vals = "50,60,40"; IN SQL "SELECT * FROM TABLE WHERE col IN( $vals )" No if i have a value like 50 and i have col in SQL contain "50,40,60" How can i selected it I mean the inverse of IN Syntax if i have table in sql contain values like Firstname | Lastname | ... | TITLE:
How can i make inverse of IN Syntax?
QUESTION:
IF I have a code like $vals = "50,60,40"; IN SQL "SELECT * FROM TABLE WHERE col IN( $vals )" No if i have a value like 50 and i have col in SQL contain "50,40,60" How can i selected it I mean the inverse of IN Syntax if i have table in sql contain values like First... | [
"php",
"sql"
] | 1 | 2 | 107 | 3 | 0 | 2011-06-05T14:39:15.197000 | 2011-06-05T14:51:42.907000 |
6,243,572 | 6,244,202 | Where is the $db in CI_Model? | I come from a Java background and I am now trying to study PHP for a web project I am doing on the side written in CodeIgniter. Right now I am trying to study how to use CI's models. I am naturally very curious about reading framework code to gain a deeper understanding of how the tools I am using work. I am really con... | I've not studied the code hard enought, but I've been using codeigniter for a while, I hope not to say something wrong, but things doesn't work as you guessed. The $db you're looking for is not in the CI_Model superclass (nor in the CI_Controller superclass), but it's a variable declared in the Loader class (system/cor... | Where is the $db in CI_Model? I come from a Java background and I am now trying to study PHP for a web project I am doing on the side written in CodeIgniter. Right now I am trying to study how to use CI's models. I am naturally very curious about reading framework code to gain a deeper understanding of how the tools I ... | TITLE:
Where is the $db in CI_Model?
QUESTION:
I come from a Java background and I am now trying to study PHP for a web project I am doing on the side written in CodeIgniter. Right now I am trying to study how to use CI's models. I am naturally very curious about reading framework code to gain a deeper understanding o... | [
"php",
"codeigniter"
] | 2 | 3 | 4,695 | 2 | 0 | 2011-06-05T14:39:41.680000 | 2011-06-05T16:26:10.030000 |
6,243,582 | 6,243,707 | cURL proxy server | I've got two PC's, but both have another IP. The simple question is how to use one of the PC's as a proxy for the other one, by using cURL, so requests from both PC's will have the same IP. Is there a way to turn one PC into a proxy server and then make cURL make requests using that IP? | Yes, there are lot's of proxy packages running out of the box (you could even configure apache to do it). Wouldn't recommend rolling your own in PHP if that's what you're after. You can configure curl easily to use a proxy, see the curl_setopt possibilities. | cURL proxy server I've got two PC's, but both have another IP. The simple question is how to use one of the PC's as a proxy for the other one, by using cURL, so requests from both PC's will have the same IP. Is there a way to turn one PC into a proxy server and then make cURL make requests using that IP? | TITLE:
cURL proxy server
QUESTION:
I've got two PC's, but both have another IP. The simple question is how to use one of the PC's as a proxy for the other one, by using cURL, so requests from both PC's will have the same IP. Is there a way to turn one PC into a proxy server and then make cURL make requests using that ... | [
"php",
"curl",
"proxy"
] | 0 | 1 | 1,141 | 2 | 0 | 2011-06-05T14:40:37.543000 | 2011-06-05T15:05:33.730000 |
6,243,583 | 6,243,689 | numpy csv import problem | I am having some difficulty with importing data from a.csv file. I am simply trying to import the data and print the max value. Here is my code: >>> x, y = numpy.loadtxt('data.csv', delimiter=',', usecols=(4,5), unpack=True) >>> print 'max =', max(x) When I enter the above code, I get the following error message: TypeE... | The output of loadtxt() is unfortunately a bit inconistent: If there is only one line in your file, x and y will be scalars, but for more than one line, they will be arrays. The Python built-in max() only works for iterables, so it only works in the latter case. Using the Python built-in max() function instead of numpy... | numpy csv import problem I am having some difficulty with importing data from a.csv file. I am simply trying to import the data and print the max value. Here is my code: >>> x, y = numpy.loadtxt('data.csv', delimiter=',', usecols=(4,5), unpack=True) >>> print 'max =', max(x) When I enter the above code, I get the follo... | TITLE:
numpy csv import problem
QUESTION:
I am having some difficulty with importing data from a.csv file. I am simply trying to import the data and print the max value. Here is my code: >>> x, y = numpy.loadtxt('data.csv', delimiter=',', usecols=(4,5), unpack=True) >>> print 'max =', max(x) When I enter the above cod... | [
"python",
"csv",
"numpy"
] | 3 | 4 | 2,610 | 1 | 0 | 2011-06-05T14:40:53.607000 | 2011-06-05T15:02:56.933000 |
6,243,586 | 6,243,607 | problem in array $_POST | i have this code it can go to if(array_key_exists('p',$_POST)) but can't go to if(isset($_POST['p'][$i]) && $_POST['p'][$i]==$row[0]) i tried to echo $_POST['p'][0] in if(array_key_exists('p',$_POST)) but it tells me 0 is undefined i don't know my error. if(array_key_exists('update',$_POST)){ //somecode echo" "; if(arr... | I think the following line gives problem echo" Try this echo" | problem in array $_POST i have this code it can go to if(array_key_exists('p',$_POST)) but can't go to if(isset($_POST['p'][$i]) && $_POST['p'][$i]==$row[0]) i tried to echo $_POST['p'][0] in if(array_key_exists('p',$_POST)) but it tells me 0 is undefined i don't know my error. if(array_key_exists('update',$_POST)){ //... | TITLE:
problem in array $_POST
QUESTION:
i have this code it can go to if(array_key_exists('p',$_POST)) but can't go to if(isset($_POST['p'][$i]) && $_POST['p'][$i]==$row[0]) i tried to echo $_POST['p'][0] in if(array_key_exists('p',$_POST)) but it tells me 0 is undefined i don't know my error. if(array_key_exists('up... | [
"php"
] | 1 | 1 | 347 | 1 | 0 | 2011-06-05T14:41:35.617000 | 2011-06-05T14:45:32.740000 |
6,243,591 | 6,243,685 | Programmatically changing the iOS lock-screen | I'm building an app which would have to have the ability to show my own views on the iPhone lock screen. I've seen lots of apps which let you customize the lockscreen and so forth and these were App Store apps so i'm guessing it has to possible. I just can't figure out what to use in the iOS SDK to even try implementin... | It can be changed programmatically (change to SpringBoard), but it won't make the way to the (official) AppStore. So if you want to build an app that can change something like the lock screen wallpaper or the ring tone which you usually need the Settings app for, you have to publish your application via Cydia, not Appl... | Programmatically changing the iOS lock-screen I'm building an app which would have to have the ability to show my own views on the iPhone lock screen. I've seen lots of apps which let you customize the lockscreen and so forth and these were App Store apps so i'm guessing it has to possible. I just can't figure out what... | TITLE:
Programmatically changing the iOS lock-screen
QUESTION:
I'm building an app which would have to have the ability to show my own views on the iPhone lock screen. I've seen lots of apps which let you customize the lockscreen and so forth and these were App Store apps so i'm guessing it has to possible. I just can... | [
"iphone",
"ios",
"sdk",
"wallpaper",
"lockscreen"
] | 18 | 19 | 32,565 | 1 | 0 | 2011-06-05T14:42:51.920000 | 2011-06-05T15:02:16.177000 |
6,243,599 | 6,249,623 | Selection of datatype for storing images | I want to store and retrieve images to/from database using java beans, which data type should be used for this purpose? | The most conventional approach would be to store the data in a BLOB. That would allow you to read and write the byte stream from Java but wouldn't allow you to do any transformation inside the database. The other alternative would be to use the interMedia ORDImage type. This provides a great deal more flexibility by al... | Selection of datatype for storing images I want to store and retrieve images to/from database using java beans, which data type should be used for this purpose? | TITLE:
Selection of datatype for storing images
QUESTION:
I want to store and retrieve images to/from database using java beans, which data type should be used for this purpose?
ANSWER:
The most conventional approach would be to store the data in a BLOB. That would allow you to read and write the byte stream from Jav... | [
"javabeans",
"oracle9i"
] | 0 | 2 | 191 | 2 | 0 | 2011-06-05T14:44:08.457000 | 2011-06-06T08:52:06.110000 |
6,243,622 | 6,243,641 | Java inheritance structure problem | I have just implemented some classes: public abstract class Job { [...] }
public abstract class ReturnValueJob extends Job { [...] }
public class MyReturnJob extends ReturnValueJob { [...] }
public class JobExecuter { public static void execute(List jobList){ for(Job actJob: jobList){ actJob.startJob(); } for(Job ac... | What wrong here?? The problem is not the change from LinkedList to List, but the change in the contained type. Java generics are not covariant, which means you cannot even do: LinkedList = new LinkedList (); Details... For more info, read the "Java theory and practice: Generics gotchas" article. Here its relevant part:... | Java inheritance structure problem I have just implemented some classes: public abstract class Job { [...] }
public abstract class ReturnValueJob extends Job { [...] }
public class MyReturnJob extends ReturnValueJob { [...] }
public class JobExecuter { public static void execute(List jobList){ for(Job actJob: jobLis... | TITLE:
Java inheritance structure problem
QUESTION:
I have just implemented some classes: public abstract class Job { [...] }
public abstract class ReturnValueJob extends Job { [...] }
public class MyReturnJob extends ReturnValueJob { [...] }
public class JobExecuter { public static void execute(List jobList){ for(... | [
"java",
"inheritance",
"polymorphism"
] | 2 | 6 | 445 | 2 | 0 | 2011-06-05T14:49:10.187000 | 2011-06-05T14:52:42.113000 |
6,243,631 | 6,268,851 | Cannot connect to mysql server with MAMP nor with Community Server | I created a database with MySQL Workbench, and now I need to access it. So I've written a php script to access it: I have doubts about MAMP and MySQL Community Server and I need a push on the right path. I've installed MAMP on my mac and switched the ports to the default mysql ones 3306. I've placed the PHP test script... | Well, I'm gonna answer myself so that if someone runs into the same problem. The error of password happened because I had two installations of mysql in the same computer, so that I was checking the passwords in one of them and the browser was looking at the other. Therefore, if you have problems with password access, c... | Cannot connect to mysql server with MAMP nor with Community Server I created a database with MySQL Workbench, and now I need to access it. So I've written a php script to access it: I have doubts about MAMP and MySQL Community Server and I need a push on the right path. I've installed MAMP on my mac and switched the po... | TITLE:
Cannot connect to mysql server with MAMP nor with Community Server
QUESTION:
I created a database with MySQL Workbench, and now I need to access it. So I've written a php script to access it: I have doubts about MAMP and MySQL Community Server and I need a push on the right path. I've installed MAMP on my mac a... | [
"mysql",
"database",
"mamp",
"community-server"
] | 1 | 0 | 12,947 | 5 | 0 | 2011-06-05T14:50:12.427000 | 2011-06-07T16:56:49.107000 |
6,243,634 | 6,243,688 | Submit form with AJAX after Jquery validation (bvalidator) | I know this is a very common (and basic) question, however I've tried without success. I have a basic form and I'm using bValidator (jQuery): and I'm trying to send the $.ajax() after validation and it just doesn't work... $(document).ready(function () { $('#contactform').bValidator(); }); $('#sendform').click(function... | You're looking for jQuery.serialize. The docs have examples that guide you further. Basically, it works like $('form').submit(function() { var payload = $(this).serialize(); // do the ajax request with "data" option set to payload return false; }); | Submit form with AJAX after Jquery validation (bvalidator) I know this is a very common (and basic) question, however I've tried without success. I have a basic form and I'm using bValidator (jQuery): and I'm trying to send the $.ajax() after validation and it just doesn't work... $(document).ready(function () { $('#co... | TITLE:
Submit form with AJAX after Jquery validation (bvalidator)
QUESTION:
I know this is a very common (and basic) question, however I've tried without success. I have a basic form and I'm using bValidator (jQuery): and I'm trying to send the $.ajax() after validation and it just doesn't work... $(document).ready(fu... | [
"jquery"
] | 2 | 0 | 1,563 | 2 | 0 | 2011-06-05T14:51:13.787000 | 2011-06-05T15:02:49.033000 |
6,243,635 | 6,243,681 | Javascript combo box multiple values | I have a function called bodyStyle() which accepts 5 values: bodyStyle(textCol, backCol, heading1Col, headingsCol, linkCol) These parameters accept 5 different colours and apply them to the page. Currently I am using images, as shown: I am trying to move this to a combo box, and currently have the following: Select Bla... | Get rid of the quotes and write it down like a single string Select Black on White Black on Yellow Something like that | Javascript combo box multiple values I have a function called bodyStyle() which accepts 5 values: bodyStyle(textCol, backCol, heading1Col, headingsCol, linkCol) These parameters accept 5 different colours and apply them to the page. Currently I am using images, as shown: I am trying to move this to a combo box, and cur... | TITLE:
Javascript combo box multiple values
QUESTION:
I have a function called bodyStyle() which accepts 5 values: bodyStyle(textCol, backCol, heading1Col, headingsCol, linkCol) These parameters accept 5 different colours and apply them to the page. Currently I am using images, as shown: I am trying to move this to a ... | [
"javascript",
"html"
] | 0 | 0 | 2,175 | 2 | 0 | 2011-06-05T14:51:33.340000 | 2011-06-05T15:01:46.113000 |
6,243,646 | 6,243,979 | Extract URLs from specific tags in python | all. I have an huge html file which contains tags like these: I need to extract all the urls from this page in python. In a loop: Find occurences of one by one. Extract the url http://xrayoptics.by.ru/database/misc/goog2text.py I need to re-write this script to extract all the links found on google. How can i achieve t... | from BeautifulSoup import BeautifulSoup
html = """... text... Don't find me! Don't find me! Don't error on missing href!... """ soup = BeautifulSoup(html)
for h3 in soup.findAll("h3", {"class": "r"}): for a in h3.findAll("a", {"class": "l", "href": True}): print a["href"] | Extract URLs from specific tags in python all. I have an huge html file which contains tags like these: I need to extract all the urls from this page in python. In a loop: Find occurences of one by one. Extract the url http://xrayoptics.by.ru/database/misc/goog2text.py I need to re-write this script to extract all the ... | TITLE:
Extract URLs from specific tags in python
QUESTION:
all. I have an huge html file which contains tags like these: I need to extract all the urls from this page in python. In a loop: Find occurences of one by one. Extract the url http://xrayoptics.by.ru/database/misc/goog2text.py I need to re-write this script t... | [
"python",
"url",
"tags",
"extract"
] | 2 | 1 | 3,409 | 3 | 0 | 2011-06-05T14:54:37.950000 | 2011-06-05T15:48:42.003000 |
6,243,653 | 6,243,692 | Facebook PHP SDK logout function | can you explain to me how can i call logout function of facebook php sdk, without that logged user have to click on logout link generated with the $facebook->getLogoutUrl. | I think theres no method to do it.. how about making a curl request for the url generated using $facebook->getLogoutUrl. in their js api they have provided FB.logout http://developers.facebook.com/docs/reference/javascript/FB.logout/ | Facebook PHP SDK logout function can you explain to me how can i call logout function of facebook php sdk, without that logged user have to click on logout link generated with the $facebook->getLogoutUrl. | TITLE:
Facebook PHP SDK logout function
QUESTION:
can you explain to me how can i call logout function of facebook php sdk, without that logged user have to click on logout link generated with the $facebook->getLogoutUrl.
ANSWER:
I think theres no method to do it.. how about making a curl request for the url generate... | [
"php",
"facebook",
"logout"
] | 1 | 1 | 2,114 | 2 | 0 | 2011-06-05T14:56:02.813000 | 2011-06-05T15:03:08.180000 |
6,243,661 | 6,243,768 | Argument for IEnumerator on TreeNode | what is the valid argument for IEnumerator on TreeNode? i got the error on this line: IEnumerator ie = tn.Nodes.GetEnumerator(); in this method: private void parseNode(TreeNode tn) { IEnumerator ie = tn.Nodes.GetEnumerator();
string parentnode = "";
parentnode = tn.Text;
while (ie.MoveNext()) { TreeNode ctn = (TreeN... | (from comments) Using the generic type 'System.Collections.Generic.IEnumerator' requires '1' type arguments That means you have using System.Collections.Generic; and not using System.Collections; switch to the latter and it will work. IEnumerable / IEnumerator are the non-generic API. Or better: use foreach - it is sim... | Argument for IEnumerator on TreeNode what is the valid argument for IEnumerator on TreeNode? i got the error on this line: IEnumerator ie = tn.Nodes.GetEnumerator(); in this method: private void parseNode(TreeNode tn) { IEnumerator ie = tn.Nodes.GetEnumerator();
string parentnode = "";
parentnode = tn.Text;
while (i... | TITLE:
Argument for IEnumerator on TreeNode
QUESTION:
what is the valid argument for IEnumerator on TreeNode? i got the error on this line: IEnumerator ie = tn.Nodes.GetEnumerator(); in this method: private void parseNode(TreeNode tn) { IEnumerator ie = tn.Nodes.GetEnumerator();
string parentnode = "";
parentnode = ... | [
"c#",
"tree-nodes"
] | 2 | 5 | 1,357 | 1 | 0 | 2011-06-05T14:58:09.343000 | 2011-06-05T15:14:52.387000 |
6,243,664 | 6,243,725 | Variadic Templates and Type Traits | I currently have a variadic function which takes an arbitrary number of arguments of arbitrary types (duh), however, I want to restrict the types to ones which are POD only, and also the same size or smaller than that of a void*. The void* check was easy, I just did this: static_assert(sizeof...(Args) <= sizeof(PVOID),... | You can write a meta-function to determine if all are POD types: template struct all_pod;
template struct all_pod { static const bool value = std::is_pod::value && all_pod::value; };
template struct all_pod { static const bool value = std::is_pod::value; }; then static_assert( all_pod::value, "All types must be POD" ... | Variadic Templates and Type Traits I currently have a variadic function which takes an arbitrary number of arguments of arbitrary types (duh), however, I want to restrict the types to ones which are POD only, and also the same size or smaller than that of a void*. The void* check was easy, I just did this: static_asser... | TITLE:
Variadic Templates and Type Traits
QUESTION:
I currently have a variadic function which takes an arbitrary number of arguments of arbitrary types (duh), however, I want to restrict the types to ones which are POD only, and also the same size or smaller than that of a void*. The void* check was easy, I just did ... | [
"c++",
"c++11",
"type-traits",
"variadic-templates"
] | 9 | 12 | 2,056 | 1 | 0 | 2011-06-05T14:58:46.817000 | 2011-06-05T15:07:45.027000 |
6,243,672 | 6,243,982 | "Unable to create component" error | I'm trying to develop a custom PDF viewer using PDFLibNet library. I downloaded compiled dlls (32 and 64 bit) and took a look to examples: very nice. Then I started a library project in VS2010 and created a new user control (the one I want to export): dll compiled succesfully. So I created a GUI project (net 4.0), refe... | make sure you don't check debug folder and the output mode is release. | "Unable to create component" error I'm trying to develop a custom PDF viewer using PDFLibNet library. I downloaded compiled dlls (32 and 64 bit) and took a look to examples: very nice. Then I started a library project in VS2010 and created a new user control (the one I want to export): dll compiled succesfully. So I cr... | TITLE:
"Unable to create component" error
QUESTION:
I'm trying to develop a custom PDF viewer using PDFLibNet library. I downloaded compiled dlls (32 and 64 bit) and took a look to examples: very nice. Then I started a library project in VS2010 and created a new user control (the one I want to export): dll compiled su... | [
"c#"
] | 0 | 1 | 1,979 | 1 | 0 | 2011-06-05T15:00:23.170000 | 2011-06-05T15:49:00.563000 |
6,243,678 | 6,243,744 | Specific ordering SQL Command | Say I have a table similar to: ID Name 1 Test 2 Contest 3 Fittest 4 Testament Is there a MySQL query I could use with ordering to allow it to display a specific word first? For example, users are searching for the word "Test". I have a statement similar to "SELECT * FROM table WHERE NAME LIKE '%Test%'". Could I display... | This will put your words that begin with Test at the top, and sort those words plus the remainder of the list in alphabetical order.. SELECT * FROM mytable ORDER BY CASE WHEN name LIKE 'test%' THEN 0 ELSE 1 END ASC, name ASC | Specific ordering SQL Command Say I have a table similar to: ID Name 1 Test 2 Contest 3 Fittest 4 Testament Is there a MySQL query I could use with ordering to allow it to display a specific word first? For example, users are searching for the word "Test". I have a statement similar to "SELECT * FROM table WHERE NAME L... | TITLE:
Specific ordering SQL Command
QUESTION:
Say I have a table similar to: ID Name 1 Test 2 Contest 3 Fittest 4 Testament Is there a MySQL query I could use with ordering to allow it to display a specific word first? For example, users are searching for the word "Test". I have a statement similar to "SELECT * FROM ... | [
"mysql",
"sql"
] | 2 | 7 | 729 | 2 | 0 | 2011-06-05T15:01:10.283000 | 2011-06-05T15:11:32.230000 |
6,243,679 | 6,245,458 | Node.js for non-web servers? | Node.js can be used for servers which are not web related. For example, this IRC server. What kind of performance can I expect from Node.js in a non-web server role? Is Node.js a good choice to build a general-purpose (non-web) server? | is it a good way to build a server of something non-web related? Yes. Its strength is in DIRT applications (data intensive, real time). I would like to know the real perfomance of Node.js What does this mean? In what context? This is too vague a way to approach performance of any type. You need specific goals in mind f... | Node.js for non-web servers? Node.js can be used for servers which are not web related. For example, this IRC server. What kind of performance can I expect from Node.js in a non-web server role? Is Node.js a good choice to build a general-purpose (non-web) server? | TITLE:
Node.js for non-web servers?
QUESTION:
Node.js can be used for servers which are not web related. For example, this IRC server. What kind of performance can I expect from Node.js in a non-web server role? Is Node.js a good choice to build a general-purpose (non-web) server?
ANSWER:
is it a good way to build a ... | [
"node.js"
] | 1 | 1 | 2,440 | 2 | 0 | 2011-06-05T15:01:10.740000 | 2011-06-05T19:53:33.713000 |
6,243,682 | 6,243,734 | simple question - change bits in java | I have a simple question - I need to write a function for my program to change the 3rd bit of a given byte. I wrote those lines: public byte turnOn(Byte value) { int flag = 8; value = (byte) (value | flag); return value; } I'm not sure if it's the right way to do that, because I saw also this way (with which I am unfam... | 1 << 2 means 1 shifted two bits to the left. Since shifting left by one bit is similar to multiplying by two, this gives 4. In binary, this is 00000100 i.e. the 3rd bit from the right is set. The constant 1 is used since that number only has a single bit set - the rightmost bit. After shifting left, only the 3rd bit (f... | simple question - change bits in java I have a simple question - I need to write a function for my program to change the 3rd bit of a given byte. I wrote those lines: public byte turnOn(Byte value) { int flag = 8; value = (byte) (value | flag); return value; } I'm not sure if it's the right way to do that, because I sa... | TITLE:
simple question - change bits in java
QUESTION:
I have a simple question - I need to write a function for my program to change the 3rd bit of a given byte. I wrote those lines: public byte turnOn(Byte value) { int flag = 8; value = (byte) (value | flag); return value; } I'm not sure if it's the right way to do ... | [
"java"
] | 1 | 5 | 3,067 | 3 | 0 | 2011-06-05T15:01:57.503000 | 2011-06-05T15:09:58.240000 |
6,243,687 | 6,243,740 | Do a GET request with parameters on iPhone SDK? | I'm doing an app which retrieves user info, and it does that using a GET request, but I don't know how could I make one. Already tried ASIHTTPRequest with this code: NSURL *url = [NSURL URLWithString:@"http://forrst.com/api/v2/users/info"]; // Now, set up the post data: ASIFormDataRequest *request = [[[ASIFormDataReque... | A Get Parameter? So why don't you try "http://forrst.com/api/v2/users/info?id=1"? [ NSString stringWithFormat:@"http://forrst.com/api/v2/users/info?id=%d", 1 ]; By the way, take a look at this librayry: http://allseeing-i.com/ASIHTTPRequest/ Good luck! | Do a GET request with parameters on iPhone SDK? I'm doing an app which retrieves user info, and it does that using a GET request, but I don't know how could I make one. Already tried ASIHTTPRequest with this code: NSURL *url = [NSURL URLWithString:@"http://forrst.com/api/v2/users/info"]; // Now, set up the post data: A... | TITLE:
Do a GET request with parameters on iPhone SDK?
QUESTION:
I'm doing an app which retrieves user info, and it does that using a GET request, but I don't know how could I make one. Already tried ASIHTTPRequest with this code: NSURL *url = [NSURL URLWithString:@"http://forrst.com/api/v2/users/info"]; // Now, set u... | [
"iphone",
"cocoa-touch",
"ios4",
"asihttprequest"
] | 0 | 3 | 3,395 | 1 | 0 | 2011-06-05T15:02:43.063000 | 2011-06-05T15:10:30.203000 |
6,243,690 | 6,244,699 | Checkbox postback in Html.Grid | I have a grid which is by an IList: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date Requested"); c.For(a => a.Comment).Named("Comment"); }) But i'd like to add a checkbox which would Post back to a controller. Something similar to this: @using (Html.... | Your question is very unclear. Where do you want to show this checkbox? On each row? Dependent on some value of your model? If yes, then you could use a custom column, like this:.Columns(c => { c.Custom( @ @Html.CheckBoxFor(x => item.Complete, new { onclick = "$(this).parent('form:first').submit();" }) ); }) | Checkbox postback in Html.Grid I have a grid which is by an IList: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date Requested"); c.For(a => a.Comment).Named("Comment"); }) But i'd like to add a checkbox which would Post back to a controller. Something... | TITLE:
Checkbox postback in Html.Grid
QUESTION:
I have a grid which is by an IList: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date Requested"); c.For(a => a.Comment).Named("Comment"); }) But i'd like to add a checkbox which would Post back to a con... | [
"c#",
".net",
"asp.net-mvc",
"asp.net-mvc-3"
] | 3 | 2 | 1,197 | 1 | 0 | 2011-06-05T15:03:04.130000 | 2011-06-05T17:51:59.427000 |
6,243,691 | 6,243,820 | python: invoking socket.recvfrom() twice | I am writing two python scripts to communicate over UDP using python sockets. Here's the related part of code s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((HOST, PORT)) s.setblocking(True) #I want it to be blocking #(...) (msg, addr) = sock.recvfrom(4) #(...) (msg2, addr2) = sock.recvfrom(2) I want the r... | socket.recvfrom(size) will (for UDP sockets) read one packet, up to size bytes. The excess data is discarded. If you want to receive the whole packet, you have to pass a larger bufsize, then process the packet in bits (instead of trying to receive it in bits.) If you want a more convenient, less fickle interface to net... | python: invoking socket.recvfrom() twice I am writing two python scripts to communicate over UDP using python sockets. Here's the related part of code s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((HOST, PORT)) s.setblocking(True) #I want it to be blocking #(...) (msg, addr) = sock.recvfrom(4) #(...) (msg... | TITLE:
python: invoking socket.recvfrom() twice
QUESTION:
I am writing two python scripts to communicate over UDP using python sockets. Here's the related part of code s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((HOST, PORT)) s.setblocking(True) #I want it to be blocking #(...) (msg, addr) = sock.recvf... | [
"python",
"sockets",
"udp"
] | 2 | 5 | 5,409 | 3 | 0 | 2011-06-05T15:03:05.773000 | 2011-06-05T15:24:08.143000 |
6,243,693 | 6,244,140 | move object along a Bézier path in 3d: rotation problem | in my opengl application i have a Bézier curve in 3d space and i want to to move an object along it. everything it's ok a part of rotations: i have some problem in calculating them. in my mind the pipeline should be this: find point on the Bézier (position vector) find tangent, normal, binormal (frenet frame) find the ... | Instead of computing angles just push the frame into the modelview matrix. Normal, Binormal and Tangent go in the upper left 3x3 of the matrix, translation in the 4th column and element 4,4 is 1. Instead of Frenet frame use the already mentioned Bishop frame. So in code: // assuming you manage your curve in a (opaque) ... | move object along a Bézier path in 3d: rotation problem in my opengl application i have a Bézier curve in 3d space and i want to to move an object along it. everything it's ok a part of rotations: i have some problem in calculating them. in my mind the pipeline should be this: find point on the Bézier (position vector)... | TITLE:
move object along a Bézier path in 3d: rotation problem
QUESTION:
in my opengl application i have a Bézier curve in 3d space and i want to to move an object along it. everything it's ok a part of rotations: i have some problem in calculating them. in my mind the pipeline should be this: find point on the Bézier... | [
"opengl",
"geometry",
"rotation"
] | 1 | 2 | 3,401 | 2 | 0 | 2011-06-05T15:03:27.720000 | 2011-06-05T16:16:22.583000 |
6,243,695 | 6,243,785 | Check if any array values are present at the end of a string | I am trying to test if a string made up of multiple words and has any values from an array at the end of it. The following is what I have so far. I am stuck on how to check if the string is longer than the array value being tested and that it is present at the end of the string. $words = trim(preg_replace('/\s+/',' ', ... | By end of string do you mean the very last word? You could use preg_match preg_match('~/?Wizard\??$~', $string, $matches); echo " ".print_r($matches, true)." "; | Check if any array values are present at the end of a string I am trying to test if a string made up of multiple words and has any values from an array at the end of it. The following is what I have so far. I am stuck on how to check if the string is longer than the array value being tested and that it is present at th... | TITLE:
Check if any array values are present at the end of a string
QUESTION:
I am trying to test if a string made up of multiple words and has any values from an array at the end of it. The following is what I have so far. I am stuck on how to check if the string is longer than the array value being tested and that i... | [
"php",
"arrays",
"if-statement",
"compare"
] | 1 | 2 | 363 | 3 | 0 | 2011-06-05T15:03:39.810000 | 2011-06-05T15:18:01.673000 |
6,243,697 | 6,243,777 | Question about Priority Queue's in Java | Is it possible to have a Priority Queue with the same key? so have entries like <100, buy> <100, sell>. then when I have entries with the same key when a buy and sell of that key exists, remove those entries. I am thinking it would work with like an if Statement If <100, buy> && <100, sell>{ then remove those two entri... | Q. Is it possible to have a Priority Queue with the same key? A. Yes it can, However please refer to comments under question there are efficient solutions suggested for your task. Check slide number 3 for more detail, http://ww3.algorithmdesign.net/handouts/Heap.pdf Happy coding! | Question about Priority Queue's in Java Is it possible to have a Priority Queue with the same key? so have entries like <100, buy> <100, sell>. then when I have entries with the same key when a buy and sell of that key exists, remove those entries. I am thinking it would work with like an if Statement If <100, buy> && ... | TITLE:
Question about Priority Queue's in Java
QUESTION:
Is it possible to have a Priority Queue with the same key? so have entries like <100, buy> <100, sell>. then when I have entries with the same key when a buy and sell of that key exists, remove those entries. I am thinking it would work with like an if Statement... | [
"java",
"priority-queue"
] | 0 | 2 | 1,023 | 1 | 0 | 2011-06-05T15:03:41.353000 | 2011-06-05T15:16:12.310000 |
6,243,698 | 6,243,710 | How much time does it take to execute a loop? | Is there any way to know how many seconds does it take a loop to execute in java? For example: for(int i=0; i < 1000000; i++) {
//Do some difficult task goes in here
} It does not have to be accurate 100%, but its just to have an idea of how long it could take. The algorithm inside is some kind of key generator that ... | Here you can try this: long startTime = System.currentTimeMillis(); long endTime = 0;
for(int i=0; i < 1000000; i++) {
//Something
}
endTime = System.currentTimeMillis();
long timeneeded = ((startTime - endTime) /1000); | How much time does it take to execute a loop? Is there any way to know how many seconds does it take a loop to execute in java? For example: for(int i=0; i < 1000000; i++) {
//Do some difficult task goes in here
} It does not have to be accurate 100%, but its just to have an idea of how long it could take. The algori... | TITLE:
How much time does it take to execute a loop?
QUESTION:
Is there any way to know how many seconds does it take a loop to execute in java? For example: for(int i=0; i < 1000000; i++) {
//Do some difficult task goes in here
} It does not have to be accurate 100%, but its just to have an idea of how long it coul... | [
"java"
] | 15 | 15 | 44,252 | 6 | 0 | 2011-06-05T15:03:42.217000 | 2011-06-05T15:05:39.160000 |
6,243,701 | 6,243,765 | VML internet explorer versions | i am reading some things about VML, but i have some doubts. What versions of Internet explorer support VML? The IE9 have full support to SVG? now VML is deprecated? correct? so, for example the dojo charting is showed in ie 7/8 not as svg but as VML? thanks | VML was Microsoft's version of SVG. It's available in IE5 - IE9 (though deprecated as of IE9 and not supported in IE10 ). IE9+ support SVG, mainly because the rest of the world was moving on with SVG and no one had interest in supporting VML. I'm not familiar with Dojo Charting, but it could be using VML. I looked at t... | VML internet explorer versions i am reading some things about VML, but i have some doubts. What versions of Internet explorer support VML? The IE9 have full support to SVG? now VML is deprecated? correct? so, for example the dojo charting is showed in ie 7/8 not as svg but as VML? thanks | TITLE:
VML internet explorer versions
QUESTION:
i am reading some things about VML, but i have some doubts. What versions of Internet explorer support VML? The IE9 have full support to SVG? now VML is deprecated? correct? so, for example the dojo charting is showed in ie 7/8 not as svg but as VML? thanks
ANSWER:
VML ... | [
"internet-explorer",
"svg",
"charts",
"vml"
] | 1 | 2 | 2,012 | 2 | 0 | 2011-06-05T15:04:27.197000 | 2011-06-05T15:14:47.020000 |
6,243,702 | 6,243,751 | Getting array param out of query string with PHP | ( NOTE: This is a follow up to a previous question, How to pass an array within a query string?, where I asked about standard methods for passing arrays within query strings.) I now have some PHP code that needs to consume the said query string- What kind of query string array formats does PHP recognize, and do I have ... | Your query string should rather look like this:?formparts[]=a&formparts[]=b&formparts[]=c | Getting array param out of query string with PHP ( NOTE: This is a follow up to a previous question, How to pass an array within a query string?, where I asked about standard methods for passing arrays within query strings.) I now have some PHP code that needs to consume the said query string- What kind of query string... | TITLE:
Getting array param out of query string with PHP
QUESTION:
( NOTE: This is a follow up to a previous question, How to pass an array within a query string?, where I asked about standard methods for passing arrays within query strings.) I now have some PHP code that needs to consume the said query string- What ki... | [
"php",
"arrays",
"query-string",
"querystringparameter"
] | 1 | 3 | 3,138 | 2 | 0 | 2011-06-05T15:04:28.693000 | 2011-06-05T15:12:12.950000 |
6,243,703 | 6,247,218 | Build/Deploy SSRS with TFS 2010 | I am trying to build and deploy an SSRS project (rptproj) but MSBuild does not support this project type. What can I use to build and deploy this project? I looks like I can use RS.EXE and Dev Env. What are the benefits of each? | It actually is recommended to install Visual Studio on the TFS Build machine to support building various types of projects that MSBuild alone does not support. You don't have to worry about licensing because as long as you have a Visual Studio license then you can put it on all of your machines. You can find more detai... | Build/Deploy SSRS with TFS 2010 I am trying to build and deploy an SSRS project (rptproj) but MSBuild does not support this project type. What can I use to build and deploy this project? I looks like I can use RS.EXE and Dev Env. What are the benefits of each? | TITLE:
Build/Deploy SSRS with TFS 2010
QUESTION:
I am trying to build and deploy an SSRS project (rptproj) but MSBuild does not support this project type. What can I use to build and deploy this project? I looks like I can use RS.EXE and Dev Env. What are the benefits of each?
ANSWER:
It actually is recommended to in... | [
"msbuild",
"reporting-services",
"tfsbuild",
"rs.exe"
] | 2 | 1 | 3,146 | 1 | 0 | 2011-06-05T15:04:37.270000 | 2011-06-06T02:02:16.947000 |
6,243,715 | 6,243,974 | Objective-C fetch POST content with custom headers synchronously | I need to establish a connection to myPage.php, send it certain POST parameters and use a custom header. All this I need to be done synchronously and the content returned as an NSString, and only returned once I have gotten the content, so I don't have to deal with asynchronous requests and set up delegates and stuff. ... | In case you cannot use ASIHttpRequest, just use a NSMutableURLRequest instead of NSURLRequest, like this. | Objective-C fetch POST content with custom headers synchronously I need to establish a connection to myPage.php, send it certain POST parameters and use a custom header. All this I need to be done synchronously and the content returned as an NSString, and only returned once I have gotten the content, so I don't have to... | TITLE:
Objective-C fetch POST content with custom headers synchronously
QUESTION:
I need to establish a connection to myPage.php, send it certain POST parameters and use a custom header. All this I need to be done synchronously and the content returned as an NSString, and only returned once I have gotten the content, ... | [
"objective-c",
"cocoa-touch",
"post",
"header",
"request"
] | 0 | 1 | 341 | 2 | 0 | 2011-06-05T15:06:15.230000 | 2011-06-05T15:48:05.773000 |
6,243,717 | 6,243,827 | Inserting smilies into div with jQuery | I'm working on some small chat application. I want to implement smilies over there so when i click on some smiley it will appear in textarea where user enters his message and when user clicks on select i want smilies to appear in div that contains the conversation. After some workarounds i got to idea that replacing te... | var testString = "test1:smile: test2:wink:"; alert(testString.replace(/:([^:]*):/g, ' ')); | Inserting smilies into div with jQuery I'm working on some small chat application. I want to implement smilies over there so when i click on some smiley it will appear in textarea where user enters his message and when user clicks on select i want smilies to appear in div that contains the conversation. After some work... | TITLE:
Inserting smilies into div with jQuery
QUESTION:
I'm working on some small chat application. I want to implement smilies over there so when i click on some smiley it will appear in textarea where user enters his message and when user clicks on select i want smilies to appear in div that contains the conversatio... | [
"javascript",
"jquery",
"html",
"emoticons"
] | 2 | 3 | 2,176 | 4 | 0 | 2011-06-05T15:06:27.953000 | 2011-06-05T15:24:56.010000 |
6,243,721 | 6,244,686 | Putting two scripts together (actionscript) | I have two scripts I wish I could make a game with, but can't seem to make them work together. Both of them are working great individually. I was hoping maybe someone could guide me into putting them together. http://ifile.it/i6scean Here is the first. http://ifile.it/h02wez5 This is the other. It's for the enemy to fo... | Just placing the second code below the first code (and renaming player_mc to player) works fine... Just make sure you also put the "enemy" movie clip in your library on your first project.... And get rid of the startDrag stopDrag code if you don't want the player to be able to click and drag the character.. For collisi... | Putting two scripts together (actionscript) I have two scripts I wish I could make a game with, but can't seem to make them work together. Both of them are working great individually. I was hoping maybe someone could guide me into putting them together. http://ifile.it/i6scean Here is the first. http://ifile.it/h02wez5... | TITLE:
Putting two scripts together (actionscript)
QUESTION:
I have two scripts I wish I could make a game with, but can't seem to make them work together. Both of them are working great individually. I was hoping maybe someone could guide me into putting them together. http://ifile.it/i6scean Here is the first. http:... | [
"flash",
"actionscript"
] | 0 | 0 | 51 | 1 | 0 | 2011-06-05T15:06:44.377000 | 2011-06-05T17:49:05.043000 |
6,243,723 | 6,243,804 | Sum of even-numbered Fibonacci terms is wrong | I'm learning programming with Java. This is my solution to the second problem in Project Euler which seems to give the right answer, however, I'm sure it's buggy. The problem is if I change the MAX_TERM_VALUE to 100, I get the answer 188. By calculating the answer by hand, I'm expecting 44. It seems that the program lo... | The reason for error is that you only check that a number is valid after summing up, thus you also get 134 as it first gets over MAX_TERM_VALUE the next iteration. Look: public static void main(String[] args) { int fibA = 0; int fibB = 1; int fibC = 0; int total = 0;
while (fibC < MAX_TERM_VALUE) { //fibC is 89 and un... | Sum of even-numbered Fibonacci terms is wrong I'm learning programming with Java. This is my solution to the second problem in Project Euler which seems to give the right answer, however, I'm sure it's buggy. The problem is if I change the MAX_TERM_VALUE to 100, I get the answer 188. By calculating the answer by hand, ... | TITLE:
Sum of even-numbered Fibonacci terms is wrong
QUESTION:
I'm learning programming with Java. This is my solution to the second problem in Project Euler which seems to give the right answer, however, I'm sure it's buggy. The problem is if I change the MAX_TERM_VALUE to 100, I get the answer 188. By calculating th... | [
"java"
] | 0 | 1 | 1,391 | 2 | 0 | 2011-06-05T15:07:17.873000 | 2011-06-05T15:22:27.647000 |
6,243,729 | 6,244,463 | DRb::DRbServerNotFound passing Sinatra params | I have a Sinatra application and DRb server object paired. When I try to pass the Sinatra params hash to a method on my server object I get DRb::DRbConnError … DRb::DRbServerNotFound, yet the same method works when I pass a simple hash directly. Why am I getting this error with the Sinatra params hash? What are the eas... | Short answer You need to add DRb.start_service to app.rb before you try to make a remote call. Explanation if you're interested The Sinatra params hash is created with an associated block to handle the case when missing keys are referenced ( here's the source ). This means there's a Proc object associated with it. Drb ... | DRb::DRbServerNotFound passing Sinatra params I have a Sinatra application and DRb server object paired. When I try to pass the Sinatra params hash to a method on my server object I get DRb::DRbConnError … DRb::DRbServerNotFound, yet the same method works when I pass a simple hash directly. Why am I getting this error ... | TITLE:
DRb::DRbServerNotFound passing Sinatra params
QUESTION:
I have a Sinatra application and DRb server object paired. When I try to pass the Sinatra params hash to a method on my server object I get DRb::DRbConnError … DRb::DRbServerNotFound, yet the same method works when I pass a simple hash directly. Why am I g... | [
"ruby",
"sinatra",
"drb"
] | 3 | 4 | 580 | 1 | 0 | 2011-06-05T15:08:42.813000 | 2011-06-05T17:09:05.450000 |
6,243,732 | 6,244,560 | problem with android simple drop down list | I have an app in android which uses an autocomplete for a query in the DB....The autocomplete entries are displayed in a drop down list.... The problem is that the size of the text displayed in this drop down list is very big and don't know how to make it smaller: This is a piece of code: public View newView(Context co... | Maybe this is what you are looking for? This would set the text size to 100dip, you could adjust the number to whatever you are looking for. mName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 100); | problem with android simple drop down list I have an app in android which uses an autocomplete for a query in the DB....The autocomplete entries are displayed in a drop down list.... The problem is that the size of the text displayed in this drop down list is very big and don't know how to make it smaller: This is a pi... | TITLE:
problem with android simple drop down list
QUESTION:
I have an app in android which uses an autocomplete for a query in the DB....The autocomplete entries are displayed in a drop down list.... The problem is that the size of the text displayed in this drop down list is very big and don't know how to make it sma... | [
"android",
"text"
] | 0 | 0 | 1,196 | 2 | 0 | 2011-06-05T15:09:01.820000 | 2011-06-05T17:26:37.713000 |
6,243,736 | 6,243,832 | how to access individual elements of a javascript object literal? | I have a javascript object literal? I access them in my webpage as data.list[i].ger or data.list[i].eng If I want to directly search an entry how can I directly access that entry? or do I have to do a linear search or a binary search upon sort? data = { list: [ { "ger": "A-as", "eng": "A as" }, { "ger": "A-aws", "eng":... | I think you may be looking for JSONSelect. It makes it easy to access data in complex JSON documents, but looks like CSS. Check out the examples, it looks pretty much like what you want to do. For instance, to get the eng version of ger:q, you would do.ger:val("q") ~.eng You can download it here and use it with JSONSel... | how to access individual elements of a javascript object literal? I have a javascript object literal? I access them in my webpage as data.list[i].ger or data.list[i].eng If I want to directly search an entry how can I directly access that entry? or do I have to do a linear search or a binary search upon sort? data = { ... | TITLE:
how to access individual elements of a javascript object literal?
QUESTION:
I have a javascript object literal? I access them in my webpage as data.list[i].ger or data.list[i].eng If I want to directly search an entry how can I directly access that entry? or do I have to do a linear search or a binary search up... | [
"javascript"
] | 0 | 1 | 876 | 2 | 0 | 2011-06-05T15:10:12.933000 | 2011-06-05T15:27:05.713000 |
6,243,747 | 6,243,754 | CSS selectors - hierarchy | I have a table with the class "forum". I would like all p and a tags within the table to have a margin as follows:.forum p,a { margin:2px; } The above code however seems to be targetting ancor tags elsewhere on the page aswell.. I cant see where i am going wrong.. Thanks in advance.. | Try:.forum p,.forum a { margin:2px; } You need to specify.forum on both, otherwise it thinks you want to apply the style on ALL a tags. | CSS selectors - hierarchy I have a table with the class "forum". I would like all p and a tags within the table to have a margin as follows:.forum p,a { margin:2px; } The above code however seems to be targetting ancor tags elsewhere on the page aswell.. I cant see where i am going wrong.. Thanks in advance.. | TITLE:
CSS selectors - hierarchy
QUESTION:
I have a table with the class "forum". I would like all p and a tags within the table to have a margin as follows:.forum p,a { margin:2px; } The above code however seems to be targetting ancor tags elsewhere on the page aswell.. I cant see where i am going wrong.. Thanks in a... | [
"html",
"css",
"css-selectors"
] | 1 | 4 | 841 | 1 | 0 | 2011-06-05T15:11:50.757000 | 2011-06-05T15:12:47.820000 |
6,243,762 | 6,243,781 | Simple Django template question | I have a template variable: {{article.pub_date}} that outputs this: May 25, 2011, 7:52 p.m. How can I get just the date without the time: May 25, 2011 without the:, 7:52 p.m. I only have access to the template tags/variables not the python code. | {{ article.pub_date|date:"DATE_FORMAT" }} https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | Simple Django template question I have a template variable: {{article.pub_date}} that outputs this: May 25, 2011, 7:52 p.m. How can I get just the date without the time: May 25, 2011 without the:, 7:52 p.m. I only have access to the template tags/variables not the python code. | TITLE:
Simple Django template question
QUESTION:
I have a template variable: {{article.pub_date}} that outputs this: May 25, 2011, 7:52 p.m. How can I get just the date without the time: May 25, 2011 without the:, 7:52 p.m. I only have access to the template tags/variables not the python code.
ANSWER:
{{ article.pub_... | [
"python",
"django"
] | 1 | 3 | 103 | 3 | 0 | 2011-06-05T15:14:27.350000 | 2011-06-05T15:17:28.690000 |
6,243,767 | 6,243,803 | Prevent users from opening multiple windows to the same web app | Let me know if it's possible to prevent users from opening the same java web in multiple IE window. If yes, then how? | No, there is no reliable way to prevent an individual from opening the very same webpage in multiple browser windows/tabs or even different browsers/machines/phones. You need to solve the problem for which you think that this is the solution differently. For example, just don't store request scoped data in the session ... | Prevent users from opening multiple windows to the same web app Let me know if it's possible to prevent users from opening the same java web in multiple IE window. If yes, then how? | TITLE:
Prevent users from opening multiple windows to the same web app
QUESTION:
Let me know if it's possible to prevent users from opening the same java web in multiple IE window. If yes, then how?
ANSWER:
No, there is no reliable way to prevent an individual from opening the very same webpage in multiple browser wi... | [
"java",
"struts"
] | 0 | 1 | 1,212 | 2 | 0 | 2011-06-05T15:14:49.517000 | 2011-06-05T15:21:27.290000 |
6,243,778 | 6,243,797 | Split string by delimiter, but not if it is escaped | How can I split a string by a delimiter, but not if it is escaped? For example, I have a string: 1|2\|2|3\\|4\\\|4 The delimiter is | and an escaped delimiter is \|. Furthermore I want to ignore escaped backslashes, so in \\| the | would still be a delimiter. So with the above string the result should be: [0] => 1 [1] ... | Use dark magic: $array = preg_split('~\\\\.(*SKIP)(*FAIL)|\|~s', $string); \\\\. matches a backslash followed by a character, (*SKIP)(*FAIL) skips it and \| matches your delimiter. | Split string by delimiter, but not if it is escaped How can I split a string by a delimiter, but not if it is escaped? For example, I have a string: 1|2\|2|3\\|4\\\|4 The delimiter is | and an escaped delimiter is \|. Furthermore I want to ignore escaped backslashes, so in \\| the | would still be a delimiter. So with ... | TITLE:
Split string by delimiter, but not if it is escaped
QUESTION:
How can I split a string by a delimiter, but not if it is escaped? For example, I have a string: 1|2\|2|3\\|4\\\|4 The delimiter is | and an escaped delimiter is \|. Furthermore I want to ignore escaped backslashes, so in \\| the | would still be a d... | [
"php",
"regex",
"preg-split"
] | 52 | 107 | 6,428 | 5 | 0 | 2011-06-05T15:16:14.213000 | 2011-06-05T15:20:46.003000 |
6,243,779 | 6,244,444 | Drupal 6 acces denied on page in non drupal folder | I have a folder in '/sites/all/libraries/folder'. In this folder some html files are automatically generated with a drupal module. In my navigation block a created a link 'mysite.com/folder' that is a redirect from '/sites/all/libraries/folder'. I can see the index.html. On this page are links to the other files that g... | In your Drupal root there is a.htaccess file that will route all requests through Drupal bootstrap by default, you probably want to either: Place your generated files outside the Drupal installation Override the.htaccess routes so those are not checked through the bootstrap Set redirects to each individual file you hav... | Drupal 6 acces denied on page in non drupal folder I have a folder in '/sites/all/libraries/folder'. In this folder some html files are automatically generated with a drupal module. In my navigation block a created a link 'mysite.com/folder' that is a redirect from '/sites/all/libraries/folder'. I can see the index.htm... | TITLE:
Drupal 6 acces denied on page in non drupal folder
QUESTION:
I have a folder in '/sites/all/libraries/folder'. In this folder some html files are automatically generated with a drupal module. In my navigation block a created a link 'mysite.com/folder' that is a redirect from '/sites/all/libraries/folder'. I can... | [
"php",
"drupal",
".htaccess",
"drupal-6"
] | 0 | 0 | 265 | 1 | 0 | 2011-06-05T15:16:20.690000 | 2011-06-05T17:06:06.573000 |
6,243,784 | 6,244,617 | iPhone: View/Close button click action on push notification message dialog | Could anyone please tell me how to handle push notification dialog's view and close button click from my application? I have gone through this thread which says to handle it in ViewDidLoad but when I click View button, this method doesn't get invoked. I want to do take user to some particular view on View button click ... | If user clicks view then you can catch that action in didFinishLaunchWithOptions method of AppDelegate class. If user clicks close then, there is no way for application to catch that. If your application didn't get the notification in AppDelegate class, then either you forgot to register your app for push notification ... | iPhone: View/Close button click action on push notification message dialog Could anyone please tell me how to handle push notification dialog's view and close button click from my application? I have gone through this thread which says to handle it in ViewDidLoad but when I click View button, this method doesn't get in... | TITLE:
iPhone: View/Close button click action on push notification message dialog
QUESTION:
Could anyone please tell me how to handle push notification dialog's view and close button click from my application? I have gone through this thread which says to handle it in ViewDidLoad but when I click View button, this met... | [
"iphone",
"apple-push-notifications"
] | 0 | 0 | 1,784 | 1 | 0 | 2011-06-05T15:17:55.913000 | 2011-06-05T17:38:16.203000 |
6,243,795 | 6,243,843 | Javascript remember combobox value | I currently have 3 combo boxes containing values which apply styles to the page using javascript. All these styles are applied to a cookie and read on body load, however I'd like to also set the combo box's values to match the applied styles. How do I go about setting a combo box value based on a cookie or applied styl... | If changing the select is changing the style, first select the relevant value then trigger the onchange. Notice I changed your script to save the selectedIndex and to apply the change after I set the index. Also please notice I pass (this) which the the select object itself and I have added an ID to it. Lastly I put th... | Javascript remember combobox value I currently have 3 combo boxes containing values which apply styles to the page using javascript. All these styles are applied to a cookie and read on body load, however I'd like to also set the combo box's values to match the applied styles. How do I go about setting a combo box valu... | TITLE:
Javascript remember combobox value
QUESTION:
I currently have 3 combo boxes containing values which apply styles to the page using javascript. All these styles are applied to a cookie and read on body load, however I'd like to also set the combo box's values to match the applied styles. How do I go about settin... | [
"javascript",
"html",
"cookies",
"combobox"
] | 0 | 0 | 1,240 | 1 | 0 | 2011-06-05T15:20:29.453000 | 2011-06-05T15:29:16.023000 |
6,243,796 | 6,244,629 | Jar recommendation for collections and sorting (merge sort) | I need a recommendation for a good implementation of merge sort in Java. Basically, I can write all the merges but if I would have a good jar from a provider such as Apache or Google it would be nicer. Requirements for the merge sort: I get an unknown number of sorted arrays. Very important: I get a number that says wh... | I don't know of a ready-made solution, but it appears simple enough to implement with the help of a priority queue: import static java.util.Arrays.asList;
import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.PriorityQueue;
public class MergingIterator implements Iterator {
... | Jar recommendation for collections and sorting (merge sort) I need a recommendation for a good implementation of merge sort in Java. Basically, I can write all the merges but if I would have a good jar from a provider such as Apache or Google it would be nicer. Requirements for the merge sort: I get an unknown number o... | TITLE:
Jar recommendation for collections and sorting (merge sort)
QUESTION:
I need a recommendation for a good implementation of merge sort in Java. Basically, I can write all the merges but if I would have a good jar from a provider such as Apache or Google it would be nicer. Requirements for the merge sort: I get a... | [
"java",
"mergesort"
] | 2 | 2 | 533 | 3 | 0 | 2011-06-05T15:20:39.020000 | 2011-06-05T17:39:43.893000 |
6,243,800 | 6,244,395 | iOS Setting the Root View Controller in IB or programmatically | Are there any differences in performance by setting the Root View Controller in IB (by setting the rootViewController outlet for window to f00 controller or by setting it in the Application Delegate by self.window.rootViewController = self.f00; Which route would be the recommended route? | no real performance issues: in a simple application, either is fine, in a more complex application, the root view might change, and if you retain the last view being displayed (as user guidelines suggest) you will want to wait until appDid… where you can make the decision to load the standard root view or not, in that ... | iOS Setting the Root View Controller in IB or programmatically Are there any differences in performance by setting the Root View Controller in IB (by setting the rootViewController outlet for window to f00 controller or by setting it in the Application Delegate by self.window.rootViewController = self.f00; Which route ... | TITLE:
iOS Setting the Root View Controller in IB or programmatically
QUESTION:
Are there any differences in performance by setting the Root View Controller in IB (by setting the rootViewController outlet for window to f00 controller or by setting it in the Application Delegate by self.window.rootViewController = self... | [
"cocoa-touch",
"ios"
] | 0 | 1 | 458 | 1 | 0 | 2011-06-05T15:21:10.403000 | 2011-06-05T16:57:43.977000 |
6,243,808 | 6,256,770 | Can I generate foo_= and foo accessors from setFoo and getFoo? | I'm getting started with using Scala on Android and a lot of the accessor methods are standard JavaBeans accessors, e.g. setTitle(...) and getTitle(). It's a lot nicer to use the title_= and title methods in scala, so I can write code like: button.title = "Foo" Is there any way to automatically map these from JavaBeans... | I think Dynamic would work, except it is not presently supported with syntactic sugar. Also, it would return AnyRef since there's no way to pass what the expected return type is. Of course, you can simply use pimp my library to add appropriate Scala-style getters and setters. | Can I generate foo_= and foo accessors from setFoo and getFoo? I'm getting started with using Scala on Android and a lot of the accessor methods are standard JavaBeans accessors, e.g. setTitle(...) and getTitle(). It's a lot nicer to use the title_= and title methods in scala, so I can write code like: button.title = "... | TITLE:
Can I generate foo_= and foo accessors from setFoo and getFoo?
QUESTION:
I'm getting started with using Scala on Android and a lot of the accessor methods are standard JavaBeans accessors, e.g. setTitle(...) and getTitle(). It's a lot nicer to use the title_= and title methods in scala, so I can write code like... | [
"scala"
] | 6 | 3 | 208 | 3 | 0 | 2011-06-05T15:22:41.720000 | 2011-06-06T19:04:41.663000 |
6,243,809 | 6,243,854 | smaller array based on array contents | I am looking for a way to create a new array based on array contents. so i've got: Array ( [0] => 1 [type] => first_value_i_need [some_id] => 2 [hits] => 88 [some_other_id] => second_value_i_need ) and i would like to get Array ( [0] => 1 [app_name] => "first_value_i_need-second_value_i_need" [hits] => "88" ) I know th... | No, you don't need any loops as long as you know which keys you need. $old = array( 0 => 1, 'type' => 'first_value_i_need', 'some_id' => 2, 'hits' => 88, 'some_other_id' => 'second_value_i_need' );
$new = array( 0 => $old[0], 'app_name' => $old['type'].'-'.$old['some_other_id'], 'hits' => $old['hits'], ); | smaller array based on array contents I am looking for a way to create a new array based on array contents. so i've got: Array ( [0] => 1 [type] => first_value_i_need [some_id] => 2 [hits] => 88 [some_other_id] => second_value_i_need ) and i would like to get Array ( [0] => 1 [app_name] => "first_value_i_need-second_va... | TITLE:
smaller array based on array contents
QUESTION:
I am looking for a way to create a new array based on array contents. so i've got: Array ( [0] => 1 [type] => first_value_i_need [some_id] => 2 [hits] => 88 [some_other_id] => second_value_i_need ) and i would like to get Array ( [0] => 1 [app_name] => "first_valu... | [
"php",
"arrays"
] | 0 | 1 | 59 | 2 | 0 | 2011-06-05T15:22:43.413000 | 2011-06-05T15:31:09.160000 |
6,243,810 | 6,243,863 | Zsh-Git-Prompt doesn't work on mac osx snow leopard | I want to use the zsh-git-prompt, from this repo https://github.com/olivierverdier/zsh-git-prompt, I've been using it on linux for a while and I haven't have any problems with it, now I'm trying to use it on Snow Leopard, but for some reason, the zsh functions are not called correctly, so it doesn't work and not throw ... | You might want to try installing oh-my-zsh - https://github.com/robbyrussell/oh-my-zsh It works great on snow leopard and contains a number of theme files with customised prompts for zsh as well as plugins for autocompletion. As for your prompt, should the $ be after the first quote mark? Or you could try leaving it ou... | Zsh-Git-Prompt doesn't work on mac osx snow leopard I want to use the zsh-git-prompt, from this repo https://github.com/olivierverdier/zsh-git-prompt, I've been using it on linux for a while and I haven't have any problems with it, now I'm trying to use it on Snow Leopard, but for some reason, the zsh functions are not... | TITLE:
Zsh-Git-Prompt doesn't work on mac osx snow leopard
QUESTION:
I want to use the zsh-git-prompt, from this repo https://github.com/olivierverdier/zsh-git-prompt, I've been using it on linux for a while and I haven't have any problems with it, now I'm trying to use it on Snow Leopard, but for some reason, the zsh... | [
"git",
"zsh",
"prompt"
] | 1 | 1 | 825 | 3 | 0 | 2011-06-05T15:22:48.477000 | 2011-06-05T15:32:29.130000 |
6,243,812 | 6,243,916 | pointer to view in "view based application" | hi I created a "view based application " and I have three classes: -MyAppViewController; -Item (UIView subclass); -MySingleton; I need to call from item class, a method of MyAppViewController so I need to create a pointer, but the problem is that I do not understand when you create the link: in singleton: h @class MyAp... | If you get your controller object created by xib, you can do this in your controller's -viewDidLoad @implementation MyAppViewController...
- (void)viewDidLoad{ [MySingleton sharedMySingleton].plCall = self; }... @end | pointer to view in "view based application" hi I created a "view based application " and I have three classes: -MyAppViewController; -Item (UIView subclass); -MySingleton; I need to call from item class, a method of MyAppViewController so I need to create a pointer, but the problem is that I do not understand when you ... | TITLE:
pointer to view in "view based application"
QUESTION:
hi I created a "view based application " and I have three classes: -MyAppViewController; -Item (UIView subclass); -MySingleton; I need to call from item class, a method of MyAppViewController so I need to create a pointer, but the problem is that I do not un... | [
"objective-c",
"xcode"
] | 0 | 0 | 87 | 1 | 0 | 2011-06-05T15:23:24.163000 | 2011-06-05T15:40:03.967000 |
6,243,813 | 6,243,840 | Kohana Framework: 'HTTP_Exception_404 [ 404 ]: The requested URL welcome/index was not found on this server.' | I followed this tutorial with only one difference. Instead of naming it hello.php, I named it welcome.php. The sources of my files are identical to that of the tutorials, and they are in the correct paths. What could cause this? I am referencing it with 'kohana/index.php/welcome' as per the tutorial. | You have to change your controller's name to Welcome instead of Hello Class Controller_Welcome extends Controller { public function action_index() { echo 'hello, world!'; } } I guess you forgot to change the controller name? | Kohana Framework: 'HTTP_Exception_404 [ 404 ]: The requested URL welcome/index was not found on this server.' I followed this tutorial with only one difference. Instead of naming it hello.php, I named it welcome.php. The sources of my files are identical to that of the tutorials, and they are in the correct paths. What... | TITLE:
Kohana Framework: 'HTTP_Exception_404 [ 404 ]: The requested URL welcome/index was not found on this server.'
QUESTION:
I followed this tutorial with only one difference. Instead of naming it hello.php, I named it welcome.php. The sources of my files are identical to that of the tutorials, and they are in the c... | [
"php",
"kohana",
"kohana-3"
] | 3 | 4 | 6,483 | 2 | 0 | 2011-06-05T15:23:27.350000 | 2011-06-05T15:29:00.487000 |
6,243,815 | 6,243,976 | Using the Haskell FFI to marshal structs; also, how to use FunPtr | I have some questions about the ffi in haskell. first of all i'm trying to work with c structs in haskell. there i have some questions: i have a struct like struct foo{int a; float b;}; when could i use data Foo = Foo { a:: Int, b:: Float } deriving (Show, Eq) when i have to implement a storable with peek and poke? oka... | Marshalling To marshal structures, you will need to use a Storable class instance to marshal data back and forth, via peek and poke. See this previous answer for an example: How to use hsc2hs to bind to constants, functions and data structures? FunPtr FunPtr is only needed when you want to pass a function across the FF... | Using the Haskell FFI to marshal structs; also, how to use FunPtr I have some questions about the ffi in haskell. first of all i'm trying to work with c structs in haskell. there i have some questions: i have a struct like struct foo{int a; float b;}; when could i use data Foo = Foo { a:: Int, b:: Float } deriving (Sho... | TITLE:
Using the Haskell FFI to marshal structs; also, how to use FunPtr
QUESTION:
I have some questions about the ffi in haskell. first of all i'm trying to work with c structs in haskell. there i have some questions: i have a struct like struct foo{int a; float b;}; when could i use data Foo = Foo { a:: Int, b:: Flo... | [
"haskell",
"ffi"
] | 4 | 9 | 1,077 | 1 | 0 | 2011-06-05T15:23:35.647000 | 2011-06-05T15:48:10.427000 |
6,243,823 | 6,243,930 | Wordpress dynamic content | I'm currently have around 100 rows in a table on my website, which include a URL and few sets of numbers pulled from a database on my server. What I would like to do is to dynamically create pages based on a cell of each row, which would contain data pulled from the same database. For example, each row (displayed in th... | I'm not sure how to best integrate this into WP, but it's fairly straightforward in PHP. You just have a file like mypage.php?id={#} where the # is the individual record's ID. You pull the ID using GET ( $id = $_GET["id"]; ) and then run an SQL query with it as the WHERE, take the results and populate the page with tha... | Wordpress dynamic content I'm currently have around 100 rows in a table on my website, which include a URL and few sets of numbers pulled from a database on my server. What I would like to do is to dynamically create pages based on a cell of each row, which would contain data pulled from the same database. For example,... | TITLE:
Wordpress dynamic content
QUESTION:
I'm currently have around 100 rows in a table on my website, which include a URL and few sets of numbers pulled from a database on my server. What I would like to do is to dynamically create pages based on a cell of each row, which would contain data pulled from the same data... | [
"php",
"wordpress"
] | 0 | 2 | 2,351 | 1 | 0 | 2011-06-05T15:24:14.790000 | 2011-06-05T15:42:42.303000 |
6,243,833 | 6,246,431 | Android minSdkVersion | I wrote a program that worked perfectly until the market required me to add 'minSdkVersion'. Since I was using 2.3.3 capabilities I set it at 10,but then my program stopped being able to access files from the disk (all file access is false though it works without 'minSdkVersion'). Changing it to require API 1 fixed the... | I'm going to assume when you say "access files" you mean on the SD card. In this case, you need to add 2 new permissions: These permissions weren't added until API level 4, so anything below that gets them for free. | Android minSdkVersion I wrote a program that worked perfectly until the market required me to add 'minSdkVersion'. Since I was using 2.3.3 capabilities I set it at 10,but then my program stopped being able to access files from the disk (all file access is false though it works without 'minSdkVersion'). Changing it to r... | TITLE:
Android minSdkVersion
QUESTION:
I wrote a program that worked perfectly until the market required me to add 'minSdkVersion'. Since I was using 2.3.3 capabilities I set it at 10,but then my program stopped being able to access files from the disk (all file access is false though it works without 'minSdkVersion')... | [
"android"
] | 1 | 3 | 843 | 2 | 0 | 2011-06-05T15:27:09.717000 | 2011-06-05T22:50:58.457000 |
6,243,838 | 6,244,027 | Problem passing string value into animate Jquery function | Hey I'm wonder what's the difference between these 2 codes? The first works but the 2nd doesnt? First >> for (i=0; i<$sequencingArray.length; i++){... $($sequencingArray[i]).delay(i*100).animate({'margin-left':$masterWidth});... }
Second >> $propToAnimate = 'margin-left'; for (i=0; i<$sequencingArray.length; i++){... ... | This is a working solution... $propToAnimate = {'margin-left': $masterWidth}; $($sequencingArray[i]).delay(i*100).animate($propToAnimate); "You cannot use a variable as a property name inside an object literal." from here | Problem passing string value into animate Jquery function Hey I'm wonder what's the difference between these 2 codes? The first works but the 2nd doesnt? First >> for (i=0; i<$sequencingArray.length; i++){... $($sequencingArray[i]).delay(i*100).animate({'margin-left':$masterWidth});... }
Second >> $propToAnimate = 'ma... | TITLE:
Problem passing string value into animate Jquery function
QUESTION:
Hey I'm wonder what's the difference between these 2 codes? The first works but the 2nd doesnt? First >> for (i=0; i<$sequencingArray.length; i++){... $($sequencingArray[i]).delay(i*100).animate({'margin-left':$masterWidth});... }
Second >> $p... | [
"jquery",
"string",
"variables",
"jquery-animate",
"assign"
] | 2 | 6 | 1,145 | 2 | 0 | 2011-06-05T15:28:07.503000 | 2011-06-05T15:57:19.440000 |
6,243,845 | 6,243,857 | When to use mysql_real_escape_string() | When is the correct time to use mysql_real_escape_string? Should I be using it when I use isset(mysql_escape_string($_GET['param'])), Should I be using it when I use $foo = mysql_real_escape_string($_GET['bar']); Thanks | You need to call this function when building SQL queries with string literals. You should not call it anywhere else. The point of calling this function is to prevent you from executing SQL like SELECT * FROM Students WHERE Name = 'Robert'); DROP TABLE Students;--'. mysql_real_escape_string will escape the ' character s... | When to use mysql_real_escape_string() When is the correct time to use mysql_real_escape_string? Should I be using it when I use isset(mysql_escape_string($_GET['param'])), Should I be using it when I use $foo = mysql_real_escape_string($_GET['bar']); Thanks | TITLE:
When to use mysql_real_escape_string()
QUESTION:
When is the correct time to use mysql_real_escape_string? Should I be using it when I use isset(mysql_escape_string($_GET['param'])), Should I be using it when I use $foo = mysql_real_escape_string($_GET['bar']); Thanks
ANSWER:
You need to call this function whe... | [
"php",
"mysql",
"code-injection",
"mysql-real-escape-string"
] | 1 | 1 | 570 | 4 | 0 | 2011-06-05T15:29:32.177000 | 2011-06-05T15:31:45.763000 |
6,243,855 | 6,244,134 | The <form> tag of my overlay disapear as it loads, and the submit button doesn't work of course | I am using bPopup to load a form in an overlay. The form is basically in a that is loaded hidden in the page, and by clicking a button on the page, the overlay shows up on top with the form in it. I was using this code in another page before and it worked fine but wanted to go the overlay route as I felt the user exper... | The code you provided works fine in my mac Firefox and Chrome with bPopup. The submit button works! May be something to do with your btn class which I have not defined or you might try putting this in a bare-bone page to test with bPopup first to track and resolve any other conflict. | The <form> tag of my overlay disapear as it loads, and the submit button doesn't work of course I am using bPopup to load a form in an overlay. The form is basically in a that is loaded hidden in the page, and by clicking a button on the page, the overlay shows up on top with the form in it. I was using this code in an... | TITLE:
The <form> tag of my overlay disapear as it loads, and the submit button doesn't work of course
QUESTION:
I am using bPopup to load a form in an overlay. The form is basically in a that is loaded hidden in the page, and by clicking a button on the page, the overlay shows up on top with the form in it. I was usi... | [
"submit",
"overlay",
"bpopup"
] | 0 | 0 | 323 | 1 | 0 | 2011-06-05T15:31:22.283000 | 2011-06-05T16:15:07.247000 |
6,243,856 | 6,245,025 | multi-threaded chess using winsock | I've been working on a small network based chess application. I managed to create a server that can handle multiple connections, however I don't know how to send data from one client to another. Here is the partial Server implementation //function to handle our Socket on its own thread. //param- SOCKET* that is connect... | Maybe you should start a thread for a new game when both players of the game are connected to the server. In that case you can deliver both sockets to the thread by the following way: DWORD WINAPI HandleGame(void* param) { GameState* game = (GameState*)param; SOCKET s1 = game->getSocketOfPlayer(1); SOCKET s2 = game->ge... | multi-threaded chess using winsock I've been working on a small network based chess application. I managed to create a server that can handle multiple connections, however I don't know how to send data from one client to another. Here is the partial Server implementation //function to handle our Socket on its own threa... | TITLE:
multi-threaded chess using winsock
QUESTION:
I've been working on a small network based chess application. I managed to create a server that can handle multiple connections, however I don't know how to send data from one client to another. Here is the partial Server implementation //function to handle our Socke... | [
"c++",
"networking",
"winsock"
] | 0 | 2 | 664 | 1 | 0 | 2011-06-05T15:31:26.130000 | 2011-06-05T18:45:21.700000 |
6,243,861 | 6,245,807 | Customizing the add button in UITableView | I wonder if there is a method to customize the normal "+" button in the initWithBarButtonSystemItem:UIBarButtonSystemItemAdd method. This is my current code: UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil]; self.navigationItem.leftBar... | What i did to a 3rd party TableView package was creating my own UIBarButtonItem and settig the target & action properties to the ones of the original button. In some cases this will work and in some cases it won't (like if the target checks the source-object for a specific object) - but it's worth a try! | Customizing the add button in UITableView I wonder if there is a method to customize the normal "+" button in the initWithBarButtonSystemItem:UIBarButtonSystemItemAdd method. This is my current code: UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:ni... | TITLE:
Customizing the add button in UITableView
QUESTION:
I wonder if there is a method to customize the normal "+" button in the initWithBarButtonSystemItem:UIBarButtonSystemItemAdd method. This is my current code: UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSyste... | [
"ios",
"objective-c",
"cocoa-touch"
] | 0 | 1 | 803 | 3 | 0 | 2011-06-05T15:32:16.317000 | 2011-06-05T20:56:59.743000 |
6,243,862 | 6,243,997 | textFieldDidEndEditing alternative | Hi I am using to following code to keep 2 UIButtons disabled until there is data in four UITextField s - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text length] >0) && ([size.text length] >0) && ([price.text length] >0)) { [calcOneButton setEnabled:YES]; [calcTwoBut... | The button will become active only when the user taps away from textField. If you are using the normal keyboard which pops up, use the DONE button on the keyboard to get rid of the keyboard, and then write an IBAction when the keyboard resigns itself, and then enable your buttons. - (BOOL) textFieldShouldReturn:(UIText... | textFieldDidEndEditing alternative Hi I am using to following code to keep 2 UIButtons disabled until there is data in four UITextField s - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text length] >0) && ([size.text length] >0) && ([price.text length] >0)) { [calcOne... | TITLE:
textFieldDidEndEditing alternative
QUESTION:
Hi I am using to following code to keep 2 UIButtons disabled until there is data in four UITextField s - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text length] >0) && ([size.text length] >0) && ([price.text lengt... | [
"iphone",
"xcode",
"ios",
"uibutton",
"uitextfield"
] | 0 | 2 | 2,267 | 2 | 0 | 2011-06-05T15:32:22.883000 | 2011-06-05T15:51:43.213000 |
6,243,864 | 6,244,051 | When should I save settings on Windows Phone 7? | I have a settings save method I call, but I tried unload, and lost focus the application will close out and not save before ever getting to either of those methods. When should I save application settings to keep this from happening? Should I use a timer and save every 30 seconds, or what? | How often you save depends on your app. However, the key timings are: Launching Activated Deactivated Closing Launching is called when the app is first launched from the main screen and Closing is called when the user presses the back key to exit your app. Naturally, you'll most likely want to save permanent data in th... | When should I save settings on Windows Phone 7? I have a settings save method I call, but I tried unload, and lost focus the application will close out and not save before ever getting to either of those methods. When should I save application settings to keep this from happening? Should I use a timer and save every 30... | TITLE:
When should I save settings on Windows Phone 7?
QUESTION:
I have a settings save method I call, but I tried unload, and lost focus the application will close out and not save before ever getting to either of those methods. When should I save application settings to keep this from happening? Should I use a timer... | [
"c#",
"windows-phone-7"
] | 6 | 10 | 1,959 | 2 | 0 | 2011-06-05T15:32:35.417000 | 2011-06-05T16:01:45.843000 |
6,243,876 | 6,243,929 | simple plan - schema database | I would like to make a simple plan: I did something like this: CREATE TABLE IF NOT EXISTS `plan` ( `id` int(20) NOT NULL AUTO_INCREMENT, `a` varchar(25) NOT NULL, `b` varchar(25) NOT NULL, `c` varchar(25) NOT NULL, `d` varchar(25) NOT NULL, `e` varchar(25) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=la... | Every cell/ doesn't need an ID. Put the ID on the row/, as you've done in your database schema. After that it should be a trivial task to identify the different columns per row. The database: | id | a | b | c | d | e | -------------------------- | 1 | t | t | t | t | t | The HTML: id a b c d e 1 t t t t t 2 u u u u u O... | simple plan - schema database I would like to make a simple plan: I did something like this: CREATE TABLE IF NOT EXISTS `plan` ( `id` int(20) NOT NULL AUTO_INCREMENT, `a` varchar(25) NOT NULL, `b` varchar(25) NOT NULL, `c` varchar(25) NOT NULL, `d` varchar(25) NOT NULL, `e` varchar(25) NOT NULL, PRIMARY KEY (`id`) ) EN... | TITLE:
simple plan - schema database
QUESTION:
I would like to make a simple plan: I did something like this: CREATE TABLE IF NOT EXISTS `plan` ( `id` int(20) NOT NULL AUTO_INCREMENT, `a` varchar(25) NOT NULL, `b` varchar(25) NOT NULL, `c` varchar(25) NOT NULL, `d` varchar(25) NOT NULL, `e` varchar(25) NOT NULL, PRIMA... | [
"php",
"mysql",
"database",
"schema"
] | 1 | 1 | 173 | 1 | 0 | 2011-06-05T15:34:29.160000 | 2011-06-05T15:42:32.890000 |
6,243,879 | 6,243,907 | How do I insert the value from a checkbox into MySQL? | MySQL `field1` tinyint(1) NOT NULL default '1', `field2` tinyint(1) NOT NULL default '1', `field3` tinyint(1) NOT NULL default '1', `field4` tinyint(1) NOT NULL default '1', `field5` tinyint(1) NOT NULL default '1', HTML Submit PHP mysql_query("UPDATE `table` SET `field1` = '$_POST[field1]',......."); So, what I want t... | You can use field[] So you can do a simple loop: for($i=0;$i<5;$i++) $field[$i] = isset($_POST['field'][$i])? 1: 0; And then build your SQL If you want to skip the isset Part you could use a radio type, so You have always or the 1 value or 0 value setted. | How do I insert the value from a checkbox into MySQL? MySQL `field1` tinyint(1) NOT NULL default '1', `field2` tinyint(1) NOT NULL default '1', `field3` tinyint(1) NOT NULL default '1', `field4` tinyint(1) NOT NULL default '1', `field5` tinyint(1) NOT NULL default '1', HTML Submit PHP mysql_query("UPDATE `table` SET `f... | TITLE:
How do I insert the value from a checkbox into MySQL?
QUESTION:
MySQL `field1` tinyint(1) NOT NULL default '1', `field2` tinyint(1) NOT NULL default '1', `field3` tinyint(1) NOT NULL default '1', `field4` tinyint(1) NOT NULL default '1', `field5` tinyint(1) NOT NULL default '1', HTML Submit PHP mysql_query("UPD... | [
"php",
"mysql",
"checkbox"
] | 3 | 3 | 17,446 | 7 | 0 | 2011-06-05T15:35:55.597000 | 2011-06-05T15:39:35.550000 |
6,243,887 | 6,243,944 | Java Exceptions - Handling exceptions without try catch | In Java, we handle exceptions using try catch blocks. I know that I can write a try catch block like the one below to catch any exception thrown in a method. try { // do something } catch (Throwable t) {
} But is there any way in Java which allows me to get a specific method called when an exception happens, instead o... | By default, the JVM handles uncaught exceptions by printing the stack-trace to System.err stream. Java allows us to customize this behavior by providing our own routine which implements Thread.UncaughtExceptionHandler interface. Take a look at this blog article which I wrote sometime back which explains this in detail ... | Java Exceptions - Handling exceptions without try catch In Java, we handle exceptions using try catch blocks. I know that I can write a try catch block like the one below to catch any exception thrown in a method. try { // do something } catch (Throwable t) {
} But is there any way in Java which allows me to get a spe... | TITLE:
Java Exceptions - Handling exceptions without try catch
QUESTION:
In Java, we handle exceptions using try catch blocks. I know that I can write a try catch block like the one below to catch any exception thrown in a method. try { // do something } catch (Throwable t) {
} But is there any way in Java which allo... | [
"java",
"exception"
] | 18 | 32 | 27,122 | 4 | 0 | 2011-06-05T15:37:01.290000 | 2011-06-05T15:44:06.997000 |
6,243,889 | 6,244,626 | MVC: How can I change a Html.Grid row's colour based on value? | I was wondering how to change the colour of a row in a Html.Grid, if a 'Completed' boolean property equals true. Here is an example grid: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date Requested"); c.For(a => a.Comment).Named("Comment"); c.For(a => ... | I guess you mean changing the background color of a given row in the grid based on a given value of a model property. If so you could use the RowAttributes method: @Html.Grid(Model.ExampleList).RowAttributes(row => new Hash(@class => row.Item.IsFoo? "redclass": "normalclass")).Columns(c => {... }) | MVC: How can I change a Html.Grid row's colour based on value? I was wondering how to change the colour of a row in a Html.Grid, if a 'Completed' boolean property equals true. Here is an example grid: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date R... | TITLE:
MVC: How can I change a Html.Grid row's colour based on value?
QUESTION:
I was wondering how to change the colour of a row in a Html.Grid, if a 'Completed' boolean property equals true. Here is an example grid: @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequest... | [
"c#",
"asp.net-mvc",
"asp.net-mvc-3"
] | 3 | 5 | 7,552 | 2 | 0 | 2011-06-05T15:37:20.323000 | 2011-06-05T17:39:39.723000 |
6,243,893 | 6,244,322 | Doctrine 1.2.3 not selecting all records | When using the following query only 24 records are returned as two clients have more than one pet who meet the criteria but Doctrine will not return the additional records in my Zend App. $q = Doctrine_Query::create() ->select('c.clientID,c.firstname,c.lastname,c.address1,c.address2,c.address3,t.county,p.name') ->from(... | This is because you're selecting from Clients and not Pets. Doctrine will return all 24 distinct clients, with their pet(s) as related records. The two clients with more than one matching pet will each have two related pet entities. If you want a record for each pet (rather than one for each distinct client), you shoul... | Doctrine 1.2.3 not selecting all records When using the following query only 24 records are returned as two clients have more than one pet who meet the criteria but Doctrine will not return the additional records in my Zend App. $q = Doctrine_Query::create() ->select('c.clientID,c.firstname,c.lastname,c.address1,c.addr... | TITLE:
Doctrine 1.2.3 not selecting all records
QUESTION:
When using the following query only 24 records are returned as two clients have more than one pet who meet the criteria but Doctrine will not return the additional records in my Zend App. $q = Doctrine_Query::create() ->select('c.clientID,c.firstname,c.lastname... | [
"zend-framework",
"doctrine"
] | 0 | 0 | 326 | 1 | 0 | 2011-06-05T15:37:45.910000 | 2011-06-05T16:45:14.470000 |
6,243,896 | 6,243,969 | C# how to object created in Btn_click event access by another Btn_Click | I am using the VS2010 C# language. I have a form with ENTER button which create an object of class ORDER in Enter_Click(..) event. Now I have another button ADD ITEM which suppose to add a new item in an order when it is clicked. I tried to access an Order object created in ENTER button click event, in ADDITEM_Click(..... | The scope of your Order is limited to the Enter_Click() event because that is where you declare it. Add the line Order myOrder at the class level and it will work because the object will continue to exist after the Enter_Click() method finishes. | C# how to object created in Btn_click event access by another Btn_Click I am using the VS2010 C# language. I have a form with ENTER button which create an object of class ORDER in Enter_Click(..) event. Now I have another button ADD ITEM which suppose to add a new item in an order when it is clicked. I tried to access ... | TITLE:
C# how to object created in Btn_click event access by another Btn_Click
QUESTION:
I am using the VS2010 C# language. I have a form with ENTER button which create an object of class ORDER in Enter_Click(..) event. Now I have another button ADD ITEM which suppose to add a new item in an order when it is clicked. ... | [
"c#",
"c#-4.0"
] | 2 | 2 | 388 | 2 | 0 | 2011-06-05T15:38:20.763000 | 2011-06-05T15:47:16.333000 |
6,243,898 | 6,247,486 | EF4: The closed type 'xxxx' does not have a corresponding element settable property | I'm using this guide to call stored procedure in my projet which using EF4 EDMX through WCFDataservice. I have mapped a complex type to return items from the stored procedure. If I call the method by http, the XML'result is perfect, but when I call with this code: public void Test() { Uri methodUri = new Uri(entities.B... | Ok I find the solution according this article Actually, you did everything right...However, our client library does not support materialization of a collection of complex types directly (yet). If you look at the output of the service op, you would see a list of tag, rather than an Atom Feed. My workaround: I'm using Ca... | EF4: The closed type 'xxxx' does not have a corresponding element settable property I'm using this guide to call stored procedure in my projet which using EF4 EDMX through WCFDataservice. I have mapped a complex type to return items from the stored procedure. If I call the method by http, the XML'result is perfect, but... | TITLE:
EF4: The closed type 'xxxx' does not have a corresponding element settable property
QUESTION:
I'm using this guide to call stored procedure in my projet which using EF4 EDMX through WCFDataservice. I have mapped a complex type to return items from the stored procedure. If I call the method by http, the XML'resu... | [
"asp.net",
"wcf",
"asp.net-mvc-2",
"entity-framework-4",
"wcf-data-services"
] | 2 | 0 | 4,196 | 1 | 0 | 2011-06-05T15:38:28.897000 | 2011-06-06T03:17:41.610000 |
6,243,902 | 6,243,939 | Error during String declaration | Why does char line[10] = "1234"; work fine but char line[10]; line = "1234"; throws an error: incompatible types in assignment error? | The first line works because it performs an initialization of the char array with data. It would be the same as: char line[10] = {'1', '2', '3', '4', '\0'}; In the second example, the type of "1234" is const char*, since it is a pointer to a constant char array. You're trying to assign a const char* to a char*, which i... | Error during String declaration Why does char line[10] = "1234"; work fine but char line[10]; line = "1234"; throws an error: incompatible types in assignment error? | TITLE:
Error during String declaration
QUESTION:
Why does char line[10] = "1234"; work fine but char line[10]; line = "1234"; throws an error: incompatible types in assignment error?
ANSWER:
The first line works because it performs an initialization of the char array with data. It would be the same as: char line[10] ... | [
"c",
"string"
] | 0 | 1 | 693 | 3 | 0 | 2011-06-05T15:38:55.520000 | 2011-06-05T15:43:41.173000 |
6,243,903 | 6,243,923 | how to convert std::string to QString | I have a problem: std::string str("character/test/raw"); qDebug() << QString::fromStdString(str); and the output is: "]AIIIIIIIIIIIIIIIIIIIIIIIIIIIII" I think the problem is in encoding but don't know how to fix it. Please help | Is your QT compiled with STL compatible enabled option? Maybe you can use fromUtf8 or one of other static functions of QString. | how to convert std::string to QString I have a problem: std::string str("character/test/raw"); qDebug() << QString::fromStdString(str); and the output is: "]AIIIIIIIIIIIIIIIIIIIIIIIIIIIII" I think the problem is in encoding but don't know how to fix it. Please help | TITLE:
how to convert std::string to QString
QUESTION:
I have a problem: std::string str("character/test/raw"); qDebug() << QString::fromStdString(str); and the output is: "]AIIIIIIIIIIIIIIIIIIIIIIIIIIIII" I think the problem is in encoding but don't know how to fix it. Please help
ANSWER:
Is your QT compiled with ST... | [
"c++",
"qt",
"string"
] | 8 | 6 | 9,519 | 2 | 0 | 2011-06-05T15:39:06.837000 | 2011-06-05T15:41:14.007000 |
6,243,906 | 6,245,961 | using DECODE with FIRST ORDER_BY in an sql query | I have started studying SQL, and while browsing a couple of reading materials I stumbled on this query: SELECT MAX(SALARY) KEEP (DENSE_RANK FIRST ORDER BY DECODE (SALARY, NULL, NULL, MONTHLY_SAL) NULLS LAST) I have tried reading up on what this means and have come up with the following (please excuse my long winded and... | 1) yes, one value 2) when you omit KEEP (DENSE_RANK... you'll get the max salary of all records. With KEEP (DENSE_RANK... you'll get max salary out of all records which have the smallest monthly_sal and a non-null salary. The job of the ´DECODE´-expression is to exclude records with null salary. | using DECODE with FIRST ORDER_BY in an sql query I have started studying SQL, and while browsing a couple of reading materials I stumbled on this query: SELECT MAX(SALARY) KEEP (DENSE_RANK FIRST ORDER BY DECODE (SALARY, NULL, NULL, MONTHLY_SAL) NULLS LAST) I have tried reading up on what this means and have come up wit... | TITLE:
using DECODE with FIRST ORDER_BY in an sql query
QUESTION:
I have started studying SQL, and while browsing a couple of reading materials I stumbled on this query: SELECT MAX(SALARY) KEEP (DENSE_RANK FIRST ORDER BY DECODE (SALARY, NULL, NULL, MONTHLY_SAL) NULLS LAST) I have tried reading up on what this means an... | [
"sql",
"oracle"
] | 2 | 1 | 1,000 | 1 | 0 | 2011-06-05T15:39:28.787000 | 2011-06-05T21:23:57.890000 |
6,243,914 | 6,263,512 | XAML changes without effect | I'm trying to put a textblock in a grid element, but it doesn't display in the debug mode. What do I do wrong? Maybe it's caused that I manipulate the window directly by my C# code? Życia: | I've already solved my issue. I had defined a canvas tag in my C# code and it overwrote the XAML changes. I replaced the XAML code to the following Życia: and removed the line creating the canvas element from my C# code and everything works now. Thanks! | XAML changes without effect I'm trying to put a textblock in a grid element, but it doesn't display in the debug mode. What do I do wrong? Maybe it's caused that I manipulate the window directly by my C# code? Życia: | TITLE:
XAML changes without effect
QUESTION:
I'm trying to put a textblock in a grid element, but it doesn't display in the debug mode. What do I do wrong? Maybe it's caused that I manipulate the window directly by my C# code? Życia:
ANSWER:
I've already solved my issue. I had defined a canvas tag in my C# code and i... | [
"c#",
"wpf",
"xaml"
] | 0 | 0 | 170 | 2 | 0 | 2011-06-05T15:39:53.823000 | 2011-06-07T09:52:44.470000 |
6,243,915 | 6,243,956 | php generated option selected by default | I'm probably blind to my own mistake again, but why doesn't 2011 become the default selected year? (The -- are for debugging, they show up that the if statement works correctly.) for($year=1900;$year<=2050;$year++) { if ($year==date("Y")) echo " --".$year." "; else echo " ".$year." "; } The selected='selected' should j... | Are you checking the generated HTML? Maybe this code works well (it seems it does), but the problem is in select, or in another place. | php generated option selected by default I'm probably blind to my own mistake again, but why doesn't 2011 become the default selected year? (The -- are for debugging, they show up that the if statement works correctly.) for($year=1900;$year<=2050;$year++) { if ($year==date("Y")) echo " --".$year." "; else echo " ".$yea... | TITLE:
php generated option selected by default
QUESTION:
I'm probably blind to my own mistake again, but why doesn't 2011 become the default selected year? (The -- are for debugging, they show up that the if statement works correctly.) for($year=1900;$year<=2050;$year++) { if ($year==date("Y")) echo " --".$year." "; ... | [
"php",
"forms",
"selected"
] | 1 | 0 | 389 | 3 | 0 | 2011-06-05T15:39:55.417000 | 2011-06-05T15:45:45.333000 |
6,243,918 | 6,243,968 | Get origin class of object instance | My Java application needs to serialize/deserialize an XML structure received via HTTP. This XML message may contain an Error element on almost any level of the XML. That's why all classes extend ApiError. Please see the following question as well: Deserialize repeating XML elements in Simple 2.5.3 (Java) I have created... | Yes, you can do this, by getting the stack trace of the current thread in the ApiError constructor: public ApiError() { StackTraceElement[] trace = Thread.currentThread().getStackTrace(); this.errorOrigin = trace[2].getClassName(); } You can see why this works by putting Thread.dumpStack(); in the ApiError constructor.... | Get origin class of object instance My Java application needs to serialize/deserialize an XML structure received via HTTP. This XML message may contain an Error element on almost any level of the XML. That's why all classes extend ApiError. Please see the following question as well: Deserialize repeating XML elements i... | TITLE:
Get origin class of object instance
QUESTION:
My Java application needs to serialize/deserialize an XML structure received via HTTP. This XML message may contain an Error element on almost any level of the XML. That's why all classes extend ApiError. Please see the following question as well: Deserialize repeat... | [
"java",
"class",
"extends"
] | 0 | 2 | 2,121 | 3 | 0 | 2011-06-05T15:40:11.440000 | 2011-06-05T15:47:08.003000 |
6,243,922 | 6,244,021 | Function pointer assignment, why does calling this function via pointer result in seg fault? | I have this struct defined: typedef struct Socket_s {... SocketConnectFunc Connect;... }Socket; where SocketConnectFunc is defined as: typedef Socket_Return (*SocketConnectFunc) (void * self); When initialising a Socket structure, I call this: void Init(Socket * sock) { sock = (Socket *)malloc(sizof(Socket)); if(sock) ... | You need to pass the address of the pointer. Passing just the pointer you can't change it in the caller void Init(Socket ** sock) { *sock = malloc(sizeof **sock); /* don't cast the return value of malloc! */ if (*sock) (*sock)->connect = SocketConnect; } And call it like so struct Socket_s *mysock; Init(&mysock); | Function pointer assignment, why does calling this function via pointer result in seg fault? I have this struct defined: typedef struct Socket_s {... SocketConnectFunc Connect;... }Socket; where SocketConnectFunc is defined as: typedef Socket_Return (*SocketConnectFunc) (void * self); When initialising a Socket structu... | TITLE:
Function pointer assignment, why does calling this function via pointer result in seg fault?
QUESTION:
I have this struct defined: typedef struct Socket_s {... SocketConnectFunc Connect;... }Socket; where SocketConnectFunc is defined as: typedef Socket_Return (*SocketConnectFunc) (void * self); When initialisin... | [
"c",
"sockets",
"pointers",
"segmentation-fault"
] | 0 | 4 | 1,095 | 2 | 0 | 2011-06-05T15:41:08.897000 | 2011-06-05T15:55:22.787000 |
6,243,933 | 6,246,264 | remotely start Python program in background | I need to use fabfile to remotely start some program in remote boxes from time to time, and get the results. Since the program takes a long while to finish, I wish to make it run in background and so I dont need to wait. So I tried os.fork() to make it work. The problem is that when I ssh to the remote box, and run the... | If I understand your question right, I think you're making this far too complicated. os.fork() is for multiprocessing, not for running a program in the background. Let's say for the sake of discussion that you wanted to run program.sh and collect what it sends to standard output. To do this with fabric, create locally:... | remotely start Python program in background I need to use fabfile to remotely start some program in remote boxes from time to time, and get the results. Since the program takes a long while to finish, I wish to make it run in background and so I dont need to wait. So I tried os.fork() to make it work. The problem is th... | TITLE:
remotely start Python program in background
QUESTION:
I need to use fabfile to remotely start some program in remote boxes from time to time, and get the results. Since the program takes a long while to finish, I wish to make it run in background and so I dont need to wait. So I tried os.fork() to make it work.... | [
"python",
"fork",
"shelve",
"python-daemon"
] | 3 | 4 | 2,357 | 2 | 0 | 2011-06-05T15:42:47.757000 | 2011-06-05T22:17:06.750000 |
6,243,942 | 6,244,079 | how to send an email with an attachment from C#? | I'm trying to write a code, what would save the content of a picturebox ( works ) and email it ( doesn't work ). What do you think might be the problem? Should there be anything more to the SmtpClient client = new SmtpClient("smtp.gmail.com");? Also the program shouldn't freeze up while the image gets uploaded, rather ... | for: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required" Try use: var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("username", "password"), EnableSsl =true };
client.Send(message); | how to send an email with an attachment from C#? I'm trying to write a code, what would save the content of a picturebox ( works ) and email it ( doesn't work ). What do you think might be the problem? Should there be anything more to the SmtpClient client = new SmtpClient("smtp.gmail.com");? Also the program shouldn't... | TITLE:
how to send an email with an attachment from C#?
QUESTION:
I'm trying to write a code, what would save the content of a picturebox ( works ) and email it ( doesn't work ). What do you think might be the problem? Should there be anything more to the SmtpClient client = new SmtpClient("smtp.gmail.com");? Also the... | [
"c#",
".net",
"smtpclient"
] | 1 | 1 | 600 | 2 | 0 | 2011-06-05T15:43:57.833000 | 2011-06-05T16:07:58.487000 |
6,243,964 | 6,244,536 | Overriding/customizing Drupal modules | I would like to override custom user template in my Drupal 7 installation. The question is - should I edit the template file in the main module or copy the module to my theme's folder and edit it there? In case of the second option, how can I do it? | You should definitely create a subtheme to customize the look and feel. Otherwise, every time you upgrade core you will have to reapply your changes. You can subtheme the default Drupal 7 theme (Bartik) by following these steps. Once you have done that, copy the user-profile.tpl.php file into your subtheme directory (/... | Overriding/customizing Drupal modules I would like to override custom user template in my Drupal 7 installation. The question is - should I edit the template file in the main module or copy the module to my theme's folder and edit it there? In case of the second option, how can I do it? | TITLE:
Overriding/customizing Drupal modules
QUESTION:
I would like to override custom user template in my Drupal 7 installation. The question is - should I edit the template file in the main module or copy the module to my theme's folder and edit it there? In case of the second option, how can I do it?
ANSWER:
You s... | [
"drupal",
"drupal-6",
"drupal-7"
] | 3 | 5 | 586 | 1 | 0 | 2011-06-05T15:46:58.487000 | 2011-06-05T17:21:34.500000 |
6,243,970 | 6,244,002 | readline and readlines methods missing from python 3.2? | Did they remove file.readline() and file.readlines() from python 3.2? If yes what did they replace it with? | While there is no file type any more in Python 3.x, the various types in the io module that replace the old file type still support f.readline() and f.readlines(). You actually don't need those methods, though, since they can be substituted by next(f) and list(f). | readline and readlines methods missing from python 3.2? Did they remove file.readline() and file.readlines() from python 3.2? If yes what did they replace it with? | TITLE:
readline and readlines methods missing from python 3.2?
QUESTION:
Did they remove file.readline() and file.readlines() from python 3.2? If yes what did they replace it with?
ANSWER:
While there is no file type any more in Python 3.x, the various types in the io module that replace the old file type still suppo... | [
"python",
"readline",
"readlines"
] | 3 | 4 | 8,272 | 4 | 0 | 2011-06-05T15:47:21.453000 | 2011-06-05T15:52:20.590000 |
6,243,977 | 6,244,014 | Rails I18n locale set date format in Rails | My environment: rails => 3.0.6, ruby => 1.9.2 I set my locale to Italan. Infact, inside the console I18n.locale # =>:it My locale file work just fine, but I'cant make my dates display right. For ex. in my console Date.current => Sun, 05 Jun 2011 instead of 05 Giugno 2011 But if I try other methods it return the right t... | Date.current => Sun, 05 Jun 2011 Won't run your code through the localizer, you should use I18n.localize(Date.current) I18n.l(Date.current) There are also the helper methods in Rails, which will respect the locale, but are only (typically) available in the view, documentation for these lives here: http://api.rubyonrail... | Rails I18n locale set date format in Rails My environment: rails => 3.0.6, ruby => 1.9.2 I set my locale to Italan. Infact, inside the console I18n.locale # =>:it My locale file work just fine, but I'cant make my dates display right. For ex. in my console Date.current => Sun, 05 Jun 2011 instead of 05 Giugno 2011 But i... | TITLE:
Rails I18n locale set date format in Rails
QUESTION:
My environment: rails => 3.0.6, ruby => 1.9.2 I set my locale to Italan. Infact, inside the console I18n.locale # =>:it My locale file work just fine, but I'cant make my dates display right. For ex. in my console Date.current => Sun, 05 Jun 2011 instead of 05... | [
"date",
"internationalization",
"locale"
] | 1 | 4 | 3,755 | 2 | 0 | 2011-06-05T15:48:33.360000 | 2011-06-05T15:54:48.170000 |
6,243,984 | 6,244,058 | Capturing the contents of native prototypes | Try and do the following: for (var key in String.prototype) console.log(key); It gives you...nothing (well, unless you defined some foreign stuff yourself.) However, you still have String.prototype.split for example. I tried it on every other native object ( Number, Array, Object ) for the same result. The following al... | From the MDC page for for..in: A for...in loop does not iterate over built-in properties The reason is that properties in Javascript are either enumerable or non-enumerable; "enumerable" means you can access the property in a for..in loop. All built-in properties are non-enumerable. Modern browsers support the Object.g... | Capturing the contents of native prototypes Try and do the following: for (var key in String.prototype) console.log(key); It gives you...nothing (well, unless you defined some foreign stuff yourself.) However, you still have String.prototype.split for example. I tried it on every other native object ( Number, Array, Ob... | TITLE:
Capturing the contents of native prototypes
QUESTION:
Try and do the following: for (var key in String.prototype) console.log(key); It gives you...nothing (well, unless you defined some foreign stuff yourself.) However, you still have String.prototype.split for example. I tried it on every other native object (... | [
"javascript"
] | 2 | 3 | 65 | 1 | 0 | 2011-06-05T15:49:26.803000 | 2011-06-05T16:03:14.743000 |
6,243,988 | 6,244,024 | C++0x Function delete - Delete all but certain types | In C++0x, I can do something like this: double f(double x) { return x; } template T f(T x) = delete; To prevent f() from being called on any other type than double. What I'm trying to do is similar, however, not quite the same. I have a function that operates on pointer arrays. For example: template T* some_string_func... | Use boost::enable_if, along with type traits. template T* some_string_function(T* x, boost::enable_if ); (assuming is_char_type is a type trait you define, which evaluates to true for the desired types, and false for all others) | C++0x Function delete - Delete all but certain types In C++0x, I can do something like this: double f(double x) { return x; } template T f(T x) = delete; To prevent f() from being called on any other type than double. What I'm trying to do is similar, however, not quite the same. I have a function that operates on poin... | TITLE:
C++0x Function delete - Delete all but certain types
QUESTION:
In C++0x, I can do something like this: double f(double x) { return x; } template T f(T x) = delete; To prevent f() from being called on any other type than double. What I'm trying to do is similar, however, not quite the same. I have a function tha... | [
"c++11",
"c-strings",
"delete-operator",
"unicode-string"
] | 0 | 3 | 139 | 3 | 0 | 2011-06-05T15:50:32.667000 | 2011-06-05T15:56:24.543000 |
6,243,990 | 6,244,852 | Cannot Facebook "Like" with Graph API's /OBJECT_ID/likes | I'd like to implement a like button in my Android app. The Graph API doc sais publishing likes can be done with /OBJECT_ID/likes. /OBJECT_ID/likes Like the given object (if it has a /likes connection) However if i implement this: Bundle par = new Bundle(); par.putString("access_token", ACCESS_TOKEN); facebook.request(A... | You cannot force users to like your application or your fan page (due to spamming reasons). The only way you can get them to like your page/app is embedding the like fbml code or iframe in a web view. That documentation is in place to like a friends wall post or comment or photo, as those are the types of items you can... | Cannot Facebook "Like" with Graph API's /OBJECT_ID/likes I'd like to implement a like button in my Android app. The Graph API doc sais publishing likes can be done with /OBJECT_ID/likes. /OBJECT_ID/likes Like the given object (if it has a /likes connection) However if i implement this: Bundle par = new Bundle(); par.pu... | TITLE:
Cannot Facebook "Like" with Graph API's /OBJECT_ID/likes
QUESTION:
I'd like to implement a like button in my Android app. The Graph API doc sais publishing likes can be done with /OBJECT_ID/likes. /OBJECT_ID/likes Like the given object (if it has a /likes connection) However if i implement this: Bundle par = ne... | [
"android",
"facebook"
] | 0 | 0 | 1,867 | 1 | 0 | 2011-06-05T15:50:55.723000 | 2011-06-05T18:15:23.990000 |
6,243,998 | 6,244,246 | Reading large strings from database without fragmenting large object heap | I have data database containing some rather large strings, each of which holds a serialized hierarchical data collection (data is stored as strings rather than as a binary stream to allow interaction with VB6). From what I can tell, any database query that returns a string over 85,000 bytes will immediately throw that ... | You can't reuse string s, because they are immutable. What you can do is either stream the data from the database ( example for ADO ), which means you can avoid LOH completely. Or you can load your column into a char array (or a byte array), which can be reused, as long as it is big enough. This all depends on what dat... | Reading large strings from database without fragmenting large object heap I have data database containing some rather large strings, each of which holds a serialized hierarchical data collection (data is stored as strings rather than as a binary stream to allow interaction with VB6). From what I can tell, any database ... | TITLE:
Reading large strings from database without fragmenting large object heap
QUESTION:
I have data database containing some rather large strings, each of which holds a serialized hierarchical data collection (data is stored as strings rather than as a binary stream to allow interaction with VB6). From what I can t... | [
".net",
"garbage-collection",
"large-object-heap"
] | 4 | 2 | 599 | 2 | 0 | 2011-06-05T15:51:49.780000 | 2011-06-05T16:33:44.690000 |
6,244,000 | 6,244,284 | Proper way to encode a (relative) URL using PHP | I'm trying to encode the following relative URL using PHP: /tracks/add/5449326 I've tried using rawurlencode and urlencode. Which made it look something like: %2Ftracks%2Fadd%2F5449326 I'm going to use this URL in an AJAX call. The URL I am trying to make the call to is: /overlay/add-track/{param1}/{param2} {param1} is... | The encoded slash is probably not allowed by the webserver resulting in a default 404. For apache see: http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes Either the apache config needs to be changed or you need to work around it by replacing the slash/backslash with something else. edit: You could t... | Proper way to encode a (relative) URL using PHP I'm trying to encode the following relative URL using PHP: /tracks/add/5449326 I've tried using rawurlencode and urlencode. Which made it look something like: %2Ftracks%2Fadd%2F5449326 I'm going to use this URL in an AJAX call. The URL I am trying to make the call to is: ... | TITLE:
Proper way to encode a (relative) URL using PHP
QUESTION:
I'm trying to encode the following relative URL using PHP: /tracks/add/5449326 I've tried using rawurlencode and urlencode. Which made it look something like: %2Ftracks%2Fadd%2F5449326 I'm going to use this URL in an AJAX call. The URL I am trying to mak... | [
"php",
"javascript",
"apache",
"urlencode",
"url-encoding"
] | 4 | 0 | 760 | 1 | 0 | 2011-06-05T15:52:04.153000 | 2011-06-05T16:39:37.550000 |
6,244,005 | 6,244,040 | JSF page reflects Date incorrectly - 1 Day shifted | DB value of Date is: 04-OCT-10 Bean method returns: Mon Oct 04 00:00:00 EEST 2010 JSF returns: 03.10.2010 JSF code:...... What reason(s),that JSF displays Date value incorrectly? thank you | The JSF date converters defaults to UTC timezone. But your date is apparently stored using EEST timezone which is some hours beyond UTC (GMT+3 to be precise). When intepreting those dates using UTC timezone (as JSF by default does), you will get hours back in time and thus the previous day will be represented. You need... | JSF page reflects Date incorrectly - 1 Day shifted DB value of Date is: 04-OCT-10 Bean method returns: Mon Oct 04 00:00:00 EEST 2010 JSF returns: 03.10.2010 JSF code:...... What reason(s),that JSF displays Date value incorrectly? thank you | TITLE:
JSF page reflects Date incorrectly - 1 Day shifted
QUESTION:
DB value of Date is: 04-OCT-10 Bean method returns: Mon Oct 04 00:00:00 EEST 2010 JSF returns: 03.10.2010 JSF code:...... What reason(s),that JSF displays Date value incorrectly? thank you
ANSWER:
The JSF date converters defaults to UTC timezone. But... | [
"jsf",
"date",
"converters"
] | 6 | 20 | 8,251 | 2 | 0 | 2011-06-05T15:52:58.407000 | 2011-06-05T16:00:18.503000 |
6,244,012 | 6,244,972 | NodeJS and asynchronous hell | I just came to this awful situation where I have an array of strings each representing a possibly existing file (e.g. var files = ['file1', 'file2', 'file3']. I need to loop through these file names and try to see if it exists in the current directory, and if it does, stop looping and forget the rest of the remaining f... | Don't use sync stuff in a normal server environment -- things are single threaded and this will completely lock things up while it waits for the results of this io bound loop. CLI utility = probably fine, server = only okay on startup. A common library for asynchronous flow control is https://github.com/caolan/async as... | NodeJS and asynchronous hell I just came to this awful situation where I have an array of strings each representing a possibly existing file (e.g. var files = ['file1', 'file2', 'file3']. I need to loop through these file names and try to see if it exists in the current directory, and if it does, stop looping and forge... | TITLE:
NodeJS and asynchronous hell
QUESTION:
I just came to this awful situation where I have an array of strings each representing a possibly existing file (e.g. var files = ['file1', 'file2', 'file3']. I need to loop through these file names and try to see if it exists in the current directory, and if it does, stop... | [
"javascript",
"asynchronous",
"node.js",
"callback"
] | 7 | 14 | 4,678 | 5 | 0 | 2011-06-05T15:53:54.333000 | 2011-06-05T18:35:25.310000 |
6,244,017 | 6,244,951 | MVC3 razor based htmlhelper with lambda field expressions based on model | I am creating a fluent HtmlHelper in MVC - to create a grid based on HTML. I am aware of mvc contrib and WebGrid - but I am making my own and have a specific problem: I have to enter this: @Html.DSGridFor().AddColumn(x=>x.FirstOrDefault().Message) but I want to be able to type this: @Html.DSGridFor().AddColumn(x=>x.Mes... | I dont have Visual Studio with me but I'll take a stab at this... I would take in a collection as a datatype either in your DsGridFor method or in the AddColumn method. This will allow you to send Strongly-typed arguments from a collection. Say you wanted a generic method of AddColumn for a given collection with access... | MVC3 razor based htmlhelper with lambda field expressions based on model I am creating a fluent HtmlHelper in MVC - to create a grid based on HTML. I am aware of mvc contrib and WebGrid - but I am making my own and have a specific problem: I have to enter this: @Html.DSGridFor().AddColumn(x=>x.FirstOrDefault().Message)... | TITLE:
MVC3 razor based htmlhelper with lambda field expressions based on model
QUESTION:
I am creating a fluent HtmlHelper in MVC - to create a grid based on HTML. I am aware of mvc contrib and WebGrid - but I am making my own and have a specific problem: I have to enter this: @Html.DSGridFor().AddColumn(x=>x.FirstOr... | [
"asp.net-mvc-3",
"lambda",
"grid",
"expression"
] | 3 | 2 | 1,768 | 1 | 0 | 2011-06-05T15:55:13.247000 | 2011-06-05T18:32:27.223000 |
6,244,025 | 6,244,092 | Map view set according to distance | I am a new android developer. I am creating a map view application Where I want to set up my map view according distance from my current location. I have three buttons such as 100m,500m and 1 Km. When application is started then mapview will appear and current location is the center of the map. When i tap on 1 km then ... | You have to compute 1km in latitude and longitude, set the center to your current position ( I guess you succed to do that) and set the span to your MapController: mController.zoomToSpan((int) spanLat,(int) spanLon); zoomToSpan public void zoomToSpan(int latSpanE6,int lonSpanE6) Attempts to adjust the zoom of the map s... | Map view set according to distance I am a new android developer. I am creating a map view application Where I want to set up my map view according distance from my current location. I have three buttons such as 100m,500m and 1 Km. When application is started then mapview will appear and current location is the center o... | TITLE:
Map view set according to distance
QUESTION:
I am a new android developer. I am creating a map view application Where I want to set up my map view according distance from my current location. I have three buttons such as 100m,500m and 1 Km. When application is started then mapview will appear and current locati... | [
"android",
"android-mapview"
] | 0 | 2 | 523 | 1 | 0 | 2011-06-05T15:56:33.210000 | 2011-06-05T16:09:19.150000 |
6,244,029 | 6,244,970 | How to use SharePoint only as a Content Management tool from a custom web application? | We have many custom built web applications (both external & internal) written in Classic ASP and ASP.NET 2.0 technologies. Internal users can upload files to these websites, which can then be viewed by External Users. In some cases, external users can upload documents as well. Screenshot # 1 gives a brief idea about th... | Question 1 Hard to say without having more details. So I'm going to assume that you currently use Active Directory for your authentication store. So this means that your SQL Server defines a list of roles and then has assigned memberships to these roles. I'm going to assume that your assigned membership is to AD users ... | How to use SharePoint only as a Content Management tool from a custom web application? We have many custom built web applications (both external & internal) written in Classic ASP and ASP.NET 2.0 technologies. Internal users can upload files to these websites, which can then be viewed by External Users. In some cases, ... | TITLE:
How to use SharePoint only as a Content Management tool from a custom web application?
QUESTION:
We have many custom built web applications (both external & internal) written in Classic ASP and ASP.NET 2.0 technologies. Internal users can upload files to these websites, which can then be viewed by External User... | [
"asp.net",
"asp.net-mvc",
"sharepoint",
"content-management"
] | 3 | 2 | 2,028 | 1 | 0 | 2011-06-05T15:57:46.623000 | 2011-06-05T18:34:52.977000 |
6,244,036 | 6,250,456 | fast increase number to be mod 16 in C | what is the best way to to get the closest, non-smaller number that is divisible by 16? the method I came up with doesn't look very elegant or fast int non_smaller_int_divisible_by_16(int x) { return x + ((16 - (x % 16)) % 16); } the expected results are result | X values -------|---------- 16 | 1,2,..., 16 32 | 17, 18... | following @nemo's comment, there's a nifty way to solve this that works for all mod bases, is very readable, and should be fast unsigned int non_smaller_int_divisible_by_16(unsigned int x) { return x + ((-x) % 16); } the generic version is therefore unsigned int non_smaller_int_divisible_by_base(unsigned int x, unsigne... | fast increase number to be mod 16 in C what is the best way to to get the closest, non-smaller number that is divisible by 16? the method I came up with doesn't look very elegant or fast int non_smaller_int_divisible_by_16(int x) { return x + ((16 - (x % 16)) % 16); } the expected results are result | X values -------|... | TITLE:
fast increase number to be mod 16 in C
QUESTION:
what is the best way to to get the closest, non-smaller number that is divisible by 16? the method I came up with doesn't look very elegant or fast int non_smaller_int_divisible_by_16(int x) { return x + ((16 - (x % 16)) % 16); } the expected results are result |... | [
"c",
"math",
"video",
"bit-manipulation",
"modulus"
] | 4 | 1 | 784 | 4 | 0 | 2011-06-05T15:59:46.797000 | 2011-06-06T10:05:38.890000 |
6,244,038 | 6,251,564 | sqlalchemy filter by count column | I have a User query which filters by the amount of orders each user has (ordersCount). User.query.filter('ordersCount>2') If I run it it says: "Unknown column 'ordersCount' in 'where clause'" From my experience I should be using having on such operations because mysql won't allow it for fields not part of the table but... | See documentation of Ordering, Grouping, Limiting, Offset...ing. Based on the sample code provided and an assumption that your orders are stored in the orders table, your version would look similar to: >>> s = select([orders.c.user_id, func.count(orders.c.id)]).\... group_by(orders.c.user_id).having(func.count(orders.c... | sqlalchemy filter by count column I have a User query which filters by the amount of orders each user has (ordersCount). User.query.filter('ordersCount>2') If I run it it says: "Unknown column 'ordersCount' in 'where clause'" From my experience I should be using having on such operations because mysql won't allow it fo... | TITLE:
sqlalchemy filter by count column
QUESTION:
I have a User query which filters by the amount of orders each user has (ordersCount). User.query.filter('ordersCount>2') If I run it it says: "Unknown column 'ordersCount' in 'where clause'" From my experience I should be using having on such operations because mysql... | [
"python",
"sqlalchemy"
] | 10 | 23 | 16,534 | 1 | 0 | 2011-06-05T16:00:04.010000 | 2011-06-06T11:48:17.173000 |
6,244,048 | 6,244,133 | Strange behavior of float in function definition. And declaration-definition mismatch, yet it works, how? | How does the following code work even though the signature of the function in the declaration doesn't match with the definition? The function declaration has empty parameter list, yet the definition has one parameter. Why the compiler doesn't give error? #include double f(); //function declaration int main(void) { prin... | Your assumption that declaration does not match the definition is incorrect. (That would be the case in C++, but not in C). In C language the double f(); declaration does not fully declare the function, i.e. it does not introduce the prototype. It only announces the fact that function f exists and that its return type ... | Strange behavior of float in function definition. And declaration-definition mismatch, yet it works, how? How does the following code work even though the signature of the function in the declaration doesn't match with the definition? The function declaration has empty parameter list, yet the definition has one paramet... | TITLE:
Strange behavior of float in function definition. And declaration-definition mismatch, yet it works, how?
QUESTION:
How does the following code work even though the signature of the function in the declaration doesn't match with the definition? The function declaration has empty parameter list, yet the definiti... | [
"c",
"definition",
"function-declaration",
"function-prototypes"
] | 5 | 7 | 6,220 | 4 | 0 | 2011-06-05T16:01:14.470000 | 2011-06-05T16:14:52.857000 |
6,244,050 | 6,244,534 | How is the memory of returned C types handled under GC? | According to the documentation for NSString's method -UTF8String: The returned C string is automatically freed just as a returned object would be released; you should copy the C string if it needs to store it outside of the autorelease context in which the C string is created. So under retain/release memory management,... | I think the memory is allocated from garbage collected memory and the return type is __strong const char*. This means that it will be collected in the normal way when it is not reachable from the root set of pointers. That basically means you need to store it in a pointer variable that is marked as __strong or it will ... | How is the memory of returned C types handled under GC? According to the documentation for NSString's method -UTF8String: The returned C string is automatically freed just as a returned object would be released; you should copy the C string if it needs to store it outside of the autorelease context in which the C strin... | TITLE:
How is the memory of returned C types handled under GC?
QUESTION:
According to the documentation for NSString's method -UTF8String: The returned C string is automatically freed just as a returned object would be released; you should copy the C string if it needs to store it outside of the autorelease context in... | [
"objective-c",
"cocoa",
"garbage-collection"
] | 8 | 2 | 189 | 2 | 0 | 2011-06-05T16:01:23.350000 | 2011-06-05T17:21:27.077000 |
6,244,052 | 6,247,375 | Empty attribute with Ruby HAML | I'm implementing Schema microformats on a Ruby project using HAML and can't figure out how to set an empty attribute on a tag. I tried nil and false, but they simply do not shown. Example: I'm tring to set an empty itemscope attribute. Code added from comment by @StrangeElement: My code:.agency.premium{:itemscope => tr... | Using something like %div{:itemscope => true} is the correct way to specify this in your Haml file. How this is rendered depends on how you set Haml's format option. The default in Haml 3.1 is xhtml, and with that it will render as itemprop='itemprop', which is valid xhtml. To render with minimized attributes (like ) y... | Empty attribute with Ruby HAML I'm implementing Schema microformats on a Ruby project using HAML and can't figure out how to set an empty attribute on a tag. I tried nil and false, but they simply do not shown. Example: I'm tring to set an empty itemscope attribute. Code added from comment by @StrangeElement: My code:.... | TITLE:
Empty attribute with Ruby HAML
QUESTION:
I'm implementing Schema microformats on a Ruby project using HAML and can't figure out how to set an empty attribute on a tag. I tried nil and false, but they simply do not shown. Example: I'm tring to set an empty itemscope attribute. Code added from comment by @Strange... | [
"ruby-on-rails",
"ruby",
"haml"
] | 51 | 77 | 13,110 | 3 | 0 | 2011-06-05T16:02:14.680000 | 2011-06-06T02:44:07.957000 |
6,244,055 | 6,244,076 | Why there are no OutOfMemoryError subclasses? | As we all know, there are multiple reasons of OutOfMEmoryError (see first answer ). Why there is only one exception covering all these cases instead of multiple fine-grained ones inheriting from OutOfMEmoryError? | I'd expect because you really can't do anything else when that happens: it almost doesn't matter WHY you ran out, since you're screwed regardless. Perhaps the additional info would be nice, but... I know tomcat tries to do this "Out Of Memory Parachute" thing, where they hold onto a chunk of memory and try and release ... | Why there are no OutOfMemoryError subclasses? As we all know, there are multiple reasons of OutOfMEmoryError (see first answer ). Why there is only one exception covering all these cases instead of multiple fine-grained ones inheriting from OutOfMEmoryError? | TITLE:
Why there are no OutOfMemoryError subclasses?
QUESTION:
As we all know, there are multiple reasons of OutOfMEmoryError (see first answer ). Why there is only one exception covering all these cases instead of multiple fine-grained ones inheriting from OutOfMEmoryError?
ANSWER:
I'd expect because you really can'... | [
"java",
"exception",
"out-of-memory",
"subclassing"
] | 6 | 8 | 625 | 6 | 0 | 2011-06-05T16:02:59.353000 | 2011-06-05T16:07:46.777000 |
6,244,069 | 6,244,122 | Facebook iOS SDK: How to Persist Login to File or Database? | I'm fairly new to iOS development, and I'm starting work on an App that will include some simple Facebook integration. As a proof of concept, I made a bare-bones, view-based application that has a simple button to log a user in to Facebook, and then another button to post a status update. This is all well and good, but... | you wouldn't do that. check out facebook SSO in their SDK ( see https://developers.facebook.com/docs/guides/mobile/ ). You request the facebook token everytime you use it or otherwise get an long-term (read: use access token offline_access) access token and persist this token to the NSUserDefaults for use in your app. ... | Facebook iOS SDK: How to Persist Login to File or Database? I'm fairly new to iOS development, and I'm starting work on an App that will include some simple Facebook integration. As a proof of concept, I made a bare-bones, view-based application that has a simple button to log a user in to Facebook, and then another bu... | TITLE:
Facebook iOS SDK: How to Persist Login to File or Database?
QUESTION:
I'm fairly new to iOS development, and I'm starting work on an App that will include some simple Facebook integration. As a proof of concept, I made a bare-bones, view-based application that has a simple button to log a user in to Facebook, a... | [
"ios",
"facebook-graph-api",
"facebook-ios-sdk"
] | 1 | 2 | 1,499 | 1 | 0 | 2011-06-05T16:06:11.893000 | 2011-06-05T16:12:52.200000 |
6,244,073 | 6,244,119 | Help with itunes XML | Im a new web developer trying to load some xml files into a JSP so that you can view them online. One particular file is giving me a lot of trouble, I keep getting this error message and I am unsure of what to do next The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and... | Never seen a DTD inside XML declarations - maybe that is the problem. It must be prior to all other statements this line: should be the first - but the DTD uri seems to be invalid - best remove it - it does no good | Help with itunes XML Im a new web developer trying to load some xml files into a JSP so that you can view them online. One particular file is giving me a lot of trouble, I keep getting this error message and I am unsure of what to do next The XML page cannot be displayed Cannot view XML input using style sheet. Please ... | TITLE:
Help with itunes XML
QUESTION:
Im a new web developer trying to load some xml files into a JSP so that you can view them online. One particular file is giving me a lot of trouble, I keep getting this error message and I am unsure of what to do next The XML page cannot be displayed Cannot view XML input using st... | [
"xml",
"jsp",
"itunes"
] | 0 | 0 | 281 | 1 | 0 | 2011-06-05T16:07:12.770000 | 2011-06-05T16:12:23.667000 |
6,244,077 | 6,245,054 | Help on SQL Server trigger | Suppose I have 3 tables t1 Nid name 1 aaa 2 bbb 3 ccc delT1 Nid name t2 Sid Nid value 1 1 AAA 2 1 BAC 3 2 CSA In table t1 Nid is primary key which is foreign key for t2 Now what I want is when I delete value from t1 it automatically deletes all values from t2 where t1.Nid=t2.Nid and a value of deleted t1 get inserted i... | Modify the FK in T2 to be ON DELETE CASCADE: ALTER TABLE T2 DROP CONSTRAINT FK_T1_Nid; <-- your constraint name here ALTER TABLE T2 ADD CONSTRAINT FK_T1_Nid FOREIGN KEY (Nid) REFERENCES T1 (Nid) ON DELETE CASCADE; Then create a trigger on T1 to push the information to delT1: CREATE TRIGGER TR_T1_D ON T1 FOR DELETE AS S... | Help on SQL Server trigger Suppose I have 3 tables t1 Nid name 1 aaa 2 bbb 3 ccc delT1 Nid name t2 Sid Nid value 1 1 AAA 2 1 BAC 3 2 CSA In table t1 Nid is primary key which is foreign key for t2 Now what I want is when I delete value from t1 it automatically deletes all values from t2 where t1.Nid=t2.Nid and a value o... | TITLE:
Help on SQL Server trigger
QUESTION:
Suppose I have 3 tables t1 Nid name 1 aaa 2 bbb 3 ccc delT1 Nid name t2 Sid Nid value 1 1 AAA 2 1 BAC 3 2 CSA In table t1 Nid is primary key which is foreign key for t2 Now what I want is when I delete value from t1 it automatically deletes all values from t2 where t1.Nid=t2... | [
"sql-server",
"triggers"
] | 2 | 2 | 336 | 3 | 0 | 2011-06-05T16:07:50.983000 | 2011-06-05T18:51:38.827000 |
6,244,093 | 6,244,114 | Why won't the closest() selector work in this instance? | I am trying to activate toggleClass() on a specific image when clicking on a radio button. I have been trying for ages to get it to work but can't. I can manage to select a parent element of the radio button but nothing proceeding it. I have tried next(), nextAll() and closest(). All of which don't seem to do what I'm ... | closest searches ancestor elements; next and nextAll search sibling elements. The img element you want is the child of a sibling element, so you'll need a more complex statement. Have a go with this: $(this).closest('tr').find('img[title="am"]').toggleClass('houdini'); This says "find the closest ancestor tr element, t... | Why won't the closest() selector work in this instance? I am trying to activate toggleClass() on a specific image when clicking on a radio button. I have been trying for ages to get it to work but can't. I can manage to select a parent element of the radio button but nothing proceeding it. I have tried next(), nextAll(... | TITLE:
Why won't the closest() selector work in this instance?
QUESTION:
I am trying to activate toggleClass() on a specific image when clicking on a radio button. I have been trying for ages to get it to work but can't. I can manage to select a parent element of the radio button but nothing proceeding it. I have trie... | [
"javascript",
"jquery",
"jquery-selectors"
] | 2 | 3 | 328 | 2 | 0 | 2011-06-05T16:09:38.150000 | 2011-06-05T16:11:58.500000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.