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,244,672 | 6,244,774 | ViewFlipper width is wrapping its content and fill_parent is not working | Here is my layout XML: So in short, I have a ViewFlipper inside a TableRow. The ViewFlipper is shrinking to the size of its content, even though all of the elements have fill_parent specified. In my screenshot below, the ViewFlipper has the grey background and the TableRows have red background. | Setting android:layout_weight="1" on your ViewFlipper would work. | ViewFlipper width is wrapping its content and fill_parent is not working Here is my layout XML: So in short, I have a ViewFlipper inside a TableRow. The ViewFlipper is shrinking to the size of its content, even though all of the elements have fill_parent specified. In my screenshot below, the ViewFlipper has the grey b... | TITLE:
ViewFlipper width is wrapping its content and fill_parent is not working
QUESTION:
Here is my layout XML: So in short, I have a ViewFlipper inside a TableRow. The ViewFlipper is shrinking to the size of its content, even though all of the elements have fill_parent specified. In my screenshot below, the ViewFlip... | [
"android",
"xml",
"layout",
"viewflipper",
"fill-parent"
] | 2 | 3 | 2,778 | 1 | 0 | 2011-06-05T17:46:43.300000 | 2011-06-05T18:02:09.910000 |
6,244,688 | 6,254,866 | Overlapping graphs using R or Excel | I have following matrix and I want to draw overlapping graph using R (preferable) or Excel. a b c a 1 0.5 0.7 b 0.5 1 0.4 c 0.7 0.4 1 For example, the above table shows that a and b have 50% overlapping, whereas a and c have 70%. | If you want overlapping then you missed one number - overlapping all three: a, b, c. As Aniko write in comment you could use Venn diagrams, e.g. Vennerable from R-forge. Installation need some packages from BioConductor: source("http://bioconductor.org/biocLite.R") biocLite(c("graph", "RBGL", "gtools", "xtable")) insta... | Overlapping graphs using R or Excel I have following matrix and I want to draw overlapping graph using R (preferable) or Excel. a b c a 1 0.5 0.7 b 0.5 1 0.4 c 0.7 0.4 1 For example, the above table shows that a and b have 50% overlapping, whereas a and c have 70%. | TITLE:
Overlapping graphs using R or Excel
QUESTION:
I have following matrix and I want to draw overlapping graph using R (preferable) or Excel. a b c a 1 0.5 0.7 b 0.5 1 0.4 c 0.7 0.4 1 For example, the above table shows that a and b have 50% overlapping, whereas a and c have 70%.
ANSWER:
If you want overlapping the... | [
"excel",
"r",
"graph",
"overlap"
] | 1 | 0 | 4,062 | 1 | 0 | 2011-06-05T17:49:08.490000 | 2011-06-06T16:09:06.777000 |
6,244,692 | 6,244,818 | Need help parsing string in bash | I have a script that uses sensors to get CPU temps in Ubuntu. IN="`/usr/bin/sensors -f | grep 'Core ' | cut -f2 -d"+" | cut -f1 -d '.'`" echo $IN It yields results like this 96 100 98 102 What I need to do is be able to call it like cpu1 to get the first, cpu2 to get the second, and so on. I need to split it up so i ca... | You can convert $IN to an array like this: TEMPERATURES=($IN) Then you can index into that array to get a particular temperature; for example: echo ${TEMPERATURES[0]} If you pass a command-line parameter to your script, you can use that as an array index: WHICH=$1 # 1st command line arg; $0 is name of script TEMPERATUR... | Need help parsing string in bash I have a script that uses sensors to get CPU temps in Ubuntu. IN="`/usr/bin/sensors -f | grep 'Core ' | cut -f2 -d"+" | cut -f1 -d '.'`" echo $IN It yields results like this 96 100 98 102 What I need to do is be able to call it like cpu1 to get the first, cpu2 to get the second, and so ... | TITLE:
Need help parsing string in bash
QUESTION:
I have a script that uses sensors to get CPU temps in Ubuntu. IN="`/usr/bin/sensors -f | grep 'Core ' | cut -f2 -d"+" | cut -f1 -d '.'`" echo $IN It yields results like this 96 100 98 102 What I need to do is be able to call it like cpu1 to get the first, cpu2 to get t... | [
"bash",
"sed",
"awk"
] | 1 | 4 | 271 | 3 | 0 | 2011-06-05T17:49:53.870000 | 2011-06-05T18:10:04.690000 |
6,244,693 | 6,251,001 | Using app access token in IOS | Since Facebook changed their policy on having a access token or not I am now forced to include an access token to fetch a user public posts. As read in the documentation I can use an app access token so I still can fetch the posts without asking a user for permissions. But since I have no clue how this works, and the f... | I'm not sure if it's what you are looking for, but if you are trying to do something simple like getting the public posts of a user, you can do it like this. Use the following request to get the token: https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_cr... | Using app access token in IOS Since Facebook changed their policy on having a access token or not I am now forced to include an access token to fetch a user public posts. As read in the documentation I can use an app access token so I still can fetch the posts without asking a user for permissions. But since I have no ... | TITLE:
Using app access token in IOS
QUESTION:
Since Facebook changed their policy on having a access token or not I am now forced to include an access token to fetch a user public posts. As read in the documentation I can use an app access token so I still can fetch the posts without asking a user for permissions. Bu... | [
"objective-c",
"ios",
"facebook-graph-api"
] | 13 | 10 | 11,591 | 2 | 0 | 2011-06-05T17:50:00.440000 | 2011-06-06T10:56:36.843000 |
6,244,698 | 6,244,781 | Jquery detect when div has scrolled to the bottom? | Searching for this on Google yields numerous results which I could not get to work. What is an absolute method of detecting when a user has reached the bottom of a div? That is when the user has scrolled to the bottom of the div which has scrollbars of its own. | should be something like if the scrollHeight = scrollTop + offsetHeight of the element then you reached the bottom. | Jquery detect when div has scrolled to the bottom? Searching for this on Google yields numerous results which I could not get to work. What is an absolute method of detecting when a user has reached the bottom of a div? That is when the user has scrolled to the bottom of the div which has scrollbars of its own. | TITLE:
Jquery detect when div has scrolled to the bottom?
QUESTION:
Searching for this on Google yields numerous results which I could not get to work. What is an absolute method of detecting when a user has reached the bottom of a div? That is when the user has scrolled to the bottom of the div which has scrollbars o... | [
"javascript",
"jquery",
"scroll"
] | 0 | 2 | 360 | 1 | 0 | 2011-06-05T17:51:20.823000 | 2011-06-05T18:03:26.633000 |
6,244,700 | 6,244,784 | Changing div background color when a link inside the div is clicked | So I have this button that is just actually a div and I have a link inside the div Link I am able to use CSS to change the background color when the link is hovered over. However, how do I make the background color change when the link is clicked? I believe this requires some javascript? If so, can you guys help me wit... | I would controll it with JavaScript and CSS. The following example will toggle the background color of the button with each click. This is done by adding the class clicked to the div, or remove it, if the div has already got this class. the html code with inline javascript: Link the css: #button { background-color: #cc... | Changing div background color when a link inside the div is clicked So I have this button that is just actually a div and I have a link inside the div Link I am able to use CSS to change the background color when the link is hovered over. However, how do I make the background color change when the link is clicked? I be... | TITLE:
Changing div background color when a link inside the div is clicked
QUESTION:
So I have this button that is just actually a div and I have a link inside the div Link I am able to use CSS to change the background color when the link is hovered over. However, how do I make the background color change when the lin... | [
"javascript",
"html",
"css"
] | 1 | 1 | 4,026 | 3 | 0 | 2011-06-05T17:51:59.367000 | 2011-06-05T18:04:06.960000 |
6,244,761 | 6,246,027 | Can I use a cookie from the native browser within my app's WebView? | I want users that visit my website using their phone to get a cookie from me. Later, when they use my application, I want them to use the same cookie from the previous session. Is that at all possible? If not, is there a different way to maintain state information between browser sessions and app sessions? Thanks for y... | From the Android documentation ( http://developer.android.com/reference/android/webkit/WebView.html ) Cookie and window management For obvious security reasons, your application has its own cache, cookie store etc.—it does not share the Browser application's data. Cookies are managed on a separate thread, so operations... | Can I use a cookie from the native browser within my app's WebView? I want users that visit my website using their phone to get a cookie from me. Later, when they use my application, I want them to use the same cookie from the previous session. Is that at all possible? If not, is there a different way to maintain state... | TITLE:
Can I use a cookie from the native browser within my app's WebView?
QUESTION:
I want users that visit my website using their phone to get a cookie from me. Later, when they use my application, I want them to use the same cookie from the previous session. Is that at all possible? If not, is there a different way... | [
"android"
] | 5 | 8 | 9,698 | 3 | 0 | 2011-06-05T17:59:56.807000 | 2011-06-05T21:36:13.963000 |
6,244,763 | 6,245,271 | How to get information from custom fields within SuperTags pulled from Batchbook CRM | I'm using the batchbook ruby gem to build a simple listing page pulling various fields out of my batchbook crm. If I pull all the attributes for a given company, I end up with something like this: {"id"=>13, "name"=>"John Deer", "notes"=>nil, "small_image"=>nil, "large_image"=>nil, "tags"=>[# "1002", "name"=>"portfolio... | I'm not sure what your first hash-like string is all about so we'll look at the @company.supertag output value: [ { "id" => 15, "name" => "portfolio", "fields" => { "logo" => "img/fr-logo-button-sm.png", "description" => "We make tractors." } } ] I took the liberty of reformatting it into something readable. The square... | How to get information from custom fields within SuperTags pulled from Batchbook CRM I'm using the batchbook ruby gem to build a simple listing page pulling various fields out of my batchbook crm. If I pull all the attributes for a given company, I end up with something like this: {"id"=>13, "name"=>"John Deer", "notes... | TITLE:
How to get information from custom fields within SuperTags pulled from Batchbook CRM
QUESTION:
I'm using the batchbook ruby gem to build a simple listing page pulling various fields out of my batchbook crm. If I pull all the attributes for a given company, I end up with something like this: {"id"=>13, "name"=>"... | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3"
] | 0 | 0 | 174 | 1 | 0 | 2011-06-05T18:00:31.313000 | 2011-06-05T19:22:13.613000 |
6,244,768 | 6,244,794 | Python & Amazon EC2 -- Using All Compute Units? | I'm building a scientific application in Python and considering using Amazon EC2 to run the process on. My application is both memory and CPU hungry and would benefit from any resources given to it. An Extra Large Instance of EC2 gives about 15GB of memory, along with 8 compute units. My question is, can a single Pytho... | The 8 "compute units" run across 4 physical processors, so a straightforward script would only be able to use 25% of the available power. However, the Python multiprocessing module allows you to write a single script using multiple processes, potentially taking advantage of all of the "compute units". | Python & Amazon EC2 -- Using All Compute Units? I'm building a scientific application in Python and considering using Amazon EC2 to run the process on. My application is both memory and CPU hungry and would benefit from any resources given to it. An Extra Large Instance of EC2 gives about 15GB of memory, along with 8 c... | TITLE:
Python & Amazon EC2 -- Using All Compute Units?
QUESTION:
I'm building a scientific application in Python and considering using Amazon EC2 to run the process on. My application is both memory and CPU hungry and would benefit from any resources given to it. An Extra Large Instance of EC2 gives about 15GB of memo... | [
"python",
"amazon-ec2"
] | 1 | 3 | 1,755 | 2 | 0 | 2011-06-05T18:01:17.007000 | 2011-06-05T18:06:07.053000 |
6,244,769 | 6,244,789 | Spring sending 401 HTTP response via Controller | Lets say i have a Controller like this one: @RequestMapping(method=RequestMethod.GET, value="/error") public void getresponse(ModelMap modelMap) {
modelMap.addAttribute("categories", ""); } Is it possible to send a 401 HTTP error when this controller is called? If yes, how? | Yes its possible. Annotate it with: @ResponseStatus(value=HttpStatus.UNAUTHORIZED) | Spring sending 401 HTTP response via Controller Lets say i have a Controller like this one: @RequestMapping(method=RequestMethod.GET, value="/error") public void getresponse(ModelMap modelMap) {
modelMap.addAttribute("categories", ""); } Is it possible to send a 401 HTTP error when this controller is called? If yes, h... | TITLE:
Spring sending 401 HTTP response via Controller
QUESTION:
Lets say i have a Controller like this one: @RequestMapping(method=RequestMethod.GET, value="/error") public void getresponse(ModelMap modelMap) {
modelMap.addAttribute("categories", ""); } Is it possible to send a 401 HTTP error when this controller is... | [
"spring",
"http"
] | 2 | 4 | 2,315 | 1 | 0 | 2011-06-05T18:01:18.227000 | 2011-06-05T18:04:38.553000 |
6,244,777 | 6,246,040 | UIImageView doesn't show up in UIScrollView | Hello I can't figure out why UIImageView doesn't want to show up in UIScrollView. Now here is a little catch, I am grabbing picture from library and adding it to the UIScrollView - that doesn't seem to work. However if I just add picture right at "did load" method then it works just fine: [code] UIImageView *tmp = [[UI... | I'm slightly confused by your implementation, as you havn't posted all of your code, you are initilizing a 'tmp' imageview but i cannot see where it is used. I'm going to persume you need to define the frame of the UIImageView after it has been initialized, currently the UIImageView has no frame and therefore is not dr... | UIImageView doesn't show up in UIScrollView Hello I can't figure out why UIImageView doesn't want to show up in UIScrollView. Now here is a little catch, I am grabbing picture from library and adding it to the UIScrollView - that doesn't seem to work. However if I just add picture right at "did load" method then it wor... | TITLE:
UIImageView doesn't show up in UIScrollView
QUESTION:
Hello I can't figure out why UIImageView doesn't want to show up in UIScrollView. Now here is a little catch, I am grabbing picture from library and adding it to the UIScrollView - that doesn't seem to work. However if I just add picture right at "did load" ... | [
"iphone",
"iphone-sdk-3.0"
] | 0 | 1 | 1,516 | 2 | 0 | 2011-06-05T18:02:19.827000 | 2011-06-05T21:38:43.377000 |
6,244,783 | 6,245,176 | How do I use a Ruby regex to capture non-English words? | I am trying to validate 'words' with Ruby 1.8.7. My regex to catch a word is currently: /[a-zA-Z]\'*\-*/ This will only catch English words; Is there a way to catch non-English UTF-8 characters? | Even the 1.8.x Regex engine is UTF-8 aware, you just need to use the right expression, and it's slightly more than just using /\w/: s = "résumé and some other words" puts s[/[a-z]+/u] puts s[/\w+/u] and you get: r résumé | How do I use a Ruby regex to capture non-English words? I am trying to validate 'words' with Ruby 1.8.7. My regex to catch a word is currently: /[a-zA-Z]\'*\-*/ This will only catch English words; Is there a way to catch non-English UTF-8 characters? | TITLE:
How do I use a Ruby regex to capture non-English words?
QUESTION:
I am trying to validate 'words' with Ruby 1.8.7. My regex to catch a word is currently: /[a-zA-Z]\'*\-*/ This will only catch English words; Is there a way to catch non-English UTF-8 characters?
ANSWER:
Even the 1.8.x Regex engine is UTF-8 aware... | [
"ruby",
"regex",
"utf-8",
"cpu-word"
] | 3 | 4 | 634 | 1 | 0 | 2011-06-05T18:03:58.050000 | 2011-06-05T19:06:42.103000 |
6,244,786 | 6,244,810 | Removing 3 nested if-then-else | I'm seeing this code as the equivalent of a mathematical permutation. It tries to set the value of $d based on a combination of $a, $b, $c. Right now it's being done with 3 nested if/then/else. Any other way the same thing can be done more efficiently? if ($a === true) { if ($b > 0) { if ($c === true) { $d = 6; } else ... | You could do this: $vals = array(3,7,1,5,0,4,2,6); $d = $vals[((int)($a === true) << 2) + ((int)($b > 0) << 1) + (int)($c === true)]; if ($b > 0) { $e = $b; } This takes each condition as a bit in a 3 bit value to determine the index of the value for d: index = a·2^2 + b·2^1 + c·2^0 Each condition yields a boolean valu... | Removing 3 nested if-then-else I'm seeing this code as the equivalent of a mathematical permutation. It tries to set the value of $d based on a combination of $a, $b, $c. Right now it's being done with 3 nested if/then/else. Any other way the same thing can be done more efficiently? if ($a === true) { if ($b > 0) { if ... | TITLE:
Removing 3 nested if-then-else
QUESTION:
I'm seeing this code as the equivalent of a mathematical permutation. It tries to set the value of $d based on a combination of $a, $b, $c. Right now it's being done with 3 nested if/then/else. Any other way the same thing can be done more efficiently? if ($a === true) {... | [
"php"
] | 2 | 8 | 318 | 4 | 0 | 2011-06-05T18:04:14.387000 | 2011-06-05T18:08:44.993000 |
6,244,787 | 6,244,909 | Mixing different categories results, ordered by score in MySQL | In my PHP application, I have a mysql table of articles which has the following columns: article_id articletext category_id score Each article has a score which is calculated based on how popular it is, and belongs to a specific category (there are around 10 categories available) My question is: how can I perform a que... | Go get the top 20. If they don't satisfy the requirements, do an additional query to get the missing pieces. You should be able to come up with some balance between number of queries and number of rows each returns. I you got the top 100 it might satisfy the requirements 90% of the time and would be cheaper and faster ... | Mixing different categories results, ordered by score in MySQL In my PHP application, I have a mysql table of articles which has the following columns: article_id articletext category_id score Each article has a score which is calculated based on how popular it is, and belongs to a specific category (there are around 1... | TITLE:
Mixing different categories results, ordered by score in MySQL
QUESTION:
In my PHP application, I have a mysql table of articles which has the following columns: article_id articletext category_id score Each article has a score which is calculated based on how popular it is, and belongs to a specific category (... | [
"php",
"mysql",
"sql-order-by",
"categories"
] | 3 | 1 | 290 | 3 | 0 | 2011-06-05T18:04:38.343000 | 2011-06-05T18:25:32.677000 |
6,244,790 | 6,246,153 | rendering issues in a (seamless) 3 column item | This problem has been bothering me for sometime now, I have not settled on a solution and have tried several approaches. I am trying to keep my markup semantic as possible. I have searched for similar questions, but I am having trouble abstracting my problem enough to find an applicable solution. I feel a quick about m... | I've only tested this in Chrome, Firefox and IE8, but it appears to have helped.. Summary: I removed the h2's from the flow by absolutely positioning them, this then removed the height differences caused by them.. to do this: make addX, addY {position: relative;} so the positioned h2 's stay relative to them add an equ... | rendering issues in a (seamless) 3 column item This problem has been bothering me for sometime now, I have not settled on a solution and have tried several approaches. I am trying to keep my markup semantic as possible. I have searched for similar questions, but I am having trouble abstracting my problem enough to find... | TITLE:
rendering issues in a (seamless) 3 column item
QUESTION:
This problem has been bothering me for sometime now, I have not settled on a solution and have tried several approaches. I am trying to keep my markup semantic as possible. I have searched for similar questions, but I am having trouble abstracting my prob... | [
"html",
"css",
"cross-browser",
"web-standards",
"html-rendering"
] | 3 | 2 | 117 | 1 | 0 | 2011-06-05T18:05:13.390000 | 2011-06-05T21:59:41.293000 |
6,244,793 | 6,245,991 | Javascript problems in IE, but not FF, Chrome, or Safari | I'm getting tired of trying to debug in IE 7, It won't let me install IE8 because I'm running vista. So if someone could help me out that would be great. http://1searchengine.com The main issue seems to be the 'class' undefined error. | I found a couple of errors that keeps coming back in IE7 The fix for the shadowbox warning, uncomment this line in the index file. There is also a error in the file src.php with you request with the GET key => type, value => web. When i look at the source of the file, I see quet a blank where there should be more infor... | Javascript problems in IE, but not FF, Chrome, or Safari I'm getting tired of trying to debug in IE 7, It won't let me install IE8 because I'm running vista. So if someone could help me out that would be great. http://1searchengine.com The main issue seems to be the 'class' undefined error. | TITLE:
Javascript problems in IE, but not FF, Chrome, or Safari
QUESTION:
I'm getting tired of trying to debug in IE 7, It won't let me install IE8 because I'm running vista. So if someone could help me out that would be great. http://1searchengine.com The main issue seems to be the 'class' undefined error.
ANSWER:
I... | [
"javascript",
"internet-explorer",
"internet-explorer-7"
] | 0 | 2 | 2,861 | 2 | 0 | 2011-06-05T18:06:06.477000 | 2011-06-05T21:29:36.033000 |
6,244,799 | 6,244,838 | Binary Files on 32bit / 64bit systems? | I am using python struct module to create custom binary files. The file itself has the following format: 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float).......................... ( 100000 such lines ) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (flo... | As long as your struct format string uses "standard size and alignment" ( < or > ) rather than "native size and alignment" ( @ ), your files can be used cross-platform. | Binary Files on 32bit / 64bit systems? I am using python struct module to create custom binary files. The file itself has the following format: 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float).......................... ( 100000 such lines ) 4 bytes (integ... | TITLE:
Binary Files on 32bit / 64bit systems?
QUESTION:
I am using python struct module to create custom binary files. The file itself has the following format: 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float).......................... ( 100000 such line... | [
"python",
"serialization",
"32bit-64bit"
] | 3 | 2 | 1,470 | 3 | 0 | 2011-06-05T18:06:30.593000 | 2011-06-05T18:13:30.183000 |
6,244,807 | 6,244,822 | Weird sqLite database string file path error | So, I'm planning to use sqlite3 to update skype's main.db file. I use sqlite3_open function to open the connection like this. int rc = sqlite3_open(filepath,db); I'm trying to do the filepath string dynamically, but a weird error is driving me crazy. I have two strings szFile and szFilePath, szFile being a test string ... | You're returning a char* that points to an array on the stack - as soon as you return from the function szGetFilePath, this pointer is quite possibly pointing to junk (it will definitely point to junk after a couple of levels of additional calls - when the values on the stack are overwritten). You can either return a d... | Weird sqLite database string file path error So, I'm planning to use sqlite3 to update skype's main.db file. I use sqlite3_open function to open the connection like this. int rc = sqlite3_open(filepath,db); I'm trying to do the filepath string dynamically, but a weird error is driving me crazy. I have two strings szFil... | TITLE:
Weird sqLite database string file path error
QUESTION:
So, I'm planning to use sqlite3 to update skype's main.db file. I use sqlite3_open function to open the connection like this. int rc = sqlite3_open(filepath,db); I'm trying to do the filepath string dynamically, but a weird error is driving me crazy. I have... | [
"c",
"string",
"sqlite"
] | 1 | 2 | 173 | 3 | 0 | 2011-06-05T18:08:24.140000 | 2011-06-05T18:11:41.563000 |
6,244,811 | 6,244,829 | Does a subroutine called by a function have to finish for the function to proceed? | If a subroutine is called within a function, does the function always wait until that subroutine is completely finished before it will proceed with the rest of the function? If so, is there any way to make it not wait and continue on with the rest of function and not care what happens in the subroutine? | In the normal course of things yes, the calls are synchronous. That is, when you make a call to a subroutine from a function, the subroutine will fully execute and only when finished will execution resume in the calling function. You need to use asynchronous programming to achieve what you want. See Calling Synchronous... | Does a subroutine called by a function have to finish for the function to proceed? If a subroutine is called within a function, does the function always wait until that subroutine is completely finished before it will proceed with the rest of the function? If so, is there any way to make it not wait and continue on wit... | TITLE:
Does a subroutine called by a function have to finish for the function to proceed?
QUESTION:
If a subroutine is called within a function, does the function always wait until that subroutine is completely finished before it will proceed with the rest of the function? If so, is there any way to make it not wait a... | [
".net",
"asp.net",
"vb.net",
"function",
"subroutine"
] | 0 | 1 | 628 | 3 | 0 | 2011-06-05T18:09:05.133000 | 2011-06-05T18:12:37.740000 |
6,244,814 | 6,244,876 | get entities for last 7 days in datastore | i need to fetch entities for the last 7 days, and if fewer than 50 entities are fetched extend the range to 10 days, the model is something like: class MyModel(db.Model): title = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) plays = db.IntegerProperty() I also need to order by number of plays descen... | I can't test the code right now but I would do something like: from datetime import datetime, timedelta
query = MyModel.gql("WHERE date >:1 ORDER BY plays DESC", datetime.now() - timedelta(days=7)) count = query.count() if count < 50: query = MyModel.gql("WHERE date >:1", datetime.now() - timedelta(days=10)) value = q... | get entities for last 7 days in datastore i need to fetch entities for the last 7 days, and if fewer than 50 entities are fetched extend the range to 10 days, the model is something like: class MyModel(db.Model): title = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) plays = db.IntegerProperty() I al... | TITLE:
get entities for last 7 days in datastore
QUESTION:
i need to fetch entities for the last 7 days, and if fewer than 50 entities are fetched extend the range to 10 days, the model is something like: class MyModel(db.Model): title = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) plays = db.Inte... | [
"python",
"google-app-engine",
"google-cloud-datastore"
] | 2 | 1 | 459 | 1 | 0 | 2011-06-05T18:09:13.573000 | 2011-06-05T18:19:52.353000 |
6,244,823 | 6,244,856 | Convert List<String> to delimited String | Possible Duplicate: Java: convert List to a join()d string Having this: List elementNames = Arrays.asList("h1", "h2", "h3", "h4", "h5", "h6"); What is an elegant way to get String with a custom delimiter, like so: "h1,h2,h3,h4,h5,h6" | If you don't mind using the StringUtils library provided by apache, you could do: // Output is "a,b,c" StringUtils.join(["a", "b", "c"], ','); https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html | Convert List<String> to delimited String Possible Duplicate: Java: convert List to a join()d string Having this: List elementNames = Arrays.asList("h1", "h2", "h3", "h4", "h5", "h6"); What is an elegant way to get String with a custom delimiter, like so: "h1,h2,h3,h4,h5,h6" | TITLE:
Convert List<String> to delimited String
QUESTION:
Possible Duplicate: Java: convert List to a join()d string Having this: List elementNames = Arrays.asList("h1", "h2", "h3", "h4", "h5", "h6"); What is an elegant way to get String with a custom delimiter, like so: "h1,h2,h3,h4,h5,h6"
ANSWER:
If you don't mind ... | [
"java",
"string",
"list"
] | 16 | 29 | 41,395 | 2 | 0 | 2011-06-05T18:11:52.373000 | 2011-06-05T18:15:33.993000 |
6,244,826 | 6,244,908 | Packing numbers efficiently | I have n numbers in the range of 0..m-1. m doen't have to be a power of 2. The most efficient way to pack them into a stream of bytes will require exactly log2(m)*n bits rounded up. I get the numbers as a List and m as int m. How can I pack it into List not exceeding the size of log2(m)*n/8? After the packing is done h... | Homework? Generally speaking, when you have N numbers in 0..M-1 range, this means that you have ONE number in 0..M*N-1 range. Representing this requires equal or fewer bits, log2(M*N), then the case when the numbers are encoded separately. Next, if you know something else about the numbers (their distribution, or their... | Packing numbers efficiently I have n numbers in the range of 0..m-1. m doen't have to be a power of 2. The most efficient way to pack them into a stream of bytes will require exactly log2(m)*n bits rounded up. I get the numbers as a List and m as int m. How can I pack it into List not exceeding the size of log2(m)*n/8?... | TITLE:
Packing numbers efficiently
QUESTION:
I have n numbers in the range of 0..m-1. m doen't have to be a power of 2. The most efficient way to pack them into a stream of bytes will require exactly log2(m)*n bits rounded up. I get the numbers as a List and m as int m. How can I pack it into List not exceeding the si... | [
"c#"
] | 1 | 1 | 251 | 2 | 0 | 2011-06-05T18:12:24.080000 | 2011-06-05T18:25:28.543000 |
6,244,831 | 6,244,891 | Difference between :class and :id , under what circumstances would we generally use <%= %> and <% %> in Rails | when we make use of rails helpers like form_form, form_tag, many a times especially when we need to use Javascript using the:html option that comes along with these helpers we give:id => "some_value" and:class => "some_value". I just wanted to understand what separates the "id" and "class" from usability perspective. T... | Your 'class' vs 'id' question is really referring to CSS best practices. Here's some info on that: http://css-tricks.com/the-difference-between-id-and-class/ The <%= %> ERB tag outputs the result of the expression in the tag, for example... <%= ['hello', 'world'].join(' ') %> Would be replaced with the string "hello wo... | Difference between :class and :id , under what circumstances would we generally use <%= %> and <% %> in Rails when we make use of rails helpers like form_form, form_tag, many a times especially when we need to use Javascript using the:html option that comes along with these helpers we give:id => "some_value" and:class ... | TITLE:
Difference between :class and :id , under what circumstances would we generally use <%= %> and <% %> in Rails
QUESTION:
when we make use of rails helpers like form_form, form_tag, many a times especially when we need to use Javascript using the:html option that comes along with these helpers we give:id => "some... | [
"ruby-on-rails",
"class",
"tags"
] | 1 | 5 | 153 | 2 | 0 | 2011-06-05T18:12:47.220000 | 2011-06-05T18:22:38.083000 |
6,244,842 | 6,244,869 | Can I view previously saved versions of a file in Visual Studio 2010? | After a freak git checkout accident I've lost some of my C# work:-P Eclipse has a local revision history which is perfect for situations like this, but this work I am doing in Visual Studio 2010 and am having trouble finding an analogous feature. | You can check to see if windows kept a old version by going to the file and right clicking and seeing if there is a previous version if your on vista or win 7. | Can I view previously saved versions of a file in Visual Studio 2010? After a freak git checkout accident I've lost some of my C# work:-P Eclipse has a local revision history which is perfect for situations like this, but this work I am doing in Visual Studio 2010 and am having trouble finding an analogous feature. | TITLE:
Can I view previously saved versions of a file in Visual Studio 2010?
QUESTION:
After a freak git checkout accident I've lost some of my C# work:-P Eclipse has a local revision history which is perfect for situations like this, but this work I am doing in Visual Studio 2010 and am having trouble finding an anal... | [
"c#",
"visual-studio-2010",
"history"
] | 2 | 0 | 1,646 | 2 | 0 | 2011-06-05T18:14:08.520000 | 2011-06-05T18:18:07.220000 |
6,244,861 | 6,245,009 | Flex executing a function on another view | I have a headerbar.mxml that is displayed when user swipes_down in my app. The headerbar.mxml contains a button component I want to run an erase() in the main application window. The main application is a drawing app that contains an erase(). I just don't know how to call a function from another mxml view file. I thoug... | To run a function in another view (AKA Component) It depends largely on the architecture. It sounds like you want to run a function in your parent. In which case the 'encapsulation proper' method is to dispatch an event from component1; listen for the event in component1s parent; and execute the function from the event... | Flex executing a function on another view I have a headerbar.mxml that is displayed when user swipes_down in my app. The headerbar.mxml contains a button component I want to run an erase() in the main application window. The main application is a drawing app that contains an erase(). I just don't know how to call a fun... | TITLE:
Flex executing a function on another view
QUESTION:
I have a headerbar.mxml that is displayed when user swipes_down in my app. The headerbar.mxml contains a button component I want to run an erase() in the main application window. The main application is a drawing app that contains an erase(). I just don't know... | [
"apache-flex",
"components",
"swipe"
] | 0 | 2 | 1,681 | 1 | 0 | 2011-06-05T18:16:26.627000 | 2011-06-05T18:42:53.497000 |
6,244,867 | 6,246,334 | Java Program - Control Dependence Graph | Are there any good tools APIs out there for generating a system dependence graph from java source code? I'm not interested in visual generators. I would like to toy around with a tool that generates a system dependence graph into memory that can then be acted upon. | What do you mean with system dependence graph? How classes in your own code depend on each other, or how your system depends on libraries (jars) from other providers (and they depend on other libs), or on the level of architectural layers (how your webserver depends on the database etc)? For the first, look at PMD and ... | Java Program - Control Dependence Graph Are there any good tools APIs out there for generating a system dependence graph from java source code? I'm not interested in visual generators. I would like to toy around with a tool that generates a system dependence graph into memory that can then be acted upon. | TITLE:
Java Program - Control Dependence Graph
QUESTION:
Are there any good tools APIs out there for generating a system dependence graph from java source code? I'm not interested in visual generators. I would like to toy around with a tool that generates a system dependence graph into memory that can then be acted up... | [
"java"
] | 1 | 1 | 946 | 1 | 0 | 2011-06-05T18:17:54.420000 | 2011-06-05T22:28:15.940000 |
6,244,873 | 6,246,532 | Handling CFNull objects in NSPropertyListSerialization | In my application, I am trying to serialize a server response dictionary and writing it to file system. But I am getting error "Property list invalid for format" for some responses. The reason is CFNull objects in the server response. Now, the server response will keep on changing so I do not have a definite way to rem... | I switched to NSKeyedArchiver option. Little slower than NSPropertyListSerialization but takes care of NSNull/CFNull objects. | Handling CFNull objects in NSPropertyListSerialization In my application, I am trying to serialize a server response dictionary and writing it to file system. But I am getting error "Property list invalid for format" for some responses. The reason is CFNull objects in the server response. Now, the server response will ... | TITLE:
Handling CFNull objects in NSPropertyListSerialization
QUESTION:
In my application, I am trying to serialize a server response dictionary and writing it to file system. But I am getting error "Property list invalid for format" for some responses. The reason is CFNull objects in the server response. Now, the ser... | [
"iphone",
"objective-c",
"cocoa-touch",
"nsdata",
"property-list"
] | 4 | 4 | 3,811 | 4 | 0 | 2011-06-05T18:19:24.620000 | 2011-06-05T23:08:46.270000 |
6,244,882 | 6,245,268 | Beginning R date plots and analysis with Matrix object? | I want to plot the data as a time series (quarterly) but the plot keeps treating the dates as Data not labels or time? Trying to keep my initial exercise very simple, (have more complex stuff to get on with, it would be a snap with Excel or even GDocs!) I am reading a very small table from csv (using read.csv) as This ... | From the output of dput(Corl) we don't have to guess at how the Date values are stored in Corl. As you can see below, the Dates are stored as class = "Date". That makes this fairly easy. library(zoo)
Corl <- structure(list(Date = structure(c(15155, 15064, 14974, 14882, 14790, 14699), class = "Date"), Survey = c(60L, 5... | Beginning R date plots and analysis with Matrix object? I want to plot the data as a time series (quarterly) but the plot keeps treating the dates as Data not labels or time? Trying to keep my initial exercise very simple, (have more complex stuff to get on with, it would be a snap with Excel or even GDocs!) I am readi... | TITLE:
Beginning R date plots and analysis with Matrix object?
QUESTION:
I want to plot the data as a time series (quarterly) but the plot keeps treating the dates as Data not labels or time? Trying to keep my initial exercise very simple, (have more complex stuff to get on with, it would be a snap with Excel or even ... | [
"r",
"date",
"charts",
"time-series"
] | 1 | 1 | 410 | 1 | 0 | 2011-06-05T18:20:33.553000 | 2011-06-05T19:21:46.327000 |
6,244,886 | 6,244,902 | How do you ensure jQuery is available when loaded asynchronously | Google allows you to load jQuery asynchronously like so: In later scripts, how do I ensure jQuery has been loaded? I could use setInterval to check whether jQuery is set, but suppose scriptb.js depends on scripta.js, and both are wrapped in a setInterval to wait for jQuery, and so the interval will "randomly" execute e... | Assign the optional setting callback ( documentation ): google.load('jquery', '1.6', {"callback":jqueryLoaded});
function jqueryLoaded(){ alert('loaded'); } | How do you ensure jQuery is available when loaded asynchronously Google allows you to load jQuery asynchronously like so: In later scripts, how do I ensure jQuery has been loaded? I could use setInterval to check whether jQuery is set, but suppose scriptb.js depends on scripta.js, and both are wrapped in a setInterval ... | TITLE:
How do you ensure jQuery is available when loaded asynchronously
QUESTION:
Google allows you to load jQuery asynchronously like so: In later scripts, how do I ensure jQuery has been loaded? I could use setInterval to check whether jQuery is set, but suppose scriptb.js depends on scripta.js, and both are wrapped... | [
"jquery",
"asynchronous"
] | 2 | 4 | 1,075 | 1 | 0 | 2011-06-05T18:21:31.947000 | 2011-06-05T18:24:43.973000 |
6,244,892 | 6,245,872 | python & SQLite in Production | When using python, can SQLite be used as production database to manage say 10,000 databases files (each in a separate file -- of size 500[MB])? Only one thread will be used to write data to the database files (no concurrency). Are there alternatives libraries that can work better / faster / more reliably? | If you are dealing with one SQLite database at a time, there is no limit on the number of database files you can handle. Just make sure you clean up properly (close each database connection) before you open the next database and you should see no problems whatsoever. Opening one database at a time makes this no differe... | python & SQLite in Production When using python, can SQLite be used as production database to manage say 10,000 databases files (each in a separate file -- of size 500[MB])? Only one thread will be used to write data to the database files (no concurrency). Are there alternatives libraries that can work better / faster ... | TITLE:
python & SQLite in Production
QUESTION:
When using python, can SQLite be used as production database to manage say 10,000 databases files (each in a separate file -- of size 500[MB])? Only one thread will be used to write data to the database files (no concurrency). Are there alternatives libraries that can wor... | [
"python",
"sqlite"
] | 2 | 1 | 921 | 2 | 0 | 2011-06-05T18:22:40.577000 | 2011-06-05T21:07:25.387000 |
6,244,903 | 6,244,940 | Why can i not create an arraylist of arraylist of integers by using a list of list of integer reference? | List > sets = new ArrayList >(); Why does the above give a compiler error and why can i not use the generic list reference here, why do I need to make it specific arraylist reference? | For that to compile, you would need either: List > sets = new ArrayList >(); or List > sets = new ArrayList >(); | Why can i not create an arraylist of arraylist of integers by using a list of list of integer reference? List > sets = new ArrayList >(); Why does the above give a compiler error and why can i not use the generic list reference here, why do I need to make it specific arraylist reference? | TITLE:
Why can i not create an arraylist of arraylist of integers by using a list of list of integer reference?
QUESTION:
List > sets = new ArrayList >(); Why does the above give a compiler error and why can i not use the generic list reference here, why do I need to make it specific arraylist reference?
ANSWER:
For ... | [
"java",
"collections"
] | 1 | 3 | 198 | 3 | 0 | 2011-06-05T18:24:57.190000 | 2011-06-05T18:30:57.937000 |
6,244,911 | 6,244,994 | Piping the output of a custom ssh console | Our product exposes an admin console by embedding an ssh server (java based) and exposing a bunch of custom commands. The output of some of these commands can be pretty verbose. Currently we handle these by having flags like -dump to dump output to a text file for later processing. I was wondering if it were possible t... | Keep the interactive commands on the local host and non-interactive on the remote, i.e. ssh remotehost ls /bin
ssh remotehost cat /var/log/messages | less The less command runs locally unless you include it in quotes: ssh remotehost "cat /var/log/messages | less" | Piping the output of a custom ssh console Our product exposes an admin console by embedding an ssh server (java based) and exposing a bunch of custom commands. The output of some of these commands can be pretty verbose. Currently we handle these by having flags like -dump to dump output to a text file for later process... | TITLE:
Piping the output of a custom ssh console
QUESTION:
Our product exposes an admin console by embedding an ssh server (java based) and exposing a bunch of custom commands. The output of some of these commands can be pretty verbose. Currently we handle these by having flags like -dump to dump output to a text file... | [
"java",
"bash"
] | 1 | 1 | 402 | 2 | 0 | 2011-06-05T18:26:16.023000 | 2011-06-05T18:38:41.783000 |
6,244,912 | 6,245,017 | div with full content width | The simplified content of my html page is: Some Content EMS The.css: html, body { height: 100%; margin: 0px; padding: 0px; } body { font-family: "Liberation Sans",'Lucida Grande',Verdana,Arial,Helvetica, "Luxi Sans", "Bitstream Vera Sans", Tahoma,Sans-Serif; font-size: 90%; background: #FAFAFA; color: #333333; } #conta... | The first solution is to change the width of #container from 100% to 2000px and remove max-width. Demo: http://jsfiddle.net/h3TQ3/ A second solution is to remove max-width and width from #container and change position:relative to position:absolute Demo: http://jsfiddle.net/h3TQ3/1/ To have your header in fixed position... | div with full content width The simplified content of my html page is: Some Content EMS The.css: html, body { height: 100%; margin: 0px; padding: 0px; } body { font-family: "Liberation Sans",'Lucida Grande',Verdana,Arial,Helvetica, "Luxi Sans", "Bitstream Vera Sans", Tahoma,Sans-Serif; font-size: 90%; background: #FAFA... | TITLE:
div with full content width
QUESTION:
The simplified content of my html page is: Some Content EMS The.css: html, body { height: 100%; margin: 0px; padding: 0px; } body { font-family: "Liberation Sans",'Lucida Grande',Verdana,Arial,Helvetica, "Luxi Sans", "Bitstream Vera Sans", Tahoma,Sans-Serif; font-size: 90%;... | [
"html",
"css"
] | 0 | 1 | 468 | 2 | 0 | 2011-06-05T18:26:30.173000 | 2011-06-05T18:44:12.963000 |
6,244,917 | 6,244,966 | Is it a code smell to have a special constructor only used during testing? | Assume I have a class Foo which is only instantiated with an instance of class Bar: public Foo(Bar x) { this.a = x.a(); this.b = x.b();... } Now I would like to test Foo, further assuming an instance of Bar with the desired state is difficult to create. As an additional constraint, the fields a, b,... are declared as f... | Mocking Bar is more likely to be considered best practice. You should be able to create a MockBar so you can do Foo foo = new Foo(new MockBar(a, b)); | Is it a code smell to have a special constructor only used during testing? Assume I have a class Foo which is only instantiated with an instance of class Bar: public Foo(Bar x) { this.a = x.a(); this.b = x.b();... } Now I would like to test Foo, further assuming an instance of Bar with the desired state is difficult to... | TITLE:
Is it a code smell to have a special constructor only used during testing?
QUESTION:
Assume I have a class Foo which is only instantiated with an instance of class Bar: public Foo(Bar x) { this.a = x.a(); this.b = x.b();... } Now I would like to test Foo, further assuming an instance of Bar with the desired sta... | [
"java",
"unit-testing",
"testing",
"constructor"
] | 5 | 9 | 1,959 | 3 | 0 | 2011-06-05T18:27:41.563000 | 2011-06-05T18:34:30.450000 |
6,244,931 | 6,244,950 | reference front and pop_front | Is this legal?: Sample& sample = stack.front(); stack.pop_front(); My program works. But Sample class have boost::optional xxx member and after pop_front, is_initialized() returns false; | No, this is not legal. You must take a copy of the object, i.e. use Sample sample = stack.front () If you are using a std::vector, the pop_front call moves the elements behind to the location and your reference points to a different element (the previously second, now first element.) | reference front and pop_front Is this legal?: Sample& sample = stack.front(); stack.pop_front(); My program works. But Sample class have boost::optional xxx member and after pop_front, is_initialized() returns false; | TITLE:
reference front and pop_front
QUESTION:
Is this legal?: Sample& sample = stack.front(); stack.pop_front(); My program works. But Sample class have boost::optional xxx member and after pop_front, is_initialized() returns false;
ANSWER:
No, this is not legal. You must take a copy of the object, i.e. use Sample s... | [
"c++",
"stl"
] | 7 | 14 | 4,068 | 3 | 0 | 2011-06-05T18:29:31.777000 | 2011-06-05T18:32:17.690000 |
6,244,939 | 6,245,146 | How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352? | I've built a.NET Windows Forms application in Visual Studio 2010. I also built a corresponding setup/install package via Visual Studio 2010. This is built as a 32-bit (x86) application. (We make use of third-party Windows Forms controls that are 32-bit only). I am able to run the setup package and deploy successfully t... | 0xE0434352 is the exception code for all.NET exceptions so that won't tell you much. How did you got this exception code? The event log? Your best bet is to use a debugger to get more information. If the Visual Studio debugger won't help you, then you might need to check out WinDbg with SOS. See here and here for an in... | How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352? I've built a.NET Windows Forms application in Visual Studio 2010. I also built a corresponding setup/install package via Visual Studio 2010. This is built as a 32-bit (x86) application. (We make use of third-party Windows Forms... | TITLE:
How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352?
QUESTION:
I've built a.NET Windows Forms application in Visual Studio 2010. I also built a corresponding setup/install package via Visual Studio 2010. This is built as a 32-bit (x86) application. (We make use of third-p... | [
"c#",
".net",
"winforms",
"visual-studio-2010"
] | 99 | 81 | 323,590 | 13 | 0 | 2011-06-05T18:30:45.133000 | 2011-06-05T19:02:02.777000 |
6,244,942 | 6,244,968 | How to get two line above a selected string? | Say i had text like this: www.something.com
get the 2 above
www.somethingss.com
get the 2 above
www.somethingssss.com
get the 2 above Maybe something like this: for a in text: if 'get the 2 above' in a: get 2 above How would i do this? | Assuming the above is a string: s = '''www.something.com
get the 2 above
www.somethingss.com
get the 2 above
www.somethingssss.com
get the 2 above'''
s = s.splitlines() for i, line in enumerate(s): if 'get the 2 above' in line: print s[i-1], s[i-2] s.splitlines() removes the newlines; if you want to leave them in... | How to get two line above a selected string? Say i had text like this: www.something.com
get the 2 above
www.somethingss.com
get the 2 above
www.somethingssss.com
get the 2 above Maybe something like this: for a in text: if 'get the 2 above' in a: get 2 above How would i do this? | TITLE:
How to get two line above a selected string?
QUESTION:
Say i had text like this: www.something.com
get the 2 above
www.somethingss.com
get the 2 above
www.somethingssss.com
get the 2 above Maybe something like this: for a in text: if 'get the 2 above' in a: get 2 above How would i do this?
ANSWER:
Assumin... | [
"python"
] | 1 | 3 | 174 | 4 | 0 | 2011-06-05T18:31:15.330000 | 2011-06-05T18:34:42.687000 |
6,244,946 | 6,244,989 | How to Delete a Specific Line in a Text File? | I have a little problem. Let me explain the workplace. My Text File Structure: X_OFFSET 0 Y_OFFSET 0 IDSTART 0001 222 222 222 222 0002 250 500 250 0003 1700 500 500 250 0004 900 600 500 250 0005 1350 250 500 250 IDEND What I must do is to find the IDSTART-IDEND block and DELETE a spesific line between them. Example: Us... | I didn't read through all your code, but your I/O logic is way to complicated and inefficient. Basic idea: using (var reader = File.OpenText(orgFileName)) using (var writer = File.CreateText(tmpFileName)) { while (true) { string line = reader.ReadLine(); if (line == null) break; // done
// logic to analyze / track con... | How to Delete a Specific Line in a Text File? I have a little problem. Let me explain the workplace. My Text File Structure: X_OFFSET 0 Y_OFFSET 0 IDSTART 0001 222 222 222 222 0002 250 500 250 0003 1700 500 500 250 0004 900 600 500 250 0005 1350 250 500 250 IDEND What I must do is to find the IDSTART-IDEND block and DE... | TITLE:
How to Delete a Specific Line in a Text File?
QUESTION:
I have a little problem. Let me explain the workplace. My Text File Structure: X_OFFSET 0 Y_OFFSET 0 IDSTART 0001 222 222 222 222 0002 250 500 250 0003 1700 500 500 250 0004 900 600 500 250 0005 1350 250 500 250 IDEND What I must do is to find the IDSTART-... | [
"c#",
"winforms",
"io"
] | 0 | 2 | 948 | 1 | 0 | 2011-06-05T18:31:51.887000 | 2011-06-05T18:38:04.053000 |
6,244,947 | 6,244,961 | sed only substitutes first occurrence of string | I use sed to create files from template files. I can't figure out, using man sed, why it does not change all the matched strings. If my file (template_file.txt) contains: #!/bin/sh # # /etc/init.d/%SCRIPT_NAME% - Startup script for play %SCRIPT_NAME% engine # ### BEGIN INIT INFO [...] EOF Using: sed -e "s;%SCRIPT_NAME%... | The s command changes only the first occurrence unless you add the g (global) modifier to it. sed -e "s;%SCRIPT_NAME%;script_test_name;g" template_file.txt > script_test_name | sed only substitutes first occurrence of string I use sed to create files from template files. I can't figure out, using man sed, why it does not change all the matched strings. If my file (template_file.txt) contains: #!/bin/sh # # /etc/init.d/%SCRIPT_NAME% - Startup script for play %SCRIPT_NAME% engine # ### BEGIN IN... | TITLE:
sed only substitutes first occurrence of string
QUESTION:
I use sed to create files from template files. I can't figure out, using man sed, why it does not change all the matched strings. If my file (template_file.txt) contains: #!/bin/sh # # /etc/init.d/%SCRIPT_NAME% - Startup script for play %SCRIPT_NAME% eng... | [
"sed"
] | 1 | 5 | 232 | 2 | 0 | 2011-06-05T18:31:58.363000 | 2011-06-05T18:33:46.753000 |
6,244,949 | 6,244,960 | How messages are organized into thread? | guys. Can anyone explain how mailing messages are organized into threads? As I understood, messages are sent always to the same email of the group. So there has to be some identifier of thread... | Every Email message has a unique Message-ID header. Every reply has an In-Reply-To and/or References header. This is enough to do a topological sort and put the messages into threads. [update] For the gory details, see RFC 5322 (the specification for Internet mail messages). Search for "Message-ID", "References", and "... | How messages are organized into thread? guys. Can anyone explain how mailing messages are organized into threads? As I understood, messages are sent always to the same email of the group. So there has to be some identifier of thread... | TITLE:
How messages are organized into thread?
QUESTION:
guys. Can anyone explain how mailing messages are organized into threads? As I understood, messages are sent always to the same email of the group. So there has to be some identifier of thread...
ANSWER:
Every Email message has a unique Message-ID header. Every... | [
"mailing-list",
"mailman"
] | 2 | 3 | 84 | 1 | 0 | 2011-06-05T18:32:02.960000 | 2011-06-05T18:33:46.213000 |
6,244,956 | 6,245,080 | Python 3.2 Idle vs terminal | In python 3.2 under OSX, if I'll run "type(sys.stdin)" under Idle I get a strange answer as shown below >>> type(sys.stdin) >>> But if I'll reun the same command under terminal, I get: >>> import sys >>> type(sys.stdin) >>> I understand this is because I'm running it under IDLE. but is this not misleading? I was trying... | This is a filed Python bug: http://bugs.python.org/issue9290 The fact that in IDLE sys.stdin is a idlelib.rpc.RPCProxy results in programs having different behavior in IDLE and in Command Line mode. I noticed that when grading many students exercises in IDLE. Things like: sys.stdin.readlines() just don´t exists in IDLE... | Python 3.2 Idle vs terminal In python 3.2 under OSX, if I'll run "type(sys.stdin)" under Idle I get a strange answer as shown below >>> type(sys.stdin) >>> But if I'll reun the same command under terminal, I get: >>> import sys >>> type(sys.stdin) >>> I understand this is because I'm running it under IDLE. but is this ... | TITLE:
Python 3.2 Idle vs terminal
QUESTION:
In python 3.2 under OSX, if I'll run "type(sys.stdin)" under Idle I get a strange answer as shown below >>> type(sys.stdin) >>> But if I'll reun the same command under terminal, I get: >>> import sys >>> type(sys.stdin) >>> I understand this is because I'm running it under ... | [
"python",
"python-idle"
] | 4 | 6 | 2,505 | 1 | 0 | 2011-06-05T18:33:12.547000 | 2011-06-05T18:54:30.297000 |
6,244,963 | 6,245,000 | How to output date to a text file, filename in Windows XP | I have tried many ways of doing this in a batch file, although when outputting to a filename, I get "/" in them, so it can't output it to a text file, I realize they differ, so one which works in XP and Vista / 7 would be handy E.g. Set FileDate=%date:/=% | Try this: I had written it a while ago. @echo off setlocal ENABLEDELAYEDEXPANSION
set today=!date:/=-! set now=!time::=-! set millis=!now:*.=! set now=!now:.%millis%=!
echo hello world > my-file-!today!_!now!.txt | How to output date to a text file, filename in Windows XP I have tried many ways of doing this in a batch file, although when outputting to a filename, I get "/" in them, so it can't output it to a text file, I realize they differ, so one which works in XP and Vista / 7 would be handy E.g. Set FileDate=%date:/=% | TITLE:
How to output date to a text file, filename in Windows XP
QUESTION:
I have tried many ways of doing this in a batch file, although when outputting to a filename, I get "/" in them, so it can't output it to a text file, I realize they differ, so one which works in XP and Vista / 7 would be handy E.g. Set FileDat... | [
"scripting",
"batch-file",
"dos"
] | 1 | 0 | 705 | 1 | 0 | 2011-06-05T18:34:05.990000 | 2011-06-05T18:40:31.120000 |
6,244,965 | 6,244,991 | @SessionScoped does not work when adding @Named | Consider the following backing bean: import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped;
@ManagedBean @SessionScoped public class Counter {
int counter;
public Counter() { this.counter = 0; }
public void Increment() { this.counter++; }
public void Decrement() { this.counter--; }
public int... | You cannot mix JSF with CDI annotations. Use the one or the other. In this case, you need to import javax.enterprise.context.SessionScoped instead of javax.faces.bean.SessionScoped. | @SessionScoped does not work when adding @Named Consider the following backing bean: import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped;
@ManagedBean @SessionScoped public class Counter {
int counter;
public Counter() { this.counter = 0; }
public void Increment() { this.counter++; }
public ... | TITLE:
@SessionScoped does not work when adding @Named
QUESTION:
Consider the following backing bean: import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped;
@ManagedBean @SessionScoped public class Counter {
int counter;
public Counter() { this.counter = 0; }
public void Increment() { this.cou... | [
"java",
"jsf-2",
"glassfish-3"
] | 3 | 9 | 4,798 | 1 | 0 | 2011-06-05T18:34:27.300000 | 2011-06-05T18:38:16.867000 |
6,244,969 | 6,245,144 | Google app engine - limit file size upload | I would like to limit the size during a file upload according to the next requirements: 1- Client side ( this is almost impossible unless using client plugins such as Flash or Applets ) so I discard this one 2- On the server side, can I know the size of a file / image / video before storing it in the database? Thanks! | With the Blobstore service, currently there is no way to limit the file size upload (open issue here ). Storing your data using a simple BlobProperty, you could check the size of the blob after the upload with len(uploaded_blob). EDIT: this is now fixed | Google app engine - limit file size upload I would like to limit the size during a file upload according to the next requirements: 1- Client side ( this is almost impossible unless using client plugins such as Flash or Applets ) so I discard this one 2- On the server side, can I know the size of a file / image / video ... | TITLE:
Google app engine - limit file size upload
QUESTION:
I would like to limit the size during a file upload according to the next requirements: 1- Client side ( this is almost impossible unless using client plugins such as Flash or Applets ) so I discard this one 2- On the server side, can I know the size of a fil... | [
"google-app-engine",
"file-upload",
"limit"
] | 4 | 6 | 4,235 | 3 | 0 | 2011-06-05T18:34:50.517000 | 2011-06-05T19:01:50.937000 |
6,244,980 | 6,245,023 | setting up icons for a list | I have an app in android that in some activity it displays using a item list the content from a column from the DB. this is the way I'm doing it: lv = (ListView) findViewById(R.id.list);
Cursor cursor = db.getAllData(); startManagingCursor(cursor);
adapter = new SimpleCursorAdapter(this, R.layout.listitem, cursor, ne... | You might want to consider using android.app.ListActivity. With a list activity you can provide an xml layout to create advanced visuals for your items. | setting up icons for a list I have an app in android that in some activity it displays using a item list the content from a column from the DB. this is the way I'm doing it: lv = (ListView) findViewById(R.id.list);
Cursor cursor = db.getAllData(); startManagingCursor(cursor);
adapter = new SimpleCursorAdapter(this, R... | TITLE:
setting up icons for a list
QUESTION:
I have an app in android that in some activity it displays using a item list the content from a column from the DB. this is the way I'm doing it: lv = (ListView) findViewById(R.id.list);
Cursor cursor = db.getAllData(); startManagingCursor(cursor);
adapter = new SimpleCur... | [
"android",
"icons",
"textview"
] | 0 | 0 | 95 | 1 | 0 | 2011-06-05T18:35:53.733000 | 2011-06-05T18:44:57.477000 |
6,244,985 | 6,245,008 | Insert HTML element two (or more) times using JavaScript | How do I insert a HTML element twice using JavaScript? This code isn't working: var div = document.createElement('div'); div.innerText = 'Hello!'; document.body.appendChild(div); document.body.appendChild(div); Test: http://jsfiddle.net/9z82D/ | Ok I found that you just have to use cloneNode: var div = document.createElement('div'); div.innerText = 'Hello!'; document.body.appendChild(div); var div2 = div.cloneNode(true); document.body.appendChild(div2); | Insert HTML element two (or more) times using JavaScript How do I insert a HTML element twice using JavaScript? This code isn't working: var div = document.createElement('div'); div.innerText = 'Hello!'; document.body.appendChild(div); document.body.appendChild(div); Test: http://jsfiddle.net/9z82D/ | TITLE:
Insert HTML element two (or more) times using JavaScript
QUESTION:
How do I insert a HTML element twice using JavaScript? This code isn't working: var div = document.createElement('div'); div.innerText = 'Hello!'; document.body.appendChild(div); document.body.appendChild(div); Test: http://jsfiddle.net/9z82D/
... | [
"javascript",
"html"
] | 5 | 21 | 14,679 | 3 | 0 | 2011-06-05T18:37:15.253000 | 2011-06-05T18:42:40.243000 |
6,244,987 | 6,245,048 | Javascript - Goto URL based on Drop Down Selections (continued!) | This is continued from here: Javascript / jQuery - Goto URL based on Drop Down Selections Some great folks have given me some code examples, but I am having real trouble on where to insert the code in my example form. Can someone let me know where exactly the code provided in the previous question location should be ad... | Somewhere in your JavaScript file you need to bind a function to the onsubmit event of your form, so it can do whatever you want. If you are using jQuery do this: $(function(){
$('form').submit(function(e){
window.location.href = $('#dd1').val() + $('#dd2').val()+ $('#dd3').val();
e.preventDefault();
}); }); Check ... | Javascript - Goto URL based on Drop Down Selections (continued!) This is continued from here: Javascript / jQuery - Goto URL based on Drop Down Selections Some great folks have given me some code examples, but I am having real trouble on where to insert the code in my example form. Can someone let me know where exactly... | TITLE:
Javascript - Goto URL based on Drop Down Selections (continued!)
QUESTION:
This is continued from here: Javascript / jQuery - Goto URL based on Drop Down Selections Some great folks have given me some code examples, but I am having real trouble on where to insert the code in my example form. Can someone let me ... | [
"javascript",
"forms",
"select"
] | 0 | 1 | 1,192 | 2 | 0 | 2011-06-05T18:37:33.897000 | 2011-06-05T18:50:47.183000 |
6,244,988 | 6,244,995 | How to make price 0.00 instead of 0.0? | my users can input and create prices. I wanted to know how to make it so when users input 23.5 they get 23.50 instead or 0.0 they get 0.00. How does one add to the t.decimal or my price:decimal the following ability? Thank you for the help! The Answer (:price with scale and precision) class CreatePrices < ActiveRecord:... | Try using the:scale option in your migration. Use a scale of 2 if you want two digits to the right of the decimal point, e.g: t.decimal:price,:precision => 10,:scale => 2 | How to make price 0.00 instead of 0.0? my users can input and create prices. I wanted to know how to make it so when users input 23.5 they get 23.50 instead or 0.0 they get 0.00. How does one add to the t.decimal or my price:decimal the following ability? Thank you for the help! The Answer (:price with scale and precis... | TITLE:
How to make price 0.00 instead of 0.0?
QUESTION:
my users can input and create prices. I wanted to know how to make it so when users input 23.5 they get 23.50 instead or 0.0 they get 0.00. How does one add to the t.decimal or my price:decimal the following ability? Thank you for the help! The Answer (:price wit... | [
"ruby-on-rails"
] | 3 | 5 | 1,822 | 3 | 0 | 2011-06-05T18:37:45.993000 | 2011-06-05T18:39:46.050000 |
6,244,993 | 6,251,450 | No access to Bundle Resource/File (OSGi) | at the moment i'm developing an OSGi based WebApp with Jetty and Equinox (see: http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit ). Everything ist fine so far but i can't get access to some files/resources of my own bundle. The location/path is "configuration/data/config.csv" and "configuration/data/da... | You are correctly retrieving the resource from the bundle. I'll suggest to get familiar with the difference between getEntry(), getResource() and getDataFile(). Because methods returns you correct URLs, this means that the resource are correctly located and the problem is in how you read them. The two ways to use them ... | No access to Bundle Resource/File (OSGi) at the moment i'm developing an OSGi based WebApp with Jetty and Equinox (see: http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit ). Everything ist fine so far but i can't get access to some files/resources of my own bundle. The location/path is "configuration/da... | TITLE:
No access to Bundle Resource/File (OSGi)
QUESTION:
at the moment i'm developing an OSGi based WebApp with Jetty and Equinox (see: http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit ). Everything ist fine so far but i can't get access to some files/resources of my own bundle. The location/path is... | [
"file",
"resources",
"osgi",
"bundle"
] | 11 | 14 | 20,037 | 2 | 0 | 2011-06-05T18:38:37.930000 | 2011-06-06T11:36:54.697000 |
6,245,002 | 6,245,402 | What is 'self' that shows up in android trace view | I've started to use the android Trace view tool to profile my game. In some of my methods im seeing a large percentage of time taken up in 'self'. I have a feeling its something obvious but does anyone know what this represents? | Self is time spent in the actual method, instead of children. For example, if you have a method that runs a loop doing some math, and then calling some draw functions, you'll see the time listed for the draw functions in children, and the time spent in that method itself(mainly the math loop) as self. | What is 'self' that shows up in android trace view I've started to use the android Trace view tool to profile my game. In some of my methods im seeing a large percentage of time taken up in 'self'. I have a feeling its something obvious but does anyone know what this represents? | TITLE:
What is 'self' that shows up in android trace view
QUESTION:
I've started to use the android Trace view tool to profile my game. In some of my methods im seeing a large percentage of time taken up in 'self'. I have a feeling its something obvious but does anyone know what this represents?
ANSWER:
Self is time ... | [
"android",
"debugging",
"trace"
] | 5 | 9 | 457 | 1 | 0 | 2011-06-05T18:41:04.620000 | 2011-06-05T19:44:34.397000 |
6,245,014 | 6,245,182 | event binding in knockout.js | I have a viewModel with an array of answerGroup objects. When the feedback property of one of the answerGroup objects is updated I want to save the updated object to my database by passing it via ajax to my ASP.Net MVC app. Instead of having a typical save button or link, I want the object to be passed to the Ajax call... | The typical way to handle this in Knockout is to do a manual subscription on the observable that you want to react to changes on. So, you would do something like: function answerGroup() { this.id = ko.observable(); this.name = ko.observable(); this.feedback = ko.observable();
this.feedback.subscribe(function (newValue... | event binding in knockout.js I have a viewModel with an array of answerGroup objects. When the feedback property of one of the answerGroup objects is updated I want to save the updated object to my database by passing it via ajax to my ASP.Net MVC app. Instead of having a typical save button or link, I want the object ... | TITLE:
event binding in knockout.js
QUESTION:
I have a viewModel with an array of answerGroup objects. When the feedback property of one of the answerGroup objects is updated I want to save the updated object to my database by passing it via ajax to my ASP.Net MVC app. Instead of having a typical save button or link, ... | [
"javascript",
"jquery",
"asp.net",
"asp.net-mvc",
"knockout.js"
] | 19 | 42 | 28,172 | 2 | 0 | 2011-06-05T18:43:55.930000 | 2011-06-05T19:07:36.910000 |
6,245,018 | 6,245,090 | sed add line if not exists | I need to make a change in the php.ini configuration file via sed (or similar). I need to add the following text: extension=solr.so The line has to be added as line number 941 in the configuration file. However, if the file is already there, it should not be added again. I guess there are two approaches: 1) replace lin... | The easiest way would be to test before using grep, for example: grep -q -e 'extension=solr.so' file || sed '...' Also, it is estrange that you need exactly that line. You should add it at the end, or something like that. Also, note that taking the same file as input and output never should be done. This can damage the... | sed add line if not exists I need to make a change in the php.ini configuration file via sed (or similar). I need to add the following text: extension=solr.so The line has to be added as line number 941 in the configuration file. However, if the file is already there, it should not be added again. I guess there are two... | TITLE:
sed add line if not exists
QUESTION:
I need to make a change in the php.ini configuration file via sed (or similar). I need to add the following text: extension=solr.so The line has to be added as line number 941 in the configuration file. However, if the file is already there, it should not be added again. I g... | [
"sed"
] | 3 | 13 | 11,373 | 1 | 0 | 2011-06-05T18:44:24.977000 | 2011-06-05T18:56:05.953000 |
6,245,021 | 6,248,067 | How to better use Opera dragonfly's console methods? | I'm trying to use opera dragonfly for debugging, it seems quite nice, but I'm probably doing things wrong here. First problem comes with the console.log() method: In my JavaScript code I just put something like console.log(someVariable) When I look at the error tab I can only see reports like [object MouseEvent] [objec... | Opera Dragonfly's console.*() methods are not yet as powerful as Firebug's. They will become more capable over time. As of now, you can not expand the object to discover properties and methods inside the console itself, but you can click an object to have its detail for inspection in the pane for inspecting objects and... | How to better use Opera dragonfly's console methods? I'm trying to use opera dragonfly for debugging, it seems quite nice, but I'm probably doing things wrong here. First problem comes with the console.log() method: In my JavaScript code I just put something like console.log(someVariable) When I look at the error tab I... | TITLE:
How to better use Opera dragonfly's console methods?
QUESTION:
I'm trying to use opera dragonfly for debugging, it seems quite nice, but I'm probably doing things wrong here. First problem comes with the console.log() method: In my JavaScript code I just put something like console.log(someVariable) When I look ... | [
"opera",
"opera-dragonfly"
] | 1 | 1 | 1,067 | 1 | 0 | 2011-06-05T18:44:40.987000 | 2011-06-06T05:22:03.590000 |
6,245,031 | 6,245,060 | MySQL Ignore is not working | I am trying to prevent duplicates from occuring using the following query, but it doesnt seem to work. Please could you tell me what the problem is? INSERT IGNORE INTO Following SET `followingUserID` = '$accountIDToFollow', `followerUserID` = '$accountID' | INSERT IGNORE INTO Following (`followingUserID`,`followerUserID`) VALUE ('$accountIDToFollow','$accountID') You were doing an UPDATE format before If you are trying to do an update this is how it works UPDATE followingUserID SET followingUserID = '$accountIDToFollow', WHERE followerUserID = '$accountID'; Of course you ... | MySQL Ignore is not working I am trying to prevent duplicates from occuring using the following query, but it doesnt seem to work. Please could you tell me what the problem is? INSERT IGNORE INTO Following SET `followingUserID` = '$accountIDToFollow', `followerUserID` = '$accountID' | TITLE:
MySQL Ignore is not working
QUESTION:
I am trying to prevent duplicates from occuring using the following query, but it doesnt seem to work. Please could you tell me what the problem is? INSERT IGNORE INTO Following SET `followingUserID` = '$accountIDToFollow', `followerUserID` = '$accountID'
ANSWER:
INSERT IG... | [
"php",
"mysql",
"duplicates"
] | 0 | 1 | 511 | 2 | 0 | 2011-06-05T18:46:30.430000 | 2011-06-05T18:52:35.567000 |
6,245,039 | 6,245,163 | Can I change the platform version of an android app after creating it? | I am just learning about android app development and have created my first app which is a relatively simple app with a link to a gallery of images and some text pages. I created this using the 1.5 platform as it seemed sensible to make it backwards compatible. I've been testing it on 3.0 and it comes up tiny on the scr... | Take a look at this. It explains how you can go about changing your AndroidManifest.xml to specify which version of the SDK to use. You may also need to update default.properties to point the target to the proper api value. This really depends on what you want to do. If you require something from 2.1 or 3.0, then I thi... | Can I change the platform version of an android app after creating it? I am just learning about android app development and have created my first app which is a relatively simple app with a link to a gallery of images and some text pages. I created this using the 1.5 platform as it seemed sensible to make it backwards ... | TITLE:
Can I change the platform version of an android app after creating it?
QUESTION:
I am just learning about android app development and have created my first app which is a relatively simple app with a link to a gallery of images and some text pages. I created this using the 1.5 platform as it seemed sensible to ... | [
"java",
"android"
] | 0 | 3 | 1,006 | 1 | 0 | 2011-06-05T18:48:35.647000 | 2011-06-05T19:04:55.740000 |
6,245,046 | 6,245,098 | Run jQuery AJAX when hitting 'enter / return' | I have a simple form for users to post on a 'wall'. As you can see it has one text input field and a submit button that is made of multiple spans styled via CSS. Share This works nicely when the user clicks on the 'Share' button, which runs the AJAX below: $(document).ready(function() {
$('.share_js').click(function(e... | why not using the form post? Share and then hook up the form POST $('#chat_form').bind('submit', function(event) {
var link = $(this).attr('action');
$.ajax({ url: link, type: "POST", data: $(this).serialize(), dataType: "html", beforeSend: function(){ $('#loading').show(); }, success: function() { $('#chat_thread').... | Run jQuery AJAX when hitting 'enter / return' I have a simple form for users to post on a 'wall'. As you can see it has one text input field and a submit button that is made of multiple spans styled via CSS. Share This works nicely when the user clicks on the 'Share' button, which runs the AJAX below: $(document).ready... | TITLE:
Run jQuery AJAX when hitting 'enter / return'
QUESTION:
I have a simple form for users to post on a 'wall'. As you can see it has one text input field and a submit button that is made of multiple spans styled via CSS. Share This works nicely when the user clicks on the 'Share' button, which runs the AJAX below:... | [
"jquery",
"ajax",
"submit",
"return"
] | 2 | 7 | 10,310 | 4 | 0 | 2011-06-05T18:50:07.097000 | 2011-06-05T18:56:41.740000 |
6,245,047 | 6,245,148 | c++ bitset problem with output | I was working around with bitset, and so i was wondering what would be the best way to convert a base-10 to base-2, because for some reason i get the wrong answer: giving the number 19, i'd expect to see: 10011 (16-2-1), why does it output (00011) #include #include using namespace std;
int main() {
bitset temp(19); f... | There were a bug in your code. You can't access element at index 4 since the size of bitset was 4 due to the fact that sizeof( int ) yielded 4, which only allows accessing from 0-3. As for your question, the template argument within the <> brackets is the size of bitset. In your case, 19 is represented with more than 4... | c++ bitset problem with output I was working around with bitset, and so i was wondering what would be the best way to convert a base-10 to base-2, because for some reason i get the wrong answer: giving the number 19, i'd expect to see: 10011 (16-2-1), why does it output (00011) #include #include using namespace std;
i... | TITLE:
c++ bitset problem with output
QUESTION:
I was working around with bitset, and so i was wondering what would be the best way to convert a base-10 to base-2, because for some reason i get the wrong answer: giving the number 19, i'd expect to see: 10011 (16-2-1), why does it output (00011) #include #include using... | [
"c++",
"binary",
"bitset"
] | 0 | 1 | 1,266 | 3 | 0 | 2011-06-05T18:50:15.990000 | 2011-06-05T19:02:17.090000 |
6,245,049 | 6,245,071 | Hierarchical List using HTML/CSS | I am trying to create a top-level menu like you would see in most applications, using HTML, CSS & Javascript. I know there's a ton of pre-built ones, but I want to create my own. ---------------------- | File | Edit | Help | ---------------------- | New | | Save | | Save As | --------- I've been trying various CSS styl... | File New Save Save As Edit Cut Copy Paste Help About Take a look at sample here: http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery | Hierarchical List using HTML/CSS I am trying to create a top-level menu like you would see in most applications, using HTML, CSS & Javascript. I know there's a ton of pre-built ones, but I want to create my own. ---------------------- | File | Edit | Help | ---------------------- | New | | Save | | Save As | --------- ... | TITLE:
Hierarchical List using HTML/CSS
QUESTION:
I am trying to create a top-level menu like you would see in most applications, using HTML, CSS & Javascript. I know there's a ton of pre-built ones, but I want to create my own. ---------------------- | File | Edit | Help | ---------------------- | New | | Save | | Sa... | [
"css",
"html"
] | 7 | 9 | 20,048 | 1 | 0 | 2011-06-05T18:51:00.980000 | 2011-06-05T18:53:49.450000 |
6,245,053 | 6,245,086 | How to make a static Calendar thread safe | I'd like to use a Calendar for some static methods and use a static field: private static Calendar calendar = Calendar.getInstance(); Now I read java.util.Calendar isn't thread safe. How can I make this thread safe (it should be static )? | You can't make something thread-safe if it isn't. In the case of Calendar, even reading data from it isn't thread-safe, as it can update internal data structures. If at all possible, I'd suggest using Joda Time instead: Most of the types are immutable The immutable types are thread-safe It's a generally much better API... | How to make a static Calendar thread safe I'd like to use a Calendar for some static methods and use a static field: private static Calendar calendar = Calendar.getInstance(); Now I read java.util.Calendar isn't thread safe. How can I make this thread safe (it should be static )? | TITLE:
How to make a static Calendar thread safe
QUESTION:
I'd like to use a Calendar for some static methods and use a static field: private static Calendar calendar = Calendar.getInstance(); Now I read java.util.Calendar isn't thread safe. How can I make this thread safe (it should be static )?
ANSWER:
You can't ma... | [
"java",
"static",
"calendar",
"thread-safety"
] | 10 | 14 | 12,785 | 6 | 0 | 2011-06-05T18:51:22.950000 | 2011-06-05T18:55:42.617000 |
6,245,062 | 6,245,109 | Search and replace in UNIX | How would i replace a string in a file such that the string to be replaced is always succeeded by some string. eg: If i want to replace ABC with 123 as below, INPUT ABC ABCXYZ ABCDHD ABC CDE OUTPUT ABC 123XYZ 123DHD ABC CDE i tried using sed but with no success. | sed -i 's/ABC\(.+\)$/123\1/g' myFile.txt ABC, match the literal ABC! \(.+\) match at least 1 other character capture it in group 1 123\1 replace the hole thing with 123 followed by what is captured in group 1 | Search and replace in UNIX How would i replace a string in a file such that the string to be replaced is always succeeded by some string. eg: If i want to replace ABC with 123 as below, INPUT ABC ABCXYZ ABCDHD ABC CDE OUTPUT ABC 123XYZ 123DHD ABC CDE i tried using sed but with no success. | TITLE:
Search and replace in UNIX
QUESTION:
How would i replace a string in a file such that the string to be replaced is always succeeded by some string. eg: If i want to replace ABC with 123 as below, INPUT ABC ABCXYZ ABCDHD ABC CDE OUTPUT ABC 123XYZ 123DHD ABC CDE i tried using sed but with no success.
ANSWER:
sed... | [
"perl",
"shell",
"unix",
"sed",
"replace"
] | 0 | 2 | 725 | 5 | 0 | 2011-06-05T18:52:43.183000 | 2011-06-05T18:57:46.937000 |
6,245,065 | 6,245,093 | Problem with big numbers in C | why should a code like this should provide a so high result when I give it the number 4293974227 (or higher) int main (int argc, char *argv[]) {
unsigned long long int i;
unsigned long long int z = atoi(argv[1]);
unsigned long long int tmp1 = z;
unsigned long long int *numbers = malloc (sizeof (unsigned long long i... | atoi() returns int. If you need larger numbers, try strtol(), strtoll(), or their relatives. | Problem with big numbers in C why should a code like this should provide a so high result when I give it the number 4293974227 (or higher) int main (int argc, char *argv[]) {
unsigned long long int i;
unsigned long long int z = atoi(argv[1]);
unsigned long long int tmp1 = z;
unsigned long long int *numbers = malloc... | TITLE:
Problem with big numbers in C
QUESTION:
why should a code like this should provide a so high result when I give it the number 4293974227 (or higher) int main (int argc, char *argv[]) {
unsigned long long int i;
unsigned long long int z = atoi(argv[1]);
unsigned long long int tmp1 = z;
unsigned long long int... | [
"c",
"int"
] | 0 | 6 | 1,513 | 3 | 0 | 2011-06-05T18:53:27.280000 | 2011-06-05T18:56:20.760000 |
6,245,074 | 6,245,611 | How to make MVC3 DisplayFor show the value of an Enum's Display-Attribute? | in a MVC3-Project, I'm using an enum with display-Attributes: public enum Foo { [Display(Name = "Undefined")] Undef = 0,
[Display(Name = "Fully colored")] Full = 1 } The model class has a property using this enum: public Foo FooProp { get; set; } The view uses the model class and displays the property via @Html.Displa... | A custom display template might help ( ~/Views/Shared/DisplayTemplates/Foo.cshtml ): @using System.ComponentModel.DataAnnotations @model Foo
@{ var field = Model.GetType().GetField(Model.ToString()); if (field!= null) { var display = ((DisplayAttribute[])field.GetCustomAttributes(typeof(DisplayAttribute), false)).Firs... | How to make MVC3 DisplayFor show the value of an Enum's Display-Attribute? in a MVC3-Project, I'm using an enum with display-Attributes: public enum Foo { [Display(Name = "Undefined")] Undef = 0,
[Display(Name = "Fully colored")] Full = 1 } The model class has a property using this enum: public Foo FooProp { get; set;... | TITLE:
How to make MVC3 DisplayFor show the value of an Enum's Display-Attribute?
QUESTION:
in a MVC3-Project, I'm using an enum with display-Attributes: public enum Foo { [Display(Name = "Undefined")] Undef = 0,
[Display(Name = "Fully colored")] Full = 1 } The model class has a property using this enum: public Foo F... | [
"asp.net-mvc-3",
"attributes",
"enums"
] | 17 | 27 | 15,509 | 2 | 0 | 2011-06-05T18:54:06.137000 | 2011-06-05T20:21:42.483000 |
6,245,075 | 6,245,125 | Group by and average in linq | I have 2 tables. MarkQuestion and Question. MarkQuestion has: IDQuestion, IDUser, Mark
Question has: IDQuestion, Text I want to extract text of each question and average mark for each question: I tried something like this: var questions = from mark in Entities.MarkedQuestions join question in Entities.Questions on mar... | It sounds to me like you want a group join, so that you have two range variables - one representing a question, and another representing all the marked questions for that particular question. Here's the query expression syntax you'd use: var questions = from question in Entities.Questions join marked in Entities.Marked... | Group by and average in linq I have 2 tables. MarkQuestion and Question. MarkQuestion has: IDQuestion, IDUser, Mark
Question has: IDQuestion, Text I want to extract text of each question and average mark for each question: I tried something like this: var questions = from mark in Entities.MarkedQuestions join question... | TITLE:
Group by and average in linq
QUESTION:
I have 2 tables. MarkQuestion and Question. MarkQuestion has: IDQuestion, IDUser, Mark
Question has: IDQuestion, Text I want to extract text of each question and average mark for each question: I tried something like this: var questions = from mark in Entities.MarkedQuest... | [
"c#",
".net",
"linq",
"ado.net",
"linq-to-entities"
] | 1 | 9 | 7,132 | 2 | 0 | 2011-06-05T18:54:07.563000 | 2011-06-05T19:00:11.650000 |
6,245,078 | 6,245,126 | Modifying all items in a list of Points | List pointList; public int pickedIndexRight = -1; public int diffX = 0; public int diffY = 0; public Form1() { InitializeComponent();
pointList = new List (); } private void Form1_MouseDown(object sender, MouseEventArgs e) { Point myPoint = new Point(e.X, e.Y); if (e.Button == MouseButtons.Left) { if (pickedIndex == -... | In this line: diffX = pointList[i].X + (e.X - pointList[i].X); The pointList[i].X terms cancel out. So it's just: diffX = e.X; You're assigning the current mouse position to every point. If you want to move all the points by the distance that the mouse has moved, but keep their positions relative to each other, you nee... | Modifying all items in a list of Points List pointList; public int pickedIndexRight = -1; public int diffX = 0; public int diffY = 0; public Form1() { InitializeComponent();
pointList = new List (); } private void Form1_MouseDown(object sender, MouseEventArgs e) { Point myPoint = new Point(e.X, e.Y); if (e.Button == M... | TITLE:
Modifying all items in a list of Points
QUESTION:
List pointList; public int pickedIndexRight = -1; public int diffX = 0; public int diffY = 0; public Form1() { InitializeComponent();
pointList = new List (); } private void Form1_MouseDown(object sender, MouseEventArgs e) { Point myPoint = new Point(e.X, e.Y);... | [
"c#",
"list",
"point"
] | 0 | 1 | 2,728 | 1 | 0 | 2011-06-05T18:54:27.437000 | 2011-06-05T19:00:16.233000 |
6,245,083 | 6,246,077 | Drupal - System for testing students | I want to create a system for testing students on Drupal. For example we have some course called “Java”. And after 1-3 months we need to test student about their knowledges – with results base, marks, etc. Maybe you can help me? What modules I can use for it? | You would definitely want to have a look at the Webform module. Each test can then be an node, which your students can fill in if they have an account on the site. | Drupal - System for testing students I want to create a system for testing students on Drupal. For example we have some course called “Java”. And after 1-3 months we need to test student about their knowledges – with results base, marks, etc. Maybe you can help me? What modules I can use for it? | TITLE:
Drupal - System for testing students
QUESTION:
I want to create a system for testing students on Drupal. For example we have some course called “Java”. And after 1-3 months we need to test student about their knowledges – with results base, marks, etc. Maybe you can help me? What modules I can use for it?
ANSW... | [
"drupal",
"testing"
] | 1 | 2 | 67 | 1 | 0 | 2011-06-05T18:55:26.423000 | 2011-06-05T21:47:43.497000 |
6,245,102 | 6,245,128 | Optional AND in WHERE statement MySQL | I'm trying to figure out how to allow optional AND statements where there is a LEFT OUTER JOIN since the table is optional when viewing records. However, I have a problem where there is no files, and in the WHERE statement, like this: SELECT rec.record_id, rec.record_name, f.file_name, f.file_id FROM ( records rec
LEF... | try moving the condition into the join statement, that way it will only join on the lines if they meet the condition SELECT rec.record_id, rec.record_name, f.file_name, f.file_id FROM ( records rec
LEFT OUTER JOIN files f ON f.record_id = rec.record_id AND f.file_approved = 1 ) WHERE rec.record_id = 4928; | Optional AND in WHERE statement MySQL I'm trying to figure out how to allow optional AND statements where there is a LEFT OUTER JOIN since the table is optional when viewing records. However, I have a problem where there is no files, and in the WHERE statement, like this: SELECT rec.record_id, rec.record_name, f.file_n... | TITLE:
Optional AND in WHERE statement MySQL
QUESTION:
I'm trying to figure out how to allow optional AND statements where there is a LEFT OUTER JOIN since the table is optional when viewing records. However, I have a problem where there is no files, and in the WHERE statement, like this: SELECT rec.record_id, rec.rec... | [
"mysql",
"left-join"
] | 3 | 5 | 975 | 2 | 0 | 2011-06-05T18:57:04.113000 | 2011-06-05T19:00:26.117000 |
6,245,106 | 6,245,197 | adding chr to the number Prototype | I have the following function: var chr = function(X) { return String.fromCharCode(X) } But I would like to use i.chr() instead of chr(i). Q: How do I add chr() to the number prototype? | if (!Number.prototype.hasOwnProperty('chr')) { Number.prototype.chr = function() { return String.fromCharCode(this); }; } To use this the number must be in a variable or wrapped in parentheses. Be aware that converting a scalar number to a Number object (called boxing) has an overhead. If you are doing the conversion r... | adding chr to the number Prototype I have the following function: var chr = function(X) { return String.fromCharCode(X) } But I would like to use i.chr() instead of chr(i). Q: How do I add chr() to the number prototype? | TITLE:
adding chr to the number Prototype
QUESTION:
I have the following function: var chr = function(X) { return String.fromCharCode(X) } But I would like to use i.chr() instead of chr(i). Q: How do I add chr() to the number prototype?
ANSWER:
if (!Number.prototype.hasOwnProperty('chr')) { Number.prototype.chr = fun... | [
"javascript"
] | 2 | 1 | 273 | 3 | 0 | 2011-06-05T18:57:32.367000 | 2011-06-05T19:10:13.390000 |
6,245,108 | 6,245,134 | Python combinatorials w/o repetition - Pyncomb? | I'm trying to do some combinatorial stuff with data in Python. I looked the question How to generate all permutations of a list in Python, but think that doesn't fit my needs.. I have data of this type...: group1-Steve group1-Mark group1-Tom group2-Brett group2-Mick group2-Foo group3-Dan group3-Phil...and i need to mak... | The easiest way is to use itertools.product(): group1 = ["Steve", "Mark", "Tom"] group2 = ["Brett", "Mick", "Foo"] group3 = ["Dan", "Phil"] for x in itertools.product(group1, group2, group3): print x prints ('Steve', 'Brett', 'Dan') ('Steve', 'Brett', 'Phil') ('Steve', 'Mick', 'Dan') ('Steve', 'Mick', 'Phil') ('Steve',... | Python combinatorials w/o repetition - Pyncomb? I'm trying to do some combinatorial stuff with data in Python. I looked the question How to generate all permutations of a list in Python, but think that doesn't fit my needs.. I have data of this type...: group1-Steve group1-Mark group1-Tom group2-Brett group2-Mick group... | TITLE:
Python combinatorials w/o repetition - Pyncomb?
QUESTION:
I'm trying to do some combinatorial stuff with data in Python. I looked the question How to generate all permutations of a list in Python, but think that doesn't fit my needs.. I have data of this type...: group1-Steve group1-Mark group1-Tom group2-Brett... | [
"python",
"combinatorics"
] | 6 | 9 | 1,470 | 2 | 0 | 2011-06-05T18:57:37.693000 | 2011-06-05T19:01:06.303000 |
6,245,115 | 6,245,137 | One time change model attribute (column name) in Ruby on Rails | I created a model with an attribute "name" but I want to change it to "username". Everything I've read about database migrations involves creating a class or some complicated stuff. All I want to do is the equivalent of "UPDATE TABLE" in SQL. How do you run a one-time database migration to change this? I'm guessing it'... | First: rails g migration rename_name_column_to_username Then in the generated rename_name_column_to_username.rb migration file: class RenameNameColumnToUsername < ActiveRecord::Migration def self.up rename_column:users,:name,:username end
def self.down rename_column:users,:username,:name end end And then rake db:migra... | One time change model attribute (column name) in Ruby on Rails I created a model with an attribute "name" but I want to change it to "username". Everything I've read about database migrations involves creating a class or some complicated stuff. All I want to do is the equivalent of "UPDATE TABLE" in SQL. How do you run... | TITLE:
One time change model attribute (column name) in Ruby on Rails
QUESTION:
I created a model with an attribute "name" but I want to change it to "username". Everything I've read about database migrations involves creating a class or some complicated stuff. All I want to do is the equivalent of "UPDATE TABLE" in S... | [
"ruby-on-rails",
"database",
"migration"
] | 5 | 9 | 6,196 | 3 | 0 | 2011-06-05T18:58:44.680000 | 2011-06-05T19:01:25.437000 |
6,245,133 | 6,245,357 | how to set up current user id only can use their own actions | I am new at Ruby-on-Rails. I could use some help after looking around at this site and Cancan Guides. I am have trouble getting this to work for Cancan and Devise. the User (Devise) only has Prices, so Price belongs to User. I have a user_id inside of my database for my Price migration: create_table "prices",:force => ... | You have defined your permissions, but you must also check for them in your controllers and possibly views in order to enforce them. The index and show actions, for example: def index # Check if the current user can actually see the Price index. authorize!:index, Price
@prices = Price.all
#... end
def show @price = ... | how to set up current user id only can use their own actions I am new at Ruby-on-Rails. I could use some help after looking around at this site and Cancan Guides. I am have trouble getting this to work for Cancan and Devise. the User (Devise) only has Prices, so Price belongs to User. I have a user_id inside of my data... | TITLE:
how to set up current user id only can use their own actions
QUESTION:
I am new at Ruby-on-Rails. I could use some help after looking around at this site and Cancan Guides. I am have trouble getting this to work for Cancan and Devise. the User (Devise) only has Prices, so Price belongs to User. I have a user_id... | [
"ruby-on-rails",
"devise",
"cancan"
] | 2 | 3 | 2,839 | 2 | 0 | 2011-06-05T19:00:54.253000 | 2011-06-05T19:35:42.497000 |
6,245,139 | 6,245,210 | Prevent spiders from following is matches URL | How do I prevent spriders crawling pages that start with mydomain.com/abc... For example mydomain.com/abcSGGSHS or mydomain.com/abc6bNNha I think I need to add some sort of regular expression to the web root's.htaccess, right? | With mod_rewrite enabled, you can do the following RewriteEngine on RewriteBase / RewriteCond %{HTTP_USER_AGENT} ^YourBadSpiderName [OR] RewriteCond %{HTTP_USER_AGENT} ^AotherBadSpider RewriteCond %{REQUEST_URI} ^abc RewriteRule ^$ http://mydomain.com/404.html [NC,L] You'll have to update the spider names accordingly. ... | Prevent spiders from following is matches URL How do I prevent spriders crawling pages that start with mydomain.com/abc... For example mydomain.com/abcSGGSHS or mydomain.com/abc6bNNha I think I need to add some sort of regular expression to the web root's.htaccess, right? | TITLE:
Prevent spiders from following is matches URL
QUESTION:
How do I prevent spriders crawling pages that start with mydomain.com/abc... For example mydomain.com/abcSGGSHS or mydomain.com/abc6bNNha I think I need to add some sort of regular expression to the web root's.htaccess, right?
ANSWER:
With mod_rewrite ena... | [
".htaccess"
] | 0 | 2 | 47 | 1 | 0 | 2011-06-05T19:01:31.180000 | 2011-06-05T19:11:50.950000 |
6,245,140 | 6,245,179 | What is the difference between $.map and $.grep in jQuery | What is the difference between $.map and $.grep in jQuery? I want a simple answer as far as possible. | I will assume you mean $.grep and $.map. The difference is that we use $.grep to filter an array while we use $.map to apply a function to each item in the array. Here is a much better explanation than I can make: http://onwebdev.blogspot.com/2011/03/jquery-grep-and-map-example-and-syntax.html | What is the difference between $.map and $.grep in jQuery What is the difference between $.map and $.grep in jQuery? I want a simple answer as far as possible. | TITLE:
What is the difference between $.map and $.grep in jQuery
QUESTION:
What is the difference between $.map and $.grep in jQuery? I want a simple answer as far as possible.
ANSWER:
I will assume you mean $.grep and $.map. The difference is that we use $.grep to filter an array while we use $.map to apply a functi... | [
"javascript",
"jquery"
] | 15 | 21 | 14,755 | 2 | 0 | 2011-06-05T19:01:32.040000 | 2011-06-05T19:07:19.250000 |
6,245,155 | 6,245,710 | Problem with XPath | Here's a link: http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/results/2010-2011/boxscore819588.html I'm using HTML Agility Pack and I would like to extract, say, the 188 from the 'Odds' column. My editor gives /html/body/form/div/div[2]/div/table/tr/td[2]/div/table/tr[3]/td[7] when asked for path. I tr... | When scraping sites, you can't rely safely on the exact XPATH given by tools as in general, they are too restrictive, and in fact catch nothing most of the time. The best way is to have a look at the HTML and determine something more resilient to changes. Here is a piece of code that works with your example: HtmlAgilit... | Problem with XPath Here's a link: http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/results/2010-2011/boxscore819588.html I'm using HTML Agility Pack and I would like to extract, say, the 188 from the 'Odds' column. My editor gives /html/body/form/div/div[2]/div/table/tr/td[2]/div/table/tr[3]/td[7] when a... | TITLE:
Problem with XPath
QUESTION:
Here's a link: http://www.covers.com/pageLoader/pageLoader.aspx?page=/data/nba/results/2010-2011/boxscore819588.html I'm using HTML Agility Pack and I would like to extract, say, the 188 from the 'Odds' column. My editor gives /html/body/form/div/div[2]/div/table/tr/td[2]/div/table/... | [
"c#",
"html",
"xpath",
"html-agility-pack"
] | 1 | 1 | 1,215 | 3 | 0 | 2011-06-05T19:03:37.537000 | 2011-06-05T20:37:18.263000 |
6,245,158 | 6,245,404 | Exposing comparison/equality on a private union type | I am struggling to expose comparison/equality on a union type whose cases are hidden. This is what I started with: Module.FSI type A<'T when 'T: comparison> Module.FS type A<'T when 'T: comparison> = A of 'T list Program.FS [ ] type B = | Case1 | Case2 of Module.A But I get the error: The struct, record or union type '... | The error message only says that the correct syntax for the FSI file declarations should use = (as in the implementation file) instead of the with... end syntax. However, that doesn't really solve the problem. After some experimantations, I think you don't need to apply the attributes in the FSI file: // Mod.fs namespa... | Exposing comparison/equality on a private union type I am struggling to expose comparison/equality on a union type whose cases are hidden. This is what I started with: Module.FSI type A<'T when 'T: comparison> Module.FS type A<'T when 'T: comparison> = A of 'T list Program.FS [ ] type B = | Case1 | Case2 of Module.A Bu... | TITLE:
Exposing comparison/equality on a private union type
QUESTION:
I am struggling to expose comparison/equality on a union type whose cases are hidden. This is what I started with: Module.FSI type A<'T when 'T: comparison> Module.FS type A<'T when 'T: comparison> = A of 'T list Program.FS [ ] type B = | Case1 | Ca... | [
"f#"
] | 2 | 2 | 545 | 1 | 0 | 2011-06-05T19:04:04.040000 | 2011-06-05T19:44:56.413000 |
6,245,159 | 6,245,192 | operator+= yields zero | [edit]Problem solved - kind of. There never really was a problem. It seems that the debugger was lying to me. Thanks[/edit] I have a wierd problem that I've been unable to resolve so far. I have a private class member private: float *_histVals; which is initialized in the constructor as follows: // allocate memory for ... | Use std::vector unless you want a difficult life or you're learning how people had to live in the bad old days. Regarding this having no effect on the array element: this->_histVals[ hIndex ] += imgFrac; Possible causes: The debugger is lying to you. imgFrac is zero Have you tried logging all the values involved to std... | operator+= yields zero [edit]Problem solved - kind of. There never really was a problem. It seems that the debugger was lying to me. Thanks[/edit] I have a wierd problem that I've been unable to resolve so far. I have a private class member private: float *_histVals; which is initialized in the constructor as follows: ... | TITLE:
operator+= yields zero
QUESTION:
[edit]Problem solved - kind of. There never really was a problem. It seems that the debugger was lying to me. Thanks[/edit] I have a wierd problem that I've been unable to resolve so far. I have a private class member private: float *_histVals; which is initialized in the constr... | [
"c++",
"operators"
] | 2 | 4 | 121 | 1 | 0 | 2011-06-05T19:04:11.497000 | 2011-06-05T19:09:02.127000 |
6,245,169 | 6,245,181 | Are there any possible way of making it impossible for website administrator to retrieve a password from a user? | I'm creating a website and I'm afraid that my friends are afraid of that I know all the passwords. So my question are there any possible way of making it impossible for me to retrieve a password of some random user. Hashing is not an option, because I can still get the password before hashing. My web app is written in ... | You could have the password hashed in Javascript on the client side, before it arrives at the server. But then you would of course have to hash+salt it again on the server side. You could also hand off authentication to another method, like Facebook Connect or OpenID. | Are there any possible way of making it impossible for website administrator to retrieve a password from a user? I'm creating a website and I'm afraid that my friends are afraid of that I know all the passwords. So my question are there any possible way of making it impossible for me to retrieve a password of some rand... | TITLE:
Are there any possible way of making it impossible for website administrator to retrieve a password from a user?
QUESTION:
I'm creating a website and I'm afraid that my friends are afraid of that I know all the passwords. So my question are there any possible way of making it impossible for me to retrieve a pas... | [
"php",
"encryption",
"passwords"
] | 1 | 3 | 81 | 2 | 0 | 2011-06-05T19:05:53.100000 | 2011-06-05T19:07:34.100000 |
6,245,170 | 6,245,318 | Is it possible to add basic authentication to an existing asp.net app without touching existing code like htaccess in Apache/PHP | I'd like to add a login/password form (basic authentication popup in browser is ok don't need more) in existing asp.net app I didn't develop but for which I have access to deployment directory. I'd like to be able to do this without entering their source code only web config or iis config something like htaccess in Apa... | Basic authentication could be configured at IIS level: Configure Basic Authentication (IIS 7) Basic Authentication in IIS 6.0 (IIS 6.0) | Is it possible to add basic authentication to an existing asp.net app without touching existing code like htaccess in Apache/PHP I'd like to add a login/password form (basic authentication popup in browser is ok don't need more) in existing asp.net app I didn't develop but for which I have access to deployment director... | TITLE:
Is it possible to add basic authentication to an existing asp.net app without touching existing code like htaccess in Apache/PHP
QUESTION:
I'd like to add a login/password form (basic authentication popup in browser is ok don't need more) in existing asp.net app I didn't develop but for which I have access to d... | [
"asp.net",
"iis"
] | 1 | 2 | 414 | 1 | 0 | 2011-06-05T19:05:55.907000 | 2011-06-05T19:29:46.937000 |
6,245,172 | 6,245,329 | Why isn't Skip() in LINQ to objects optimized? | var res = new int[1000000].Skip(999999).First(); It would be great if this query would just use the indexer instead of traversing 999999 entries. I had a look into the System.Core.dll and noticed that in contrast to Skip(), the Count() extension method is optimized. If the IEnumerable implements ICollection then it jus... | If you look at my answer to a similar question, it appears as though it should be easy to provide a non-naive (i.e. throws proper exceptions) optimization of Skip for any IList: public static IEnumerable Skip (this IList source, int count) { using (var e = source.GetEnumerator()) while (count < source.Count && e.MoveNe... | Why isn't Skip() in LINQ to objects optimized? var res = new int[1000000].Skip(999999).First(); It would be great if this query would just use the indexer instead of traversing 999999 entries. I had a look into the System.Core.dll and noticed that in contrast to Skip(), the Count() extension method is optimized. If the... | TITLE:
Why isn't Skip() in LINQ to objects optimized?
QUESTION:
var res = new int[1000000].Skip(999999).First(); It would be great if this query would just use the indexer instead of traversing 999999 entries. I had a look into the System.Core.dll and noticed that in contrast to Skip(), the Count() extension method is... | [
".net",
"linq",
"optimization",
"linq-to-objects"
] | 5 | 3 | 723 | 2 | 0 | 2011-06-05T19:06:07.247000 | 2011-06-05T19:31:32.967000 |
6,245,174 | 6,245,219 | Update background color of table row using jquery | I used the following jquery to load an external html page into a div named content: $(document).ready(function(){ $("#content").load("content.html"); });
(function($) { $(function() { $('.load_link').click(function() { $("#content").load("content2.html"); return false; }); }); })(jQuery); The link (using ) that trigge... | How about: $('.load_link').click(function() { $("#content").load("content2.html"); var $row = $(this).closest("tr"); // find the parent and set the class $row.removeClass("rownotselected").addClass("rowselected"); // Set the class of the other rows: $row.siblings("tr").removeClass("rowselected").addClass("rownotselecte... | Update background color of table row using jquery I used the following jquery to load an external html page into a div named content: $(document).ready(function(){ $("#content").load("content.html"); });
(function($) { $(function() { $('.load_link').click(function() { $("#content").load("content2.html"); return false;... | TITLE:
Update background color of table row using jquery
QUESTION:
I used the following jquery to load an external html page into a div named content: $(document).ready(function(){ $("#content").load("content.html"); });
(function($) { $(function() { $('.load_link').click(function() { $("#content").load("content2.htm... | [
"javascript",
"jquery",
"html"
] | 2 | 1 | 1,201 | 1 | 0 | 2011-06-05T19:06:28.750000 | 2011-06-05T19:13:12.390000 |
6,245,185 | 6,245,338 | Setting javascript inside of php for Mobfox backfill | I'm using Mobfox as my primary ad network for a mobile app, and have identified the spot where I can backfill: if (preg_match(' ', $contents)){ global $no_ad_availible; $no_ad_availible=true; } else { $no_ad_availible=false; } The script I need inside of there is: I've tried everything I can think of, both loading the ... | You need to echo the JavaScript and image calls or (even better) temporarily end your PHP... if you simply put them in PHP code, they will be interpreted as PHP. I can't tell for sure if you want the code to be inserted if $no_ad_available == true or false. Either way, the same concept would apply, I'm going to assume ... | Setting javascript inside of php for Mobfox backfill I'm using Mobfox as my primary ad network for a mobile app, and have identified the spot where I can backfill: if (preg_match(' ', $contents)){ global $no_ad_availible; $no_ad_availible=true; } else { $no_ad_availible=false; } The script I need inside of there is: I'... | TITLE:
Setting javascript inside of php for Mobfox backfill
QUESTION:
I'm using Mobfox as my primary ad network for a mobile app, and have identified the spot where I can backfill: if (preg_match(' ', $contents)){ global $no_ad_availible; $no_ad_availible=true; } else { $no_ad_availible=false; } The script I need insi... | [
"php",
"javascript",
"mobile"
] | 0 | 0 | 436 | 1 | 0 | 2011-06-05T19:07:51.863000 | 2011-06-05T19:33:34.547000 |
6,245,190 | 6,245,227 | htaccess+modrewrite issue | I want that every user has a profile-url like this: www.example.com/username I have created this htaccess: RewriteEngine on RewriteRule ([^/]+) profile.php?username=$1 [L] but I get error with the css and js files. what I have to write in the htaccess? | You should in general exclude all real files and directories, as this will handle css/js/images/whatever else you want to serve: RewriteEngine On RewriteCond %{REQUEST_FILENAME}!-f RewriteCond %{REQUEST_FILENAME}!-d RewriteRule ^([^/]+)$ profile.php?username=$1 [L] | htaccess+modrewrite issue I want that every user has a profile-url like this: www.example.com/username I have created this htaccess: RewriteEngine on RewriteRule ([^/]+) profile.php?username=$1 [L] but I get error with the css and js files. what I have to write in the htaccess? | TITLE:
htaccess+modrewrite issue
QUESTION:
I want that every user has a profile-url like this: www.example.com/username I have created this htaccess: RewriteEngine on RewriteRule ([^/]+) profile.php?username=$1 [L] but I get error with the css and js files. what I have to write in the htaccess?
ANSWER:
You should in ... | [
".htaccess",
"mod-rewrite"
] | 3 | 3 | 46 | 2 | 0 | 2011-06-05T19:08:40.290000 | 2011-06-05T19:14:39.637000 |
6,245,195 | 6,257,378 | Can not set Devise user property sign_in_count in rspec controller test. It is reset to 0 in the controller | I have a controller which makes a test: @first_login = (@user.sign_in_count == 1) And I need to set it up with devise in the rspec spec: I have tried the four ideas: In all of them user is created like: user = Factory(:member) [see below for factory] user.stubs(:sign_in_count).returns(1) sign_in user get 'index'
user.... | Save the user. Seems like I have solved the problem with this in the spec: user = Factory(:customer) sign_in user user.sign_in_count = 1 user.save! get 'index' Not sure if this is intended in the way devise/warden's current_user helper method is supposed to be used in the controller, but it works. I'll leave it open if... | Can not set Devise user property sign_in_count in rspec controller test. It is reset to 0 in the controller I have a controller which makes a test: @first_login = (@user.sign_in_count == 1) And I need to set it up with devise in the rspec spec: I have tried the four ideas: In all of them user is created like: user = Fa... | TITLE:
Can not set Devise user property sign_in_count in rspec controller test. It is reset to 0 in the controller
QUESTION:
I have a controller which makes a test: @first_login = (@user.sign_in_count == 1) And I need to set it up with devise in the rspec spec: I have tried the four ideas: In all of them user is creat... | [
"ruby-on-rails",
"rspec",
"devise"
] | 0 | 0 | 1,659 | 2 | 0 | 2011-06-05T19:09:55.847000 | 2011-06-06T20:02:50.917000 |
6,245,216 | 6,246,339 | How can I get a random cell in OpenOffice Calc? | I've perused the Stack Exchange list of sites, and I can only think that SO is the right place to ask this (I saw a few excel questions, at least). I have an array of values Sheet1.B3:B9. On another sheet, I'm trying to get a random value from one of those cells. I suppose it has to be something with the RANK() functio... | In Excel, this will give random lookup into the range =INDEX(Sheet1!$B$3:$B$9,INT(RAND()*7)+1) Or you can give your source data range a name =INDEX(RandDataSource,INT(RAND()*ROWS(RandDataSource))+1) Don't know if it applies to Openoffice | How can I get a random cell in OpenOffice Calc? I've perused the Stack Exchange list of sites, and I can only think that SO is the right place to ask this (I saw a few excel questions, at least). I have an array of values Sheet1.B3:B9. On another sheet, I'm trying to get a random value from one of those cells. I suppos... | TITLE:
How can I get a random cell in OpenOffice Calc?
QUESTION:
I've perused the Stack Exchange list of sites, and I can only think that SO is the right place to ask this (I saw a few excel questions, at least). I have an array of values Sheet1.B3:B9. On another sheet, I'm trying to get a random value from one of tho... | [
"formula",
"worksheet-function",
"openoffice-calc"
] | 4 | 3 | 10,265 | 2 | 0 | 2011-06-05T19:12:26.177000 | 2011-06-05T22:28:35.563000 |
6,245,217 | 6,245,464 | Location based applications for android | I would like to develop a location based application for android. I have been writing some code and succesfully retrieve my current location. The thing is that i would like to be able to handle another people locations too (of course once registered in my service and accepted the terms of service). I am not sure wether... | I would build (and I did:)) own service for handling users' location. In case you will try to use google latitude you have to push your users register not only with you, but also with google application.... | Location based applications for android I would like to develop a location based application for android. I have been writing some code and succesfully retrieve my current location. The thing is that i would like to be able to handle another people locations too (of course once registered in my service and accepted the... | TITLE:
Location based applications for android
QUESTION:
I would like to develop a location based application for android. I have been writing some code and succesfully retrieve my current location. The thing is that i would like to be able to handle another people locations too (of course once registered in my servic... | [
"java",
"android",
"service",
"location",
"google-latitude"
] | 0 | 0 | 384 | 1 | 0 | 2011-06-05T19:12:37.230000 | 2011-06-05T19:55:01.317000 |
6,245,224 | 6,245,579 | zero mq pub/sub with multipart not working | Here's my script. #!/usr/bin/env python
import traceback import sys import zmq from time import sleep
print "Creating the zmq.Context" context = zmq.Context()
print "Binding the publisher to the local socket at port 5557" sender = context.socket(zmq.PUB) sender.bind("tcp://*:5557")
print "Binding the subscriber to ... | Credit: Chuck Remes You may need a "sleep" between the socket creation steps (bind, connect, setsockopt) and the actual transmission of the messages. The bind & connect operations are asynchronous, so they may not complete by the time you get to the logic that sends all of the messages. In that case, any messages sent ... | zero mq pub/sub with multipart not working Here's my script. #!/usr/bin/env python
import traceback import sys import zmq from time import sleep
print "Creating the zmq.Context" context = zmq.Context()
print "Binding the publisher to the local socket at port 5557" sender = context.socket(zmq.PUB) sender.bind("tcp://... | TITLE:
zero mq pub/sub with multipart not working
QUESTION:
Here's my script. #!/usr/bin/env python
import traceback import sys import zmq from time import sleep
print "Creating the zmq.Context" context = zmq.Context()
print "Binding the publisher to the local socket at port 5557" sender = context.socket(zmq.PUB) s... | [
"python",
"publish-subscribe",
"zeromq"
] | 7 | 11 | 7,201 | 3 | 0 | 2011-06-05T19:13:44.337000 | 2011-06-05T20:15:18.963000 |
6,245,236 | 6,245,957 | Clickable TextView only works once | I made a textview clickable then it triggers an intent, it works but only once. After clicking the textview the first time it's no longer clickable and I have no idea why. Your help will be appreciated. TextView txt = (TextView) findViewById(R.id.textView1);
txt.setOnLongClickListener(new OnLongClickListener() {
publ... | What does the alert class do? If it is an activity it could be that it is being laid over the top of your current activity so although you can see your activity, it's not at the top of the stack/in the foreground so you're not actually pressing the TextView, you're pressing a transparent activity that is over the top o... | Clickable TextView only works once I made a textview clickable then it triggers an intent, it works but only once. After clicking the textview the first time it's no longer clickable and I have no idea why. Your help will be appreciated. TextView txt = (TextView) findViewById(R.id.textView1);
txt.setOnLongClickListene... | TITLE:
Clickable TextView only works once
QUESTION:
I made a textview clickable then it triggers an intent, it works but only once. After clicking the textview the first time it's no longer clickable and I have no idea why. Your help will be appreciated. TextView txt = (TextView) findViewById(R.id.textView1);
txt.set... | [
"android",
"textview"
] | 0 | 0 | 670 | 2 | 0 | 2011-06-05T19:16:44.250000 | 2011-06-05T21:23:28.403000 |
6,245,244 | 6,245,285 | Google Analytics Javascript error | I have this page which used to return some other JavaScript errors, but it seems I fixed them since the system now complains differently:) Here is the page: http://www.comehike.com/outdoors/parks/trailhead.php And here is the JS error I am getting in the console: Unable to post message to http://googleads.g.doubleclick... | The error most likely is a side effect of something else going on on the page. Specifically something with the google maps API. The error Firefox throws is Error: uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://... | Google Analytics Javascript error I have this page which used to return some other JavaScript errors, but it seems I fixed them since the system now complains differently:) Here is the page: http://www.comehike.com/outdoors/parks/trailhead.php And here is the JS error I am getting in the console: Unable to post message... | TITLE:
Google Analytics Javascript error
QUESTION:
I have this page which used to return some other JavaScript errors, but it seems I fixed them since the system now complains differently:) Here is the page: http://www.comehike.com/outdoors/parks/trailhead.php And here is the JS error I am getting in the console: Unab... | [
"php",
"javascript",
"google-analytics"
] | 0 | 1 | 783 | 1 | 0 | 2011-06-05T19:18:15.210000 | 2011-06-05T19:24:04.413000 |
6,245,245 | 6,246,218 | cgimagemaskcreate and memory leak, how to fix it | i have this code: Texture2D *cachedTexture;
if(cachedTexture = [cachedTextures objectForKey:aName]) { return cachedTexture; }
// We are using imageWithContentsOfFile rather than imageNamed, as imageNamed caches the image in the device. // This can lead to memory issue as we do not have direct control over when it wou... | Use CGImageRelease(mask) CGImageMaskCreate returns a CGImageRef with a retain count of 1. | cgimagemaskcreate and memory leak, how to fix it i have this code: Texture2D *cachedTexture;
if(cachedTexture = [cachedTextures objectForKey:aName]) { return cachedTexture; }
// We are using imageWithContentsOfFile rather than imageNamed, as imageNamed caches the image in the device. // This can lead to memory issue ... | TITLE:
cgimagemaskcreate and memory leak, how to fix it
QUESTION:
i have this code: Texture2D *cachedTexture;
if(cachedTexture = [cachedTextures objectForKey:aName]) { return cachedTexture; }
// We are using imageWithContentsOfFile rather than imageNamed, as imageNamed caches the image in the device. // This can lea... | [
"objective-c",
"memory-leaks",
"cgimagemaskcreate"
] | 0 | 1 | 1,343 | 2 | 0 | 2011-06-05T19:18:43.650000 | 2011-06-05T22:08:50.603000 |
6,245,246 | 6,245,292 | Translating #!/bin/ksh date conversion function into #!/bin/sh | I used this ksh function for converting "1-Jan-2011" format to "1.1.2011." #!/bin/ksh
##---- function to convert 3 char month into numeric value ---------- convertDate() { echo $1 | awk -F"-" '{print $1,$2,$3}' | read day mm yyyy ## split the date arg typeset -u mmm=`echo $mm` ## set month to uppercase typeset -u mont... | The problem is that whether the read command runs in a subshell due to the pipeline depends on exactly which shell /bin/sh is; you will get one behavior from bash and another from legacy UNIX (e.g. Solaris) /bin/sh. Use set instead. set -- `echo $1 | awk -F"-" '{print $1,$2,$3}'` although I would probably write oIFS="$... | Translating #!/bin/ksh date conversion function into #!/bin/sh I used this ksh function for converting "1-Jan-2011" format to "1.1.2011." #!/bin/ksh
##---- function to convert 3 char month into numeric value ---------- convertDate() { echo $1 | awk -F"-" '{print $1,$2,$3}' | read day mm yyyy ## split the date arg type... | TITLE:
Translating #!/bin/ksh date conversion function into #!/bin/sh
QUESTION:
I used this ksh function for converting "1-Jan-2011" format to "1.1.2011." #!/bin/ksh
##---- function to convert 3 char month into numeric value ---------- convertDate() { echo $1 | awk -F"-" '{print $1,$2,$3}' | read day mm yyyy ## split... | [
"linux",
"shell",
"unix",
"scripting"
] | 0 | 2 | 1,010 | 1 | 0 | 2011-06-05T19:19:08.573000 | 2011-06-05T19:25:19.333000 |
6,245,255 | 6,246,505 | Full text search works in mysql but not php | I have the following in php: public function myfunction($v){ //ini_set("memory_limit","32M"); $v=mysqli_real_escape_string($this->connection,$v); $stmt=mysqli_prepare($this->connection,"SELECT * from TABLE WHERE MATCH(column) AGAINST($v)");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt); $this->throwExcep... | Because you save all the records that mysql gave in your $rows array. If the recordset is huge then you get that error. Also your syntax with a double call of mysqli_stmt_bind_result($stmt,$row->column1,$row->column2); isn't that good looking | Full text search works in mysql but not php I have the following in php: public function myfunction($v){ //ini_set("memory_limit","32M"); $v=mysqli_real_escape_string($this->connection,$v); $stmt=mysqli_prepare($this->connection,"SELECT * from TABLE WHERE MATCH(column) AGAINST($v)");
$this->throwExceptionOnError();
m... | TITLE:
Full text search works in mysql but not php
QUESTION:
I have the following in php: public function myfunction($v){ //ini_set("memory_limit","32M"); $v=mysqli_real_escape_string($this->connection,$v); $stmt=mysqli_prepare($this->connection,"SELECT * from TABLE WHERE MATCH(column) AGAINST($v)");
$this->throwExce... | [
"php",
"mysql"
] | 1 | 0 | 145 | 1 | 0 | 2011-06-05T19:20:10.647000 | 2011-06-05T23:04:09.060000 |
6,245,257 | 6,245,584 | Chart based on two series and two axis in VB (Excel) | I'd like to generate a chart in Excel using VB. The chart needs to have two series. One of them should be displayed as values and the other used as x-axis. How can I do that? Additionally, how to set labels for the series? Here is my code that plots one set of values on chart: ActiveChart.ChartType = xlXYScatterLines '... | Give this a try... Sub AddNewSeries() With ActiveChart.SeriesCollection.NewSeries.Name = '//Name of Series Goes Here//.Values = Worksheets("My Label").Range("H8:H11") '// change with range of intended x-axis values.XValues = Worksheets("My Label").Range("A8:A11").HasDataLabels = True End With End Sub Read more: Quick E... | Chart based on two series and two axis in VB (Excel) I'd like to generate a chart in Excel using VB. The chart needs to have two series. One of them should be displayed as values and the other used as x-axis. How can I do that? Additionally, how to set labels for the series? Here is my code that plots one set of values... | TITLE:
Chart based on two series and two axis in VB (Excel)
QUESTION:
I'd like to generate a chart in Excel using VB. The chart needs to have two series. One of them should be displayed as values and the other used as x-axis. How can I do that? Additionally, how to set labels for the series? Here is my code that plots... | [
"excel",
"excel-2007",
"excel-2010",
"vba"
] | 0 | 1 | 1,727 | 1 | 0 | 2011-06-05T19:20:35.300000 | 2011-06-05T20:16:33.780000 |
6,245,258 | 6,255,351 | How to make search engines prefer updated content instead of archives? | We archive documentation for every release, but the top google result is often several years old instead of from the latest release. If we use robots.txt to disallow indexing the old stuff entirely, then a search including that version number would no longer be helpful. The old docs would still be accessible by navigat... | Your best bet is to create a google xml sitemap and set the priority of your content pages higher than the archives. This is no guarantee of anything, but it's probably the only thing you can really do to attempt to control it. I wouldn't worry about it too much, just put a notice about the deprecated APIs and a link b... | How to make search engines prefer updated content instead of archives? We archive documentation for every release, but the top google result is often several years old instead of from the latest release. If we use robots.txt to disallow indexing the old stuff entirely, then a search including that version number would ... | TITLE:
How to make search engines prefer updated content instead of archives?
QUESTION:
We archive documentation for every release, but the top google result is often several years old instead of from the latest release. If we use robots.txt to disallow indexing the old stuff entirely, then a search including that ver... | [
"documentation",
"search-engine",
"google-index"
] | 0 | 1 | 35 | 1 | 0 | 2011-06-05T19:20:40.967000 | 2011-06-06T16:50:55.003000 |
6,245,260 | 6,246,481 | Installers: WIX or Inno Setup? | I'm comparing these two tools. The impression I have is: Inno Setup does not produce an MSI, but can do everything WIX can do WIX does produce an MSI, but has a steep learning curve Do you agree with this characterization? What other differences are there? How does WIX# shake-up this story? Since Inno Setup does not us... | It's been a long time since I worked with MSI, when I switched to InnoSetup I never looked back. I did not want my installation to be a headache. I needed something where I could "Set it and forget it" By default InnoSetup produces an uninstall. It can handle simple or complex install and uninstall needs. With InnoSetu... | Installers: WIX or Inno Setup? I'm comparing these two tools. The impression I have is: Inno Setup does not produce an MSI, but can do everything WIX can do WIX does produce an MSI, but has a steep learning curve Do you agree with this characterization? What other differences are there? How does WIX# shake-up this stor... | TITLE:
Installers: WIX or Inno Setup?
QUESTION:
I'm comparing these two tools. The impression I have is: Inno Setup does not produce an MSI, but can do everything WIX can do WIX does produce an MSI, but has a steep learning curve Do you agree with this characterization? What other differences are there? How does WIX# ... | [
"windows",
"installation",
"wix",
"inno-setup"
] | 53 | 49 | 24,531 | 5 | 0 | 2011-06-05T19:21:09.900000 | 2011-06-05T22:59:47.383000 |
6,245,262 | 6,245,279 | Getting the row of the table cell that was just clicked | I have the following: $('tbody').delegate('td','click',function() { log($(this).index()); // Column }); Q: How do I determine the row? | Use the.parent() method. $('tbody').delegate('td','click',function() { $(this).parent(); // tr }); Or you can use:.closest() Traverse up the tree, starting at current element..parents() Traverse up the tree starting with parent element. | Getting the row of the table cell that was just clicked I have the following: $('tbody').delegate('td','click',function() { log($(this).index()); // Column }); Q: How do I determine the row? | TITLE:
Getting the row of the table cell that was just clicked
QUESTION:
I have the following: $('tbody').delegate('td','click',function() { log($(this).index()); // Column }); Q: How do I determine the row?
ANSWER:
Use the.parent() method. $('tbody').delegate('td','click',function() { $(this).parent(); // tr }); Or ... | [
"javascript",
"jquery"
] | 1 | 3 | 402 | 2 | 0 | 2011-06-05T19:21:20.663000 | 2011-06-05T19:23:13.057000 |
6,245,278 | 6,245,366 | mix-up WebForm and MVC in one project vs separate them in 2 projects in the same solution | I've tried to mix up WebForm and MVC in the same application, but so far I've failed miserably. It looks like I'm missing some steps some how some where. I'm really tired. I wonder if just it's bad prectice to have 3 projects in a solution: The first one for the Model, the second one for the Webform, and the last one f... | If you have two separate projects one for MVC and one for classic WebForms it's like you have two distinct web applications. Those two should be deployed separately in different virtual folders in IIS. On the other hand you have the possibility to mix classic WebForms and ASP.NET MVC in the same project. Usually people... | mix-up WebForm and MVC in one project vs separate them in 2 projects in the same solution I've tried to mix up WebForm and MVC in the same application, but so far I've failed miserably. It looks like I'm missing some steps some how some where. I'm really tired. I wonder if just it's bad prectice to have 3 projects in a... | TITLE:
mix-up WebForm and MVC in one project vs separate them in 2 projects in the same solution
QUESTION:
I've tried to mix up WebForm and MVC in the same application, but so far I've failed miserably. It looks like I'm missing some steps some how some where. I'm really tired. I wonder if just it's bad prectice to ha... | [
"asp.net"
] | 2 | 3 | 1,813 | 1 | 0 | 2011-06-05T19:23:12.100000 | 2011-06-05T19:38:10.070000 |
6,245,280 | 6,245,353 | cURL PHP and request referrer | what is default referrer URL which from are coming cURL requests in PHP?Is it customizable? For example when I make this request.. $curl = curl_init("https://3dsecure.csas.cz/transaction"); curl_setopt_array($curl, array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_AUTOREFERER => true, ... | Default referer is none. You can set your own via CURLOPT_REFERER option. CURLOPT_AUTOREFERER is for redirects. | cURL PHP and request referrer what is default referrer URL which from are coming cURL requests in PHP?Is it customizable? For example when I make this request.. $curl = curl_init("https://3dsecure.csas.cz/transaction"); curl_setopt_array($curl, array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($data),... | TITLE:
cURL PHP and request referrer
QUESTION:
what is default referrer URL which from are coming cURL requests in PHP?Is it customizable? For example when I make this request.. $curl = curl_init("https://3dsecure.csas.cz/transaction"); curl_setopt_array($curl, array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_b... | [
"php",
"url",
"curl"
] | 1 | 7 | 3,489 | 1 | 0 | 2011-06-05T19:23:21.353000 | 2011-06-05T19:35:12.253000 |
6,245,284 | 6,245,387 | where to put secure passwords/keys in a rails app? | I have a few web services that require secure tokens/keys/passwords to be passed in. Where should I define these secure values for my rails app to see? I want the development keys in version control, but don't want the production keys in version control. How should I set this up? I'm new to rails. | You see the question properly. Put your passwords and keys in some yml file excluded from version control. Then on your production server, create the very same file and symlink your app to it every time you deploy. EDIT. Capistrano is almost made to fits these needs: put your yml files in the shared folder In your capi... | where to put secure passwords/keys in a rails app? I have a few web services that require secure tokens/keys/passwords to be passed in. Where should I define these secure values for my rails app to see? I want the development keys in version control, but don't want the production keys in version control. How should I s... | TITLE:
where to put secure passwords/keys in a rails app?
QUESTION:
I have a few web services that require secure tokens/keys/passwords to be passed in. Where should I define these secure values for my rails app to see? I want the development keys in version control, but don't want the production keys in version contr... | [
"ruby-on-rails",
"security"
] | 4 | 4 | 932 | 3 | 0 | 2011-06-05T19:24:00.523000 | 2011-06-05T19:42:15.233000 |
6,245,289 | 6,245,299 | Securing A Web Service .Net | I am looking all over the internet and cannot seem to find a good example on how to pass credentials to a web service to secure it. Can someone point me to a detailed sample how to add security to a web service? It looks like everyone is using a WCF Model for this. Is ASMX getting phased out? If not I am looking to pas... | Take a look here: Programming WCF Security at MSDN WCF Security Guidance by Microsoft Patterns & Practices | Securing A Web Service .Net I am looking all over the internet and cannot seem to find a good example on how to pass credentials to a web service to secure it. Can someone point me to a detailed sample how to add security to a web service? It looks like everyone is using a WCF Model for this. Is ASMX getting phased out... | TITLE:
Securing A Web Service .Net
QUESTION:
I am looking all over the internet and cannot seem to find a good example on how to pass credentials to a web service to secure it. Can someone point me to a detailed sample how to add security to a web service? It looks like everyone is using a WCF Model for this. Is ASMX ... | [
".net",
"web-services"
] | 2 | 1 | 521 | 2 | 0 | 2011-06-05T19:24:47.127000 | 2011-06-05T19:27:01.867000 |
6,245,293 | 6,245,903 | Extract version number from file in shell script | I'm trying to write a bash script that increments the version number which is given in {major}.{minor}.{revision} For example. 1.2.13 Is there a good way to easily extract those 3 numbers using something like sed or awk such that I could increment the {revision} number and output the full version number string. | $ v=1.2.13 $ echo "${v%.*}.$((${v##*.}+1))" 1.2.14 $ v=11.1.2.3.0 $ echo "${v%.*}.$((${v##*.}+1))" 11.1.2.3.1 Here is how it works: The string is split in two parts. the first one contains everything but the last dot and next characters: ${v%.*} the second one contains everything but all characters up to the last dot: ... | Extract version number from file in shell script I'm trying to write a bash script that increments the version number which is given in {major}.{minor}.{revision} For example. 1.2.13 Is there a good way to easily extract those 3 numbers using something like sed or awk such that I could increment the {revision} number a... | TITLE:
Extract version number from file in shell script
QUESTION:
I'm trying to write a bash script that increments the version number which is given in {major}.{minor}.{revision} For example. 1.2.13 Is there a good way to easily extract those 3 numbers using something like sed or awk such that I could increment the {... | [
"bash",
"shell",
"scripting",
"sed"
] | 50 | 77 | 55,632 | 9 | 0 | 2011-06-05T19:25:40.583000 | 2011-06-05T21:11:37.020000 |
6,245,295 | 6,245,408 | Destructor parameters | The article Are destructors overloadable? talks about overloading the destructor. This raised a question: Can a destructor have parameters? I've never used or seen a destructor with parameters. I could not come up with an example of a reason to use parameters to the destructor. | Section §12.4 of C++0x draft n3290 has this to say about destructors: Destructors A special declarator syntax using an optional function-specifier (7.1.2) followed by ˜ followed by the destructor’s class name followed by an empty parameter list is used to declare the destructor in a class definition. (emphasis added) So ... | Destructor parameters The article Are destructors overloadable? talks about overloading the destructor. This raised a question: Can a destructor have parameters? I've never used or seen a destructor with parameters. I could not come up with an example of a reason to use parameters to the destructor. | TITLE:
Destructor parameters
QUESTION:
The article Are destructors overloadable? talks about overloading the destructor. This raised a question: Can a destructor have parameters? I've never used or seen a destructor with parameters. I could not come up with an example of a reason to use parameters to the destructor.
... | [
"c++",
"parameters",
"destructor"
] | 42 | 53 | 40,926 | 4 | 0 | 2011-06-05T19:26:29.727000 | 2011-06-05T19:45:17.250000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.