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,259,748
6,259,869
how to send email from input fields - my code debugging
i seem to have encountered a problem here.. i have the 2 edittext boxes and one button. when i click the button it gives me an option of what way to send the message, however it does not capture what my inputs are but gives out a weird message saying This is a Testandroid.widget.EditText@47b84299android.widget.EditText...
try: i.putExtra(Intent.EXTRA_TEXT, "\nThis is a Test" + input1.getText().toString() + input2.getText().toString());
how to send email from input fields - my code debugging i seem to have encountered a problem here.. i have the 2 edittext boxes and one button. when i click the button it gives me an option of what way to send the message, however it does not capture what my inputs are but gives out a weird message saying This is a Tes...
TITLE: how to send email from input fields - my code debugging QUESTION: i seem to have encountered a problem here.. i have the 2 edittext boxes and one button. when i click the button it gives me an option of what way to send the message, however it does not capture what my inputs are but gives out a weird message sa...
[ "android", "eclipse" ]
1
1
302
1
0
2011-06-07T01:17:48.263000
2011-06-07T01:46:27.313000
6,259,750
6,260,258
Setting width of a TextBlock vs a Grid
If there's a TextBlock inside a Grid, what's the best way (performance wise) to set its width and height? Is setting them in the TextBlock's properties will be better than setting it as Grid's properties? basically what I'm asking is which one of the following is better: vs
Using a Grid purely to constrain a TextBox is not really a good way to set the width of the TextBox. A Grid is more for laying out multiple controls. However this is perfectly acceptable: This is along the same lines as what @Ahmed suggested. Generally with a XAML layout the recommendation is to use a proportional layo...
Setting width of a TextBlock vs a Grid If there's a TextBlock inside a Grid, what's the best way (performance wise) to set its width and height? Is setting them in the TextBlock's properties will be better than setting it as Grid's properties? basically what I'm asking is which one of the following is better: vs
TITLE: Setting width of a TextBlock vs a Grid QUESTION: If there's a TextBlock inside a Grid, what's the best way (performance wise) to set its width and height? Is setting them in the TextBlock's properties will be better than setting it as Grid's properties? basically what I'm asking is which one of the following is...
[ "wpf", "height", "width" ]
0
0
516
4
0
2011-06-07T01:18:18.617000
2011-06-07T03:09:53.463000
6,259,751
6,259,790
how to make a long url spread into two lines
I have a very narrow column and a three-word URL that is pushing wider that the column's original width. can i force the three words to spread over two or three lines and keep the URL link intact? I am using css to style a custom drupal theme and the length/name of this url is a Drupal node name turned into a tab via t...
Try using: word-wrap: break-word; I don't think its supported in all browsers though. See http://jsfiddle.net/jrRqb/ for an example
how to make a long url spread into two lines I have a very narrow column and a three-word URL that is pushing wider that the column's original width. can i force the three words to spread over two or three lines and keep the URL link intact? I am using css to style a custom drupal theme and the length/name of this url ...
TITLE: how to make a long url spread into two lines QUESTION: I have a very narrow column and a three-word URL that is pushing wider that the column's original width. can i force the three words to spread over two or three lines and keep the URL link intact? I am using css to style a custom drupal theme and the length...
[ "css", "url", "drupal-6", "hyperlink", "line-breaks" ]
4
4
5,292
2
0
2011-06-07T01:18:40.560000
2011-06-07T01:26:55.677000
6,259,756
6,259,759
Easy way to create an array in PHP
I have 2 arrays: first array is a bunch of keys. second array is a bunch of values. I would like to merge them into an associated array in PHP. Is there a simpler way to do this other than using loops?
Use array_combine() function: http://php.net/manual/en/function.array-combine.php Snippet: $keys = array('a', 'b', 'c', 'd'); $values = array(1, 2, 3, 4); $result = array_combine($keys, $values); var_dump($result); Result: array(4) { ["a"]=> int(1) ["b"]=> int(2) ["c"]=> int(3) ["d"]=> int(4) }
Easy way to create an array in PHP I have 2 arrays: first array is a bunch of keys. second array is a bunch of values. I would like to merge them into an associated array in PHP. Is there a simpler way to do this other than using loops?
TITLE: Easy way to create an array in PHP QUESTION: I have 2 arrays: first array is a bunch of keys. second array is a bunch of values. I would like to merge them into an associated array in PHP. Is there a simpler way to do this other than using loops? ANSWER: Use array_combine() function: http://php.net/manual/en/f...
[ "php", "arrays", "loops" ]
4
8
131
2
0
2011-06-07T01:20:34.080000
2011-06-07T01:21:25.980000
6,259,770
6,259,794
Adding column_name != 3 returns much fewer results
I have this database query: select scheduled_hike_id, hike_date, hike_title, hike_group_id, hike_privacy, hike_description, DAYOFMONTH(hike_date), DAYNAME(hike_date), YEAR(hike_date), MONTH(hike_date) from scheduled_hikes where is_cancelled is null and hike_date > DATE_ADD(NOW(), INTERVAL -1 DAY) and show_on_home_page ...
If hike_privacy is null, it won't match hike_privacy!= 3. Try: and (hike_privacy!= 3 or hike_privacy is null) Nulls never match non "null style" comparisons. Note: Make sure you use brackets around your "OR" terms! In SQL, OR takes precedence, so without the brackets it would parsed as if it was coded like this (note t...
Adding column_name != 3 returns much fewer results I have this database query: select scheduled_hike_id, hike_date, hike_title, hike_group_id, hike_privacy, hike_description, DAYOFMONTH(hike_date), DAYNAME(hike_date), YEAR(hike_date), MONTH(hike_date) from scheduled_hikes where is_cancelled is null and hike_date > DATE...
TITLE: Adding column_name != 3 returns much fewer results QUESTION: I have this database query: select scheduled_hike_id, hike_date, hike_title, hike_group_id, hike_privacy, hike_description, DAYOFMONTH(hike_date), DAYNAME(hike_date), YEAR(hike_date), MONTH(hike_date) from scheduled_hikes where is_cancelled is null an...
[ "mysql", "sql", "database" ]
0
0
44
2
0
2011-06-07T01:23:07.353000
2011-06-07T01:27:42.340000
6,259,773
6,259,817
jQuery ajax not working with JS confirmation modal
When a user clicks on Delete this post a modal pops up asking if the user is sure. If OK, the AJAX proceeds as normal. But if the user clicks on Cancel, the delete action is happening as well. I've tried return false in several parts of this AJAX code but it completely blocks the AJAX request. I'd like to accomplish th...
You need to return the result of the confirm — return false if the user cancels. It would be simpler to use an if to only send the request if the user clicks OK in the first place.
jQuery ajax not working with JS confirmation modal When a user clicks on Delete this post a modal pops up asking if the user is sure. If OK, the AJAX proceeds as normal. But if the user clicks on Cancel, the delete action is happening as well. I've tried return false in several parts of this AJAX code but it completely...
TITLE: jQuery ajax not working with JS confirmation modal QUESTION: When a user clicks on Delete this post a modal pops up asking if the user is sure. If OK, the AJAX proceeds as normal. But if the user clicks on Cancel, the delete action is happening as well. I've tried return false in several parts of this AJAX code...
[ "jquery", "ajax", "modal-dialog" ]
2
2
1,655
3
0
2011-06-07T01:23:37.517000
2011-06-07T01:34:33.897000
6,259,775
6,259,981
How to display the current year in a Django template?
What is the inbuilt template tag to display the present year dynamically. Like "2011" what would be the template tag to display that?
The full tag to print just the current year is {% now "Y" %}. Note that the Y must be in quotes.
How to display the current year in a Django template? What is the inbuilt template tag to display the present year dynamically. Like "2011" what would be the template tag to display that?
TITLE: How to display the current year in a Django template? QUESTION: What is the inbuilt template tag to display the present year dynamically. Like "2011" what would be the template tag to display that? ANSWER: The full tag to print just the current year is {% now "Y" %}. Note that the Y must be in quotes.
[ "python", "django" ]
195
396
74,425
5
0
2011-06-07T01:23:45.510000
2011-06-07T02:10:49.947000
6,259,779
6,259,851
WPF: view that scales to container at large sizes, scrolls at small sizes?
I am building a control depicting a diagram. The control's content (which is rather complex) will try to scale to fit allotted space to the extent possible. However, not all scales are valid. The content cannot shrink indefinitely. E.g. a box on a diagram should be at least 20 pixels wide. Thus, when the window is too ...
Set the Horizontal & VerticalAlignment of the content to Stretch but also set the MinWidth and MinHeight to appropriate values, place your content in a ScrollViewer whose Horizontal & VerticalScrollBarVisibility is set to Auto. That should work, probably... Example:
WPF: view that scales to container at large sizes, scrolls at small sizes? I am building a control depicting a diagram. The control's content (which is rather complex) will try to scale to fit allotted space to the extent possible. However, not all scales are valid. The content cannot shrink indefinitely. E.g. a box on...
TITLE: WPF: view that scales to container at large sizes, scrolls at small sizes? QUESTION: I am building a control depicting a diagram. The control's content (which is rather complex) will try to scale to fit allotted space to the extent possible. However, not all scales are valid. The content cannot shrink indefinit...
[ "wpf", "layout", "scroll", "size", "containers" ]
0
0
273
1
0
2011-06-07T01:24:48.490000
2011-06-07T01:43:37.220000
6,259,784
6,259,895
Help with PHP and filepaths
I am using windows right now but I need my script to work on windows or linux. I am working on a project which allows to upload video to youtube, the youtube library requires the use of Zend framework (unfortunately) so I am really trying to get it to work, with no luck. So my page says Warning: require_once(Zend/Loade...
If you want to change the include path in php.ini, just change include_path. Check out this tutorial to find out about a myriad of ways of changing the include path.
Help with PHP and filepaths I am using windows right now but I need my script to work on windows or linux. I am working on a project which allows to upload video to youtube, the youtube library requires the use of Zend framework (unfortunately) so I am really trying to get it to work, with no luck. So my page says Warn...
TITLE: Help with PHP and filepaths QUESTION: I am using windows right now but I need my script to work on windows or linux. I am working on a project which allows to upload video to youtube, the youtube library requires the use of Zend framework (unfortunately) so I am really trying to get it to work, with no luck. So...
[ "php", "zend-framework", "include-path" ]
0
2
153
2
0
2011-06-07T01:25:39.013000
2011-06-07T01:54:28.570000
6,259,801
6,259,826
How to use a custom Zend Framework form in a directory inside application
I have a "forms" directory inside my application directory with custom form php files in there. In my application.ini the appnamespace is "Application". The form name I'm trying to use is BetaSignup.php. The class is Application_Form_BetaSignup. In my controller I try to do $form = new Application_Form_BetaSignup, and ...
You can use the typical application/forms directory for your form classes if you name them appropriately using the configured appnamespace directive (default "Application"). Please note, the directory name is lowercase "forms". For example, say you have a registration form "Registration". Create the file at application...
How to use a custom Zend Framework form in a directory inside application I have a "forms" directory inside my application directory with custom form php files in there. In my application.ini the appnamespace is "Application". The form name I'm trying to use is BetaSignup.php. The class is Application_Form_BetaSignup. ...
TITLE: How to use a custom Zend Framework form in a directory inside application QUESTION: I have a "forms" directory inside my application directory with custom form php files in there. In my application.ini the appnamespace is "Application". The form name I'm trying to use is BetaSignup.php. The class is Application...
[ "php", "zend-framework", "zend-form" ]
2
2
343
1
0
2011-06-07T01:31:03.663000
2011-06-07T01:36:47.440000
6,259,807
6,259,820
jQuery UI tabs replace part of file name on tabsshow
I am using jQuery and Joomla. Sinca I need to use jQuery.noConlict() due to the use of other javascript libraries, I use jQuery instead of $ I have a set of tabs. I am using jQuery UI. I am using the fadein fadeout through opacity toggle, and the rotation (all working fine) I want to change the file name of the img tag...
It should be like this: jQuery( "#tabs" ).bind('tabsshow', function(event, ui){ var image = jQuery(ui.tab).children(); image.attr("src",image.attr("src").replace(".png","-active.png")); var liContent = image.attr("src"); alert(liContent); }); Or Like this: jQuery( "#tabs" ).bind('tabsshow', function(event, ui){ var im...
jQuery UI tabs replace part of file name on tabsshow I am using jQuery and Joomla. Sinca I need to use jQuery.noConlict() due to the use of other javascript libraries, I use jQuery instead of $ I have a set of tabs. I am using jQuery UI. I am using the fadein fadeout through opacity toggle, and the rotation (all workin...
TITLE: jQuery UI tabs replace part of file name on tabsshow QUESTION: I am using jQuery and Joomla. Sinca I need to use jQuery.noConlict() due to the use of other javascript libraries, I use jQuery instead of $ I have a set of tabs. I am using jQuery UI. I am using the fadein fadeout through opacity toggle, and the ro...
[ "jquery-ui", "replace" ]
0
0
484
1
0
2011-06-07T01:31:46.997000
2011-06-07T01:34:58.823000
6,259,811
6,260,216
Given a Facebook username, how do I get the ID of the profile?
I want the ID, not the username. But given the username...what do I have to do?
https://graph.facebook.com/username e.g. https://graph.facebook.com/boxoft { "id": "1264933131", "name": "Box He", "first_name": "Box", "last_name": "He", "link": " http://www.facebook.com/boxoft ", "username": "boxoft", "gender": "male", "locale": "en_US" }
Given a Facebook username, how do I get the ID of the profile? I want the ID, not the username. But given the username...what do I have to do?
TITLE: Given a Facebook username, how do I get the ID of the profile? QUESTION: I want the ID, not the username. But given the username...what do I have to do? ANSWER: https://graph.facebook.com/username e.g. https://graph.facebook.com/boxoft { "id": "1264933131", "name": "Box He", "first_name": "Box", "last_name": "...
[ "facebook", "facebook-graph-api" ]
6
13
9,911
2
0
2011-06-07T01:32:59.197000
2011-06-07T02:58:25.953000
6,259,816
6,259,843
Forward and back native buttons in UIWebview iphone
Inside the Twitter iPhone app, if you click on a link it pushes in a WebView. Ive gotten this far, but I can't find the correct identifier for the forward and backward buttons like at the bottom left of the image below. Are they native? or are they just images they have created themselves?
Per the list of UIBarButtonItems from the docs, those items you desire need to be custom images a they are not provided in the current SDK.
Forward and back native buttons in UIWebview iphone Inside the Twitter iPhone app, if you click on a link it pushes in a WebView. Ive gotten this far, but I can't find the correct identifier for the forward and backward buttons like at the bottom left of the image below. Are they native? or are they just images they ha...
TITLE: Forward and back native buttons in UIWebview iphone QUESTION: Inside the Twitter iPhone app, if you click on a link it pushes in a WebView. Ive gotten this far, but I can't find the correct identifier for the forward and backward buttons like at the bottom left of the image below. Are they native? or are they j...
[ "iphone", "objective-c", "button", "uiwebview" ]
1
1
7,101
2
0
2011-06-07T01:34:01.887000
2011-06-07T01:42:11.557000
6,259,823
6,259,963
Installing secure CodeIgniter with Sparks
Installing Sparks assumes that you are abiding by the default CodeIgniter installation pattern; extracting the application, system, and user guide folders, along with with a index.php and a license file into your web root. However, many of us pull the application and system folders out of the web root for security reas...
To answer my own question: The solution was in the MY_Loader.php file. By modifying the SPARKPATH variable on line 43, one can reroute the location of all sparks! Cheers!
Installing secure CodeIgniter with Sparks Installing Sparks assumes that you are abiding by the default CodeIgniter installation pattern; extracting the application, system, and user guide folders, along with with a index.php and a license file into your web root. However, many of us pull the application and system fol...
TITLE: Installing secure CodeIgniter with Sparks QUESTION: Installing Sparks assumes that you are abiding by the default CodeIgniter installation pattern; extracting the application, system, and user guide folders, along with with a index.php and a license file into your web root. However, many of us pull the applicat...
[ "codeigniter", "security", "sparks-pakage-management" ]
14
14
3,358
1
0
2011-06-07T01:35:46.053000
2011-06-07T02:06:46.163000
6,259,825
6,290,152
Hide php extension, force trailing slash - common question, always a crappy answer. Tell me if I got it right
I hate to ask this question because it's been asked a million times, but the answers never seem satisfactory, and most of the threads seem abandoned without an accepted answer. Here's exactly what I need to do (bad urls are intentional due to low karma): http://example.com/file.php redirects to http://example.com/file/...
Oh, I have the answer to this one! This little rewrite snippet to go in.htaccess will remove the extension from any file you specify in its url. RewriteEngine on RewriteCond %{REQUEST_FILENAME}!-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteBase / RewriteCond %{REQUEST_URI}!(.*)/$ RewriteRu...
Hide php extension, force trailing slash - common question, always a crappy answer. Tell me if I got it right I hate to ask this question because it's been asked a million times, but the answers never seem satisfactory, and most of the threads seem abandoned without an accepted answer. Here's exactly what I need to do ...
TITLE: Hide php extension, force trailing slash - common question, always a crappy answer. Tell me if I got it right QUESTION: I hate to ask this question because it's been asked a million times, but the answers never seem satisfactory, and most of the threads seem abandoned without an accepted answer. Here's exactly ...
[ ".htaccess", "mod-rewrite", "redirect" ]
6
2
1,441
1
0
2011-06-07T01:36:44.130000
2011-06-09T08:39:38.263000
6,259,840
6,259,868
Memory footprint of NSDictionary and NSArray
The project I'm working on requires me to temporarily store hundreds and sometimes thousands of entries in a buffer. The easy way is to store each entry in an NSDictionary and all the entries in an NSArray. Each NSDictionary contains about a dozen objects ( NSStrings and NSNumbers ). During the entire operation, the NS...
Instruments contains a memory monitoring module. In the bottom-left corner of instruments, click on the gear icon, then choose Add Instrument > Memory Monitory. Apple's documentation should help you understand how to monitor memory with Instruments. See also this question. In my experience, NSDictionary and NSArray are...
Memory footprint of NSDictionary and NSArray The project I'm working on requires me to temporarily store hundreds and sometimes thousands of entries in a buffer. The easy way is to store each entry in an NSDictionary and all the entries in an NSArray. Each NSDictionary contains about a dozen objects ( NSStrings and NSN...
TITLE: Memory footprint of NSDictionary and NSArray QUESTION: The project I'm working on requires me to temporarily store hundreds and sometimes thousands of entries in a buffer. The easy way is to store each entry in an NSDictionary and all the entries in an NSArray. Each NSDictionary contains about a dozen objects (...
[ "cocoa", "macos", "nsarray", "nsdictionary" ]
2
2
1,551
2
0
2011-06-07T01:41:25.950000
2011-06-07T01:46:26.217000
6,259,844
6,260,201
ASP.NET Validation of viewstate MAC failed
I've a listView to show list of data. It was all good and suddendly we are receiving the error message below: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a ...
It could be that IIS recycled your app and therefore you get new keys for the session/view state. To alleviate this, add a machine static key in the web.config. Generate a key from http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx And place the keys in your web.config example as below The s...
ASP.NET Validation of viewstate MAC failed I've a listView to show list of data. It was all good and suddendly we are receiving the error message below: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation a...
TITLE: ASP.NET Validation of viewstate MAC failed QUESTION: I've a listView to show list of data. It was all good and suddendly we are receiving the error message below: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKe...
[ "asp.net" ]
16
33
42,014
5
0
2011-06-07T01:42:32.800000
2011-06-07T02:54:51.957000
6,259,847
6,259,878
Development environments for google-chrome-extension
Currently I am coding my google-chrome-extensions using a combination of notepad and the chrome console. I am 100% sure that there is a better way of programming these extensions. What environments are people using?
Your preferred IDE (eg. NetBeans) and Google Chrome (you have to test on something, right?).
Development environments for google-chrome-extension Currently I am coding my google-chrome-extensions using a combination of notepad and the chrome console. I am 100% sure that there is a better way of programming these extensions. What environments are people using?
TITLE: Development environments for google-chrome-extension QUESTION: Currently I am coding my google-chrome-extensions using a combination of notepad and the chrome console. I am 100% sure that there is a better way of programming these extensions. What environments are people using? ANSWER: Your preferred IDE (eg. ...
[ "google-chrome-extension", "development-environment" ]
6
2
3,104
3
0
2011-06-07T01:42:59.960000
2011-06-07T01:47:48.447000
6,259,849
6,264,886
Delphi / WCF SOAP connectivity and Virtual Machine (VMWare) settings
I've got a working WCF service and a working Delphi client. On a normal PC, they work nicely. On a VM that's "Bridged" they work nicely if I log onto the domain (but not if I logon locally to the VM as administrator). If the VM is NATed, the connection attempt times out. I would love to hear people's thoughts on what c...
Within the VM, open Internet Explorer and verify that you can view the WSDL of the WCF service. If you can't, then your issue is connectivity and has nothing to do with your Delphi code.
Delphi / WCF SOAP connectivity and Virtual Machine (VMWare) settings I've got a working WCF service and a working Delphi client. On a normal PC, they work nicely. On a VM that's "Bridged" they work nicely if I log onto the domain (but not if I logon locally to the VM as administrator). If the VM is NATed, the connectio...
TITLE: Delphi / WCF SOAP connectivity and Virtual Machine (VMWare) settings QUESTION: I've got a working WCF service and a working Delphi client. On a normal PC, they work nicely. On a VM that's "Bridged" they work nicely if I log onto the domain (but not if I logon locally to the VM as administrator). If the VM is NA...
[ "wcf", "delphi", "soap", "vmware" ]
4
1
506
2
0
2011-06-07T01:43:07.937000
2011-06-07T12:05:21.757000
6,259,854
6,259,885
Use default blue background when UITableViewCell is selected
For a better user experience, I would like my UITableViewCell to have the default blue styling when a user taps it. Currently, there is no styling at all. Shouldn't the following this be all I need? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView selectRowAtIndex...
Go to cellForRowAtIndexPath and use cell.selectionStyle= UITableViewCellSelectionStyleBlue;
Use default blue background when UITableViewCell is selected For a better user experience, I would like my UITableViewCell to have the default blue styling when a user taps it. Currently, there is no styling at all. Shouldn't the following this be all I need? - (void)tableView:(UITableView *)tableView didSelectRowAtInd...
TITLE: Use default blue background when UITableViewCell is selected QUESTION: For a better user experience, I would like my UITableViewCell to have the default blue styling when a user taps it. Currently, there is no styling at all. Shouldn't the following this be all I need? - (void)tableView:(UITableView *)tableView...
[ "iphone", "objective-c", "cocoa-touch" ]
1
2
209
1
0
2011-06-07T01:44:01.193000
2011-06-07T01:50:24.287000
6,259,857
6,260,011
PHP log: Warning format
The PHP log format does not include the date, for Warnings. For instance PHP Warning: Cannot modify header information... does not have any date of when the warning happened. Is there a way to change the Warning format, or at least have the date in the log? (using php-fpm if it matters).
You can of course always define your own error handler using set_error_handler. Simplified example: function handler($errno, $errstr, $errfile, $errline, $errcontext) { $message = date('Y-m-d H:i:s'). ": $errstr in $errfile at $errline\n"; file_put_contents('error.log', $message, FILE_APPEND); } set_error_handler('han...
PHP log: Warning format The PHP log format does not include the date, for Warnings. For instance PHP Warning: Cannot modify header information... does not have any date of when the warning happened. Is there a way to change the Warning format, or at least have the date in the log? (using php-fpm if it matters).
TITLE: PHP log: Warning format QUESTION: The PHP log format does not include the date, for Warnings. For instance PHP Warning: Cannot modify header information... does not have any date of when the warning happened. Is there a way to change the Warning format, or at least have the date in the log? (using php-fpm if it...
[ "php", "date", "warnings", "logging" ]
5
2
2,591
1
0
2011-06-07T01:44:25.920000
2011-06-07T02:15:06.297000
6,259,871
6,287,242
NSLog Timestamps in Xcode Organizer's Console Don't Show Milliseconds
I am using NSLog to record logs in an iPhone application. In Xcode when I execute my iPhone application with "Run -> Console," I get timestamps in the following format: "2011-06-06 18:34:58.189". When I view the console through the Xcode Organizer, the timestamps are in the following format: "Jun 6 18:42:51". Is there ...
I ended up using the method described here ( http://blog.coriolis.ch/2009/01/09/redirect-nslog-to-a-file-on-the-iphone/) to redirect stderr to a file.
NSLog Timestamps in Xcode Organizer's Console Don't Show Milliseconds I am using NSLog to record logs in an iPhone application. In Xcode when I execute my iPhone application with "Run -> Console," I get timestamps in the following format: "2011-06-06 18:34:58.189". When I view the console through the Xcode Organizer, t...
TITLE: NSLog Timestamps in Xcode Organizer's Console Don't Show Milliseconds QUESTION: I am using NSLog to record logs in an iPhone application. In Xcode when I execute my iPhone application with "Run -> Console," I get timestamps in the following format: "2011-06-06 18:34:58.189". When I view the console through the ...
[ "ios", "xcode", "nslog", "organizer" ]
3
1
1,888
2
0
2011-06-07T01:46:54.597000
2011-06-09T01:51:36.467000
6,259,875
6,260,104
How to run clickHandlers on buttons moved from main view component to header bar
I've used JRab's example here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/App-specific-system-menu/td-p/693... to add a header menu to my app. What I'm having trouble with is executing my functions from the header mennu. For example, my firstView is appHome.mxml. It instantiates a Canvas object t...
Based on your description, I don't understand how my comment on the previous answer doesn't answer it. The event from headermenu dispatches up to app; which can call the method on it's child (appHome) like this: appHome.erase()
How to run clickHandlers on buttons moved from main view component to header bar I've used JRab's example here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/App-specific-system-menu/td-p/693... to add a header menu to my app. What I'm having trouble with is executing my functions from the header me...
TITLE: How to run clickHandlers on buttons moved from main view component to header bar QUESTION: I've used JRab's example here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/App-specific-system-menu/td-p/693... to add a header menu to my app. What I'm having trouble with is executing my functions ...
[ "apache-flex", "function", "click" ]
0
1
47
1
0
2011-06-07T01:47:28.790000
2011-06-07T02:33:47.383000
6,259,880
6,259,899
Can someone explain this ruby code?
From the rails postgresql_adapter.rb. I get what it's trying to do, I just don't get how it happens. It's really to do with the <<-SQL that I'm lost. exec_query(<<-SQL, 'SCHEMA', binds).rows.first[0].to_i > 0 SELECT COUNT(*) FROM pg_tables WHERE tablename = $1 #{schema? "AND schemaname = $2": ''} SQL I've seen code bef...
You can use a heredoc-marker (like <<-SQL in your example) anywhere (or even multiple times) in a line and the heredoc will then start on the following line and continue until the end-marker is met (in case of multiple markers, the (n+1)th heredoc will start after the nth end-marker and continue up to the (n+1)th end-m...
Can someone explain this ruby code? From the rails postgresql_adapter.rb. I get what it's trying to do, I just don't get how it happens. It's really to do with the <<-SQL that I'm lost. exec_query(<<-SQL, 'SCHEMA', binds).rows.first[0].to_i > 0 SELECT COUNT(*) FROM pg_tables WHERE tablename = $1 #{schema? "AND schemana...
TITLE: Can someone explain this ruby code? QUESTION: From the rails postgresql_adapter.rb. I get what it's trying to do, I just don't get how it happens. It's really to do with the <<-SQL that I'm lost. exec_query(<<-SQL, 'SCHEMA', binds).rows.first[0].to_i > 0 SELECT COUNT(*) FROM pg_tables WHERE tablename = $1 #{sch...
[ "ruby", "syntax", "heredoc" ]
4
13
447
1
0
2011-06-07T01:48:54.490000
2011-06-07T01:54:52.220000
6,259,889
6,263,558
Equivalent fread using ifstream
I want to use ifstream to read n blocks of data like fread, is there a way to do implement similar functionality in C++ using ifstream? I tried to load the TGA file, and its header looks like: struct TgaHeader { char identSize; char colorMapType; char imageType; unsigned short colorMapStart; unsigned short colorMapLeng...
As the comments under the question say, you want basic_istream<>::read() and to use size * count instead of the two separate arguments of fread().
Equivalent fread using ifstream I want to use ifstream to read n blocks of data like fread, is there a way to do implement similar functionality in C++ using ifstream? I tried to load the TGA file, and its header looks like: struct TgaHeader { char identSize; char colorMapType; char imageType; unsigned short colorMapSt...
TITLE: Equivalent fread using ifstream QUESTION: I want to use ifstream to read n blocks of data like fread, is there a way to do implement similar functionality in C++ using ifstream? I tried to load the TGA file, and its header looks like: struct TgaHeader { char identSize; char colorMapType; char imageType; unsigne...
[ "c++" ]
0
0
1,513
1
0
2011-06-07T01:51:05.280000
2011-06-07T09:56:20.710000
6,259,904
6,259,938
Getting attributes to bleed through to children
I want to simulate tabs such that the first word in a list entry always gets a fixed width. I do it like this: first entry in my list second list entry the approach works relatively well except that if I want to do: li { color: blue } it applies the color (not surprisingly) to the but not to the. this means that I woul...
By default the the span should be colored blue if the li is colored blue. See http://jsfiddle.net/Q2UGE/ for an example I think you must have some other CSS overriding it In case you do have something else overriding it that you cant change, you can also enforce li.tabbed to inherit from it parent li.tabbed { color: in...
Getting attributes to bleed through to children I want to simulate tabs such that the first word in a list entry always gets a fixed width. I do it like this: first entry in my list second list entry the approach works relatively well except that if I want to do: li { color: blue } it applies the color (not surprisingl...
TITLE: Getting attributes to bleed through to children QUESTION: I want to simulate tabs such that the first word in a list entry always gets a fixed width. I do it like this: first entry in my list second list entry the approach works relatively well except that if I want to do: li { color: blue } it applies the colo...
[ "css", "css-float" ]
1
2
56
4
0
2011-06-07T01:55:52.253000
2011-06-07T02:00:45.360000
6,259,909
6,260,021
Undoing a Migration Error
How do you go about changing column names and types in your rails app? Do you create a new migration to make the changes, or do you rollback, edit your migration file, and then migrate again? What's the "proper" way to do this in Rails?
It sort of depends on when this happened in your development cycle, If you recently made the change and haven't pushed it out into a public repo, then you indeed might want to do the rollback thing and then edit the migration files and migrate again, just to keep things clean. But if it's a change to a migration that's...
Undoing a Migration Error How do you go about changing column names and types in your rails app? Do you create a new migration to make the changes, or do you rollback, edit your migration file, and then migrate again? What's the "proper" way to do this in Rails?
TITLE: Undoing a Migration Error QUESTION: How do you go about changing column names and types in your rails app? Do you create a new migration to make the changes, or do you rollback, edit your migration file, and then migrate again? What's the "proper" way to do this in Rails? ANSWER: It sort of depends on when thi...
[ "ruby-on-rails", "migration" ]
1
2
179
3
0
2011-06-07T01:56:34.263000
2011-06-07T02:17:02.470000
6,259,910
6,259,999
Require a model to have another model? Basically, a model validation
What I mean is, is it possible in Rails to require at least one instance of a model in a relationship? For example, in my discussion.rb I have: has_many:posts And in my post.rb: belongs_to:discussion How can I make it that in order to create a discussion you need to have at least one Post? I was not sure how to search ...
The post record will need a discussion_id foreign key in order to be associated with a discussion. The discussion can't be created (and given an id) until the post is created. It's a catch-22. You'll have to introduce something else, like a "complete" boolean on the discussion model that only gets flipped true after a ...
Require a model to have another model? Basically, a model validation What I mean is, is it possible in Rails to require at least one instance of a model in a relationship? For example, in my discussion.rb I have: has_many:posts And in my post.rb: belongs_to:discussion How can I make it that in order to create a discuss...
TITLE: Require a model to have another model? Basically, a model validation QUESTION: What I mean is, is it possible in Rails to require at least one instance of a model in a relationship? For example, in my discussion.rb I have: has_many:posts And in my post.rb: belongs_to:discussion How can I make it that in order t...
[ "ruby-on-rails", "ruby-on-rails-3", "model-view-controller", "rails-models" ]
0
0
270
2
0
2011-06-07T01:56:36.180000
2011-06-07T02:13:03.220000
6,259,913
6,259,958
SIGSEGV memcopy or memmove
I am developing an Android application using NDK. The application blows up with "SIGSEGV" error which I believe a segmentation fault error. I looked at my code and I think memcopy and memmove might cause this error. I was wondering if there is a safe way to call these functions. Also please let me know any well describ...
The rule with those 2 is that you use memcpy when you're copying a block of bytes from one place to another, and the source and destination don't overlap. If they do overlap, you have to use memmove. However, using them incorrectly results in corrupted data, not segfaults. Segfaults happen when you try to read or write...
SIGSEGV memcopy or memmove I am developing an Android application using NDK. The application blows up with "SIGSEGV" error which I believe a segmentation fault error. I looked at my code and I think memcopy and memmove might cause this error. I was wondering if there is a safe way to call these functions. Also please l...
TITLE: SIGSEGV memcopy or memmove QUESTION: I am developing an Android application using NDK. The application blows up with "SIGSEGV" error which I believe a segmentation fault error. I looked at my code and I think memcopy and memmove might cause this error. I was wondering if there is a safe way to call these functi...
[ "android", "c" ]
0
1
1,462
2
0
2011-06-07T01:57:15.107000
2011-06-07T02:05:43.103000
6,259,915
6,259,931
Threads going into deadlock despite synchronized keyword
I tried to make a event dispatcher in Java that will dispatch events as threads. So all the EventListener classes are essentially implemented the Runnable class. Like how firing of events work traditionally, a method in the event dispatcher class loops through a list of EventListeners and then invoke their handler meth...
Deadlock is something along the lines of this: A needs iron to make tools, asks B for iron B needs tools to make iron, asks A for tools Neither will complete. Just because you've put the syncronized key word around them does not guarantee that you're going to run into a logical impossibility. You have to judge when one...
Threads going into deadlock despite synchronized keyword I tried to make a event dispatcher in Java that will dispatch events as threads. So all the EventListener classes are essentially implemented the Runnable class. Like how firing of events work traditionally, a method in the event dispatcher class loops through a ...
TITLE: Threads going into deadlock despite synchronized keyword QUESTION: I tried to make a event dispatcher in Java that will dispatch events as threads. So all the EventListener classes are essentially implemented the Runnable class. Like how firing of events work traditionally, a method in the event dispatcher clas...
[ "java", "multithreading", "synchronization", "deadlock" ]
1
4
1,441
4
0
2011-06-07T01:57:33.327000
2011-06-07T02:00:18.130000
6,259,916
6,260,051
Finding Max Question
I have such a list List. Let's call each 2-dimensional array in the list a layer. So I should compare each element in each layer and extract max. And construct layer of max values. How do I do that? Maybe with use of LINQ? Or foreach loop construction? Help! And Thanks!
Assuming that all your layers are the same size sizeX x sizeY, because otherwise this makes no sense: var maxLayer = new Double[sizeX,sizeY]; for( int x = 0; x <= maxLayer.GetUpperBound(0); x++ ) for( int y = 0; y <= maxLayer.GetUpperBound(1); y++ ) maxLayer[x,y] = Double.NegativeInfinity; foreach( Double[,] layer in...
Finding Max Question I have such a list List. Let's call each 2-dimensional array in the list a layer. So I should compare each element in each layer and extract max. And construct layer of max values. How do I do that? Maybe with use of LINQ? Or foreach loop construction? Help! And Thanks!
TITLE: Finding Max Question QUESTION: I have such a list List. Let's call each 2-dimensional array in the list a layer. So I should compare each element in each layer and extract max. And construct layer of max values. How do I do that? Maybe with use of LINQ? Or foreach loop construction? Help! And Thanks! ANSWER: A...
[ "c#", "linq", "multidimensional-array", "foreach", "max" ]
1
2
783
2
0
2011-06-07T01:57:47.083000
2011-06-07T02:22:22.307000
6,259,926
6,259,972
How to integrate Google Closure Compiler as a build step in Visual Studio 2010
Is there any reference or tutorial for this? And if it's possible, have the javascript file being built only if the file is modified.
You might be able to try this: http://closurecompiler.codeplex.com/documentation, But I couldn't get it to work and ended up writing a batch file and hooked it up as a post-build process in the project properties. I've been pretty happy with that solution as it allows me to easily (and in a more standardized fashion) t...
How to integrate Google Closure Compiler as a build step in Visual Studio 2010 Is there any reference or tutorial for this? And if it's possible, have the javascript file being built only if the file is modified.
TITLE: How to integrate Google Closure Compiler as a build step in Visual Studio 2010 QUESTION: Is there any reference or tutorial for this? And if it's possible, have the javascript file being built only if the file is modified. ANSWER: You might be able to try this: http://closurecompiler.codeplex.com/documentation...
[ "visual-studio-2010", "google-closure-compiler" ]
7
3
3,297
1
0
2011-06-07T01:59:09.500000
2011-06-07T02:09:13.213000
6,259,930
6,259,975
height auto css works in FF but not IE
I have a background with sidebars. It contains the home, about steng. This is the widget in the red. I also have one that is in yellow. There is a drop down resizer and it is working in FF. If i go to 12, 16, and 20. If i do this in IE the background image ( red circle and yellow ) is not auto adjusting. Does anyone kn...
Remove the div: //remove //this... //and remove //this The "div" between "li" and "ul". Doesn't seem to be doing anything, that's what is affecting ie, I've just tried it.
height auto css works in FF but not IE I have a background with sidebars. It contains the home, about steng. This is the widget in the red. I also have one that is in yellow. There is a drop down resizer and it is working in FF. If i go to 12, 16, and 20. If i do this in IE the background image ( red circle and yellow ...
TITLE: height auto css works in FF but not IE QUESTION: I have a background with sidebars. It contains the home, about steng. This is the widget in the red. I also have one that is in yellow. There is a drop down resizer and it is working in FF. If i go to 12, 16, and 20. If i do this in IE the background image ( red ...
[ "javascript", "jquery", "font-size" ]
0
1
163
1
0
2011-06-07T01:59:51.253000
2011-06-07T02:09:48.180000
6,259,939
6,260,196
PHP 5.3.x include statement problems on iis7 with fast cgi
I have a web server that is running PHP 5.3.6 non thread safe (VC9), running on a server 2008 R2 (iis 7.5) using FastCGI. I am getting several errors like the one below: PHP Warning: include_once(\\DB-FUNCTIONS.PHP): failed to open stream: No such file or directory in M:\Depts\uc\uc-template\resources\library\faq-funct...
The include behaviour is expected. The. in PHP's include path only refers to the outermost PHP file, usually the one invoked by the request. If you want to include a file relative to the file doing the including, use the __DIR__ magic constant, eg include __DIR__. '/DB-FUNCTIONS.php';
PHP 5.3.x include statement problems on iis7 with fast cgi I have a web server that is running PHP 5.3.6 non thread safe (VC9), running on a server 2008 R2 (iis 7.5) using FastCGI. I am getting several errors like the one below: PHP Warning: include_once(\\DB-FUNCTIONS.PHP): failed to open stream: No such file or direc...
TITLE: PHP 5.3.x include statement problems on iis7 with fast cgi QUESTION: I have a web server that is running PHP 5.3.6 non thread safe (VC9), running on a server 2008 R2 (iis 7.5) using FastCGI. I am getting several errors like the one below: PHP Warning: include_once(\\DB-FUNCTIONS.PHP): failed to open stream: No ...
[ "php", "iis-7", "include", "fastcgi" ]
0
1
2,917
1
0
2011-06-07T02:00:52.303000
2011-06-07T02:53:30.913000
6,259,947
6,259,952
About naming an App ID in IOS provisioning portal
I am working for an Australian company atm. When I create an Apple ID in "Provisioning Portal", can i just use prefix as "au.com.mycompany.appname" instead of "com.mycompany.appname". Our company do not have a ".com" website. I got questions about: What's different between "com.mycompany.appname" and "au.com.mycompany....
Yes. You could even use "somethingWithNoDotAndNotEvenYourCompanyName", as long as it's unique. The "com.company.product" is only a recommandation. I myself use "ca.mycompany.product" without any problem.
About naming an App ID in IOS provisioning portal I am working for an Australian company atm. When I create an Apple ID in "Provisioning Portal", can i just use prefix as "au.com.mycompany.appname" instead of "com.mycompany.appname". Our company do not have a ".com" website. I got questions about: What's different betw...
TITLE: About naming an App ID in IOS provisioning portal QUESTION: I am working for an Australian company atm. When I create an Apple ID in "Provisioning Portal", can i just use prefix as "au.com.mycompany.appname" instead of "com.mycompany.appname". Our company do not have a ".com" website. I got questions about: Wha...
[ "iphone", "ios4" ]
2
2
874
2
0
2011-06-07T02:03:14.710000
2011-06-07T02:05:00.013000
6,259,954
6,260,025
C# .net - override existing built-in function + get underlying method code
Apologies if these are extremely basic questions, but let's say I'm using the void Add(T item) function of BlockingCollection: 1) How would I override the Add function, i.e. if I want to add a check at the beginning and then call the base function, is this possible to do, and if so, would the code look something like t...
IEnumerable doesn't have an "Add" method; you'd have to implement your own. ICollection does, however! Also, because IEnumerable/ICollection are interfaces, not classes, there's no existing implmementation for you to override. You have to do that part yourself. Edit for possible additional extra super duper correctness...
C# .net - override existing built-in function + get underlying method code Apologies if these are extremely basic questions, but let's say I'm using the void Add(T item) function of BlockingCollection: 1) How would I override the Add function, i.e. if I want to add a check at the beginning and then call the base functi...
TITLE: C# .net - override existing built-in function + get underlying method code QUESTION: Apologies if these are extremely basic questions, but let's say I'm using the void Add(T item) function of BlockingCollection: 1) How would I override the Add function, i.e. if I want to add a check at the beginning and then ca...
[ "c#", ".net" ]
4
2
3,064
4
0
2011-06-07T02:05:17.003000
2011-06-07T02:18:00.643000
6,259,967
6,260,059
Micro Linux PC Solution for driving a simple kiosk that displays a static webpage
Can anyone point me in the direction of some cheap low end hardware that I can attach a VGA monitor to and essentially have small information kiosk. Preferably a fanless pc.
I've enjoyed Shuttle products in the past; this machine looks shiny and cheap.
Micro Linux PC Solution for driving a simple kiosk that displays a static webpage Can anyone point me in the direction of some cheap low end hardware that I can attach a VGA monitor to and essentially have small information kiosk. Preferably a fanless pc.
TITLE: Micro Linux PC Solution for driving a simple kiosk that displays a static webpage QUESTION: Can anyone point me in the direction of some cheap low end hardware that I can attach a VGA monitor to and essentially have small information kiosk. Preferably a fanless pc. ANSWER: I've enjoyed Shuttle products in the ...
[ "linux", "embedded" ]
0
0
323
1
0
2011-06-07T02:07:33.670000
2011-06-07T02:23:48.213000
6,259,968
6,260,036
How do I get a .p12 certificate and a .mobileprovision file to export for iOS in CS5.5?
I've been looking into developing applications for iOS using Flash CS5.5, however I'm having some trouble publishing the application because I don't know where I can get a signed certificate. CS4 had a feature when exporting for AIR that let you create one on the spot but this doesn't seem to be there anymore. Any sugg...
Getting a signed certificate for iOS application production requires registration as an iOS developer with apple. Then you get your signing certificate and provisioning profiles.
How do I get a .p12 certificate and a .mobileprovision file to export for iOS in CS5.5? I've been looking into developing applications for iOS using Flash CS5.5, however I'm having some trouble publishing the application because I don't know where I can get a signed certificate. CS4 had a feature when exporting for AIR...
TITLE: How do I get a .p12 certificate and a .mobileprovision file to export for iOS in CS5.5? QUESTION: I've been looking into developing applications for iOS using Flash CS5.5, however I'm having some trouble publishing the application because I don't know where I can get a signed certificate. CS4 had a feature when...
[ "ios", "certificate", "flash-cs5" ]
1
3
3,277
1
0
2011-06-07T02:08:09.187000
2011-06-07T02:19:28.147000
6,259,969
6,260,283
create a link in an email that bypasses login but still facilitates authentication
I have a rails 3 app that is currently using Devise for authentication. I would like to send an email to users from time to time that would contain a link. When they click the link they would... bypass the login page go directly to the page i'm directing them to and authenticate in the process I tried several Google se...
I think you're really looking for token authentication. Take a look at this blog (deleted) which is linked to from the devise wiki here. It's a bit of a weird example in that UI given is for a user to generate a login link for themselves. Still - it presents the correct approach to login-using-a-link.
create a link in an email that bypasses login but still facilitates authentication I have a rails 3 app that is currently using Devise for authentication. I would like to send an email to users from time to time that would contain a link. When they click the link they would... bypass the login page go directly to the p...
TITLE: create a link in an email that bypasses login but still facilitates authentication QUESTION: I have a rails 3 app that is currently using Devise for authentication. I would like to send an email to users from time to time that would contain a link. When they click the link they would... bypass the login page go...
[ "ruby-on-rails", "ruby-on-rails-3", "devise" ]
2
2
1,054
2
0
2011-06-07T02:08:36.897000
2011-06-07T03:17:59.930000
6,259,974
6,260,320
Haskell can't match type, claims rigid variable
I am new to Haskell, and I am playing around with creating a typeclass for graphs and the nodes in them. Since I want both directed and undirected graphs, I have data Node = Node { label:: Char, index:: Int } deriving (Ord, Eq) type Graph edgeType = ([Node], [edgeType]) data Edge = DirectedEdge {h:: Node, t:: Node} | U...
You probably want to have two separate edge types instead of Edge newtype DirectedEdge = DirectedEdge { h:: Node, t:: Node} newtype UndirectedEdge = UndirectedEdge { a:: Node, b:: Node} And you probably want some kind of typeclass that gives you back a (Node, Node) given an arbitrary edge: class HasNodeEndpoints a wher...
Haskell can't match type, claims rigid variable I am new to Haskell, and I am playing around with creating a typeclass for graphs and the nodes in them. Since I want both directed and undirected graphs, I have data Node = Node { label:: Char, index:: Int } deriving (Ord, Eq) type Graph edgeType = ([Node], [edgeType]) d...
TITLE: Haskell can't match type, claims rigid variable QUESTION: I am new to Haskell, and I am playing around with creating a typeclass for graphs and the nodes in them. Since I want both directed and undirected graphs, I have data Node = Node { label:: Char, index:: Int } deriving (Ord, Eq) type Graph edgeType = ([No...
[ "haskell", "types", "polymorphism" ]
5
7
1,092
2
0
2011-06-07T02:09:42.870000
2011-06-07T03:28:29.857000
6,259,982
6,260,001
How do you use the ? : (conditional) operator in JavaScript?
What is the?: (question mark and colon operator aka. conditional or "ternary") operator and how can I use it?
This is a one-line shorthand for an if-else statement. It's called the conditional operator. 1 Here is an example of code that could be shortened with the conditional operator: var userType; if (userIsYoungerThan18) { userType = "Minor"; } else { userType = "Adult"; } if (userIsYoungerThan21) { serveDrink("Grape Juice...
How do you use the ? : (conditional) operator in JavaScript? What is the?: (question mark and colon operator aka. conditional or "ternary") operator and how can I use it?
TITLE: How do you use the ? : (conditional) operator in JavaScript? QUESTION: What is the?: (question mark and colon operator aka. conditional or "ternary") operator and how can I use it? ANSWER: This is a one-line shorthand for an if-else statement. It's called the conditional operator. 1 Here is an example of code ...
[ "javascript", "conditional-operator" ]
527
765
710,741
20
0
2011-06-07T02:10:54.253000
2011-06-07T02:13:15.177000
6,259,984
6,260,153
Google App Engine: Is adding to the task queue faster than doing a datastore write?
I'm trying to optimize some of the user facing parts of my app by adding background tasks to the task queue rather than performing the operations right away. For CPU intensive tasks it's an obvious choice to do it this way, but what about for simply saving data? Is it faster on average to perform a taskqueue.add() oper...
Yes, marginally. Task queue payloads are limited to 10kb, though, and the performance difference is small enough you shouldn't use a task queue task just to store a datastore record. If you're concerned about datastore latency, look into the async API or Guido's NDB project so you can continue to do other work while yo...
Google App Engine: Is adding to the task queue faster than doing a datastore write? I'm trying to optimize some of the user facing parts of my app by adding background tasks to the task queue rather than performing the operations right away. For CPU intensive tasks it's an obvious choice to do it this way, but what abo...
TITLE: Google App Engine: Is adding to the task queue faster than doing a datastore write? QUESTION: I'm trying to optimize some of the user facing parts of my app by adding background tasks to the task queue rather than performing the operations right away. For CPU intensive tasks it's an obvious choice to do it this...
[ "google-app-engine" ]
3
2
567
1
0
2011-06-07T02:11:14.560000
2011-06-07T02:43:04.350000
6,259,994
6,260,170
how to merge DIVs across li elements
Above html will design following design li li li |__|__|__| -> odd DIVs |__|__|__| -> even DIVs I want to merge all the odd DIVs and place some text on the top of it. li li li |__|__|__| -> odd DIVs |__|__ __| -> even DIVs Is there any way to do this? Thanks
Try using this: li { display: inline-block; } li div:last-child { display: inline; } Ive tested it in Firefox 5 only, and it seems to work. See an example here http://jsfiddle.net/ffESR/
how to merge DIVs across li elements Above html will design following design li li li |__|__|__| -> odd DIVs |__|__|__| -> even DIVs I want to merge all the odd DIVs and place some text on the top of it. li li li |__|__|__| -> odd DIVs |__|__ __| -> even DIVs Is there any way to do this? Thanks
TITLE: how to merge DIVs across li elements QUESTION: Above html will design following design li li li |__|__|__| -> odd DIVs |__|__|__| -> even DIVs I want to merge all the odd DIVs and place some text on the top of it. li li li |__|__|__| -> odd DIVs |__|__ __| -> even DIVs Is there any way to do this? Thanks ANSWE...
[ "css", "html" ]
0
0
2,108
1
0
2011-06-07T02:12:33.490000
2011-06-07T02:48:20.990000
6,259,997
6,260,045
What is f-ing my data?
I'm getting a NSData * and trying to get it byte by byte but the data is filled with f. NSData *Data = getData(); cout << "The log way:" << endl; NSLog(@"%@", Data); cout << "The data way:" << endl; char *data = (char *)[Data bytes]; for(int i = 0; i < [Data length]; i++) { cout.width(2); cout.fill(0); cout << hex << (...
The char data type is of undefined signedness, and it seems your compiler (gcc or clang?) decided it should be signed. Therefore, when you cast a char to a larger type, sign extension is used, which fills the extra bits with the same value the most significant bit has. For bytes with a value larger than 0x7F, the most ...
What is f-ing my data? I'm getting a NSData * and trying to get it byte by byte but the data is filled with f. NSData *Data = getData(); cout << "The log way:" << endl; NSLog(@"%@", Data); cout << "The data way:" << endl; char *data = (char *)[Data bytes]; for(int i = 0; i < [Data length]; i++) { cout.width(2); cout.fi...
TITLE: What is f-ing my data? QUESTION: I'm getting a NSData * and trying to get it byte by byte but the data is filled with f. NSData *Data = getData(); cout << "The log way:" << endl; NSLog(@"%@", Data); cout << "The data way:" << endl; char *data = (char *)[Data bytes]; for(int i = 0; i < [Data length]; i++) { cout...
[ "objective-c" ]
0
4
107
2
0
2011-06-07T02:12:42.200000
2011-06-07T02:21:17.923000
6,259,998
6,260,031
MYSQL Selecting reciprocating data?
I have a table called Follow, with three fields: Id (autoincrement int), UserId (int), Following (int) If I have data like this: ID UserId Following -------------------------- 1 2 3 2 3 2 3 2 5 4 2 6 5 3 5 How would I find user 2's friends (ie: user 2 is following them, and they follow user 2) I guess, in other words, ...
Try this: SELECT a.UserId, a.Following FROM Follow a INNER JOIN Follow b ON a.UserId = b.Following AND b.UserId = a.Following
MYSQL Selecting reciprocating data? I have a table called Follow, with three fields: Id (autoincrement int), UserId (int), Following (int) If I have data like this: ID UserId Following -------------------------- 1 2 3 2 3 2 3 2 5 4 2 6 5 3 5 How would I find user 2's friends (ie: user 2 is following them, and they foll...
TITLE: MYSQL Selecting reciprocating data? QUESTION: I have a table called Follow, with three fields: Id (autoincrement int), UserId (int), Following (int) If I have data like this: ID UserId Following -------------------------- 1 2 3 2 3 2 3 2 5 4 2 6 5 3 5 How would I find user 2's friends (ie: user 2 is following t...
[ "mysql", "sql" ]
1
4
203
2
0
2011-06-07T02:12:43.440000
2011-06-07T02:18:50.400000
6,260,000
6,260,030
Data base - not populating the objects
I have a got an issue on SQL Server Database as it is not getting objects (missing + sign to expand to get objects) and sorry, my company policy not accepting to post images so I am presenting GUI in code SSMS 2008 view as Server - Databases + System Databases + Database Snapshots [DB1] (missing expansion + sign to get...
Missing security rights? Maybe your user does not have rights to read the database objects
Data base - not populating the objects I have a got an issue on SQL Server Database as it is not getting objects (missing + sign to expand to get objects) and sorry, my company policy not accepting to post images so I am presenting GUI in code SSMS 2008 view as Server - Databases + System Databases + Database Snapshots...
TITLE: Data base - not populating the objects QUESTION: I have a got an issue on SQL Server Database as it is not getting objects (missing + sign to expand to get objects) and sorry, my company policy not accepting to post images so I am presenting GUI in code SSMS 2008 view as Server - Databases + System Databases + ...
[ "sql-server-2008" ]
0
1
42
1
0
2011-06-07T02:13:13.243000
2011-06-07T02:18:47.280000
6,260,003
6,260,057
Appropriate place to store globals (not constants!) in Rails 3
I browsed the related questions but I couldn't find what I needed since most questions were asking where to store constants, not simply globals. I'd like my CMS to randomly select a color scheme at the click of a button. Before a user auto-generates the colorscheme though, I'd like to be able to load a default one from...
Do you want the user to only change the color scheme for their account? If so, that setting should be stored in the database associated with that user. If you store the value in a Ruby constant like $color in config/initializers/color.rb, it will be set and re-set for all users hitting that running instance of the Rail...
Appropriate place to store globals (not constants!) in Rails 3 I browsed the related questions but I couldn't find what I needed since most questions were asking where to store constants, not simply globals. I'd like my CMS to randomly select a color scheme at the click of a button. Before a user auto-generates the col...
TITLE: Appropriate place to store globals (not constants!) in Rails 3 QUESTION: I browsed the related questions but I couldn't find what I needed since most questions were asking where to store constants, not simply globals. I'd like my CMS to randomly select a color scheme at the click of a button. Before a user auto...
[ "ruby-on-rails", "ruby", "content-management-system" ]
2
3
181
1
0
2011-06-07T02:13:31.907000
2011-06-07T02:23:13.483000
6,260,009
6,260,210
Read numbers following a keyword into an array in Fortran 90 from a text file
I have many text files of this format.... 'FOP' 0.19 1 24 1 25 7 8 / 'FOP' 0.18 1 24 1 25 9 11 / / TURX 560231 300244 70029 200250 645257 800191 900333 600334 770291 300335 220287 110262 / SUBTRACT 'TURX' 'TURY'/...... where the portions I snipped off contain other various data in various formats. The file format is ...
I'll give you a nudge in the right direction so that you can finish your project. Some basics: Do/While as you'll need some sort of loop structure to loop through the file and then over the numbers. There's no for loop in Fortran, so use this type. Read to read the strings. To start you need something like this: progra...
Read numbers following a keyword into an array in Fortran 90 from a text file I have many text files of this format.... 'FOP' 0.19 1 24 1 25 7 8 / 'FOP' 0.18 1 24 1 25 9 11 / / TURX 560231 300244 70029 200250 645257 800191 900333 600334 770291 300335 220287 110262 / SUBTRACT 'TURX' 'TURY'/...... where the portions I ...
TITLE: Read numbers following a keyword into an array in Fortran 90 from a text file QUESTION: I have many text files of this format.... 'FOP' 0.19 1 24 1 25 7 8 / 'FOP' 0.18 1 24 1 25 9 11 / / TURX 560231 300244 70029 200250 645257 800191 900333 600334 770291 300335 220287 110262 / SUBTRACT 'TURX' 'TURY'/...... whe...
[ "parsing", "file-io", "fortran", "fortran90" ]
2
1
4,147
3
0
2011-06-07T02:14:19.290000
2011-06-07T02:57:32.440000
6,260,015
6,260,040
How to add another field in an existing table in mysql
Okay, I have these table and I also have another table right here: So,idAlbum is in the gallery table, what is the query for this? I want to select the data from one field in one table and insert it into a field in another table.
If you want to add a field in existing table in PhpMyAdmin, click "Structure" tab while viewing its data, and at the bottom of table structure you have nice box: "Add [number] fields at the [beginning / ending] of a table. Click the button on the right and processd with forms.
How to add another field in an existing table in mysql Okay, I have these table and I also have another table right here: So,idAlbum is in the gallery table, what is the query for this? I want to select the data from one field in one table and insert it into a field in another table.
TITLE: How to add another field in an existing table in mysql QUESTION: Okay, I have these table and I also have another table right here: So,idAlbum is in the gallery table, what is the query for this? I want to select the data from one field in one table and insert it into a field in another table. ANSWER: If you w...
[ "mysql", "phpmyadmin" ]
6
26
30,702
2
0
2011-06-07T02:15:53.983000
2011-06-07T02:20:05.080000
6,260,024
6,260,065
Combat system in JQuery
i would like to create a pretty simple combat system in JQuery, for a browser game. The idea is that i have combat statistics ( i already have that ), and i want to represent them back to the user in a nice graphical manner. If you have played the game shakes and fidget, you can already see what i'm asking. If not, thi...
It seems like you're talking about something like FF7, alternating offense/defense. Interface You might want to take a note from WoW/Rift-type MMORPGs: animation: numeric hit/defense points appear in full opacity and then it scrolls down and fades out (as one fluid animation) over a period of something like 2 seconds a...
Combat system in JQuery i would like to create a pretty simple combat system in JQuery, for a browser game. The idea is that i have combat statistics ( i already have that ), and i want to represent them back to the user in a nice graphical manner. If you have played the game shakes and fidget, you can already see what...
TITLE: Combat system in JQuery QUESTION: i would like to create a pretty simple combat system in JQuery, for a browser game. The idea is that i have combat statistics ( i already have that ), and i want to represent them back to the user in a nice graphical manner. If you have played the game shakes and fidget, you ca...
[ "javascript", "jquery" ]
1
4
1,329
1
0
2011-06-07T02:17:30.707000
2011-06-07T02:24:48.603000
6,260,038
6,260,105
Deadlocks and Synchronized methods
I've found one of the code on Stack Overflow and I thought it is pretty similar to what I am facing but I still don't understand why this would enter a deadlock. The example was taken from Deadlock detection in Java: Class A { synchronized void methodA(B b) { b.last(); } synchronized void last() { System.out.println(“...
It is possible that the execution of these two statements is interweaved: Thread 1: a.methodA(b); //inside the constructor Thread 2: b.methodB(a); //inside run() to execute a.methodA(), Thread 1 will need to obtain the lock on the A object. to execute b.methodB(), Thread 2 will need to obtain the lock on the B object. ...
Deadlocks and Synchronized methods I've found one of the code on Stack Overflow and I thought it is pretty similar to what I am facing but I still don't understand why this would enter a deadlock. The example was taken from Deadlock detection in Java: Class A { synchronized void methodA(B b) { b.last(); } synchronized...
TITLE: Deadlocks and Synchronized methods QUESTION: I've found one of the code on Stack Overflow and I thought it is pretty similar to what I am facing but I still don't understand why this would enter a deadlock. The example was taken from Deadlock detection in Java: Class A { synchronized void methodA(B b) { b.last(...
[ "java", "multithreading", "synchronization", "deadlock" ]
5
23
19,846
3
0
2011-06-07T02:19:52.703000
2011-06-07T02:33:50.220000
6,260,039
6,260,061
Final member variables makes for better GC?
This question is a continuation of this one but asking for a more specific scenario. Lets say we have the following class: public class Person { private Foot left, right; public Person(Foot left, Foot right) { this.left = left; this.right = right; } } I was wondering if the following class would be able to be optimise...
Assignment to fields does not trigger any garbage collector work or reference count adjustment because Java GCs don't use reference counting (*). So the answer is that declaring a field as final will make no difference to garbage collector performance. (The tracing phase of the collector has to examine the field whethe...
Final member variables makes for better GC? This question is a continuation of this one but asking for a more specific scenario. Lets say we have the following class: public class Person { private Foot left, right; public Person(Foot left, Foot right) { this.left = left; this.right = right; } } I was wondering if the ...
TITLE: Final member variables makes for better GC? QUESTION: This question is a continuation of this one but asking for a more specific scenario. Lets say we have the following class: public class Person { private Foot left, right; public Person(Foot left, Foot right) { this.left = left; this.right = right; } } I was...
[ "java", "optimization", "garbage-collection", "final" ]
3
7
2,536
3
0
2011-06-07T02:19:57.800000
2011-06-07T02:24:15.620000
6,260,044
6,260,082
Is it possible to make a circular GUI in java?
I'm just wondering, is it possible in JAVA to make a circular GUI with components inside it (buttons, text fields... etc)?
Yes, it's entirely possible, albeit in a manner of speaking - they're not truly circular, however they have some "transparent" parts, which are filled in with a screen capture prior to displaying the frame, etc. A good introduction to performing this can be seen in the online chapter 6.5 of Killer Game Programming in J...
Is it possible to make a circular GUI in java? I'm just wondering, is it possible in JAVA to make a circular GUI with components inside it (buttons, text fields... etc)?
TITLE: Is it possible to make a circular GUI in java? QUESTION: I'm just wondering, is it possible in JAVA to make a circular GUI with components inside it (buttons, text fields... etc)? ANSWER: Yes, it's entirely possible, albeit in a manner of speaking - they're not truly circular, however they have some "transpare...
[ "java", "user-interface" ]
2
3
324
3
0
2011-06-07T02:21:14.803000
2011-06-07T02:28:16.283000
6,260,049
6,260,081
Telling the scene manager you are ready to switch scenes?
Right now for my game, I have a scene manager and it runs a scene. What it does is send event messages to the scene such as render, input, etc. This has allowed me to make the scene unaware of the scene manager. I would now like the scene to be able to send the scene manager a message saying which scene it would like t...
One way is to have the scene manager pass in NOT a reference to itself, but a reference to a smaller object that only supports the small number of methods needed for the particular messages to pass. This could be an abstract class (aka "interface") which the scene manager implements, or a separate object. And if you're...
Telling the scene manager you are ready to switch scenes? Right now for my game, I have a scene manager and it runs a scene. What it does is send event messages to the scene such as render, input, etc. This has allowed me to make the scene unaware of the scene manager. I would now like the scene to be able to send the ...
TITLE: Telling the scene manager you are ready to switch scenes? QUESTION: Right now for my game, I have a scene manager and it runs a scene. What it does is send event messages to the scene such as render, input, etc. This has allowed me to make the scene unaware of the scene manager. I would now like the scene to be...
[ "c++", "design-patterns", "observer-pattern" ]
0
1
495
2
0
2011-06-07T02:22:09.227000
2011-06-07T02:28:12.483000
6,260,053
6,260,073
How do I create a bash script that accept user input on the same line as the execution of the script?
I guess I'm more of a newb than I thought?:) The weird thing is, I know this is an easy answer. I know I will be embarrassed at how simple this is. But you can see from the title of the question that I have can't figure out how to even ask the question properly, which is probably why I can't google it... And I know of ...
the first argument in a bash script is $1, second is $2 etc...
How do I create a bash script that accept user input on the same line as the execution of the script? I guess I'm more of a newb than I thought?:) The weird thing is, I know this is an easy answer. I know I will be embarrassed at how simple this is. But you can see from the title of the question that I have can't figur...
TITLE: How do I create a bash script that accept user input on the same line as the execution of the script? QUESTION: I guess I'm more of a newb than I thought?:) The weird thing is, I know this is an easy answer. I know I will be embarrassed at how simple this is. But you can see from the title of the question that ...
[ "bash", "variables", "input" ]
1
3
867
2
0
2011-06-07T02:22:33.540000
2011-06-07T02:26:52.967000
6,260,066
6,260,077
Trying to add/subtract variable
I am trying to have something where when it is enabled it adds to a variable and when it is disabled it subtracts from the variable but when I alert the value of the variable is just comes up saying NaN Here is my code: This is for enabling/disabling the button var speedrating; function onoffButton(i, g, r) { $(i).clic...
You will need to give speedRating a value before you add/subtract from it var speedrating = 0;
Trying to add/subtract variable I am trying to have something where when it is enabled it adds to a variable and when it is disabled it subtracts from the variable but when I alert the value of the variable is just comes up saying NaN Here is my code: This is for enabling/disabling the button var speedrating; function ...
TITLE: Trying to add/subtract variable QUESTION: I am trying to have something where when it is enabled it adds to a variable and when it is disabled it subtracts from the variable but when I alert the value of the variable is just comes up saying NaN Here is my code: This is for enabling/disabling the button var spee...
[ "javascript" ]
0
6
705
1
0
2011-06-07T02:25:11.330000
2011-06-07T02:27:40.563000
6,260,089
6,260,097
Strange result when removing item from a list while iterating over it in Python
I've got this piece of code: numbers = list(range(1, 50)) for i in numbers: if i < 20: numbers.remove(i) print(numbers) But, the result I'm getting is: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49] Of course, I'...
You're modifying the list while you iterate over it. That means that the first time through the loop, i == 1, so 1 is removed from the list. Then the for loop goes to the second item in the list, which is not 2, but 3! Then that's removed from the list, and then the for loop goes on to the third item in the list, which...
Strange result when removing item from a list while iterating over it in Python I've got this piece of code: numbers = list(range(1, 50)) for i in numbers: if i < 20: numbers.remove(i) print(numbers) But, the result I'm getting is: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 3...
TITLE: Strange result when removing item from a list while iterating over it in Python QUESTION: I've got this piece of code: numbers = list(range(1, 50)) for i in numbers: if i < 20: numbers.remove(i) print(numbers) But, the result I'm getting is: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28,...
[ "python", "list", "loops", "for-loop", "range" ]
101
152
24,510
12
0
2011-06-07T02:29:26.447000
2011-06-07T02:31:40.517000
6,260,091
6,260,116
Regex for MySQL query
I am trying to select a field based on it meeting one of 3 criteria... and I'm not sure how to do this. I think a RegExp is probably the best method buy I'm unfamiliar with writing them. Say I have the integer 123, I would like to match the following cases: 123 (thats 123 only with no spaces or other numbers after it) ...
A regex is plausible, but it's not the best performing option. The last comparison put MySQL's regex support as being par with wildcarding the left side of a LIKE statement -- works, but the slowest of every option available. Based on your example, you could use: SELECT t.* FROM YOUR_TABLE t WHERE t.column LIKE '123-%'...
Regex for MySQL query I am trying to select a field based on it meeting one of 3 criteria... and I'm not sure how to do this. I think a RegExp is probably the best method buy I'm unfamiliar with writing them. Say I have the integer 123, I would like to match the following cases: 123 (thats 123 only with no spaces or ot...
TITLE: Regex for MySQL query QUESTION: I am trying to select a field based on it meeting one of 3 criteria... and I'm not sure how to do this. I think a RegExp is probably the best method buy I'm unfamiliar with writing them. Say I have the integer 123, I would like to match the following cases: 123 (thats 123 only wi...
[ "mysql", "sql", "regex" ]
1
2
528
3
0
2011-06-07T02:30:49.147000
2011-06-07T02:35:44.327000
6,260,108
6,260,272
(Question on best practice) Why is "using System.Text" there by default?
Every time I creat a class, I see using System.Text that is added (amongst other using ) by default. Every time I remove it after a while because it is unused according to ReSharper. Am I missing a best practice? Do you use that namespace often? In which situation? There has to be a reason why this namespace is referen...
The System.Text namespace contains classes, abstract base classes and helper classes. Say for example if you wanted to take advantage of the StringBuilder, Decoder, Encoder, etc.... The classes above, plays a significant role in most cases in.net. But it is not necessary for it to be there in your code. It only applies...
(Question on best practice) Why is "using System.Text" there by default? Every time I creat a class, I see using System.Text that is added (amongst other using ) by default. Every time I remove it after a while because it is unused according to ReSharper. Am I missing a best practice? Do you use that namespace often? I...
TITLE: (Question on best practice) Why is "using System.Text" there by default? QUESTION: Every time I creat a class, I see using System.Text that is added (amongst other using ) by default. Every time I remove it after a while because it is unused according to ReSharper. Am I missing a best practice? Do you use that ...
[ "c#", ".net", "visual-studio", "class", "namespaces" ]
14
13
10,252
5
0
2011-06-07T02:34:00.033000
2011-06-07T03:16:06.103000
6,260,112
6,261,486
need some help figuring out how to approach this validation
I am using codeigniter for my form validation. I have two select fields named parent_male and parent_female. I would like to have a validation callback to check both the parent_male and parent_female in my database to see if it exists. I already have a previous callback function that does just that, but with only one f...
You can define your callback as: function isparent($parent) { $result = FALSE; /* do your stuff to check $parent is a valid parent and then... */ return $result; } and the rules can be set as $this->form_validation->set_rules('parent_male', 'Male parent', 'callback_isparent'); $this->form_validation->set_rules('parent...
need some help figuring out how to approach this validation I am using codeigniter for my form validation. I have two select fields named parent_male and parent_female. I would like to have a validation callback to check both the parent_male and parent_female in my database to see if it exists. I already have a previou...
TITLE: need some help figuring out how to approach this validation QUESTION: I am using codeigniter for my form validation. I have two select fields named parent_male and parent_female. I would like to have a validation callback to check both the parent_male and parent_female in my database to see if it exists. I alre...
[ "php", "validation", "codeigniter" ]
0
3
63
1
0
2011-06-07T02:34:45.337000
2011-06-07T06:42:53.363000
6,260,113
6,260,264
UnsupportedOperationException in AbstractList.remove() when operating on ArrayList
ArrayList 's list iterator does implement the remove method, however, I get the following exception thrown: UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:144) By this code: protected void removeZeroLengthStringsFrom(List stringList) { ListIterator iter = stringList.listIterator(); Str...
I think you may be using the Arrays utility to get the List that you pass into that method. The object is indeed of type ArrayList, but it's java.util.Arrays.ArrayList, not java.util.ArrayList. The java.util.Arrays.ArrayList version is immutable and its remove() method is not overridden. As such, it defers to the Abstr...
UnsupportedOperationException in AbstractList.remove() when operating on ArrayList ArrayList 's list iterator does implement the remove method, however, I get the following exception thrown: UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:144) By this code: protected void removeZeroLeng...
TITLE: UnsupportedOperationException in AbstractList.remove() when operating on ArrayList QUESTION: ArrayList 's list iterator does implement the remove method, however, I get the following exception thrown: UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:144) By this code: protected v...
[ "java", "list", "iterator", "arraylist" ]
54
152
32,222
2
0
2011-06-07T02:34:46.450000
2011-06-07T03:12:04.560000
6,260,114
6,260,132
What's the difference between async and nonblocking in unix socket?
I'm seeing such code in nginx: if(fcntl(ngx_processes[s].channel[0], F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK) == -1) {... if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {... Anyone can tell me what's the difference between fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK) and ioctl(s, FIOASYNC, &on),aren'...
FIOASYNC toggles the O_ASYNC flag (which is usually set in open(2) or fcntl(2) ) for a file descriptor, which will ask the kernel to send SIGIO or SIGPOLL to the process when the file descriptor is ready for IO. O_ASYNC is not used often: it is extremely difficult to properly handle IO in signal handlers; they are best...
What's the difference between async and nonblocking in unix socket? I'm seeing such code in nginx: if(fcntl(ngx_processes[s].channel[0], F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK) == -1) {... if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {... Anyone can tell me what's the difference between fcntl(s, F_SETF...
TITLE: What's the difference between async and nonblocking in unix socket? QUESTION: I'm seeing such code in nginx: if(fcntl(ngx_processes[s].channel[0], F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK) == -1) {... if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {... Anyone can tell me what's the difference betwe...
[ "c", "network-programming", "nonblocking", "asyncsocket" ]
21
24
9,236
1
0
2011-06-07T02:35:07.633000
2011-06-07T02:38:45.153000
6,260,127
6,260,168
SQL Query to check rate limit
Lets say I have a table of messages that users have sent, each with a timestamp. I want to make a query that will tell me (historically) the most number of messages a user ever sent in an hour. So in other words, in any given 1 hour period, what was the most number of messages sent. Any ideas?
Assuming timestamp to be a DATETIME - otherwise, use FROM_UNIXTIME to convert to a DATETIME... For a [rolling] count within the last hour: SELECT COUNT(*) AS cnt FROM MESSAGES m WHERE m.timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) AND NOW() GROUP BY m.user ORDER BY cnt DESC LIMIT 1 If you want a specific hour, sp...
SQL Query to check rate limit Lets say I have a table of messages that users have sent, each with a timestamp. I want to make a query that will tell me (historically) the most number of messages a user ever sent in an hour. So in other words, in any given 1 hour period, what was the most number of messages sent. Any id...
TITLE: SQL Query to check rate limit QUESTION: Lets say I have a table of messages that users have sent, each with a timestamp. I want to make a query that will tell me (historically) the most number of messages a user ever sent in an hour. So in other words, in any given 1 hour period, what was the most number of mes...
[ "mysql", "sql" ]
4
2
1,721
4
0
2011-06-07T02:37:55.150000
2011-06-07T02:47:52.533000
6,260,133
6,260,187
Bug in the validator or obscure error in my CSS?
I am trying to validate a CSS document with the W3C validator, and it's giving some warnings related to color and background-color that should not appear since, well, I don't have those issues present in my document. Having it incorrectly report a warning wouldn't be so much of a surprise, but it reports different warn...
If you copy the CSS and paste it into here it validates without any warnings. I'd just put it down to validator weirdness.
Bug in the validator or obscure error in my CSS? I am trying to validate a CSS document with the W3C validator, and it's giving some warnings related to color and background-color that should not appear since, well, I don't have those issues present in my document. Having it incorrectly report a warning wouldn't be so ...
TITLE: Bug in the validator or obscure error in my CSS? QUESTION: I am trying to validate a CSS document with the W3C validator, and it's giving some warnings related to color and background-color that should not appear since, well, I don't have those issues present in my document. Having it incorrectly report a warni...
[ "css", "w3c", "validation" ]
2
1
113
1
0
2011-06-07T02:38:45.413000
2011-06-07T02:52:22.823000
6,260,140
6,260,289
How to Attach image file in Local Report(RDLC)?
In Reporting Services Report(rdl) Image can be attached easily using Select the image Source and Use this image (Import). But when i create a local Report (rdlc) the options on rdl is not provided. So i cannot attached my.jpeg image on it. Thanks
If you only need a static image you can simply navigate to Report -> Embedded Images in Visual Studio and click 'New Image' to add a new image.
How to Attach image file in Local Report(RDLC)? In Reporting Services Report(rdl) Image can be attached easily using Select the image Source and Use this image (Import). But when i create a local Report (rdlc) the options on rdl is not provided. So i cannot attached my.jpeg image on it. Thanks
TITLE: How to Attach image file in Local Report(RDLC)? QUESTION: In Reporting Services Report(rdl) Image can be attached easily using Select the image Source and Use this image (Import). But when i create a local Report (rdlc) the options on rdl is not provided. So i cannot attached my.jpeg image on it. Thanks ANSWER...
[ "winforms", "reportviewer", "rdlc", "localreport" ]
1
1
1,630
1
0
2011-06-07T02:40:31.480000
2011-06-07T03:18:57.347000
6,260,143
6,260,198
Tomcat 7 java.lang.NoSuchMethodError: main - Mac OS X 10.6
I have unpacked the tar file in /usr/local and created a symbolic link in /Library/Tomcat. From there I made all.sh files in /bin executable. Upon startup, I get nothing, including a normal "could not connect" upon visiting localhost:8080. Checking my catalina.out shows "Exception in thread "main" java.lang.NoSuchMetho...
It seems you have incomaptible jar files in your classpath you use to launch Tomcat, (For example Tomcat 7 may depend on a library foo.jar version 1.2 but you have 1.1 installed) The only way to know for sure is to see the strack trace (what method is Tomcat expecting and in which class). That will lead you to your pro...
Tomcat 7 java.lang.NoSuchMethodError: main - Mac OS X 10.6 I have unpacked the tar file in /usr/local and created a symbolic link in /Library/Tomcat. From there I made all.sh files in /bin executable. Upon startup, I get nothing, including a normal "could not connect" upon visiting localhost:8080. Checking my catalina....
TITLE: Tomcat 7 java.lang.NoSuchMethodError: main - Mac OS X 10.6 QUESTION: I have unpacked the tar file in /usr/local and created a symbolic link in /Library/Tomcat. From there I made all.sh files in /bin executable. Upon startup, I get nothing, including a normal "could not connect" upon visiting localhost:8080. Che...
[ "java", "apache", "tomcat" ]
0
1
1,131
1
0
2011-06-07T02:41:24.903000
2011-06-07T02:53:58.430000
6,260,144
6,260,169
ExpatError: not well-formed (invalid token)
please consider this code: import xml.etree.ElementTree as ET import urllib XML_response = urllib.urlopen('http://www.navlost.eu/aero/metar/?icao=LWSK&dt0=2011-05-03+12%3A00%3A00&c=1&rt=metar').read() tree = ET.fromstring(XML_response) Which raises this error: ----------------------------------------------------------...
Double dashes are not valid within comments (other than when ending them). There was a bug filed against Expat with the same issue you have, and they rejected it with a link to the relevant standard.
ExpatError: not well-formed (invalid token) please consider this code: import xml.etree.ElementTree as ET import urllib XML_response = urllib.urlopen('http://www.navlost.eu/aero/metar/?icao=LWSK&dt0=2011-05-03+12%3A00%3A00&c=1&rt=metar').read() tree = ET.fromstring(XML_response) Which raises this error: --------------...
TITLE: ExpatError: not well-formed (invalid token) QUESTION: please consider this code: import xml.etree.ElementTree as ET import urllib XML_response = urllib.urlopen('http://www.navlost.eu/aero/metar/?icao=LWSK&dt0=2011-05-03+12%3A00%3A00&c=1&rt=metar').read() tree = ET.fromstring(XML_response) Which raises this err...
[ "python" ]
2
2
11,548
1
0
2011-06-07T02:41:31.080000
2011-06-07T02:47:53.837000
6,260,152
6,260,186
RSpec doesn't remove DB record so it fails the second time it runs
This is from Michael Hartl's book, section 8.4. RSpec is testing a successful signup but is fails because the email address isn't unique. So if I go into the code and update the email address in the spec, it works the first time I run it but not the second time. I have confirmed this because I can make the test pass by...
What does your spec/spec_helper.rb file look like? Do you have transactions turned on? RSpec.configure do |config| config.use_transactional_fixtures = true end This runs each of your specs within a database transaction, returning it back to its original state after each test run. Once your spec helper looks something l...
RSpec doesn't remove DB record so it fails the second time it runs This is from Michael Hartl's book, section 8.4. RSpec is testing a successful signup but is fails because the email address isn't unique. So if I go into the code and update the email address in the spec, it works the first time I run it but not the sec...
TITLE: RSpec doesn't remove DB record so it fails the second time it runs QUESTION: This is from Michael Hartl's book, section 8.4. RSpec is testing a successful signup but is fails because the email address isn't unique. So if I go into the code and update the email address in the spec, it works the first time I run ...
[ "ruby-on-rails", "rspec" ]
1
5
3,018
1
0
2011-06-07T02:43:03.040000
2011-06-07T02:52:11.657000
6,260,157
6,260,325
Mysql - How to quit/exit from stored procedure
I have very simple question but i did't get any simple code to exit from SP using Mysql. Can anyone share with me how to do that? CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20)) BEGIN IF tablename IS NULL THEN #Exit this stored procedure here END IF; #proceed the code END;
CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20)) proc_label:BEGIN IF tablename IS NULL THEN LEAVE proc_label; END IF; #proceed the code END;
Mysql - How to quit/exit from stored procedure I have very simple question but i did't get any simple code to exit from SP using Mysql. Can anyone share with me how to do that? CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20)) BEGIN IF tablename IS NULL THEN #Exit this stored procedure here END IF; #proceed the ...
TITLE: Mysql - How to quit/exit from stored procedure QUESTION: I have very simple question but i did't get any simple code to exit from SP using Mysql. Can anyone share with me how to do that? CREATE PROCEDURE SP_Reporting(IN tablename VARCHAR(20)) BEGIN IF tablename IS NULL THEN #Exit this stored procedure here END ...
[ "mysql", "sql", "stored-procedures" ]
157
252
129,166
7
0
2011-06-07T02:44:00.450000
2011-06-07T03:29:43.433000
6,260,158
6,260,190
How to use Maven classpath to run Java main class?
I'm currently using Maven to build my Rhino JavaScript project, download dependent libraries, and manage the classpath at runtime. I'm able to run the JavaScript entry point by using the Maven exec plugin, in the following way: org.codehaus.mojo exec-maven-plugin 1.1 java org.mozilla.javascript.tools.shell.Main runtime...
You can use the -o / --offline switch to tell Maven to not bother checking for snapshot or plugin updates. Use the appassembler or assembly plugins to generate startup scripts which will automatically (in the case of appassembler) reference the desired classpath.
How to use Maven classpath to run Java main class? I'm currently using Maven to build my Rhino JavaScript project, download dependent libraries, and manage the classpath at runtime. I'm able to run the JavaScript entry point by using the Maven exec plugin, in the following way: org.codehaus.mojo exec-maven-plugin 1.1 j...
TITLE: How to use Maven classpath to run Java main class? QUESTION: I'm currently using Maven to build my Rhino JavaScript project, download dependent libraries, and manage the classpath at runtime. I'm able to run the JavaScript entry point by using the Maven exec plugin, in the following way: org.codehaus.mojo exec-...
[ "java", "maven", "rhino" ]
7
4
3,163
1
0
2011-06-07T02:44:10.937000
2011-06-07T02:53:13.060000
6,260,160
6,263,180
How can I save array of samples as audio file in iPhone?
I have a sound as array of samples. How can I save this as audio file? I have examined iPhone Core Audio APIs. And I understand how to record from mic and play music. But I can't find how to do that.
Here is a piece of code that works for me. For any more information you should check out the book Core Audio Rough Cuts. #include "WavGenerator.h" #import #import #include "AudioController.h" #define SAMPLE_RATE 44100 #define DURATION 5.0 #define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[...
How can I save array of samples as audio file in iPhone? I have a sound as array of samples. How can I save this as audio file? I have examined iPhone Core Audio APIs. And I understand how to record from mic and play music. But I can't find how to do that.
TITLE: How can I save array of samples as audio file in iPhone? QUESTION: I have a sound as array of samples. How can I save this as audio file? I have examined iPhone Core Audio APIs. And I understand how to record from mic and play music. But I can't find how to do that. ANSWER: Here is a piece of code that works f...
[ "iphone", "objective-c", "core-audio" ]
2
4
1,272
2
0
2011-06-07T02:44:58.803000
2011-06-07T09:25:06.467000
6,260,173
6,260,208
Joining 2 model's data together and ordering them by common column?
I have 2 models that I am interested in merging and then ordering them by the created_at column. One of the models is photos and the other one is statuses. Currently, I have two tabs, photos and statuses in which I display each of the model data sepeartely by the time they were created. However, I want to make another ...
There's probably some slick way to do this in SQL but if you're only displaying a few records, doing it in Ruby is fine, and readable. Something like: @photos = Photo.recent(5) @images = Image.recent(5) @both = (@photos + @images).sort_by(&:created_at).reverse If your goal is to display a classic activity feed, I recom...
Joining 2 model's data together and ordering them by common column? I have 2 models that I am interested in merging and then ordering them by the created_at column. One of the models is photos and the other one is statuses. Currently, I have two tabs, photos and statuses in which I display each of the model data sepear...
TITLE: Joining 2 model's data together and ordering them by common column? QUESTION: I have 2 models that I am interested in merging and then ordering them by the created_at column. One of the models is photos and the other one is statuses. Currently, I have two tabs, photos and statuses in which I display each of the...
[ "ruby-on-rails", "sorting", "rails-models" ]
1
1
43
2
0
2011-06-07T02:49:58.600000
2011-06-07T02:56:47.910000
6,260,176
6,260,184
"Specified method is not supported" error with iTextSharp
I'm using iTextSharp to generate PDFs. I've added a test method below that makes a simple page with one paragraph. It works, the PDF is generated, however, sometime after the PDF is sent to the browser I get a NotSupportedException in the Event log (or if I catch them myself from Application_Error). Here's the simplest...
There is an error is in this line: Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); Use ToArray instead of GetBuffer. Like this: var bytes = ms.ToArray(); Response.OutputStream.Write(bytes, 0, bytes.Length); MemoryStream.GetBuffer returns allocated bytes, not filled bytes. Example of the issue: us...
"Specified method is not supported" error with iTextSharp I'm using iTextSharp to generate PDFs. I've added a test method below that makes a simple page with one paragraph. It works, the PDF is generated, however, sometime after the PDF is sent to the browser I get a NotSupportedException in the Event log (or if I catc...
TITLE: "Specified method is not supported" error with iTextSharp QUESTION: I'm using iTextSharp to generate PDFs. I've added a test method below that makes a simple page with one paragraph. It works, the PDF is generated, however, sometime after the PDF is sent to the browser I get a NotSupportedException in the Event...
[ "c#", "asp.net-mvc", "itext", "notsupportedexception" ]
4
1
7,553
1
0
2011-06-07T02:50:13.590000
2011-06-07T02:51:59.607000
6,260,182
6,260,203
some problem with variables in objective-c
Here is what I am doing: [imageTag.mediaTags addObject:unitTag]; [imageTag.allTags addObject:unitTag]; unitTag.title=@""; unitTag.link=@""; unitTag.description=@""; unitTag.price=@""; unitTag.imageLink=@""; The problem is, once I make execute beyond line 2, the values stored in the array gets lost too (I used GDB to p...
If I understand correctly, you need to make a copy of the UnitTag object and insert that into the array. You're just storing an object reference in the array and then nuking the values the reference is using. addObject is not storing a copy - it's storing the actual object reference. To make a copy, you need to create ...
some problem with variables in objective-c Here is what I am doing: [imageTag.mediaTags addObject:unitTag]; [imageTag.allTags addObject:unitTag]; unitTag.title=@""; unitTag.link=@""; unitTag.description=@""; unitTag.price=@""; unitTag.imageLink=@""; The problem is, once I make execute beyond line 2, the values stored ...
TITLE: some problem with variables in objective-c QUESTION: Here is what I am doing: [imageTag.mediaTags addObject:unitTag]; [imageTag.allTags addObject:unitTag]; unitTag.title=@""; unitTag.link=@""; unitTag.description=@""; unitTag.price=@""; unitTag.imageLink=@""; The problem is, once I make execute beyond line 2, ...
[ "objective-c", "ios", "variables", "memory" ]
0
1
848
1
0
2011-06-07T02:51:50.977000
2011-06-07T02:55:20.167000
6,260,194
6,260,225
scrub document of BBcode
Say I have a document like: [b]blah[/b] [img]Thisismyimage.png[/img] How can I make it so that I completely remove all of the BBcode tags. And also remove all the text from between the [img] tags. If it helps at all I am using an IPB board. If any knows of a way to easily to parse the BBcode that would be great, howeve...
Parsing BBcode is pretty much a solved task: http://pear.php.net/package/HTML_BBCodeParser - And that would also be the more advisable path for removing (for simplicity just apply strip_tags() afterwards). But for removing a limited set of syntax constructs, you could use a very simple regex: $text = preg_replace('#\[i...
scrub document of BBcode Say I have a document like: [b]blah[/b] [img]Thisismyimage.png[/img] How can I make it so that I completely remove all of the BBcode tags. And also remove all the text from between the [img] tags. If it helps at all I am using an IPB board. If any knows of a way to easily to parse the BBcode th...
TITLE: scrub document of BBcode QUESTION: Say I have a document like: [b]blah[/b] [img]Thisismyimage.png[/img] How can I make it so that I completely remove all of the BBcode tags. And also remove all the text from between the [img] tags. If it helps at all I am using an IPB board. If any knows of a way to easily to p...
[ "php", "bbcode", "ipb" ]
0
2
249
1
0
2011-06-07T02:53:24.970000
2011-06-07T03:00:27.830000
6,260,197
6,263,474
Magento multi website controller
Is it possible to programmatically dispatch websites in Magento? Currently, I have a directory in the root of my site called /websites. In this directory I have subdirectories for each website, for example, site_a, site_b, site_c. Then each site subdirectory has a.htaccess and index.php with appropriate run code, for e...
You have access to the $_SERVER variables in php and you can use these to determine the Mage::run("whatever", "website"); call, e.g.: $whatever=$_SERVER['condition/url/whatever']; // or use some cookies if (isset($_COOKIE['dev'])) $whatever=$_COOKIE['dev']; switch($whatever) { case "example.com": case "www.example.c...
Magento multi website controller Is it possible to programmatically dispatch websites in Magento? Currently, I have a directory in the root of my site called /websites. In this directory I have subdirectories for each website, for example, site_a, site_b, site_c. Then each site subdirectory has a.htaccess and index.php...
TITLE: Magento multi website controller QUESTION: Is it possible to programmatically dispatch websites in Magento? Currently, I have a directory in the root of my site called /websites. In this directory I have subdirectories for each website, for example, site_a, site_b, site_c. Then each site subdirectory has a.htac...
[ "magento", "web", "store", "controllers" ]
3
3
679
3
0
2011-06-07T02:53:43.300000
2011-06-07T09:48:50.080000
6,260,205
6,260,215
Why is it that regex cannot match an XML element?
This article argues that regular expressions cannot match nested structures because regexes are finite automatons. He then offers a list of problems in which the answer states that the following cannot be solved using regexes: matching an XML element matching a C/VB/C# math expression matching a valid regex Since 2 & 3...
You can match a limited subset of HTML tags, if you know in advance the tags to be matched. But you can't (reliably or nicely) parse arbitrary HTML. It is not a regular language.
Why is it that regex cannot match an XML element? This article argues that regular expressions cannot match nested structures because regexes are finite automatons. He then offers a list of problems in which the answer states that the following cannot be solved using regexes: matching an XML element matching a C/VB/C# ...
TITLE: Why is it that regex cannot match an XML element? QUESTION: This article argues that regular expressions cannot match nested structures because regexes are finite automatons. He then offers a list of problems in which the answer states that the following cannot be solved using regexes: matching an XML element m...
[ "xml", "regex", "language-agnostic" ]
6
3
412
4
0
2011-06-07T02:55:50.797000
2011-06-07T02:58:02.393000
6,260,219
6,260,269
Indicator of loading
I am working on a project that requires a sound to play when a link is clicked. Everything works fine, I used the Javascript below. The problem is that it takes about 30 seconds (depending on internet speed) before you actually hear the file because the browser has to download it. Is there a way to adapt the code below...
A forewarning that "bgsound" is proprietary to Internet Explorer, as far as I know. Having said that, you can subscribe to its "readystatechage" event to find out when it's done loading.... (untested! as I don't have IE) http://www.highdots.com/forums/javascript/finding-when-bgsound-downloads-47830.html
Indicator of loading I am working on a project that requires a sound to play when a link is clicked. Everything works fine, I used the Javascript below. The problem is that it takes about 30 seconds (depending on internet speed) before you actually hear the file because the browser has to download it. Is there a way to...
TITLE: Indicator of loading QUESTION: I am working on a project that requires a sound to play when a link is clicked. Everything works fine, I used the Javascript below. The problem is that it takes about 30 seconds (depending on internet speed) before you actually hear the file because the browser has to download it....
[ "javascript", "html", "audio", "onclick" ]
0
2
605
2
0
2011-06-07T02:59:19.103000
2011-06-07T03:15:37.517000
6,260,221
6,260,300
go back to the previous form (c#)
I know how to go to another form in modal mode just like what I did below: public partial class Form1: Form { public Form1() { InitializeComponent(); } Form2 myNewForm = new Form2(); private void button1_Click(object sender, EventArgs e) { this.Hide(); myNewForm.ShowDialog(); } } This is my second form, how do I go b...
When you call ShowDialog on a form, it runs until the form is closed, the form's DialogResult property is set to something other than None, or a child button with a DialogResult property other than None is clicked. So you could do something like public partial class Form1 {... private void button1_Click(object sender, ...
go back to the previous form (c#) I know how to go to another form in modal mode just like what I did below: public partial class Form1: Form { public Form1() { InitializeComponent(); } Form2 myNewForm = new Form2(); private void button1_Click(object sender, EventArgs e) { this.Hide(); myNewForm.ShowDialog(); } } Thi...
TITLE: go back to the previous form (c#) QUESTION: I know how to go to another form in modal mode just like what I did below: public partial class Form1: Form { public Form1() { InitializeComponent(); } Form2 myNewForm = new Form2(); private void button1_Click(object sender, EventArgs e) { this.Hide(); myNewForm.Show...
[ "c#", "forms", "modal-dialog", "back-button" ]
2
10
49,720
2
0
2011-06-07T02:59:25.267000
2011-06-07T03:21:14.860000
6,260,224
6,260,295
How to write CDATA using SimpleXmlElement?
I have this code to create and update xml file: '); $xml->title = 'Site Title'; $xml->title->addAttribute('lang', 'en'); $xml->saveXML($xmlFile);?> This generates the following xml file: Site Title The question is: is there a way to add CDATA with this method/technique to create xml code below? Site Title
Got it! I adapted the code from this great solution ( archived version ): ownerDocument; $node->appendChild( $ownerDocumentNode->createCDATASection( $cdata_text )); } } // How to create the following example, below: // // // Site Title // /* * Instead of SimpleXMLElement: * $xml = new SimpleXMLElement( ' ' ); * crea...
How to write CDATA using SimpleXmlElement? I have this code to create and update xml file: '); $xml->title = 'Site Title'; $xml->title->addAttribute('lang', 'en'); $xml->saveXML($xmlFile);?> This generates the following xml file: Site Title The question is: is there a way to add CDATA with this method/technique to crea...
TITLE: How to write CDATA using SimpleXmlElement? QUESTION: I have this code to create and update xml file: '); $xml->title = 'Site Title'; $xml->title->addAttribute('lang', 'en'); $xml->saveXML($xmlFile);?> This generates the following xml file: Site Title The question is: is there a way to add CDATA with this method...
[ "php", "xml", "simplexml", "cdata" ]
59
96
61,905
5
0
2011-06-07T03:00:18.600000
2011-06-07T03:20:40.457000
6,260,226
6,286,726
About xcode console text color and background
Cannot change text color of xcode color output despite trying to use the "xcode preference" dialogue box. Please help... The above is a screen shot of the preference dialogue window. Somehow, the option for changing the console output does not seem to be showing up.
Under Debugging >> Fonts & Colors you can set fonts the following way;: 1. Debugger Console Prompt = the color text prompt when breakpointing 2. Debugger Console Input = the color of typed text when breakpointing 3. Executable Standard Output = most of the debug text, you can change the foreground color. This accounts ...
About xcode console text color and background Cannot change text color of xcode color output despite trying to use the "xcode preference" dialogue box. Please help... The above is a screen shot of the preference dialogue window. Somehow, the option for changing the console output does not seem to be showing up.
TITLE: About xcode console text color and background QUESTION: Cannot change text color of xcode color output despite trying to use the "xcode preference" dialogue box. Please help... The above is a screen shot of the preference dialogue window. Somehow, the option for changing the console output does not seem to be s...
[ "objective-c", "xcode" ]
3
4
5,763
1
0
2011-06-07T03:01:23.233000
2011-06-09T00:12:19.510000
6,260,236
6,261,298
Ajax to Python Pyramid data
So far, I have managed to take a bunch of HTML elements for whose contentEditable attribute is True and join their id's and HTML data together to make an Ajax data string. I can get the serialized data back to the server, no problem. For example, $(document).ready(function(){ $("#save").click(function(){ var ajax_strin...
You say you want to convert each request.param string into a dictionary object, but is that what you meant? It looks like each string is just a key/value pair. You can pretty simply create a dictionary from those values using: opts = {} for r in request.params: parts = r.split(':', 1) if len(parts) == 2: opts[parts[0]]...
Ajax to Python Pyramid data So far, I have managed to take a bunch of HTML elements for whose contentEditable attribute is True and join their id's and HTML data together to make an Ajax data string. I can get the serialized data back to the server, no problem. For example, $(document).ready(function(){ $("#save").clic...
TITLE: Ajax to Python Pyramid data QUESTION: So far, I have managed to take a bunch of HTML elements for whose contentEditable attribute is True and join their id's and HTML data together to make an Ajax data string. I can get the serialized data back to the server, no problem. For example, $(document).ready(function(...
[ "python", "ajax", "pyramid" ]
1
0
1,863
1
0
2011-06-07T03:02:43.187000
2011-06-07T06:21:07.837000
6,260,241
6,260,259
Runtime exception(s) when running an F# benchmark on Mono
I am trying to compare the performance of a specific F# benchmark running on.NET and Mono 2.10.2 (Windows 7, 64-bit). I took the Spectral-Norm benchmark from the Benchmarks Game followed the traditional SO advice of using System.Diagnostics.StopWatch for benchmarking C# and added the lines 4, 89-90, and 93-95 at this l...
Reference Assemblies do not (often) have code - they are API signatures only (enough info for the compiler to reference them at design-time/compile-time). You need to copy the runtime assemblies, not the reference assemblies, in order to run it. (You'll often find the runtime assemblies in the GAC.)
Runtime exception(s) when running an F# benchmark on Mono I am trying to compare the performance of a specific F# benchmark running on.NET and Mono 2.10.2 (Windows 7, 64-bit). I took the Spectral-Norm benchmark from the Benchmarks Game followed the traditional SO advice of using System.Diagnostics.StopWatch for benchma...
TITLE: Runtime exception(s) when running an F# benchmark on Mono QUESTION: I am trying to compare the performance of a specific F# benchmark running on.NET and Mono 2.10.2 (Windows 7, 64-bit). I took the Spectral-Norm benchmark from the Benchmarks Game followed the traditional SO advice of using System.Diagnostics.Sto...
[ "f#", "mono", "benchmarking" ]
2
3
321
2
0
2011-06-07T03:04:21.503000
2011-06-07T03:10:13.747000
6,260,244
6,264,697
JSF 2 Composite Component EL type conversion error
I have a JSF Composite Component that has a EL Expression on the Interface part, code snippet below. Now my problem is that the "default="#{cc.attrs.label ne null}" is giving an error. java.lang.IllegalArgumentException: Cannot convert /resources/cc/label.xhtml @20,85 default="#{cc.attrs.label!= null}" of type class co...
The #{cc.attrs} is only available inside. I'd suggest to rewrite it as follows:...
JSF 2 Composite Component EL type conversion error I have a JSF Composite Component that has a EL Expression on the Interface part, code snippet below. Now my problem is that the "default="#{cc.attrs.label ne null}" is giving an error. java.lang.IllegalArgumentException: Cannot convert /resources/cc/label.xhtml @20,85 ...
TITLE: JSF 2 Composite Component EL type conversion error QUESTION: I have a JSF Composite Component that has a EL Expression on the Interface part, code snippet below. Now my problem is that the "default="#{cc.attrs.label ne null}" is giving an error. java.lang.IllegalArgumentException: Cannot convert /resources/cc/l...
[ "jsf", "el", "composite-component" ]
4
7
2,516
1
0
2011-06-07T03:05:09.847000
2011-06-07T11:46:31.110000
6,260,247
6,260,274
asp ERROR MESSAGE
How I can solve this error message Microsoft VBScript runtime error '800a01a8' Object required: 'lUATRef' /cmgtest/transaction/viewPCReqForm.asp, line 284 this is some source code that I wrote below function checkUATReq(aUATRef) Dim correctness,lUATRef,uatRef correctness = False lUATRef = aUATRef uatRef = lUATRef.Subst...
Seems like your function isn't getting a parameter passed to it. Check whether aUATRef is getting initialized.
asp ERROR MESSAGE How I can solve this error message Microsoft VBScript runtime error '800a01a8' Object required: 'lUATRef' /cmgtest/transaction/viewPCReqForm.asp, line 284 this is some source code that I wrote below function checkUATReq(aUATRef) Dim correctness,lUATRef,uatRef correctness = False lUATRef = aUATRef uatR...
TITLE: asp ERROR MESSAGE QUESTION: How I can solve this error message Microsoft VBScript runtime error '800a01a8' Object required: 'lUATRef' /cmgtest/transaction/viewPCReqForm.asp, line 284 this is some source code that I wrote below function checkUATReq(aUATRef) Dim correctness,lUATRef,uatRef correctness = False lUAT...
[ "asp-classic", "vbscript" ]
0
0
143
2
0
2011-06-07T03:05:44.810000
2011-06-07T03:16:21.250000
6,260,273
6,260,324
MySQL issue when moving from Dreamhost to HostGator
First, let me start by saying the website was working perfectly well on Dreamhost (except for the last week with horrible lags and downtime - but it was not what made me move away from them, read below). I was hosting my website on Dreamhost. I had to move due to a problem with the owner of the revenue hosting (he'd no...
Try this: What I've done is simplify the original code to remove the IF / ELSE statement which looks like it might be there for development purposes. If you're getting other errors not posted, please include them.
MySQL issue when moving from Dreamhost to HostGator First, let me start by saying the website was working perfectly well on Dreamhost (except for the last week with horrible lags and downtime - but it was not what made me move away from them, read below). I was hosting my website on Dreamhost. I had to move due to a pr...
TITLE: MySQL issue when moving from Dreamhost to HostGator QUESTION: First, let me start by saying the website was working perfectly well on Dreamhost (except for the last week with horrible lags and downtime - but it was not what made me move away from them, read below). I was hosting my website on Dreamhost. I had t...
[ "php", "hosting" ]
0
2
686
4
0
2011-06-07T03:16:15.743000
2011-06-07T03:29:24.907000
6,260,276
6,260,341
regular expression with space
I am using regular expression in R with the following code: > temp <- c("Herniorrhaphy, left inguinal", "Herniorrhaphy, right inguinal") > grep("Herniorrhaphy, [left|right] inguinal",temp) integer(0) > grep("Herniorrhaphy, [left inguinal|right inguinal]",temp) [1] 1 2 I wonder why the two regular expression give differ...
I think you want brackets ( ) not character class [ ], ie "Herniorrhaphy, (left|right) inguinal" "Herniorrhaphy, (left inguinal|right inguinal)"
regular expression with space I am using regular expression in R with the following code: > temp <- c("Herniorrhaphy, left inguinal", "Herniorrhaphy, right inguinal") > grep("Herniorrhaphy, [left|right] inguinal",temp) integer(0) > grep("Herniorrhaphy, [left inguinal|right inguinal]",temp) [1] 1 2 I wonder why the two ...
TITLE: regular expression with space QUESTION: I am using regular expression in R with the following code: > temp <- c("Herniorrhaphy, left inguinal", "Herniorrhaphy, right inguinal") > grep("Herniorrhaphy, [left|right] inguinal",temp) integer(0) > grep("Herniorrhaphy, [left inguinal|right inguinal]",temp) [1] 1 2 I w...
[ "regex", "r" ]
1
2
232
2
0
2011-06-07T03:16:35.273000
2011-06-07T03:33:29.940000
6,260,280
6,260,290
Can you use @ instead of <% in ASP.net
I am seeing some examples online where the @ is being used before server side code. eg Browsing Genre: @Model.Name So can you just use a single @ instead of wrapping the c#/vb code in <% %>?
You can use @ if you're using the Razor view engine in ASP.NET MVC. That's most-likely what you're seeing examples of.
Can you use @ instead of <% in ASP.net I am seeing some examples online where the @ is being used before server side code. eg Browsing Genre: @Model.Name So can you just use a single @ instead of wrapping the c#/vb code in <% %>?
TITLE: Can you use @ instead of <% in ASP.net QUESTION: I am seeing some examples online where the @ is being used before server side code. eg Browsing Genre: @Model.Name So can you just use a single @ instead of wrapping the c#/vb code in <% %>? ANSWER: You can use @ if you're using the Razor view engine in ASP.NET ...
[ "asp.net", "asp.net-mvc" ]
0
8
100
2
0
2011-06-07T03:17:20.203000
2011-06-07T03:19:02.443000
6,260,281
6,260,334
Database design - Help desk application
I can't decide whether to keep the help desk application in the same database as the rest of the corporate applications or completely separate it. The help desk application can log support request from a phone call, email, website. We can get questions sent to us from registered customers and non-registered customers. ...
I think this is a subjective answer, but I would keep the help desk system as a separate entity, unless there is a good business reason to use the same user base. This is mostly based on what I've seen in professional helpdesk call logging/ticket software, but I do have another compelling reason - security - logic is a...
Database design - Help desk application I can't decide whether to keep the help desk application in the same database as the rest of the corporate applications or completely separate it. The help desk application can log support request from a phone call, email, website. We can get questions sent to us from registered ...
TITLE: Database design - Help desk application QUESTION: I can't decide whether to keep the help desk application in the same database as the rest of the corporate applications or completely separate it. The help desk application can log support request from a phone call, email, website. We can get questions sent to u...
[ "c#", "database-design", "application-design" ]
1
2
1,438
2
0
2011-06-07T03:17:20.757000
2011-06-07T03:32:00.373000
6,260,284
6,260,366
iOS: Search on a main word(noun), not its pronoun
I am writing a TableView app where people can search for a word in a foreign language. In this language, the article is important as it tells the word's gender. A reasonable english example is "The Book". I want to search for "Book", not "The". Any ideas on the best way to do this? Many thanks
Are you talking about looking something up in a database, eg? SQLite can be built with Full Text Search extensions that allow you to search for individual words in text. Even without the FTS extensions you can use a LIKE match in SQLite to find a word in a phrase, though the FTS extensions are much faster and more flex...
iOS: Search on a main word(noun), not its pronoun I am writing a TableView app where people can search for a word in a foreign language. In this language, the article is important as it tells the word's gender. A reasonable english example is "The Book". I want to search for "Book", not "The". Any ideas on the best way...
TITLE: iOS: Search on a main word(noun), not its pronoun QUESTION: I am writing a TableView app where people can search for a word in a foreign language. In this language, the article is important as it tells the word's gender. A reasonable english example is "The Book". I want to search for "Book", not "The". Any ide...
[ "search", "ios4" ]
0
1
212
2
0
2011-06-07T03:18:02.837000
2011-06-07T03:39:02.607000
6,260,302
6,260,330
Program Design - Package by Feature vs. Layer or Both?
I am in the design stage of a web application that allows users to create requests of work and the workers to put time against those requests. The application will also have reporting capabilities for supervisors to get daily totals, reports, and account for time spent, "cost allocation". Applications I've worked on in...
I would suggest to start package things based on business entities. And in there you can divide things based on layers. With all of the overlap is this really functional? I am practising it for long. I don't see any major issues with this approach. You must find out what to decouple and how much it should be decoupled....
Program Design - Package by Feature vs. Layer or Both? I am in the design stage of a web application that allows users to create requests of work and the workers to put time against those requests. The application will also have reporting capabilities for supervisors to get daily totals, reports, and account for time s...
TITLE: Program Design - Package by Feature vs. Layer or Both? QUESTION: I am in the design stage of a web application that allows users to create requests of work and the workers to put time against those requests. The application will also have reporting capabilities for supervisors to get daily totals, reports, and ...
[ "java", "web-applications", "domain-driven-design", "packaging" ]
12
5
8,469
3
0
2011-06-07T03:21:39.783000
2011-06-07T03:31:05.027000
6,260,314
6,262,049
Database and UI framework for J2ME?
I am an Android developer. I haven't developed J2ME applications before. I have a requirement in which the client needs a J2ME application which requires me to store around 10,000 (Each record would have around 60-150 KB of data) records on the mobile phone. The mobile app will also be tied up with a backend server usi...
RMS is probably your only decent option for on-device data persistence in J2ME (unless you go for direct file access using JSR-75, however if you aren't signed, the user will see all sorts of intrusive error popups when using this API). 10,000 records at 60KB per record, i.e. 614MB minimum? I've never heard of a MIDlet...
Database and UI framework for J2ME? I am an Android developer. I haven't developed J2ME applications before. I have a requirement in which the client needs a J2ME application which requires me to store around 10,000 (Each record would have around 60-150 KB of data) records on the mobile phone. The mobile app will also ...
TITLE: Database and UI framework for J2ME? QUESTION: I am an Android developer. I haven't developed J2ME applications before. I have a requirement in which the client needs a J2ME application which requires me to store around 10,000 (Each record would have around 60-150 KB of data) records on the mobile phone. The mob...
[ "database", "java-me", "cdc", "rms", "cldc" ]
0
3
422
1
0
2011-06-07T03:27:11.713000
2011-06-07T07:43:17.773000
6,260,316
6,260,337
polymorphism and encapsulation of classes
I'm trying to take advantage of the polymorphism in c++, but I'm from a c world, and I think what I've done could be done more cleverly in a OOP way. I have 2 classes that has exactly the same public attributes, and I want to "hide" that there exists 2 different implementations. Such that I can have a single class wher...
There are many ways to do it. Through a Factory for example. But to keep it simple - make a base abstract class that defines the interface, and derive your classes from it to implement the functionality. Then you only need to make the distinction once, when you create the class, after that you don't care, you just call...
polymorphism and encapsulation of classes I'm trying to take advantage of the polymorphism in c++, but I'm from a c world, and I think what I've done could be done more cleverly in a OOP way. I have 2 classes that has exactly the same public attributes, and I want to "hide" that there exists 2 different implementations...
TITLE: polymorphism and encapsulation of classes QUESTION: I'm trying to take advantage of the polymorphism in c++, but I'm from a c world, and I think what I've done could be done more cleverly in a OOP way. I have 2 classes that has exactly the same public attributes, and I want to "hide" that there exists 2 differe...
[ "c++", "inheritance", "polymorphism", "encapsulation" ]
1
3
1,148
5
0
2011-06-07T03:27:21.807000
2011-06-07T03:32:25.120000
6,260,327
6,266,010
Threading Model
I am going to develop an ATL COM for my device. We are using Win CE 6.0. My doubts are What threading models are supported by COM dll in WInCE? What threading models are supported by COM EXE in WInCE? Does WIN CE have support for DCOM? How can I check whether DCOM support is available in the WIN CE device I have?
COM in Windows CE supports only in-process, free-threaded automation objects DCOM supports all threading models DCOM Remoting is not supported (removed as of 6.0 IIRC) To see if your device has support, look in the \Windows folder at ceconfig.h and see if it contains SYSGEN_OLE (for COM support) and/or SYSGEN_DCOM (for...
Threading Model I am going to develop an ATL COM for my device. We are using Win CE 6.0. My doubts are What threading models are supported by COM dll in WInCE? What threading models are supported by COM EXE in WInCE? Does WIN CE have support for DCOM? How can I check whether DCOM support is available in the WIN CE devi...
TITLE: Threading Model QUESTION: I am going to develop an ATL COM for my device. We are using Win CE 6.0. My doubts are What threading models are supported by COM dll in WInCE? What threading models are supported by COM EXE in WInCE? Does WIN CE have support for DCOM? How can I check whether DCOM support is available ...
[ "com", "windows-ce", "atl" ]
2
2
207
1
0
2011-06-07T03:30:03.320000
2011-06-07T13:36:03.257000
6,260,343
6,270,908
Ruby on Rails form building simplification
thanks for taking the time to read this. I'm trying to build a form that accepts multiple members. It starts off with 3 members and then there's a javascript button that adds a member, with a maximum of 100 members. The only way I can figure out how to do it is by hard coding all the form elements as below 1..100 (I on...
This sort of functionality is covered in episodes 196 & 197 of RailsCasts Nested Model Forms Part 1 | Nested Model Forms Part 2
Ruby on Rails form building simplification thanks for taking the time to read this. I'm trying to build a form that accepts multiple members. It starts off with 3 members and then there's a javascript button that adds a member, with a maximum of 100 members. The only way I can figure out how to do it is by hard coding ...
TITLE: Ruby on Rails form building simplification QUESTION: thanks for taking the time to read this. I'm trying to build a form that accepts multiple members. It starts off with 3 members and then there's a javascript button that adds a member, with a maximum of 100 members. The only way I can figure out how to do it ...
[ "ruby-on-rails", "forms" ]
1
2
135
2
0
2011-06-07T03:33:50.180000
2011-06-07T19:59:16.887000
6,260,344
6,260,369
PHP Array to jQuery array with JSON. ($.post, parseJSON, json_encode)
I am trying to get a php file setup to return the results of a MySQL database query from a jQuery AJAX call. The returned results will be an array. I have a very basic start where I am just getting some basic data back and forth to and from the php file, but am stuck with some basic syntax issues: The PHP code: $arr = ...
You can use: alert(obj['a']); See this question for more info.
PHP Array to jQuery array with JSON. ($.post, parseJSON, json_encode) I am trying to get a php file setup to return the results of a MySQL database query from a jQuery AJAX call. The returned results will be an array. I have a very basic start where I am just getting some basic data back and forth to and from the php f...
TITLE: PHP Array to jQuery array with JSON. ($.post, parseJSON, json_encode) QUESTION: I am trying to get a php file setup to return the results of a MySQL database query from a jQuery AJAX call. The returned results will be an array. I have a very basic start where I am just getting some basic data back and forth to ...
[ "php", "jquery", "json" ]
2
2
11,994
2
0
2011-06-07T03:33:57.927000
2011-06-07T03:39:51.700000
6,260,367
6,262,010
SQL One-to-One Relationship Definition
I'm designing a database and I'm not sure how to define one of the relationships. Here's the situation: An invoice is created If the product is not in stock then it needs to be manufactured and so a work order is created. The relationship is one-to-one. However work orders are sometimes created for other purposes so th...
Okay, this answer is SQL Server specific, but should be adaptable to other RDBMSs, with a little work. So far as I see, we have the following constraints: An invoice may be associated with 0 or 1 Work Orders A Work Order must be associated with an invoice or an ABC or a DEF I'd design the WorkOrder table as follows: CR...
SQL One-to-One Relationship Definition I'm designing a database and I'm not sure how to define one of the relationships. Here's the situation: An invoice is created If the product is not in stock then it needs to be manufactured and so a work order is created. The relationship is one-to-one. However work orders are som...
TITLE: SQL One-to-One Relationship Definition QUESTION: I'm designing a database and I'm not sure how to define one of the relationships. Here's the situation: An invoice is created If the product is not in stock then it needs to be manufactured and so a work order is created. The relationship is one-to-one. However w...
[ "sql", "database-design" ]
4
3
1,984
5
0
2011-06-07T03:39:06.673000
2011-06-07T07:38:48.430000
6,260,370
6,276,443
How to retrieve multiple json files to multiple divs?
I want to retrieve json data from multiple files. I am making plugin to do this. Here I am able to put data from one json file. But when I wanted to pull the data from multiple json files, all the data are appended to same div. What can I do to retrieve separate file data on separate div? My code to call plugin is: $(d...
I did this with some modification. //retrive JSON feed from external file $.ajax({ type: "POST", url: test.txt, dataType: "json", cache: false, contentType: "application/json; charset=utf-8", //beforeSend: function() { $("#slider ul").html("Saving").show(); }, success: function(data) { //alert("Success"); html = ''; $....
How to retrieve multiple json files to multiple divs? I want to retrieve json data from multiple files. I am making plugin to do this. Here I am able to put data from one json file. But when I wanted to pull the data from multiple json files, all the data are appended to same div. What can I do to retrieve separate fil...
TITLE: How to retrieve multiple json files to multiple divs? QUESTION: I want to retrieve json data from multiple files. I am making plugin to do this. Here I am able to put data from one json file. But when I wanted to pull the data from multiple json files, all the data are appended to same div. What can I do to ret...
[ "json", "jquery-plugins" ]
0
0
1,086
1
0
2011-06-07T03:40:03.323000
2011-06-08T09:02:44.913000
6,260,988
6,261,148
Handling site wide data in MVC Razor
I've seen this question asked in a couple of places and generally the answer has been "use the ViewBag" which I don't think fits our scenario. We have a membership site which has common properties (e.g. Account -which contains the user's account settings) and I would like to use that in both the Views and _layout.cshtm...
Your main options are: 1. Consider implementing a profile provider - the settings are then available everywhere, use an Action Filter 2. use your own custom context assigned to the current request/user 3. use a base controller/base viewmodel for the pages that don't have them 4. use a global action filter 5. viewdata/s...
Handling site wide data in MVC Razor I've seen this question asked in a couple of places and generally the answer has been "use the ViewBag" which I don't think fits our scenario. We have a membership site which has common properties (e.g. Account -which contains the user's account settings) and I would like to use tha...
TITLE: Handling site wide data in MVC Razor QUESTION: I've seen this question asked in a couple of places and generally the answer has been "use the ViewBag" which I don't think fits our scenario. We have a membership site which has common properties (e.g. Account -which contains the user's account settings) and I wou...
[ "asp.net-mvc-3", "razor" ]
1
0
601
1
0
2011-06-07T05:36:18.520000
2011-06-07T06:02:25.043000
6,260,989
6,262,142
When do casts call the constructor of the new type?
What are the rules to determine whether or not a particular static_cast will call a class's constructor? How about c style/functional style casts?
Any time a new object is created, a constructor is called. A static_cast always results in a new, temporary object (but see comment by James McNellis) either immediately, or through a call to a user defined conversion. (But in order to have an object of the desired type to return, the user defined conversion operator w...
When do casts call the constructor of the new type? What are the rules to determine whether or not a particular static_cast will call a class's constructor? How about c style/functional style casts?
TITLE: When do casts call the constructor of the new type? QUESTION: What are the rules to determine whether or not a particular static_cast will call a class's constructor? How about c style/functional style casts? ANSWER: Any time a new object is created, a constructor is called. A static_cast always results in a n...
[ "c++", "casting" ]
26
17
14,667
3
0
2011-06-07T05:36:24.047000
2011-06-07T07:51:10.600000