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,231,021
6,238,021
Path related problem in an attempt to save an array created by jQuery with a Rails 3 controller
I used "p current_user" in the controller to see if the jquery "get" is even getting to the appropriate action in the controller. It is not! Here's the code. Relevant portion of jquery code used to send the array (note the path): update: function(event, ui) { var sOrder = $(this).sortable('toArray'); $.get('<%= update_...
You will need to get the param values. (I also am using each_with_index and just one find method). I am assuming that you have a fixed number of sOrders for each user. def update_strength_order sOrders = current_user.s_orders # In model: has_many:s_orders,:order =>:position [*params['sOrder']].each_with_index do |val...
Path related problem in an attempt to save an array created by jQuery with a Rails 3 controller I used "p current_user" in the controller to see if the jquery "get" is even getting to the appropriate action in the controller. It is not! Here's the code. Relevant portion of jquery code used to send the array (note the p...
TITLE: Path related problem in an attempt to save an array created by jQuery with a Rails 3 controller QUESTION: I used "p current_user" in the controller to see if the jquery "get" is even getting to the appropriate action in the controller. It is not! Here's the code. Relevant portion of jquery code used to send the...
[ "jquery", "ruby-on-rails-3" ]
0
1
112
2
0
2011-06-03T18:14:55.447000
2011-06-04T16:43:28.217000
6,231,028
6,231,468
Techniques for Working With Very Large Tables in Highly-Available Systems
We have a large table of ~20 million records in MySql InnoDB (v5.0.85). The table records state for user actions and is shared by multiple app servers. Occasionally a new requirement comes along that means we need to add a new column to this table to store additional information. Running the alter command takes about 2...
If you need to add new columns on a regular basis, you should probably find a technique where adding new information that doesn't require altering tables while under load. Here are a few solutions that come to mind: Use PropertyType/PropertyValue tables, where PropertyType is an enum to which you can add a new entry wh...
Techniques for Working With Very Large Tables in Highly-Available Systems We have a large table of ~20 million records in MySql InnoDB (v5.0.85). The table records state for user actions and is shared by multiple app servers. Occasionally a new requirement comes along that means we need to add a new column to this tabl...
TITLE: Techniques for Working With Very Large Tables in Highly-Available Systems QUESTION: We have a large table of ~20 million records in MySql InnoDB (v5.0.85). The table records state for user actions and is shared by multiple app servers. Occasionally a new requirement comes along that means we need to add a new c...
[ "mysql", "database", "database-design" ]
2
1
462
4
0
2011-06-03T18:15:24.600000
2011-06-03T18:59:11.730000
6,231,038
6,231,216
How can I get log of the android app running on real device which uses its SD card?
I have Samsung Galaxy Ace, Android version: 2.2.1. My app uses the camera and gallery, which require SD card to be mounted. But in the USB mode, the SD card is not detected because of which I am not able to test the app. Please help me out. Thanks in advance.
Yep hooraygradschool's answer is correct: you do not need to u'Turn on USB-Storage' when connecting your device to a pc when working in Eclipse or other ADB-related stuff. Just hook up your phone with your pc - maybe check if it didn't turn usbstorage on automatically? this could be your problem.. (good one John:) Then...
How can I get log of the android app running on real device which uses its SD card? I have Samsung Galaxy Ace, Android version: 2.2.1. My app uses the camera and gallery, which require SD card to be mounted. But in the USB mode, the SD card is not detected because of which I am not able to test the app. Please help me ...
TITLE: How can I get log of the android app running on real device which uses its SD card? QUESTION: I have Samsung Galaxy Ace, Android version: 2.2.1. My app uses the camera and gallery, which require SD card to be mounted. But in the USB mode, the SD card is not detected because of which I am not able to test the ap...
[ "android", "testing", "android-sdcard" ]
0
1
1,654
1
0
2011-06-03T18:16:33.583000
2011-06-03T18:34:25.557000
6,231,047
6,231,115
Execute Bash script on a different server through PHP
I think I understand how to execute a bash script on the same server exec('./myshell.sh'); Completely new to this kind of thing so excuse me if this is completely wrong. But I'm wondering how I would execute a bash script on a different server? Reason is I want the bash script to execute some stuff on my dedicated Mine...
Do you absolutely need to trigger events on your minecraft server on demand, instead of checking against your webserver on a regular basis? It may be worth it to use a cronjob on the minecraft server and have it poll the webserver via wget for whether or not it should execute that bash script. This keeps your webserver...
Execute Bash script on a different server through PHP I think I understand how to execute a bash script on the same server exec('./myshell.sh'); Completely new to this kind of thing so excuse me if this is completely wrong. But I'm wondering how I would execute a bash script on a different server? Reason is I want the ...
TITLE: Execute Bash script on a different server through PHP QUESTION: I think I understand how to execute a bash script on the same server exec('./myshell.sh'); Completely new to this kind of thing so excuse me if this is completely wrong. But I'm wondering how I would execute a bash script on a different server? Rea...
[ "php", "bash", "shell", "exec" ]
1
1
2,640
5
0
2011-06-03T18:17:34.247000
2011-06-03T18:23:36.230000
6,231,052
6,231,142
How to have a mouseover event fire only if the mouse is hovered over an element for at least 1 second?
I want to display a dialog when a user mouses over a certain image. That part works. Unfortunately if the mouse even just passes over the corner of the image quickly it will display the dialog. I would like to have the dialog show only if the mouse is left over the image for one full second so as to avoid inadvertent p...
You can't delay the firing of the event, but you can delay your handling of the event. Here's a quick example without jQuery or Prototype that will make it easier to understand. var delay = function (elem, callback) { var timeout = null; elem.onmouseover = function() { // Set timeout to be a timer which will invoke cal...
How to have a mouseover event fire only if the mouse is hovered over an element for at least 1 second? I want to display a dialog when a user mouses over a certain image. That part works. Unfortunately if the mouse even just passes over the corner of the image quickly it will display the dialog. I would like to have th...
TITLE: How to have a mouseover event fire only if the mouse is hovered over an element for at least 1 second? QUESTION: I want to display a dialog when a user mouses over a certain image. That part works. Unfortunately if the mouse even just passes over the corner of the image quickly it will display the dialog. I wou...
[ "javascript", "prototypejs" ]
37
70
40,348
5
0
2011-06-03T18:18:13.840000
2011-06-03T18:26:05.600000
6,231,059
6,231,093
How to handle javascript on page with thousands of checkboxes in IE6
I am having problems with code written in ASP.NET with some javascript, doing a postback to the server for changes made to a grid of approximately 8,000 checkboxes. The this is, while I was testing it, everything seemed ok with approximately 1,000 checkboxes with IE6. But now, having imported the real data, I am stuck ...
Granted, I don't know what you're doing, but having 8,000 check boxes on one page seems pretty user-unfriendly to me. Consider adding pagination & filtering to keep the number of check boxes per page under, perhaps, 100? EDIT - You also seem to think this is an IE6 problem. I'd hazard a guess that any browser would hav...
How to handle javascript on page with thousands of checkboxes in IE6 I am having problems with code written in ASP.NET with some javascript, doing a postback to the server for changes made to a grid of approximately 8,000 checkboxes. The this is, while I was testing it, everything seemed ok with approximately 1,000 che...
TITLE: How to handle javascript on page with thousands of checkboxes in IE6 QUESTION: I am having problems with code written in ASP.NET with some javascript, doing a postback to the server for changes made to a grid of approximately 8,000 checkboxes. The this is, while I was testing it, everything seemed ok with appro...
[ "javascript", "internet-explorer-6", "performance" ]
0
4
665
2
0
2011-06-03T18:18:44.213000
2011-06-03T18:22:09.170000
6,231,063
6,231,271
ClickOnce Deployment Error: different computed hash than specified in manifest
I keep on running across this error when trying to deploy via ClickOnce File, image.jpg, has a different computed hash than specified in manifest. I realize that this is an error that has a lot of google results but I have been unable to resolve this. The stranger part is that this ClickOnce package has been deployed o...
You need to regenerate the application manifest. This happens when you change file contents and do not update your manifests accordingly. Mage.exe MSDN Docs
ClickOnce Deployment Error: different computed hash than specified in manifest I keep on running across this error when trying to deploy via ClickOnce File, image.jpg, has a different computed hash than specified in manifest. I realize that this is an error that has a lot of google results but I have been unable to res...
TITLE: ClickOnce Deployment Error: different computed hash than specified in manifest QUESTION: I keep on running across this error when trying to deploy via ClickOnce File, image.jpg, has a different computed hash than specified in manifest. I realize that this is an error that has a lot of google results but I have ...
[ "c#", "visual-studio", "clickonce" ]
17
5
31,524
3
0
2011-06-03T18:19:14.697000
2011-06-03T18:41:46.257000
6,231,089
6,231,325
Call didFinishPickingImage with custom camera button?
I am creating a custom camera view that I use to take a picture. Here is what I have: picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.showsCameraControls = NO; picker.navigationBarHidden = YES; picker.toolbarHidden = YES; picke...
Call UIImagePickerController 's takePicture. [cameraButton addTarget:picker action:@selector(takePicture) forControlEvents:UIControlEventTouchUpInside]; It will call the delegate method.
Call didFinishPickingImage with custom camera button? I am creating a custom camera view that I use to take a picture. Here is what I have: picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.showsCameraControls = NO; picker.naviga...
TITLE: Call didFinishPickingImage with custom camera button? QUESTION: I am creating a custom camera view that I use to take a picture. Here is what I have: picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.showsCameraControls =...
[ "objective-c", "uiimagepickercontroller" ]
1
3
1,065
1
0
2011-06-03T18:21:56.047000
2011-06-03T18:45:53.933000
6,231,092
6,231,144
Input type for EditText in preference screen?
Is there any way to set an EditText in my XML preference screen to only accept number input?
In the xml file: android:inputType="number" or during runtime: editText.setRawInputType(TYPE_CLASS_NUMBER | TYPE_NUMBER_VARIATION_NORMAL); http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
Input type for EditText in preference screen? Is there any way to set an EditText in my XML preference screen to only accept number input?
TITLE: Input type for EditText in preference screen? QUESTION: Is there any way to set an EditText in my XML preference screen to only accept number input? ANSWER: In the xml file: android:inputType="number" or during runtime: editText.setRawInputType(TYPE_CLASS_NUMBER | TYPE_NUMBER_VARIATION_NORMAL); http://develope...
[ "android" ]
23
59
25,201
6
0
2011-06-03T18:22:08.247000
2011-06-03T18:26:24.180000
6,231,104
6,231,195
Behavior of the C++ extraction operator when used to read into a string
I was working with some C++ code, and noticed some code of the following form: ss >> str; where ss is a stream (a stringstream, in this case), and str is a string. What is the defined behavior of this code? Specifically, what is the value of str after this is executed?
Unless the skipws flag is set in ss.flags() (it is by default, but you can unset it), white space is skipped (and not copied into str ), then ss copies text from the input until either a white space or end of file is encountered (or it runs out of memory, or it reads std::string::max_size characters). What is white spa...
Behavior of the C++ extraction operator when used to read into a string I was working with some C++ code, and noticed some code of the following form: ss >> str; where ss is a stream (a stringstream, in this case), and str is a string. What is the defined behavior of this code? Specifically, what is the value of str af...
TITLE: Behavior of the C++ extraction operator when used to read into a string QUESTION: I was working with some C++ code, and noticed some code of the following form: ss >> str; where ss is a stream (a stringstream, in this case), and str is a string. What is the defined behavior of this code? Specifically, what is t...
[ "c++", "string", "iostream" ]
1
11
1,328
4
0
2011-06-03T18:22:56.860000
2011-06-03T18:32:21.213000
6,231,118
6,231,177
Datagridview shows classname instead of property
I'm trying to put data in a datagridview by putting a List as the datasource. This works great, however, nested classes are listed as shown on the screenshot. I'd like to show only 1 property of those classes. https://i.stack.imgur.com/oFRDD.png Is there a way I can do this? I don't really know what to search for..
Just override ToString to show what you need. Unless you want editing, which will require more effort. Update: A simple solution (if you do not have 10's or 100's of these) is to create a proxy class. Example: class FooProxy { Foo bar; // internal object public string Baz { get {return bar.Baz; } set { bar.Baz = value...
Datagridview shows classname instead of property I'm trying to put data in a datagridview by putting a List as the datasource. This works great, however, nested classes are listed as shown on the screenshot. I'd like to show only 1 property of those classes. https://i.stack.imgur.com/oFRDD.png Is there a way I can do t...
TITLE: Datagridview shows classname instead of property QUESTION: I'm trying to put data in a datagridview by putting a List as the datasource. This works great, however, nested classes are listed as shown on the screenshot. I'd like to show only 1 property of those classes. https://i.stack.imgur.com/oFRDD.png Is ther...
[ "c#", "class", "datagridview", "datasource" ]
2
3
779
1
0
2011-06-03T18:23:51.197000
2011-06-03T18:30:23.433000
6,231,122
6,231,148
an question on iterator object in the "for" statement
I am trying to understand a java program, which has a code segment such as for (final Document document: cluster.getDocuments()) { if (documentsShown >= maxNumberOfDocumentsToShow) { break; } displayDocument(level + 1, document); documentsShown++; } Does this mean that cluster.getDocuments() must be an iterator object?
It needs to be an iterable object (i.e. collection or array). Basically, It's commonly used to iterate over an array or a Collections class (eg, ArrayList). It can also iterate over anything that implements the Iterable interface (must define iterator() method). Many of the Collections classes (eg, ArrayList) implement...
an question on iterator object in the "for" statement I am trying to understand a java program, which has a code segment such as for (final Document document: cluster.getDocuments()) { if (documentsShown >= maxNumberOfDocumentsToShow) { break; } displayDocument(level + 1, document); documentsShown++; } Does this mean t...
TITLE: an question on iterator object in the "for" statement QUESTION: I am trying to understand a java program, which has a code segment such as for (final Document document: cluster.getDocuments()) { if (documentsShown >= maxNumberOfDocumentsToShow) { break; } displayDocument(level + 1, document); documentsShown++; ...
[ "java" ]
2
7
155
4
0
2011-06-03T18:24:07.777000
2011-06-03T18:26:59.853000
6,231,130
6,231,149
Singleton in .NET shared across all sessions?
I am creating a singleton to hold a linqtoumbraco datacontext which pulls data from a cached xml file. I understand how to create a singleton class and to use locks to prevent new threads from creating new instances. I don't understand multithreading and how.NET sessions work too well and want to know if I create the s...
Yes it will be, static members are shared for whole ASP.Net application Another way to do this, to create and assign datacontext in HttpContext.Current.Application, and you can get it from anywhere you want in any session But think about it a bit, are all clients only read from xml file? what if one client is reading i...
Singleton in .NET shared across all sessions? I am creating a singleton to hold a linqtoumbraco datacontext which pulls data from a cached xml file. I understand how to create a singleton class and to use locks to prevent new threads from creating new instances. I don't understand multithreading and how.NET sessions wo...
TITLE: Singleton in .NET shared across all sessions? QUESTION: I am creating a singleton to hold a linqtoumbraco datacontext which pulls data from a cached xml file. I understand how to create a singleton class and to use locks to prevent new threads from creating new instances. I don't understand multithreading and h...
[ "c#", ".net", "asp.net", "singleton" ]
4
5
3,255
3
0
2011-06-03T18:24:52.850000
2011-06-03T18:27:16.583000
6,231,134
6,231,163
Objective-C memory leak, memory management question
I am new to Objective C and believe I have a memory leak situation in this function, but I am not sure when to delete/release the objects. Since I store the recipeObject into my View, I free it in the dealloc of the view, but I am not sure about the view? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPa...
The first rule to remember when you're dealing with memory management in Objective-C is that you're responsible for anything that you (1) allocate (using alloc ), (2) new up (using new ), (3) copy (using copy ), or (4) retain (using retain ). In those four cases, you must explicitly release (or autorelease ) those refe...
Objective-C memory leak, memory management question I am new to Objective C and believe I have a memory leak situation in this function, but I am not sure when to delete/release the objects. Since I store the recipeObject into my View, I free it in the dealloc of the view, but I am not sure about the view? - (void)tabl...
TITLE: Objective-C memory leak, memory management question QUESTION: I am new to Objective C and believe I have a memory leak situation in this function, but I am not sure when to delete/release the objects. Since I store the recipeObject into my View, I free it in the dealloc of the view, but I am not sure about the ...
[ "objective-c", "ios4", "xcode4" ]
1
4
146
3
0
2011-06-03T18:25:01.660000
2011-06-03T18:29:04.317000
6,231,138
6,231,157
Should we use select_db() in php?
I am wondering whether we need to use select_db() function when we query the DB since we are already defining which table we want to use when writing the query like "select * from users" I tried without it and it worked but I don't know what kind of goodness that function offers? //$sau_db->select_db("users"); $query ...
Selecting a database is different than selecting a table. A database can contain multiple tables and a MySQL server can contain more than one database. I'm not sure what system you're using to access your databases but unless configured elsewhere (which it very well may be) it is normally necessary to select a database...
Should we use select_db() in php? I am wondering whether we need to use select_db() function when we query the DB since we are already defining which table we want to use when writing the query like "select * from users" I tried without it and it worked but I don't know what kind of goodness that function offers? //$sa...
TITLE: Should we use select_db() in php? QUESTION: I am wondering whether we need to use select_db() function when we query the DB since we are already defining which table we want to use when writing the query like "select * from users" I tried without it and it worked but I don't know what kind of goodness that func...
[ "php" ]
1
4
645
4
0
2011-06-03T18:25:23.947000
2011-06-03T18:28:32.737000
6,231,151
6,233,176
KRL webhooks receiving JSON
I'm trying to set up a Webhook for Amazon SNS. SNS will send a JSON object to the webhook. Based on the KRL documentation I can get the event parameters using event:param('name'). That works for form encoded data, but what about JSON? I sent a call to postbin.org and this is what postbin reported: body { "Message": "Yo...
Your second code block is very close. Here it is, rewritten to use the correct event:param() rule sns_json { select when webhook sometopic pre { body = event:param('request_body').decode(); msg_type = body.pick("Type"); signature = body.pick("Signature");... } if msg_type eq "SubscriptionConfirmation" && valid(signatur...
KRL webhooks receiving JSON I'm trying to set up a Webhook for Amazon SNS. SNS will send a JSON object to the webhook. Based on the KRL documentation I can get the event parameters using event:param('name'). That works for form encoded data, but what about JSON? I sent a call to postbin.org and this is what postbin rep...
TITLE: KRL webhooks receiving JSON QUESTION: I'm trying to set up a Webhook for Amazon SNS. SNS will send a JSON object to the webhook. Based on the KRL documentation I can get the event parameters using event:param('name'). That works for form encoded data, but what about JSON? I sent a call to postbin.org and this i...
[ "krl", "webhooks" ]
2
2
191
1
0
2011-06-03T18:27:21.967000
2011-06-03T22:12:18.753000
6,231,152
6,231,184
WPF Disabling TabStop for ObjectDataProvider
I have a ObjectDataProvider of check boxes: When I tab through the controls and get to the datatemplate, it looks selects the it before going to the controls inside, like this - Is there any way to turn this off? Conclusion It isn't the ObjectDataProvider, but rather the ItemsControl that needs to be turned off - Thank...
There is no problem with ObjectDataProvider in your code, just try to set IsTabStop = false in the container where CheckBoxes are. can you provide more xaml code from UserControl?
WPF Disabling TabStop for ObjectDataProvider I have a ObjectDataProvider of check boxes: When I tab through the controls and get to the datatemplate, it looks selects the it before going to the controls inside, like this - Is there any way to turn this off? Conclusion It isn't the ObjectDataProvider, but rather the Ite...
TITLE: WPF Disabling TabStop for ObjectDataProvider QUESTION: I have a ObjectDataProvider of check boxes: When I tab through the controls and get to the datatemplate, it looks selects the it before going to the controls inside, like this - Is there any way to turn this off? Conclusion It isn't the ObjectDataProvider, ...
[ "wpf", "itemscontrol", "tabstop" ]
2
2
1,011
1
0
2011-06-03T18:27:39.027000
2011-06-03T18:31:22.930000
6,231,153
6,231,497
Flex - how to detect event when a DateField is edited
How can I detect when a user changes a date field - specifically when they TYPE the date as I have set it to editable: The change event seems to only throw when using the calendar pop-up. It is not thrown when the user manually types in to the field. I also tried dataChange.
I found something that works - I used the focusOut="" event.
Flex - how to detect event when a DateField is edited How can I detect when a user changes a date field - specifically when they TYPE the date as I have set it to editable: The change event seems to only throw when using the calendar pop-up. It is not thrown when the user manually types in to the field. I also tried da...
TITLE: Flex - how to detect event when a DateField is edited QUESTION: How can I detect when a user changes a date field - specifically when they TYPE the date as I have set it to editable: The change event seems to only throw when using the calendar pop-up. It is not thrown when the user manually types in to the fiel...
[ "apache-flex", "events", "flash-builder", "datefield" ]
0
2
2,721
2
0
2011-06-03T18:27:51.290000
2011-06-03T19:02:48.010000
6,231,162
6,233,308
OpenCV: is it possible to perform openGL pixel shading with it?
How to execute OpenGL pixel shaders on top of openCV images structures? is there any library or plugin for OpenCV for that?
I won't include setting up a OpenGL context, performing actual render operations etc. Consider this as an outline in pseudo code just trying to give you an idea on how you could do it (assuming you'd like to reuse the ouput in OpenCV: At first you create a texture (has to be done once only, of coirse), then you upload ...
OpenCV: is it possible to perform openGL pixel shading with it? How to execute OpenGL pixel shaders on top of openCV images structures? is there any library or plugin for OpenCV for that?
TITLE: OpenCV: is it possible to perform openGL pixel shading with it? QUESTION: How to execute OpenGL pixel shaders on top of openCV images structures? is there any library or plugin for OpenCV for that? ANSWER: I won't include setting up a OpenGL context, performing actual render operations etc. Consider this as an...
[ "c++", "opengl", "opencv", "pixel", "shader" ]
2
4
3,456
2
0
2011-06-03T18:29:02.030000
2011-06-03T22:33:59.773000
6,231,164
6,231,499
What's the best way to update multiple unique rows of a table in MySQL?
I have a list of items in a MySQL table. The user is able to order these items by dragging them up and down in a HTML list. I then need to store each items position in the list. Is it possible to do this in one MySQL call or does it have to be a seperate call for each product to set its own order ID? A single call woul...
Well, you could drop the whole table and then insert the new order numbers for all products. That's only two statements. This would work as long as this table only contains the "order" information and no other critical data.
What's the best way to update multiple unique rows of a table in MySQL? I have a list of items in a MySQL table. The user is able to order these items by dragging them up and down in a HTML list. I then need to store each items position in the list. Is it possible to do this in one MySQL call or does it have to be a se...
TITLE: What's the best way to update multiple unique rows of a table in MySQL? QUESTION: I have a list of items in a MySQL table. The user is able to order these items by dragging them up and down in a HTML list. I then need to store each items position in the list. Is it possible to do this in one MySQL call or does ...
[ "mysql", "rows" ]
0
0
451
2
0
2011-06-03T18:29:10.153000
2011-06-03T19:02:49.627000
6,231,167
6,231,388
Best ways to reduct volume when emailing unhandled exception
I'm thinking of adding some code to my global.asax to my web apps to email me when there is an unhandled exception. Current, I'm doing the following Writing a cookie on the user's machine - in case they spam hit F5 and the website was restarted Adding an entry into system.Web.Cache - Am I missing something? Would you d...
Depending on how soon you want the exceptions you could always just log them to a file and then email the file to yourself every 10 minutes, 1 hour, 1 day and etc. That way you don't need to worry to much about if people spam the website as it will just be a bunch of duplicate exceptions in the file. Once you send the ...
Best ways to reduct volume when emailing unhandled exception I'm thinking of adding some code to my global.asax to my web apps to email me when there is an unhandled exception. Current, I'm doing the following Writing a cookie on the user's machine - in case they spam hit F5 and the website was restarted Adding an entr...
TITLE: Best ways to reduct volume when emailing unhandled exception QUESTION: I'm thinking of adding some code to my global.asax to my web apps to email me when there is an unhandled exception. Current, I'm doing the following Writing a cookie on the user's machine - in case they spam hit F5 and the website was restar...
[ "c#", "asp.net-mvc", "email", "exception" ]
0
2
84
2
0
2011-06-03T18:29:25.353000
2011-06-03T18:50:51.357000
6,231,171
6,231,230
PDO Insert on Duplicate Key Update
After posting this question MySQL update or insert or die query I've change to using PDO but I'm having some issues using the on duplicate key update phrase. Here's an example of my array data array(114) { ["fname"]=> string(6) "Bryana" ["lname"]=> string(6) "Greene" ["m080"]=> string(1) "c" ["t080"]=> string(1) "-" ["...
What you have attempted to do is to dynamically build a SQL string that will become parameterized. The:paramname parameters are expected to be single values mapped to column values, where clause parameters, etc. Instead you have used $fields[] = sprintf("%s =:%s", $key, $key); to create a string of:paramname fields in ...
PDO Insert on Duplicate Key Update After posting this question MySQL update or insert or die query I've change to using PDO but I'm having some issues using the on duplicate key update phrase. Here's an example of my array data array(114) { ["fname"]=> string(6) "Bryana" ["lname"]=> string(6) "Greene" ["m080"]=> string...
TITLE: PDO Insert on Duplicate Key Update QUESTION: After posting this question MySQL update or insert or die query I've change to using PDO but I'm having some issues using the on duplicate key update phrase. Here's an example of my array data array(114) { ["fname"]=> string(6) "Bryana" ["lname"]=> string(6) "Greene"...
[ "php", "parameters", "insert", "pdo" ]
5
2
8,168
2
0
2011-06-03T18:29:43.390000
2011-06-03T18:36:21.123000
6,231,187
6,231,215
How to get distances from gps points from Core Location?
I'm developing an iPhone iOS4 application and one of the things that it have to do is to calculate the distance from 2 gps coordinate points. I already know that Core Location Framework can return points from iPhones gps. Ok, but I was wondering if there already is a method or a function to calculate the distance betwe...
See the CLLocation documentation and in particular; - (CLLocationDistance)distanceFromLocation:(const CLLocation *)location
How to get distances from gps points from Core Location? I'm developing an iPhone iOS4 application and one of the things that it have to do is to calculate the distance from 2 gps coordinate points. I already know that Core Location Framework can return points from iPhones gps. Ok, but I was wondering if there already ...
TITLE: How to get distances from gps points from Core Location? QUESTION: I'm developing an iPhone iOS4 application and one of the things that it have to do is to calculate the distance from 2 gps coordinate points. I already know that Core Location Framework can return points from iPhones gps. Ok, but I was wondering...
[ "iphone", "ios", "core-location" ]
2
8
1,297
1
0
2011-06-03T18:31:41.220000
2011-06-03T18:34:14.777000
6,231,192
6,231,229
Working with PHP objects
I was previously mostly scripting in PHP and now considering getting "more serious" about it:) I am working on a hiking website, and I needed to put some values into an object that I then try to pass back to the calling code. I tried doing this: $trailhead = new Object (); But the system sort of barfed at me. Then I di...
$trailheads[] = $trailhead; I'd do a print_r() of $trailhead to check that it's what you expect it to be. The default object type in PHP is going to be stdClass. Yes, that's going to be better, as it'll allow your Trailhead objects to have functions. The way you're currently doing it is basically taking advantage of no...
Working with PHP objects I was previously mostly scripting in PHP and now considering getting "more serious" about it:) I am working on a hiking website, and I needed to put some values into an object that I then try to pass back to the calling code. I tried doing this: $trailhead = new Object (); But the system sort o...
TITLE: Working with PHP objects QUESTION: I was previously mostly scripting in PHP and now considering getting "more serious" about it:) I am working on a hiking website, and I needed to put some values into an object that I then try to pass back to the calling code. I tried doing this: $trailhead = new Object (); But...
[ "php" ]
5
4
2,671
3
0
2011-06-03T18:32:00.733000
2011-06-03T18:36:17.753000
6,231,197
6,232,339
How do I print an RPT file using an ODBC connection from a C# console app?
I tried it with and without the database authentication code below. With the authentication it fails to log in...we normally use ODBC, but I don't see how to link it to an ODBC connection. Without the authentication, it prints me an empty report (the real report, just as if no records were returned). Also, how do I say...
For the connection to ODBC you should be able to use the ServerName property of your ConnectionInfo object to specify your connectionstring/dsn. Please see the following questions answers for a few examples. How do I change a Crystal Report's ODBC database connection at runtime? For the second part of you question, you...
How do I print an RPT file using an ODBC connection from a C# console app? I tried it with and without the database authentication code below. With the authentication it fails to log in...we normally use ODBC, but I don't see how to link it to an ODBC connection. Without the authentication, it prints me an empty report...
TITLE: How do I print an RPT file using an ODBC connection from a C# console app? QUESTION: I tried it with and without the database authentication code below. With the authentication it fails to log in...we normally use ODBC, but I don't see how to link it to an ODBC connection. Without the authentication, it prints ...
[ "c#", ".net", "crystal-reports", "console-application", "crystal-reports-xi" ]
0
1
1,363
1
0
2011-06-03T18:32:22.220000
2011-06-03T20:30:08.830000
6,231,200
6,231,293
Regexp for :name, :othername, :other
I'm trying to get all the names in a string like this::name,:lastName But I don't seem to find a correct way. This is what I've tried so far: /^(:((\w+)(,:(\w+))+).*)$/ In Java: Pattern a = Pattern.compile("(:((\\w+)(,:(\\w+))+).*)"); Matcher m = a.matcher(":name,:lastName,:bd"); if( m.matches() ) { for( int i = 0; i <...
Is it a requirement that you place the result in different groups? This will oterwise work: Pattern a = Pattern.compile(":([^,]+)"); Matcher m = a.matcher(":name,:lastName,:bd"); while (m.find()) { System.out.println(m.group(1)); } Edit:... and you can use split if you want to get an array of results: String data = ":n...
Regexp for :name, :othername, :other I'm trying to get all the names in a string like this::name,:lastName But I don't seem to find a correct way. This is what I've tried so far: /^(:((\w+)(,:(\w+))+).*)$/ In Java: Pattern a = Pattern.compile("(:((\\w+)(,:(\\w+))+).*)"); Matcher m = a.matcher(":name,:lastName,:bd"); if...
TITLE: Regexp for :name, :othername, :other QUESTION: I'm trying to get all the names in a string like this::name,:lastName But I don't seem to find a correct way. This is what I've tried so far: /^(:((\w+)(,:(\w+))+).*)$/ In Java: Pattern a = Pattern.compile("(:((\\w+)(,:(\\w+))+).*)"); Matcher m = a.matcher(":name,:...
[ "java", "regex", "language-agnostic" ]
2
4
193
4
0
2011-06-03T18:32:50.587000
2011-06-03T18:43:08.050000
6,231,206
6,231,224
"lib" Prefix on Libraries
From http://www.adp-gmbh.ch/cpp/gcc/create_lib.html: Note: the library must start with the three letters lib and have the suffix.a. Is this an operating system convention, or a gcc / ar quirk? Xcode seems to be able to create libraries without the prefix. What's it doing differently?
You can name a library whatever you want, but if you want gcc's -l flag to find the right one, you need to name it the way that link describes. For example: gcc -o myapp myapp.c -lm Will compile myapp.c, link the resulting object with libm.a, and output an executable called myapp. These days, there might be a more comp...
"lib" Prefix on Libraries From http://www.adp-gmbh.ch/cpp/gcc/create_lib.html: Note: the library must start with the three letters lib and have the suffix.a. Is this an operating system convention, or a gcc / ar quirk? Xcode seems to be able to create libraries without the prefix. What's it doing differently?
TITLE: "lib" Prefix on Libraries QUESTION: From http://www.adp-gmbh.ch/cpp/gcc/create_lib.html: Note: the library must start with the three letters lib and have the suffix.a. Is this an operating system convention, or a gcc / ar quirk? Xcode seems to be able to create libraries without the prefix. What's it doing diff...
[ "c++", "c", "gcc", "naming-conventions" ]
18
30
8,981
1
0
2011-06-03T18:33:09.260000
2011-06-03T18:36:05.313000
6,231,213
6,231,307
Ruby on Rails URL Validation (regex)
I'm trying to use a regular expression to validate the format of a URL in my Rails model. I've tested the regex in Rubular with the URL http://trentscott.com and it matched. Any idea why it fails validation when I test it in my Rails app (it says "name is invalid"). Code: url_regex = /^((http|https):\/\/)?[a-z0-9]+([-....
Your input ( http://trentscott.com ) does not have a subdomain but the regex is checking for one. domain_regex = /^((http|https):\/\/)[a-z0-9]*(\.?[a-z0-9]+)\.[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$/ix Update You also don't need the? after ((http|https):\/\/) unless the protocol is sometimes missing. I've also escaped. because...
Ruby on Rails URL Validation (regex) I'm trying to use a regular expression to validate the format of a URL in my Rails model. I've tested the regex in Rubular with the URL http://trentscott.com and it matched. Any idea why it fails validation when I test it in my Rails app (it says "name is invalid"). Code: url_regex ...
TITLE: Ruby on Rails URL Validation (regex) QUESTION: I'm trying to use a regular expression to validate the format of a URL in my Rails model. I've tested the regex in Rubular with the URL http://trentscott.com and it matched. Any idea why it fails validation when I test it in my Rails app (it says "name is invalid")...
[ "ruby-on-rails", "regex", "validation", "dns", "format" ]
5
7
11,400
5
0
2011-06-03T18:33:51.383000
2011-06-03T18:44:20.473000
6,231,231
6,232,226
Centralizing MEF composition
Currently all of the classes that I have handle their own imports. Using a typical example: [ImportMany] private Lazy [] someOfMyInterfaces { get; set; } public MyConstructor() { AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly()); CompositionContainer container = new CompositionContainer(cat...
Yes, you definitely don't want to be creating a container in each of your parts. Rather, try to have every part with an import also have an export which is imported by another part. Then in your startup code you create a container and pull a root export from it which will cause all the other parts to get created and th...
Centralizing MEF composition Currently all of the classes that I have handle their own imports. Using a typical example: [ImportMany] private Lazy [] someOfMyInterfaces { get; set; } public MyConstructor() { AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly()); CompositionContainer container =...
TITLE: Centralizing MEF composition QUESTION: Currently all of the classes that I have handle their own imports. Using a typical example: [ImportMany] private Lazy [] someOfMyInterfaces { get; set; } public MyConstructor() { AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly()); CompositionCon...
[ "c#", "mef" ]
2
1
203
1
0
2011-06-03T18:36:34.847000
2011-06-03T20:19:31.077000
6,231,236
6,231,290
MySQL - Ideal way to store business hours information
I want to store a standardized set of information about when a business is open for each day of the week. Is there a standard way to easily store/alter this in MySQL? Thanks!
Database design is really an art, there are many different ways to design schemas. I would start with a table, say "business_hours", and make the following columns: - business_id (integer, auto increment) - business_name (varchar, largish like 255) - open_monday (varchar, integer, however you want to represent the data...
MySQL - Ideal way to store business hours information I want to store a standardized set of information about when a business is open for each day of the week. Is there a standard way to easily store/alter this in MySQL? Thanks!
TITLE: MySQL - Ideal way to store business hours information QUESTION: I want to store a standardized set of information about when a business is open for each day of the week. Is there a standard way to easily store/alter this in MySQL? Thanks! ANSWER: Database design is really an art, there are many different ways ...
[ "mysql" ]
3
4
1,393
2
0
2011-06-03T18:37:14.440000
2011-06-03T18:42:54.703000
6,231,245
6,231,267
Program exit state
I have a question about program exit state in Linux. In my program, I fork a child process and invoke waitpid to reap it. When waitpid returns, I wanna check exit state of my child process. I turn to manual for help and find that the second argument of waitpid will hold exit state and I can use macro WEXITSTATE to read...
I think you will find that 0x377 is really, or should have been, 0377. It's octal, so 377 8 is 8 bits.
Program exit state I have a question about program exit state in Linux. In my program, I fork a child process and invoke waitpid to reap it. When waitpid returns, I wanna check exit state of my child process. I turn to manual for help and find that the second argument of waitpid will hold exit state and I can use macro...
TITLE: Program exit state QUESTION: I have a question about program exit state in Linux. In my program, I fork a child process and invoke waitpid to reap it. When waitpid returns, I wanna check exit state of my child process. I turn to manual for help and find that the second argument of waitpid will hold exit state a...
[ "c", "linux", "exit", "exit-code" ]
3
6
1,158
3
0
2011-06-03T18:38:26.890000
2011-06-03T18:41:07.110000
6,231,253
6,231,278
How to declare a class instance as a constant in C#?
I need to implement this: static class MyStaticClass { public const TimeSpan theTime = new TimeSpan(13, 0, 0); public static bool IsTooLate(DateTime dt) { return dt.TimeOfDay >= theTime; } } theTime is a constant (seriously:-), like π is, in my case it'd be pointless to read it from settings, for example. And I'd like ...
Using readonly instead of const can be initialized and not modified after that. Is that what you're looking for? Code example: static class MyStaticClass { static readonly TimeSpan theTime; static MyStaticClass() { theTime = new TimeSpan(13, 0, 0); } }
How to declare a class instance as a constant in C#? I need to implement this: static class MyStaticClass { public const TimeSpan theTime = new TimeSpan(13, 0, 0); public static bool IsTooLate(DateTime dt) { return dt.TimeOfDay >= theTime; } } theTime is a constant (seriously:-), like π is, in my case it'd be pointless...
TITLE: How to declare a class instance as a constant in C#? QUESTION: I need to implement this: static class MyStaticClass { public const TimeSpan theTime = new TimeSpan(13, 0, 0); public static bool IsTooLate(DateTime dt) { return dt.TimeOfDay >= theTime; } } theTime is a constant (seriously:-), like π is, in my case...
[ "c#", ".net", "constants" ]
60
72
64,770
7
0
2011-06-03T18:39:13.643000
2011-06-03T18:42:08.323000
6,231,255
6,231,981
Xml exception due to leading unicode character in REST API response
When I try to parse a response from a certain REST API, I'm getting an XmlException saying "Data at the root level is invalid. Line 1, position 1." Looking at the XML it looks fine, but then examining the first character I see that it is actually a zero-width no-break space (character code 65279 or 0xFEFF). Is there an...
Instead of using Encoding.UTF8, create your own UTF-8 encoder, using the constructor overload that lets you specify whether or not the BOM is to be emitted: req.Encoding = new UTF8Encoding( false ); // omit the BOM I believe that will do the trick for you. Amended to Note: The following will work: public static User Ge...
Xml exception due to leading unicode character in REST API response When I try to parse a response from a certain REST API, I'm getting an XmlException saying "Data at the root level is invalid. Line 1, position 1." Looking at the XML it looks fine, but then examining the first character I see that it is actually a zer...
TITLE: Xml exception due to leading unicode character in REST API response QUESTION: When I try to parse a response from a certain REST API, I'm getting an XmlException saying "Data at the root level is invalid. Line 1, position 1." Looking at the XML it looks fine, but then examining the first character I see that it...
[ "c#", "xml", "unicode" ]
0
1
2,143
4
0
2011-06-03T18:39:27.323000
2011-06-03T19:53:46.033000
6,231,275
6,231,622
Mysql SUM time with ranges in different days
I have the following table structure ( reduced of course ): CREATE TABLE `log` ( `ID` int(11) unsigned NOT NULL auto_increment, `StartTime` datetime default NULL, `FinishTime` datetime default NULL, PRIMARY KEY (`ID`), ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 Some sample data: StartTime FinishTime 2011-0...
What you can do is look for Start/Finish times that contain some or all of the target day, but "crop" the times to the limits of that day. For example: SELECT SUM( UNIX_TIMESTAMP( CASE WHEN FinishTime > '2011-06-03 23:59:59' THEN '2011-06-03 23:59:59' ELSE FinishTime END ) - UNIX_TIMESTAMP( CASE WHEN StartTime < '2011-...
Mysql SUM time with ranges in different days I have the following table structure ( reduced of course ): CREATE TABLE `log` ( `ID` int(11) unsigned NOT NULL auto_increment, `StartTime` datetime default NULL, `FinishTime` datetime default NULL, PRIMARY KEY (`ID`), ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 ...
TITLE: Mysql SUM time with ranges in different days QUESTION: I have the following table structure ( reduced of course ): CREATE TABLE `log` ( `ID` int(11) unsigned NOT NULL auto_increment, `StartTime` datetime default NULL, `FinishTime` datetime default NULL, PRIMARY KEY (`ID`), ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAU...
[ "mysql" ]
1
1
452
1
0
2011-06-03T18:42:03.393000
2011-06-03T19:17:45.227000
6,231,280
6,231,391
Function works OK, but returns garbage
I have this function: float calc_nnc(struct ImageWindow *window1, struct ImageWindow *window2) { /* More code */ double numerator = (double) sum_a_x_b; double divisor = ( sqrt(sum_a) * sqrt(sum_b) ); double result = numerator / divisor; float resultf = (float) result; printf("numerator: %lf, divisor: %lf, result: %lf,...
You probably have no prototype for calc_nnc in the context where you call it, so your compiler thinks its return type is int (as per the spec). A quick test program: #include union u { float f; int i; }; int main(int argc, char **argv) { union u a; union u b; a.f = 0.466019; b.i = 1055824384; printf("%d %f\n", a.i, ...
Function works OK, but returns garbage I have this function: float calc_nnc(struct ImageWindow *window1, struct ImageWindow *window2) { /* More code */ double numerator = (double) sum_a_x_b; double divisor = ( sqrt(sum_a) * sqrt(sum_b) ); double result = numerator / divisor; float resultf = (float) result; printf("num...
TITLE: Function works OK, but returns garbage QUESTION: I have this function: float calc_nnc(struct ImageWindow *window1, struct ImageWindow *window2) { /* More code */ double numerator = (double) sum_a_x_b; double divisor = ( sqrt(sum_a) * sqrt(sum_b) ); double result = numerator / divisor; float resultf = (float) re...
[ "c", "function", "floating-point", "return-value" ]
5
8
644
1
0
2011-06-03T18:42:18.690000
2011-06-03T18:51:00.710000
6,231,281
6,231,399
WCF - Using ServiceRoutes instead of svc files -- My app states I need AspNetCompatability only when I first attempt to connect?
public class Global: HttpApplication { protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } private static void RegisterRoutes(ICollection routes) { routes.Add(new ServiceRoute("Calculator", new WebServiceHostFactory(), typeof(CalculatorService))); } } When I do this and ...
I think that your problem is messed configuration. You are adding a route and in the same time you are registering the service with configuration based activation. Use either one or second. Also you can use routes and only Http based protocols or non-http protocols but without routes.
WCF - Using ServiceRoutes instead of svc files -- My app states I need AspNetCompatability only when I first attempt to connect? public class Global: HttpApplication { protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } private static void RegisterRoutes(ICollection rout...
TITLE: WCF - Using ServiceRoutes instead of svc files -- My app states I need AspNetCompatability only when I first attempt to connect? QUESTION: public class Global: HttpApplication { protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } private static void RegisterRoute...
[ "asp.net", "wcf", "url-routing", "svc" ]
0
2
1,478
2
0
2011-06-03T18:42:23.270000
2011-06-03T18:51:44.587000
6,231,285
6,231,453
Fastest way to insert 134675 values in remote database
I have an array with more than 134675+ values, I need to insert them to my mySQL table. I know all the things needed in this to work with PHP and mySQL data insertion. Is there a fast method that would let me insert all these values on a remote server within 30-60 seconds? because when i am trying it with the foreach m...
You could include in your loop the mysql_ping() function. This function checks to make sure that the connection is open, and if it is not, it re-connects. Using your own example, you could do something like: foreach($array as $value) { mysql_ping($dbconn); $sql="insert into collected values('".$value."')"; $res=mysql_q...
Fastest way to insert 134675 values in remote database I have an array with more than 134675+ values, I need to insert them to my mySQL table. I know all the things needed in this to work with PHP and mySQL data insertion. Is there a fast method that would let me insert all these values on a remote server within 30-60 ...
TITLE: Fastest way to insert 134675 values in remote database QUESTION: I have an array with more than 134675+ values, I need to insert them to my mySQL table. I know all the things needed in this to work with PHP and mySQL data insertion. Is there a fast method that would let me insert all these values on a remote se...
[ "php", "mysql", "insert" ]
5
17
3,440
4
0
2011-06-03T18:42:41.813000
2011-06-03T18:57:24.237000
6,231,288
6,231,340
JSTL format tag
Trying to populate and formate a date value inside an INPUT text field. What am I doing wrong here?
The JSTL fmt taglib exists of tags, not ${fmt:xxx} functions. Fix it accordingly: " /> /> (note that days are to be represented as dd, not mm and that years are to be represented as yyyy, not YYYY, see also SimpleDateFormat javadoc for all valid patterns) If your IDE jerks about the nested tags (which should run perfec...
JSTL format tag Trying to populate and formate a date value inside an INPUT text field. What am I doing wrong here?
TITLE: JSTL format tag QUESTION: Trying to populate and formate a date value inside an INPUT text field. What am I doing wrong here? ANSWER: The JSTL fmt taglib exists of tags, not ${fmt:xxx} functions. Fix it accordingly: " /> /> (note that days are to be represented as dd, not mm and that years are to be represente...
[ "jsp", "jstl" ]
5
13
15,022
1
0
2011-06-03T18:42:50.970000
2011-06-03T18:46:51.380000
6,231,292
6,232,531
ListBox GetDirectoryInfo problem
I am current creating a file deleter in VB.net, although for some reason I am unable to get the contents of my folder on to the listbox, my code is as follows: Public Class Form1 Dim dir = "C:\Users\Limited\Desktop\" Private Sub listbox() ListBox1.DataSource = _ My.Computer.FileSystem.GetDirectoryInfo( _ dir).GetFiles(...
You forgot.ToList() ListBox1.DataSource = _ My.Computer.FileSystem.GetDirectoryInfo( _ dir).GetFiles("*.txt").ToList() ListBox1.DisplayMember = "Name" ListBox1.ValueMember = "FullName"
ListBox GetDirectoryInfo problem I am current creating a file deleter in VB.net, although for some reason I am unable to get the contents of my folder on to the listbox, my code is as follows: Public Class Form1 Dim dir = "C:\Users\Limited\Desktop\" Private Sub listbox() ListBox1.DataSource = _ My.Computer.FileSystem.G...
TITLE: ListBox GetDirectoryInfo problem QUESTION: I am current creating a file deleter in VB.net, although for some reason I am unable to get the contents of my folder on to the listbox, my code is as follows: Public Class Form1 Dim dir = "C:\Users\Limited\Desktop\" Private Sub listbox() ListBox1.DataSource = _ My.Com...
[ ".net", "windows", "vb.net" ]
0
1
253
1
0
2011-06-03T18:43:03.033000
2011-06-03T20:50:00.810000
6,231,294
6,231,334
Form field description in django admin
How to add hint for the form field in django admin like in next example? (here: URL and Content descriptions are shown with gray color under field)
When defining your fields in models.py: myfield = models.CharField(max_length=100, help_text="This is the grey text") Bookmark this link: https://docs.djangoproject.com/en/dev/ref/models/fields/#help-text I find myself referring to it all the time (not just for help_text, but for everything to do with model fields)!
Form field description in django admin How to add hint for the form field in django admin like in next example? (here: URL and Content descriptions are shown with gray color under field)
TITLE: Form field description in django admin QUESTION: How to add hint for the form field in django admin like in next example? (here: URL and Content descriptions are shown with gray color under field) ANSWER: When defining your fields in models.py: myfield = models.CharField(max_length=100, help_text="This is the ...
[ "django", "django-admin", "django-forms" ]
93
169
56,028
3
0
2011-06-03T18:43:13.713000
2011-06-03T18:46:30.173000
6,231,311
6,232,126
perl call to ruby script using backticks returns nothing
Ok, so I have a ruby script that grabs some data from FM Server and returns a tuple. I had to do this because there's no good perl FM module that I'm aware of. [test.pl] $ret = `ruby /root/rfm-query.rb $cid`; @extens = split(/,/, $ret, 2); print "DIAL SIP/$extens[0]"; So when I run this it will print "DIAL SIP/215" as ...
I'm not sure what an Asterix AGI script is, but if its anything like CGI, where your code is being run by a server, then its probably running as a different user as you. Hopefully it is and not root and it probably can't read /root/rfm-query.rb. You can check this by trying to open and print the file for reading. my $r...
perl call to ruby script using backticks returns nothing Ok, so I have a ruby script that grabs some data from FM Server and returns a tuple. I had to do this because there's no good perl FM module that I'm aware of. [test.pl] $ret = `ruby /root/rfm-query.rb $cid`; @extens = split(/,/, $ret, 2); print "DIAL SIP/$extens...
TITLE: perl call to ruby script using backticks returns nothing QUESTION: Ok, so I have a ruby script that grabs some data from FM Server and returns a tuple. I had to do this because there's no good perl FM module that I'm aware of. [test.pl] $ret = `ruby /root/rfm-query.rb $cid`; @extens = split(/,/, $ret, 2); print...
[ "perl", "asterisk", "agi" ]
2
2
1,104
1
0
2011-06-03T18:44:36.233000
2011-06-03T20:10:27.463000
6,231,313
6,231,408
Why won't this merge statement work?
I've spent the better part of the day trying to determine why a merge statement won't work and I'm starting to think the problem must be something a bit exotic. My database has dozens of PL/SQL procedures that use merge statements but I absolutely cannot get one in particular to work. Although it's much larger than the...
It looks like your using clause is missing the column you're trying to join on. Your code: merge into customer_contact c using (select p.fax_number, p.email from sfdc_cust_contact_temp p ) p on (p.sfdc_cust_contact_pk = c.sfdc_cust_contact_pk) Potential fix: merge into customer_contact c using (select p.sfdc_cust_conta...
Why won't this merge statement work? I've spent the better part of the day trying to determine why a merge statement won't work and I'm starting to think the problem must be something a bit exotic. My database has dozens of PL/SQL procedures that use merge statements but I absolutely cannot get one in particular to wor...
TITLE: Why won't this merge statement work? QUESTION: I've spent the better part of the day trying to determine why a merge statement won't work and I'm starting to think the problem must be something a bit exotic. My database has dozens of PL/SQL procedures that use merge statements but I absolutely cannot get one in...
[ "sql", "oracle", "oracle10g", "ora-00904" ]
1
4
387
1
0
2011-06-03T18:44:40.503000
2011-06-03T18:53:09.873000
6,231,318
6,231,880
How to display sqlite contents
I'm not that experienced so I may have missed something obvious. What I am trying to achieve is a search feature for the database. The two methods I'm thinking of are either an edittext and a listview and everytime the edittext changed a query is run and the listview is updated. Or populating the listview with all the ...
A good place to start is the Android Dev Guide under the Data Storage section. Have a look at the Searchable Dictionary sample there.
How to display sqlite contents I'm not that experienced so I may have missed something obvious. What I am trying to achieve is a search feature for the database. The two methods I'm thinking of are either an edittext and a listview and everytime the edittext changed a query is run and the listview is updated. Or popula...
TITLE: How to display sqlite contents QUESTION: I'm not that experienced so I may have missed something obvious. What I am trying to achieve is a search feature for the database. The two methods I'm thinking of are either an edittext and a listview and everytime the edittext changed a query is run and the listview is ...
[ "android" ]
1
0
211
1
0
2011-06-03T18:45:11.443000
2011-06-03T19:41:54.113000
6,231,319
6,232,146
javolution support unsigned64 or not?
Anybody knows if Javolution support unsigned64 or not? I cannot find similar type defined in its API. My co-worker start use Javolution hoping it will help us to mapping Java types with C++ types in our socket communication. I don't know is there any better solution for this type of conversions.
For the most part you can treat a long as unsigned with minor changes. For network communication, its usually simple. However in some cases you need to use BigInteger to store/calculate the value accurately. I have created a one class library which shows you wys to treat a long as Unsigned
javolution support unsigned64 or not? Anybody knows if Javolution support unsigned64 or not? I cannot find similar type defined in its API. My co-worker start use Javolution hoping it will help us to mapping Java types with C++ types in our socket communication. I don't know is there any better solution for this type o...
TITLE: javolution support unsigned64 or not? QUESTION: Anybody knows if Javolution support unsigned64 or not? I cannot find similar type defined in its API. My co-worker start use Javolution hoping it will help us to mapping Java types with C++ types in our socket communication. I don't know is there any better soluti...
[ "java", "javolution" ]
1
2
435
1
0
2011-06-03T18:45:24
2011-06-03T20:12:03.257000
6,231,321
6,231,396
How do I sync my folder to Amazon S3 in Java
I am building a java application as a learning exercise. For now, I want to make an app that will take the contents in a folder and replicate it to my Amazon S3 bucket. By searching around, I found out that the best way to tell if 2 files are identical is to take the MD5 value. How do I iteratively take the MD5 of each...
ObjectListing objectListing = s3.listObjects( new ListObjectsRequest().withBucketName(bucket)); List l = objectListing.getObjectSummaries(); S3ObjectSummary has memeber called eTag which is md5 hash of the object
How do I sync my folder to Amazon S3 in Java I am building a java application as a learning exercise. For now, I want to make an app that will take the contents in a folder and replicate it to my Amazon S3 bucket. By searching around, I found out that the best way to tell if 2 files are identical is to take the MD5 val...
TITLE: How do I sync my folder to Amazon S3 in Java QUESTION: I am building a java application as a learning exercise. For now, I want to make an app that will take the contents in a folder and replicate it to my Amazon S3 bucket. By searching around, I found out that the best way to tell if 2 files are identical is t...
[ "java", "amazon-s3" ]
3
2
3,905
1
0
2011-06-03T18:45:36.853000
2011-06-03T18:51:24.153000
6,231,336
6,231,369
Is is possible to use std::map in C++ with a class without any copy operator?
I'm using a Class (Object) that doesn't have any copy operator: it basically cannot be copied right now. I have a std::map objects variable that lists objects with an int identifier. How could I add an Object to this map without having to use copy operators? I tried objects.insert(std::pair<0,Object()>); but that won't...
In C++03, objects that are stored in STL containers must be copyable. This is because a STL container's std::allocator actually uses the placement version of the new operator to copy construct the objects in pre-allocated memory blocks, and that requires the existence of a copy-constructor to copy the actual instance o...
Is is possible to use std::map in C++ with a class without any copy operator? I'm using a Class (Object) that doesn't have any copy operator: it basically cannot be copied right now. I have a std::map objects variable that lists objects with an int identifier. How could I add an Object to this map without having to use...
TITLE: Is is possible to use std::map in C++ with a class without any copy operator? QUESTION: I'm using a Class (Object) that doesn't have any copy operator: it basically cannot be copied right now. I have a std::map objects variable that lists objects with an int identifier. How could I add an Object to this map wit...
[ "c++", "constructor", "copy-constructor", "stdmap" ]
15
11
13,686
3
0
2011-06-03T18:46:34.623000
2011-06-03T18:49:10.697000
6,231,338
6,231,370
php mysql query within foreach loop not working
Name pretty much explains it all-- I have an array and I want to run a query for each item in the array Two variables come from this, volume and page number -- the volumes are contained within the array and I need to pull the respective page numbers for each volume heres my code: $volsArr = array(1, 2, 3, 4); foreach ...
Based on your update, the reason is: Rows do not exist where vol in ('2','3','4') $page is never being updated because there are no rows to fetch.
php mysql query within foreach loop not working Name pretty much explains it all-- I have an array and I want to run a query for each item in the array Two variables come from this, volume and page number -- the volumes are contained within the array and I need to pull the respective page numbers for each volume heres ...
TITLE: php mysql query within foreach loop not working QUESTION: Name pretty much explains it all-- I have an array and I want to run a query for each item in the array Two variables come from this, volume and page number -- the volumes are contained within the array and I need to pull the respective page numbers for ...
[ "php", "mysql", "arrays", "foreach" ]
1
1
2,346
1
0
2011-06-03T18:46:46.493000
2011-06-03T18:49:11.283000
6,231,346
6,256,614
How to create a JSON post request in firefox extension?
I am trying to call the Google API, a JSON post request from a Firefox extension, e.g. POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} How can I call this API and handle the response in a Firefox extension?
Simplest way is to use XMLHttpRequest, exactly as you would do from a web page (only that a web page is limited by the same-origin policy). var request = new XMLHttpRequest(); request.open("POST", "https://www.googleapis.com/urlshortener/v1/url"); request.setRequestHeader("Content-Type", "application/json"); request.ov...
How to create a JSON post request in firefox extension? I am trying to call the Google API, a JSON post request from a Firefox extension, e.g. POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} How can I call this API and handle the response in a Fi...
TITLE: How to create a JSON post request in firefox extension? QUESTION: I am trying to call the Google API, a JSON post request from a Firefox extension, e.g. POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} How can I call this API and handle th...
[ "ajax", "json", "firefox", "firefox-addon", "google-api" ]
3
3
10,439
1
0
2011-06-03T18:46:56.927000
2011-06-06T18:49:34.690000
6,231,347
6,231,727
Scraping (Regex) Issues
I've been trying to build a simple scraper that would take a keyword, then go to Amazon and enter the keyword into the search box, then scrape the main results only. The problem is that the Regex isn't working. I've tried many different ways, but it's still not working properly. $url = "http://www.amazon.com/s/ref=nb_s...
Parsing complex structures with a regex often fails. The regex gets complicate and even you put lot of efforts in, it never properly works. That's by the nature of the data you would like to analyse and the limitation of regexes. When website's weren't that complex, I did the following which often works well for a quic...
Scraping (Regex) Issues I've been trying to build a simple scraper that would take a keyword, then go to Amazon and enter the keyword into the search box, then scrape the main results only. The problem is that the Regex isn't working. I've tried many different ways, but it's still not working properly. $url = "http://w...
TITLE: Scraping (Regex) Issues QUESTION: I've been trying to build a simple scraper that would take a keyword, then go to Amazon and enter the keyword into the search box, then scrape the main results only. The problem is that the Regex isn't working. I've tried many different ways, but it's still not working properly...
[ "php", "regex", "web-scraping" ]
0
1
456
4
0
2011-06-03T18:47:00.393000
2011-06-03T19:27:53.860000
6,231,350
6,236,122
INSERT with Subtype SuperType
I am currently working with a db that utilizes a subtype / supertype structure. I am wondering the best approach to handling INSERTs. Do I keep the population of multiple tables in the SQL itself, or with PHP, or even a combo of the two? I am using MySQL / PHP (w/ Yii Framework) ///EDIT/// Don't know whats up with a do...
The "standard" approach is to create one updatable view for each subtype. Each updatable view joins the supertype with one subtype. Then application code usually uses the view, not the base tables. On most platforms, that means you need to write some triggers.
INSERT with Subtype SuperType I am currently working with a db that utilizes a subtype / supertype structure. I am wondering the best approach to handling INSERTs. Do I keep the population of multiple tables in the SQL itself, or with PHP, or even a combo of the two? I am using MySQL / PHP (w/ Yii Framework) ///EDIT///...
TITLE: INSERT with Subtype SuperType QUESTION: I am currently working with a db that utilizes a subtype / supertype structure. I am wondering the best approach to handling INSERTs. Do I keep the population of multiple tables in the SQL itself, or with PHP, or even a combo of the two? I am using MySQL / PHP (w/ Yii Fra...
[ "php", "mysql", "database", "yii" ]
1
2
1,519
4
0
2011-06-03T18:47:17.850000
2011-06-04T10:13:25.177000
6,231,353
6,231,432
Android query selection difference
Using query for my database searching for rows with a specific number, I notice that for the selection argument if I use: String selection = NUMBER + " MATCH?" String selectionArgs = new String[]{number} Cursor cursor1 = db.query(TABLE_NAME, null, selection, selectionArgs, null, null, null); cursor1.moveToFirst(); thi...
From the SQLite documentation: "The MATCH operator is a special syntax for the match() application-defined function. The default match() function implementation raises an exception and is not really useful for anything. But extensions can override the match() function with more helpful logic." http://www.sqlite.org/lan...
Android query selection difference Using query for my database searching for rows with a specific number, I notice that for the selection argument if I use: String selection = NUMBER + " MATCH?" String selectionArgs = new String[]{number} Cursor cursor1 = db.query(TABLE_NAME, null, selection, selectionArgs, null, null...
TITLE: Android query selection difference QUESTION: Using query for my database searching for rows with a specific number, I notice that for the selection argument if I use: String selection = NUMBER + " MATCH?" String selectionArgs = new String[]{number} Cursor cursor1 = db.query(TABLE_NAME, null, selection, selecti...
[ "android", "sqlite" ]
0
0
692
1
0
2011-06-03T18:47:27.437000
2011-06-03T18:55:57.933000
6,231,362
6,231,448
scale image on browser resize
I am wondering how would I scale an image on browser resize with minimum and maximum width and height parameters? I know how to use the Event.RESIZE function to make my image proportional with the browser using stage.stageWidth/Height, but I am trying to figure out a way to have a movieclip or image scale up or down to...
Use Math.min() and Math.max() to clamp the values for your width and height. I'm assuming you want the image to scale proportionally. var w: Number = Math.max(320, Math.min(stage.stageWidth, 640)); var scaleRatio: Number = w / 640; var h: Number = 480 * scaleRatio; myImage.width = w; myImage.height = h;
scale image on browser resize I am wondering how would I scale an image on browser resize with minimum and maximum width and height parameters? I know how to use the Event.RESIZE function to make my image proportional with the browser using stage.stageWidth/Height, but I am trying to figure out a way to have a moviecli...
TITLE: scale image on browser resize QUESTION: I am wondering how would I scale an image on browser resize with minimum and maximum width and height parameters? I know how to use the Event.RESIZE function to make my image proportional with the browser using stage.stageWidth/Height, but I am trying to figure out a way ...
[ "actionscript-3" ]
0
0
526
1
0
2011-06-03T18:48:41.460000
2011-06-03T18:57:16.573000
6,231,368
6,233,961
objective c undefined symbol compilation error
Help please! my first program in objective c. Followed a tutorial word for word but it gives me this error that I don't know quite how to read for objective c. SimpleCar.h: #import @interface SimpleCar: NSObject { NSString* make; NSString* model; NSNumber* vin; } // set methods - (void) setVin: (NSNumber*)newVin; - (v...
It looks like you just created an Xcode Workspace without an Xcode project. Here's a project that you could use: http://www.markdouma.com/developer/CarApp.zip Generally, you just choose File > New Project to create a new project. You'd likely want a Foundation-based command-line program for this particular project. Unf...
objective c undefined symbol compilation error Help please! my first program in objective c. Followed a tutorial word for word but it gives me this error that I don't know quite how to read for objective c. SimpleCar.h: #import @interface SimpleCar: NSObject { NSString* make; NSString* model; NSNumber* vin; } // set m...
TITLE: objective c undefined symbol compilation error QUESTION: Help please! my first program in objective c. Followed a tutorial word for word but it gives me this error that I don't know quite how to read for objective c. SimpleCar.h: #import @interface SimpleCar: NSObject { NSString* make; NSString* model; NSNumber...
[ "objective-c", "compiler-errors" ]
2
1
11,737
2
0
2011-06-03T18:49:06.670000
2011-06-04T00:54:20.660000
6,231,374
6,231,431
js style doesn't update
I have a piece of code which is making me really crazy: I have a horizontal menu in my website, and on a mouseover event on one of the items a vertical submenu appears. I got this to work. The html looks something like this (don't mind the js for now, comments are also not in the real html): //the real html has some co...
This seems like a lot of engineering to acheive something rather simple. Firstly, have you considered fixed widths for the drop-down results. Next have you checked out the many many pure CSS examples out there, so you don't need to use JavaScript at all? http://csswizardry.com/2011/02/creating-a-pure-css-dropdown-menu/
js style doesn't update I have a piece of code which is making me really crazy: I have a horizontal menu in my website, and on a mouseover event on one of the items a vertical submenu appears. I got this to work. The html looks something like this (don't mind the js for now, comments are also not in the real html): //t...
TITLE: js style doesn't update QUESTION: I have a piece of code which is making me really crazy: I have a horizontal menu in my website, and on a mouseover event on one of the items a vertical submenu appears. I got this to work. The html looks something like this (don't mind the js for now, comments are also not in t...
[ "javascript", "css" ]
0
1
476
1
0
2011-06-03T18:49:25.517000
2011-06-03T18:55:53.610000
6,231,382
6,231,409
How does xUnit runner handle static methods w/static class constructor?
If I have a class with static Facts (test methods) and the class has a static constructor, is the constructor called for each Fact or only once for all Facts in a class? I guess it depends on how the runner loads/unloads test classes?
Out of experience, I know that it is only called once for the class. It is the same if you use a static class (i.e. settings class) in your non-static tests (facts). The static object constructor is only called once for the whole test class.
How does xUnit runner handle static methods w/static class constructor? If I have a class with static Facts (test methods) and the class has a static constructor, is the constructor called for each Fact or only once for all Facts in a class? I guess it depends on how the runner loads/unloads test classes?
TITLE: How does xUnit runner handle static methods w/static class constructor? QUESTION: If I have a class with static Facts (test methods) and the class has a static constructor, is the constructor called for each Fact or only once for all Facts in a class? I guess it depends on how the runner loads/unloads test clas...
[ ".net", "unit-testing", "xunit.net", "xunit" ]
1
2
2,826
2
0
2011-06-03T18:50:15.610000
2011-06-03T18:53:11.833000
6,231,387
6,231,457
How to make a search function? (Replace something with what people search for)
This is my current code: $result = mysql_query("SELECT * FROM characters WHERE namn = 'Jargon'"); while($row = mysql_fetch_array($result)) { echo " "; echo " Information "; echo " "; echo $row['Namn']; echo " "; echo " "; echo " Obekräftade fall "; echo str_replace(',',' ', $row['unconfirmed']); echo " "; echo " "; ...
Change your first line to these: if (!isset($_GET['name']) { // Handle a missing name variable in some way // (if you like you can even include the form on this page itself, allowing // the page to submit data back to itself, with this isset() check // determining whether to show the form or process the form) print "Yo...
How to make a search function? (Replace something with what people search for) This is my current code: $result = mysql_query("SELECT * FROM characters WHERE namn = 'Jargon'"); while($row = mysql_fetch_array($result)) { echo " "; echo " Information "; echo " "; echo $row['Namn']; echo " "; echo " "; echo " Obekräftad...
TITLE: How to make a search function? (Replace something with what people search for) QUESTION: This is my current code: $result = mysql_query("SELECT * FROM characters WHERE namn = 'Jargon'"); while($row = mysql_fetch_array($result)) { echo " "; echo " Information "; echo " "; echo $row['Namn']; echo " "; echo " ";...
[ "php", "mysql", "sql", "function" ]
0
0
964
3
0
2011-06-03T18:50:46.580000
2011-06-03T18:57:39.093000
6,231,414
6,240,302
How to load a flat file with header and detail data into a database using SSIS package?
I have to load a flat file that has different header and detail with variable number of columns. These have parent child relations. How to load the data into SQL Server? The file looks like this: DEP*0116960*20110511***01*061000104*DA*1000022220940 AMT*3*13006.05 QTY*41*3 QTY*42*5 BAT*20110511**STAWRRY11051101 AMT*2*93...
Here is one possible way of loading this file into SQL Server. Below shown example reads the contents of EDI 823 Lockbox file and loads into multiple tables along with the relationship. I am sure that there are other better ways of doing this. This is just one example of loading an EDI file into SQL Server. The example...
How to load a flat file with header and detail data into a database using SSIS package? I have to load a flat file that has different header and detail with variable number of columns. These have parent child relations. How to load the data into SQL Server? The file looks like this: DEP*0116960*20110511***01*061000104*...
TITLE: How to load a flat file with header and detail data into a database using SSIS package? QUESTION: I have to load a flat file that has different header and detail with variable number of columns. These have parent child relations. How to load the data into SQL Server? The file looks like this: DEP*0116960*201105...
[ "ssis", "edi" ]
5
7
15,851
3
0
2011-06-03T18:53:52.597000
2011-06-05T00:47:03.837000
6,231,435
6,237,746
Turning personal hotspot on?
Is there a way I can turn personal hotspot on using objective-c? I need to connect to a printer and I don't want the user to go to the settings and then turn it on, rather I want to turn it on in code, print, then turn it back off.
Sorry, there is no way to do that in the published APIs. You may want to file an enhancement request at http://bugreport.apple.com/ However, I suspect that your use case is sufficiently esoteric that only a few people will be affected. I mean, you have a wifi-enabled printer but no wifi network? That is probably rare f...
Turning personal hotspot on? Is there a way I can turn personal hotspot on using objective-c? I need to connect to a printer and I don't want the user to go to the settings and then turn it on, rather I want to turn it on in code, print, then turn it back off.
TITLE: Turning personal hotspot on? QUESTION: Is there a way I can turn personal hotspot on using objective-c? I need to connect to a printer and I don't want the user to go to the settings and then turn it on, rather I want to turn it on in code, print, then turn it back off. ANSWER: Sorry, there is no way to do tha...
[ "objective-c", "cocoa-touch", "ios" ]
1
3
983
1
0
2011-06-03T18:56:27.863000
2011-06-04T15:49:50.010000
6,231,438
6,231,475
Parsing DateTime
How would one parse 1900-01-01 00:00:00Z into a DateTime object? string temp = "1900-01-01 00:00:00Z"; CultureInfo provider = CultureInfo.InvariantCulture; var date = DateTime.ParseExact(temp, "yyyy-MM-dd hh:mm:ssZ", provider); this returns me: 12/31/1899 7:00:00 PM
How are you displaying the value? I suspect it's just applying your local time zone to the date. For example, try printing out: date.Year date.Kind date.Hour My guess is that you'll see date is actually a UTC DateTime with the right value. It's unfortunate that.NET is performing the time zone conversion for you implici...
Parsing DateTime How would one parse 1900-01-01 00:00:00Z into a DateTime object? string temp = "1900-01-01 00:00:00Z"; CultureInfo provider = CultureInfo.InvariantCulture; var date = DateTime.ParseExact(temp, "yyyy-MM-dd hh:mm:ssZ", provider); this returns me: 12/31/1899 7:00:00 PM
TITLE: Parsing DateTime QUESTION: How would one parse 1900-01-01 00:00:00Z into a DateTime object? string temp = "1900-01-01 00:00:00Z"; CultureInfo provider = CultureInfo.InvariantCulture; var date = DateTime.ParseExact(temp, "yyyy-MM-dd hh:mm:ssZ", provider); this returns me: 12/31/1899 7:00:00 PM ANSWER: How are y...
[ "c#", "datetime", "iformatprovider" ]
2
3
493
4
0
2011-06-03T18:56:42.927000
2011-06-03T18:59:41.017000
6,231,442
6,231,904
Image to the left, text centered and keeping both in center of div when text changes?
I had this question answered here: Left-align image and centered text on same level inside of a div? I encountered an issue with this solution, however. The title has a series of font families defined. When one of the font families is not present on a user's computer, so a different font is shown, the static positionin...
Here's an illustration of what I think you want, using top: 50%; image size of 48px, and top margin of -24px to keep it vertically centered: http://jsfiddle.net/5L5V9/5/
Image to the left, text centered and keeping both in center of div when text changes? I had this question answered here: Left-align image and centered text on same level inside of a div? I encountered an issue with this solution, however. The title has a series of font families defined. When one of the font families is...
TITLE: Image to the left, text centered and keeping both in center of div when text changes? QUESTION: I had this question answered here: Left-align image and centered text on same level inside of a div? I encountered an issue with this solution, however. The title has a series of font families defined. When one of th...
[ "css" ]
0
1
373
3
0
2011-06-03T18:56:52.120000
2011-06-03T19:43:48.073000
6,231,450
6,253,272
When playing 3 MP3 sound files in synchronously I receive a strange exception
I would like to do this: Sistema.Util.MP3Player(@"sound1.mp3"); Sistema.Util.MP3Player(@"sound2.mp3"); namespace Sistema.Util.TextToSpeech { public class Player { static System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer(); public static void MP3Player(string FileName, bool Async = false) { if...
For now I am using this solution: WPF MediaPlayer: How to play in sequence, sync?
When playing 3 MP3 sound files in synchronously I receive a strange exception I would like to do this: Sistema.Util.MP3Player(@"sound1.mp3"); Sistema.Util.MP3Player(@"sound2.mp3"); namespace Sistema.Util.TextToSpeech { public class Player { static System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPla...
TITLE: When playing 3 MP3 sound files in synchronously I receive a strange exception QUESTION: I would like to do this: Sistema.Util.MP3Player(@"sound1.mp3"); Sistema.Util.MP3Player(@"sound2.mp3"); namespace Sistema.Util.TextToSpeech { public class Player { static System.Windows.Media.MediaPlayer mp = new System.Wind...
[ "c#", "wpf", "naudio" ]
1
0
2,391
4
0
2011-06-03T18:57:18.060000
2011-06-06T14:08:51.490000
6,231,470
6,231,859
Why do I get "Errno::ECONNREFUSED" with 'net/http' in Rails?
I am trying to parse an XML file from a URL. When I try something like this: require 'net/http' require 'rubygems' require 'xmlsimple' url = 'http://my-address.com/xmltest/note.xml' xml_data = Net::HTTP.get_response(URI.parse(url)).body Everything works, but only when I do this outside of my Rails project. If I try in...
Net::HTTP is part of Ruby's standard library. You can use require 'net/http' to load it. Rather than use Net::HTTP, which is fairly low-level for what you want to do, I'd recommend using Ruby's Open::URI. If you are moving a lot of HTTP data, you might want to look into something like HTTPClient or Curb or Typhoeus, wh...
Why do I get "Errno::ECONNREFUSED" with 'net/http' in Rails? I am trying to parse an XML file from a URL. When I try something like this: require 'net/http' require 'rubygems' require 'xmlsimple' url = 'http://my-address.com/xmltest/note.xml' xml_data = Net::HTTP.get_response(URI.parse(url)).body Everything works, but...
TITLE: Why do I get "Errno::ECONNREFUSED" with 'net/http' in Rails? QUESTION: I am trying to parse an XML file from a URL. When I try something like this: require 'net/http' require 'rubygems' require 'xmlsimple' url = 'http://my-address.com/xmltest/note.xml' xml_data = Net::HTTP.get_response(URI.parse(url)).body Eve...
[ "ruby-on-rails", "ruby", "net-http" ]
6
6
13,487
2
0
2011-06-03T18:59:14.490000
2011-06-03T19:39:29.830000
6,231,471
6,231,525
Why is this SHA256 function printing some weird characters?
This is the code #include #include #include #include #include #include #include "/usr/include/openssl/sha.h" #include bool hex2bin(unsigned char *p, const char *hexstr, size_t len); bool hex2bin(unsigned char *p, const char *hexstr, size_t len) { while (*hexstr && len) { char hex_byte[3]; unsigned int v; if (!hexstr[...
The output of a hash is almost always opaque binary data - i.e. any bytes. You're trying to print those as if they were text. That means it'll be applying some encoding to the binary data, trying to interpret it as text. Basically you should use the opposite of hex2bin in order to convert the arbitrary binary data into...
Why is this SHA256 function printing some weird characters? This is the code #include #include #include #include #include #include #include "/usr/include/openssl/sha.h" #include bool hex2bin(unsigned char *p, const char *hexstr, size_t len); bool hex2bin(unsigned char *p, const char *hexstr, size_t len) { while (*hexs...
TITLE: Why is this SHA256 function printing some weird characters? QUESTION: This is the code #include #include #include #include #include #include #include "/usr/include/openssl/sha.h" #include bool hex2bin(unsigned char *p, const char *hexstr, size_t len); bool hex2bin(unsigned char *p, const char *hexstr, size_t l...
[ "c", "sha256" ]
3
5
2,064
1
0
2011-06-03T18:59:20.267000
2011-06-03T19:06:09.860000
6,231,474
6,235,748
IE8 negative margin issue
I have a layout issue in IE8 only where a negative margin does strange things. I have tried to use some of the fixes I have found in this forum, but to no avail. It is Friday night after all! The page is here: http://community.thelandtrust.org.uk/wordpress/ The culprit is the search field on the right hand side, which ...
for some reason IE8 is making the button double width. adding padding: 0; to input.search-submit seems to fix it
IE8 negative margin issue I have a layout issue in IE8 only where a negative margin does strange things. I have tried to use some of the fixes I have found in this forum, but to no avail. It is Friday night after all! The page is here: http://community.thelandtrust.org.uk/wordpress/ The culprit is the search field on t...
TITLE: IE8 negative margin issue QUESTION: I have a layout issue in IE8 only where a negative margin does strange things. I have tried to use some of the fixes I have found in this forum, but to no avail. It is Friday night after all! The page is here: http://community.thelandtrust.org.uk/wordpress/ The culprit is the...
[ "css", "internet-explorer-8", "margin" ]
2
2
3,894
1
0
2011-06-03T18:59:32.147000
2011-06-04T08:52:45.843000
6,231,481
6,231,498
Android: Moving buttons freely in Eclipse's Graphical Layout Editor
I've developed several iPhone apps and now I'm porting them onto Android. From what I was used to, I was able to freely move buttons around using the Interface Editor for the iPhone, and from what I understand for Android, you can (or need) to use the XML layout file to "layout" your buttons and whatnot. So this means ...
The reason for iPhone absolute layouts is that all the screens are the same size. Because there is such a wide variety of android devices, you should try getting used to relative and linear layout construction. To answer, no, you won't be able to place a button in an exact pixel location using the graphical layout edit...
Android: Moving buttons freely in Eclipse's Graphical Layout Editor I've developed several iPhone apps and now I'm porting them onto Android. From what I was used to, I was able to freely move buttons around using the Interface Editor for the iPhone, and from what I understand for Android, you can (or need) to use the ...
TITLE: Android: Moving buttons freely in Eclipse's Graphical Layout Editor QUESTION: I've developed several iPhone apps and now I'm porting them onto Android. From what I was used to, I was able to freely move buttons around using the Interface Editor for the iPhone, and from what I understand for Android, you can (or...
[ "java", "android", "xml", "eclipse" ]
7
7
20,367
3
0
2011-06-03T19:00:18.697000
2011-06-03T19:02:48.763000
6,231,484
6,231,553
Passing model objects from one view controller to another in a navigation stack
I have two UITableViewControllers. One displays a list of names and on tapping any cell will push the second TableViewController which enables the user to edit the name in a UITextField. Now I am able to pass the name string from the first TableViewController to the second. (I'm doing this by creating a property in the...
Create a mutable array property in the first controller, and pass that array and an index to the second controller. FirstController.h @property (nonatomic,retain) NSMutableArray *myStrings; FirstController.m @synthesize myStrings; init { self.myStrings = [NSMutableArray arrayWithCapacity:8]; } didSelectRowAtIndexPath...
Passing model objects from one view controller to another in a navigation stack I have two UITableViewControllers. One displays a list of names and on tapping any cell will push the second TableViewController which enables the user to edit the name in a UITextField. Now I am able to pass the name string from the first ...
TITLE: Passing model objects from one view controller to another in a navigation stack QUESTION: I have two UITableViewControllers. One displays a list of names and on tapping any cell will push the second TableViewController which enables the user to edit the name in a UITextField. Now I am able to pass the name stri...
[ "iphone", "ios", "uitableview", "uinavigationcontroller" ]
1
1
1,394
5
0
2011-06-03T19:00:58.160000
2011-06-03T19:09:14.610000
6,231,486
6,232,008
Injecting code into executable at runtime
I'm working on application (written in C++), which generate some machine code at runtime (Linux, x86-64 now, but I plan to migrate on ARM). Next it store generated code in memory and execute it by jumping to memory location. For a long time I had a problem with allocating executable memory, but I finally solved it usin...
This is essentially how executable loaders do things; in their case they perform a mmap of a file, not an anonymous mapping, but apart from that it's essentially the same. Note that it's a good idea not to have both write and execute access at the same time, as it makes certain types of security exploits easier. You ca...
Injecting code into executable at runtime I'm working on application (written in C++), which generate some machine code at runtime (Linux, x86-64 now, but I plan to migrate on ARM). Next it store generated code in memory and execute it by jumping to memory location. For a long time I had a problem with allocating execu...
TITLE: Injecting code into executable at runtime QUESTION: I'm working on application (written in C++), which generate some machine code at runtime (Linux, x86-64 now, but I plan to migrate on ARM). Next it store generated code in memory and execute it by jumping to memory location. For a long time I had a problem wit...
[ "linux", "assembly", "arm", "x86-64" ]
14
13
3,698
2
0
2011-06-03T19:01:38.120000
2011-06-03T19:57:16.890000
6,231,503
6,231,602
Make htaccess put all directories into a single get variable
I am working with a CMS that needs pretty urls. I found this snippet of htaccess code that I thought would solve all my problems: Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME}!-d RewriteCond %{SCRIPT_FILENAME}!-f RewriteRule ^(\w+)$./index.php?route=$1 Then on index.php I put this: echo $_GE...
This should work flawlessly: RewriteEngine On RewriteCond %{SCRIPT_FILENAME}!-d RewriteCond %{SCRIPT_FILENAME}!-f RewriteRule ^(.*)$ index.php [L] You don't have to pass the URL as a GET parameter to your script, because that would cause additional headaches about escaping special characters. You can easily access your...
Make htaccess put all directories into a single get variable I am working with a CMS that needs pretty urls. I found this snippet of htaccess code that I thought would solve all my problems: Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME}!-d RewriteCond %{SCRIPT_FILENAME}!-f RewriteRule ^(\w+)...
TITLE: Make htaccess put all directories into a single get variable QUESTION: I am working with a CMS that needs pretty urls. I found this snippet of htaccess code that I thought would solve all my problems: Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME}!-d RewriteCond %{SCRIPT_FILENAME}!-f ...
[ "regex", ".htaccess" ]
2
3
580
4
0
2011-06-03T19:03:05.233000
2011-06-03T19:14:10.210000
6,231,508
6,232,725
How to run process in terminal with reading only permission for given directory
I am trying to run a process in my terminal but I don't trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS.
As knittl told, you can use chroot for making jail. For the more complex things, MAC have MAC, (mean OS X have Mandatory Access Control), what allow specify what processes can do and what cannot. This implemented with the sandbox mechanism, what is extremely powerful and fine grained. you need setup the sandbox, so: ma...
How to run process in terminal with reading only permission for given directory I am trying to run a process in my terminal but I don't trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS.
TITLE: How to run process in terminal with reading only permission for given directory QUESTION: I am trying to run a process in my terminal but I don't trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS. ANSWER: As knittl tol...
[ "linux", "macos", "shell", "permissions", "terminal" ]
1
2
1,067
1
0
2011-06-03T19:03:48.940000
2011-06-03T21:08:56.737000
6,231,512
6,231,673
Redirect a page and load/refresh a div within that page using ajax
I am using ajax to redirect to a page by window.location = "page.php" After the page is redirected I need to load a div within that page. For example search.php. I have been reading up on how to do this and from what I gather you can do this by using jquery. I have never used jquery so if someone can help me out I will...
May be this is what you are looking for (using jQuery): In page.php: Description: This will load the page search.php into the ( div ) element with id, "divID" after page.php has been loaded.
Redirect a page and load/refresh a div within that page using ajax I am using ajax to redirect to a page by window.location = "page.php" After the page is redirected I need to load a div within that page. For example search.php. I have been reading up on how to do this and from what I gather you can do this by using jq...
TITLE: Redirect a page and load/refresh a div within that page using ajax QUESTION: I am using ajax to redirect to a page by window.location = "page.php" After the page is redirected I need to load a div within that page. For example search.php. I have been reading up on how to do this and from what I gather you can d...
[ "php", "jquery", "ajax", "redirect", "partial-page-refresh" ]
0
0
4,394
2
0
2011-06-03T19:04:10.180000
2011-06-03T19:23:08.593000
6,231,519
6,231,596
javascript validation for numbers
can someone tell me what i am doing wrong here.. i am not getting invalid number alert when i enter 1 1 0r a function validateNumeric() { var old_val = document.getElementById("tbNumber").value; var new_val = old_val.replace(/^\s+|\s+$/g,""); var validChars = '0123456789.'; for(var i = 0; i < val.length; i++){ if(vali...
In your for loop test, you're referencing a variable val, which probably comes back as having a length of 0, so your loop will never do anything and the function will simply return true. I'm guessing your for loop should actually look like: for(var i = 0; i < new_val.length; i++){... }
javascript validation for numbers can someone tell me what i am doing wrong here.. i am not getting invalid number alert when i enter 1 1 0r a function validateNumeric() { var old_val = document.getElementById("tbNumber").value; var new_val = old_val.replace(/^\s+|\s+$/g,""); var validChars = '0123456789.'; for(var i ...
TITLE: javascript validation for numbers QUESTION: can someone tell me what i am doing wrong here.. i am not getting invalid number alert when i enter 1 1 0r a function validateNumeric() { var old_val = document.getElementById("tbNumber").value; var new_val = old_val.replace(/^\s+|\s+$/g,""); var validChars = '0123456...
[ "javascript", "validation" ]
1
2
1,437
2
0
2011-06-03T19:05:07.133000
2011-06-03T19:13:55.043000
6,231,520
6,231,529
Does re-use of file pointers cause a memory leak?
It's been several years since I've dealt with C++, so bear with me... I have a memory leak in my program which causes a run-time error. Could this be causing the error? I have a global variable FILE *fp; In a callback funciton, I have: fp = fopen(filen,"w"); // do some writing fclose(fp); This process is repeated sever...
This approach won't cause any memory leaks so long as the fopen is always followed by a fclose before the next fopen call. However if this is indeed what's happening I would question the need for a global variable. It's much safer overall to make this a local and pass it around to the functions which need to output inf...
Does re-use of file pointers cause a memory leak? It's been several years since I've dealt with C++, so bear with me... I have a memory leak in my program which causes a run-time error. Could this be causing the error? I have a global variable FILE *fp; In a callback funciton, I have: fp = fopen(filen,"w"); // do some ...
TITLE: Does re-use of file pointers cause a memory leak? QUESTION: It's been several years since I've dealt with C++, so bear with me... I have a memory leak in my program which causes a run-time error. Could this be causing the error? I have a global variable FILE *fp; In a callback funciton, I have: fp = fopen(filen...
[ "c++", "file-io", "memory-leaks", "fopen", "fclose" ]
2
3
4,997
4
0
2011-06-03T19:05:07.333000
2011-06-03T19:06:51.707000
6,231,534
6,231,733
raw Resources Android filepath
I have database placed in raw folder and i need to load the database path when the apk is installed? Where it is? in /data/data/package_name/FILE? I dont see it? I work with extisting sqlite database.
It has no path: It is a resource, so you need to reference is as such using getResources(). You should, at the first run, copy it to the /data/data/YOUR_APP_FOLDER/databases/YOUR_DB.db You can follow this tutorial: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
raw Resources Android filepath I have database placed in raw folder and i need to load the database path when the apk is installed? Where it is? in /data/data/package_name/FILE? I dont see it? I work with extisting sqlite database.
TITLE: raw Resources Android filepath QUESTION: I have database placed in raw folder and i need to load the database path when the apk is installed? Where it is? in /data/data/package_name/FILE? I dont see it? I work with extisting sqlite database. ANSWER: It has no path: It is a resource, so you need to reference is...
[ "android", "database" ]
2
2
3,937
2
0
2011-06-03T19:07:08.827000
2011-06-03T19:28:16.117000
6,231,536
6,231,954
Firefox 4 Text Rendering Bug
I've run into a bug with my app that I traced down to inconsistent text rendering between Chrome and Firefox 4. Chrome tells me that a certain string of text is 215px wide whereas Firefox 4 tells me its 218px wide: A bit of searching indicates that the issue is with Firefox 4, not Chrome. The following code renders the...
Is there a way to render text consistently between the browsers? Short answer: No. Not with fillText. Long answer: In fact it will be different on different operating systems and on different OS settings too. And it's not a bug with Firefox, per se. If anything, FF4 is the most consistent. For Chrome 13.0.782.1, Safari...
Firefox 4 Text Rendering Bug I've run into a bug with my app that I traced down to inconsistent text rendering between Chrome and Firefox 4. Chrome tells me that a certain string of text is 215px wide whereas Firefox 4 tells me its 218px wide: A bit of searching indicates that the issue is with Firefox 4, not Chrome. T...
TITLE: Firefox 4 Text Rendering Bug QUESTION: I've run into a bug with my app that I traced down to inconsistent text rendering between Chrome and Firefox 4. Chrome tells me that a certain string of text is 215px wide whereas Firefox 4 tells me its 218px wide: A bit of searching indicates that the issue is with Firefo...
[ "canvas", "firefox4" ]
3
4
686
2
0
2011-06-03T19:07:22.947000
2011-06-03T19:50:06.483000
6,231,554
6,231,590
DOM addressing with jquery
I don't know what it is called but can anyone direct me to a tutorial or something which will enlighten me on how to address HTML DOM elements in jquery?? For Example, I want to know the difference between $('#someid div') or $('#someid > div').
jQuery uses CSS selectors for addressing HTML elements. Read the jQuery documentation on its selectors (api.jquery.com/category/selectors) to know the details. The difference between the selectors you mentioned is following: #someid div gets you all div elements located inside element with ID= someid, #someid > div get...
DOM addressing with jquery I don't know what it is called but can anyone direct me to a tutorial or something which will enlighten me on how to address HTML DOM elements in jquery?? For Example, I want to know the difference between $('#someid div') or $('#someid > div').
TITLE: DOM addressing with jquery QUESTION: I don't know what it is called but can anyone direct me to a tutorial or something which will enlighten me on how to address HTML DOM elements in jquery?? For Example, I want to know the difference between $('#someid div') or $('#someid > div'). ANSWER: jQuery uses CSS sele...
[ "jquery", "dom" ]
0
1
1,655
3
0
2011-06-03T19:09:19.833000
2011-06-03T19:13:28.527000
6,231,556
6,231,688
What is the fastest java framework/server combo?
I'm absolutely confused by all the choices out there. Glassfish, jersey, jax-ws, Grizzly, nginx, cherokee...all of them could be used as a web server and/or application server. Then there is the framework side. I want that side to be as small as humanly possible. I'm not very happy with the kind of frameworks I found i...
As already mentioned, this seems like a case of "premature optimization", but if you really want to go for performance try the Simple HTTP Framework. Or a small servlet container like Jetty. They make you start at a pretty basic level and you can evolve your application from there. As soon as you hit a database though,...
What is the fastest java framework/server combo? I'm absolutely confused by all the choices out there. Glassfish, jersey, jax-ws, Grizzly, nginx, cherokee...all of them could be used as a web server and/or application server. Then there is the framework side. I want that side to be as small as humanly possible. I'm not...
TITLE: What is the fastest java framework/server combo? QUESTION: I'm absolutely confused by all the choices out there. Glassfish, jersey, jax-ws, Grizzly, nginx, cherokee...all of them could be used as a web server and/or application server. Then there is the framework side. I want that side to be as small as humanly...
[ "java", "webserver", "web-frameworks" ]
0
9
7,739
4
0
2011-06-03T19:09:32.163000
2011-06-03T19:24:11.707000
6,231,563
6,242,001
stringstream: why does "showpoint" behave similar as "fixed"?
I'd like to write my own lexical_cast which preserves the decimal point when converting double to std::string. So I'm using ostringstream and set the flag std::ios::showpoint: #include #include #include template std::string my_string_cast(Source arg){ std::ostringstream interpreter; interpreter.precision(std::numeric_l...
After a long time looking through the code of the std library it seems everything gets handed over to some printf type function: __builtin_vsnprintf(__out, __size, __fmt, __args). The format string __fmt is set depending on the flags set on the ostringstream object and can be queried using std::ostringstream s; //... c...
stringstream: why does "showpoint" behave similar as "fixed"? I'd like to write my own lexical_cast which preserves the decimal point when converting double to std::string. So I'm using ostringstream and set the flag std::ios::showpoint: #include #include #include template std::string my_string_cast(Source arg){ std::o...
TITLE: stringstream: why does "showpoint" behave similar as "fixed"? QUESTION: I'd like to write my own lexical_cast which preserves the decimal point when converting double to std::string. So I'm using ostringstream and set the flag std::ios::showpoint: #include #include #include template std::string my_string_cast(S...
[ "g++", "stringstream", "lexical-cast" ]
2
0
814
2
0
2011-06-03T19:10:10.450000
2011-06-05T09:16:51.817000
6,231,575
6,232,006
Asp.Net MVC action based custom authorization
I have a web application written in asp.net mvc with fluent nhibernate. Data hierarchy: Post -> Category -> Company User roles: user, admin I try to find a architecture to develop custom authorization. A user can be member of multiple company. Also a user can be an admin of a company while he can be also just member of...
This is a bit tricky actually - you may want to rethink the custom authorization and consider populating the roles in say Application_AuthenticateRequest, and then use the [Authorize] attribute to do the actual checks if the user belongs to those roles.This way you are applying it directly to the action method and avoi...
Asp.Net MVC action based custom authorization I have a web application written in asp.net mvc with fluent nhibernate. Data hierarchy: Post -> Category -> Company User roles: user, admin I try to find a architecture to develop custom authorization. A user can be member of multiple company. Also a user can be an admin of...
TITLE: Asp.Net MVC action based custom authorization QUESTION: I have a web application written in asp.net mvc with fluent nhibernate. Data hierarchy: Post -> Category -> Company User roles: user, admin I try to find a architecture to develop custom authorization. A user can be member of multiple company. Also a user ...
[ "asp.net", "asp.net-mvc-2", "authorization" ]
4
1
744
1
0
2011-06-03T19:11:42.697000
2011-06-03T19:57:11.193000
6,231,583
6,231,595
When using YUI TaskNode, when clicking on labels, my listener on labelClick isn't called?
How come when using a YUI tree using TaskNode (illustrated below) my listener on labelClick isn't called, while it is called if I create the same tree with TextNode?
This is most likely something that used to work. The YUI code in TaskNode.js calls TextNode.onLabelClick() which does just a return false. This will work if you modify TaskNode.js and instead of calling node.labelClick(node), call tree.fireEvent('labelClick', node). Specifically, replace: sb[sb.length] = ' onclick="ret...
When using YUI TaskNode, when clicking on labels, my listener on labelClick isn't called? How come when using a YUI tree using TaskNode (illustrated below) my listener on labelClick isn't called, while it is called if I create the same tree with TextNode?
TITLE: When using YUI TaskNode, when clicking on labels, my listener on labelClick isn't called? QUESTION: How come when using a YUI tree using TaskNode (illustrated below) my listener on labelClick isn't called, while it is called if I create the same tree with TextNode? ANSWER: This is most likely something that us...
[ "tree", "yui" ]
0
0
73
1
0
2011-06-03T19:12:48.370000
2011-06-03T19:13:52.580000
6,231,586
6,232,368
Android ViewRoot NullPointerException
This causes the error: this.addContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); Not sure what the problem is, here is the trace: ViewRoot.draw(boolean) line: 1440 ViewRoot.performTraversals() line: 1172 ViewRoot.handleMessage(Message) line: 1736 View...
I'd highly suggest reworking the way you're using the video player activity. If you just want to play a video, use the VideoView and embed it in an XML layout. The way you're starting an activity and stealing its view looks like you're trying to work around the framework, which is going to lead to all sorts of wacky er...
Android ViewRoot NullPointerException This causes the error: this.addContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); Not sure what the problem is, here is the trace: ViewRoot.draw(boolean) line: 1440 ViewRoot.performTraversals() line: 1172 ViewRoot....
TITLE: Android ViewRoot NullPointerException QUESTION: This causes the error: this.addContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); Not sure what the problem is, here is the trace: ViewRoot.draw(boolean) line: 1440 ViewRoot.performTraversals() li...
[ "android", "nullpointerexception" ]
0
2
568
1
0
2011-06-03T19:13:07.620000
2011-06-03T20:32:39.587000
6,231,587
6,232,530
iPhone: Adding a Done button within a pop up DatePicker frame
I pop up a DatePicker with the following. Now I'm trying to add a Done button at the top of the pop up frame. -(IBAction) contactBDayDatePicker{ NSLog(@"contactBDayDatePicker"); pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePickerModeDate; if (self.pickerView.superview == nil){ [self.v...
I've done basically the exact same thing. I subclassed UIView. It animates up and everything. Here's some code for you: #import #define MyDateTimePickerHeight 260 @interface MyDateTimePicker: UIView { } @property (nonatomic, assign, readonly) UIDatePicker *picker; - (void) setMode: (UIDatePickerMode) mode; - (void) ...
iPhone: Adding a Done button within a pop up DatePicker frame I pop up a DatePicker with the following. Now I'm trying to add a Done button at the top of the pop up frame. -(IBAction) contactBDayDatePicker{ NSLog(@"contactBDayDatePicker"); pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePi...
TITLE: iPhone: Adding a Done button within a pop up DatePicker frame QUESTION: I pop up a DatePicker with the following. Now I'm trying to add a Done button at the top of the pop up frame. -(IBAction) contactBDayDatePicker{ NSLog(@"contactBDayDatePicker"); pickerView = [[UIDatePicker alloc] init]; pickerView.datePic...
[ "iphone", "popup", "datepicker" ]
4
13
18,545
5
0
2011-06-03T19:13:08.307000
2011-06-03T20:49:57.543000
6,231,598
6,232,808
Flash doesnt like my Formtted XML
I am getting the following error: #1088: The markup in the document following the root element must be well-formed I am calling a php script from AS3 that grabs some XML data from a website and echos it to a page. myLoader.load(new URLRequest("http://www.mywebsite.com/my_test/my_Weather.php")); to get around a cross do...
Maybe, this won't help you directly but I tested your code and everything works fine here: The XML content is traced in debug mode. I used the same AS3 code* and provided a PHP with exactly the same content on my web server. Therefore, I would guess that the problem has nothing to do with the shown sourcecode and lies ...
Flash doesnt like my Formtted XML I am getting the following error: #1088: The markup in the document following the root element must be well-formed I am calling a php script from AS3 that grabs some XML data from a website and echos it to a page. myLoader.load(new URLRequest("http://www.mywebsite.com/my_test/my_Weathe...
TITLE: Flash doesnt like my Formtted XML QUESTION: I am getting the following error: #1088: The markup in the document following the root element must be well-formed I am calling a php script from AS3 that grabs some XML data from a website and echos it to a page. myLoader.load(new URLRequest("http://www.mywebsite.com...
[ "php", "xml", "flash", "actionscript-3" ]
0
1
205
1
0
2011-06-03T19:13:59.053000
2011-06-03T21:20:05.727000
6,231,599
6,231,949
Insert a large image (200px / 150px) centered in a line in a listview?
I wonder if it is possible to insert a large centered image in a listview of a jquery mobile website? I try this: Techno: vb.net - asp.net - vb6 But it doesn't work: ths image is rendered small. Thanks for your help.
Well best I could come up with for now, maybe you can play with it, Live Example Techno: vb.net - asp.net - vb6
Insert a large image (200px / 150px) centered in a line in a listview? I wonder if it is possible to insert a large centered image in a listview of a jquery mobile website? I try this: Techno: vb.net - asp.net - vb6 But it doesn't work: ths image is rendered small. Thanks for your help.
TITLE: Insert a large image (200px / 150px) centered in a line in a listview? QUESTION: I wonder if it is possible to insert a large centered image in a listview of a jquery mobile website? I try this: Techno: vb.net - asp.net - vb6 But it doesn't work: ths image is rendered small. Thanks for your help. ANSWER: Well ...
[ "jquery", "jquery-mobile" ]
0
1
4,045
1
0
2011-06-03T19:13:59.953000
2011-06-03T19:49:27.700000
6,231,607
6,231,693
What are the advantages of "yield item" vs return iter(items)?
In the examples below, resp.results is an iterator. Version1: items = [] for result in resp.results: item = process(result) items.append(item) return iter(items) Version 2: for result in resp.results: yield process(result) Is returning iter(items) in Version 1 any better/worse in terms of performance/memory savings tha...
It's easy to turn an iterator or generator back into a list if you need it: results = [item for item in iterator] Or as kindly pointed out in the comments, an even simpler method: results = list(iterator)
What are the advantages of "yield item" vs return iter(items)? In the examples below, resp.results is an iterator. Version1: items = [] for result in resp.results: item = process(result) items.append(item) return iter(items) Version 2: for result in resp.results: yield process(result) Is returning iter(items) in Versio...
TITLE: What are the advantages of "yield item" vs return iter(items)? QUESTION: In the examples below, resp.results is an iterator. Version1: items = [] for result in resp.results: item = process(result) items.append(item) return iter(items) Version 2: for result in resp.results: yield process(result) Is returning ite...
[ "python", "unit-testing", "iterator", "yield" ]
6
4
4,153
5
0
2011-06-03T19:14:39.063000
2011-06-03T19:24:28.853000
6,231,616
6,232,708
Storing names vs retrieving from cache by id
Simple mongodb collection which stores sent emails: { msgid: objectid senderid:, sendername:, recip: [{memid:, name: }, {memid:, name: },...] } contains information about message sender and recipients. Now, I'm trying to decide whether I should store sender/recipients names in the message or resolve them after I retrie...
storing names along with teh messages will increase disk space used dramatically. Don't care about disk space -- disk space is nothing, it is cheap. If your system will highload store at recip everything you need (even mother, father names;)), no doubt. Denormalize your data in order to increase application speed and d...
Storing names vs retrieving from cache by id Simple mongodb collection which stores sent emails: { msgid: objectid senderid:, sendername:, recip: [{memid:, name: }, {memid:, name: },...] } contains information about message sender and recipients. Now, I'm trying to decide whether I should store sender/recipients names ...
TITLE: Storing names vs retrieving from cache by id QUESTION: Simple mongodb collection which stores sent emails: { msgid: objectid senderid:, sendername:, recip: [{memid:, name: }, {memid:, name: },...] } contains information about message sender and recipients. Now, I'm trying to decide whether I should store sender...
[ "performance", "mongodb", "memcached" ]
1
0
66
1
0
2011-06-03T19:16:26.767000
2011-06-03T21:07:27.060000
6,231,619
6,231,708
PHP Algorithm Help
I'm working on a PHP algorithm to match compatibility based on responses to questions in a form. In this situation, user A and user B are asked the same exact questions. Let's say these are a few of the questions: Cleanliness No preference Somewhat Clean Tidy but cluttered Strictly organized Person B Cleanliness Prefe...
Line up all your "fields" you are asking your users in the questionnaire. Either make your ranges very limited (always, sometimes, never) and assign them constant values like 1, 2, 3. Loop through everyone to match responses together. Generate a list of potential compatible matches - which you can then sort as your app...
PHP Algorithm Help I'm working on a PHP algorithm to match compatibility based on responses to questions in a form. In this situation, user A and user B are asked the same exact questions. Let's say these are a few of the questions: Cleanliness No preference Somewhat Clean Tidy but cluttered Strictly organized Person ...
TITLE: PHP Algorithm Help QUESTION: I'm working on a PHP algorithm to match compatibility based on responses to questions in a form. In this situation, user A and user B are asked the same exact questions. Let's say these are a few of the questions: Cleanliness No preference Somewhat Clean Tidy but cluttered Strictly ...
[ "php", "algorithm" ]
0
1
223
3
0
2011-06-03T19:17:04.623000
2011-06-03T19:25:46.867000
6,231,623
6,231,787
update a VAR in javascript
How can I update the "storage" var set in uploadify? I have this function set_path that updates the var combined to other values that is launched when some content is selected $(document).ready(function () { $('#uploader').uploadify({ 'uploader': '/admin/includes/uploadify/uploadify.swf', 'script': '/admin/includes/upl...
Because the storage variable was only used to pass the value to uploadify settings array upon instantiating, it doesn't "live" there. What you want to do is alter the 'folder' setting for the uploadify object. According to Uploadify documentation, your set_path function should look like this: function set_path(new_path...
update a VAR in javascript How can I update the "storage" var set in uploadify? I have this function set_path that updates the var combined to other values that is launched when some content is selected $(document).ready(function () { $('#uploader').uploadify({ 'uploader': '/admin/includes/uploadify/uploadify.swf', 'sc...
TITLE: update a VAR in javascript QUESTION: How can I update the "storage" var set in uploadify? I have this function set_path that updates the var combined to other values that is launched when some content is selected $(document).ready(function () { $('#uploader').uploadify({ 'uploader': '/admin/includes/uploadify/u...
[ "javascript", "jquery", "uploadify" ]
1
2
179
2
0
2011-06-03T19:17:48.383000
2011-06-03T19:33:01.123000
6,231,627
6,231,652
GC Collection problem
I am converting a byte array into a BitmapSource. My routine works, I can put a breakpoint on "return dest;" see the value and it's properties for a few seconds and then it times out and I can't access any more properties. Is this getting GC'd? Any ideas how to fix this? public static class ImageConversion { public sta...
The memory referenced by dest won't get garbage collected until it's unrooted. As long as you have some variable referencing that memory (including the dest variable itself) it won't get collected. This is more likely a debugger issue, not a GC issue.
GC Collection problem I am converting a byte array into a BitmapSource. My routine works, I can put a breakpoint on "return dest;" see the value and it's properties for a few seconds and then it times out and I can't access any more properties. Is this getting GC'd? Any ideas how to fix this? public static class ImageC...
TITLE: GC Collection problem QUESTION: I am converting a byte array into a BitmapSource. My routine works, I can put a breakpoint on "return dest;" see the value and it's properties for a few seconds and then it times out and I can't access any more properties. Is this getting GC'd? Any ideas how to fix this? public s...
[ "c#-4.0", "garbage-collection" ]
1
1
84
1
0
2011-06-03T19:18:00.250000
2011-06-03T19:21:00.073000
6,231,630
6,234,717
How to undo the actions of previous touch on UIImageView when touch it again and also how to give preview?
My question is actually simple but for better understanding I explained everything here. I have a series of UIImageView 's inside a UIScrollView and also have another big UIImageView. My code is like this - (void)viewDidLoad { imgScrollView.clipsToBounds = YES; imgScrollView.scrollEnabled = YES; imgScrollView.userInte...
This is a perfect example of when to use a delegate method. Essentially, a delegate method allows actions in one viewController (button clicked, view tapped, etc) to trigger the methods of another.
How to undo the actions of previous touch on UIImageView when touch it again and also how to give preview? My question is actually simple but for better understanding I explained everything here. I have a series of UIImageView 's inside a UIScrollView and also have another big UIImageView. My code is like this - (void)...
TITLE: How to undo the actions of previous touch on UIImageView when touch it again and also how to give preview? QUESTION: My question is actually simple but for better understanding I explained everything here. I have a series of UIImageView 's inside a UIScrollView and also have another big UIImageView. My code is ...
[ "iphone", "objective-c", "ios", "uiimageview" ]
0
0
320
1
0
2011-06-03T19:19:02.610000
2011-06-04T04:38:13.690000
6,231,631
6,252,915
Is Hollywood Bowl for blackberry written in J2ME or Webworks?
Hollywood Bowl looks modern yet it is compatible with most of the devices which is making me think it is a web works app. Any thoughts?
It looks like a Java app. But as mentioned in one of the comments, the best way to find out is to email the developer:)
Is Hollywood Bowl for blackberry written in J2ME or Webworks? Hollywood Bowl looks modern yet it is compatible with most of the devices which is making me think it is a web works app. Any thoughts?
TITLE: Is Hollywood Bowl for blackberry written in J2ME or Webworks? QUESTION: Hollywood Bowl looks modern yet it is compatible with most of the devices which is making me think it is a web works app. Any thoughts? ANSWER: It looks like a Java app. But as mentioned in one of the comments, the best way to find out is ...
[ "blackberry", "blackberry-webworks" ]
1
0
95
1
0
2011-06-03T19:19:16.470000
2011-06-06T13:43:15.330000
6,231,633
6,231,824
Sync Android with a website database?
So this is what I need to do before my traineeship ends. connect android app with the database from a website store some information into the database retrieve some information back from the database I have already experience with the standard sqlite build in android apps. The problem is, I need to let people get some ...
1) Create an SQLite database (Windows GUI SQLite prog: http://sqliteadmin.orbmu2k.de/ ) 2) Put it on a server 3) make a php script that will update / read your database (on the server) query($query); echo DONE; } else { die($err); }?> 4) Call this php script from your android app http://yourserver/yourfolder/yourscrip...
Sync Android with a website database? So this is what I need to do before my traineeship ends. connect android app with the database from a website store some information into the database retrieve some information back from the database I have already experience with the standard sqlite build in android apps. The prob...
TITLE: Sync Android with a website database? QUESTION: So this is what I need to do before my traineeship ends. connect android app with the database from a website store some information into the database retrieve some information back from the database I have already experience with the standard sqlite build in andr...
[ "android", "database", "synchronization" ]
3
7
8,955
1
0
2011-06-03T19:19:20.207000
2011-06-03T19:36:42.733000
6,231,637
6,231,722
Managing SQL Connections in WCF Service
I am currently building a WCF Web Service which may have 5 endpoints or even more. Each of these endpoints' methods will need to access a SQL Server database (for different reasons, though), and, of course, these endpoints may be called by several clients at the same time. In this scenario, what is the best way to mana...
The correct approach is 1) + connection pooling which is used by default if all your connections connect to database under single account (pool is per unique connection string which contains user login). Connection pooling ensures that connections are reused for multiple operations but it is absolutely transparent to d...
Managing SQL Connections in WCF Service I am currently building a WCF Web Service which may have 5 endpoints or even more. Each of these endpoints' methods will need to access a SQL Server database (for different reasons, though), and, of course, these endpoints may be called by several clients at the same time. In thi...
TITLE: Managing SQL Connections in WCF Service QUESTION: I am currently building a WCF Web Service which may have 5 endpoints or even more. Each of these endpoints' methods will need to access a SQL Server database (for different reasons, though), and, of course, these endpoints may be called by several clients at the...
[ "sql-server", "wcf", "web-services", "sqlconnection" ]
1
3
1,804
1
0
2011-06-03T19:19:32.050000
2011-06-03T19:27:12.820000
6,231,640
6,231,703
Close app requiring location-services if user selects "Don't Allow"?
I have an app whose core functionality revolves around the use of the user's current location. It shows objects near the user on the map. I don't create a location manager, I just use the mapview's. This works well, but now I'm trying to make sure my app alerts the user correctly of it's need for location-services. Wha...
You can't "close" an app--Apple doesn't allow it, and there's actually no public API to "quit". What you can do instead is throw up a view that takes over the whole screen explaining the failure to operate properly without CoreLocation permission. Maybe even with a button making CLLocationManager prompt them for permis...
Close app requiring location-services if user selects "Don't Allow"? I have an app whose core functionality revolves around the use of the user's current location. It shows objects near the user on the map. I don't create a location manager, I just use the mapview's. This works well, but now I'm trying to make sure my ...
TITLE: Close app requiring location-services if user selects "Don't Allow"? QUESTION: I have an app whose core functionality revolves around the use of the user's current location. It shows objects near the user on the map. I don't create a location manager, I just use the mapview's. This works well, but now I'm tryin...
[ "iphone", "xcode", "cllocationmanager", "userlocation" ]
1
1
893
2
0
2011-06-03T19:19:37.297000
2011-06-03T19:25:19.380000
6,231,645
6,231,724
using ACTION_IMAGE_CAPTURE to take picture and setImageBitmap to display it
EDIT i updated the code to reflect changes suggested in both answers, unfortunately, now my app force closes. the error is listed at the bottom this is my camera/picture class in its entirety (except for import s) this class is supposed to take a picture, display it to the screen, and let another class have the string ...
You need move these 2 lines into onActivityResult(): case 1: final File file = getTempFile(this); try { Media.getBitmap(getContentResolver(), Uri.fromFile(file) ); image_string = Uri.fromFile(file).toString(); Bitmap bm = BitmapFactory.decodeFile(image_string); imageview.setImageBitmap(bm); } catch (FileNotFoundExcepti...
using ACTION_IMAGE_CAPTURE to take picture and setImageBitmap to display it EDIT i updated the code to reflect changes suggested in both answers, unfortunately, now my app force closes. the error is listed at the bottom this is my camera/picture class in its entirety (except for import s) this class is supposed to take...
TITLE: using ACTION_IMAGE_CAPTURE to take picture and setImageBitmap to display it QUESTION: EDIT i updated the code to reflect changes suggested in both answers, unfortunately, now my app force closes. the error is listed at the bottom this is my camera/picture class in its entirety (except for import s) this class i...
[ "android", "image", "bitmap", "imageview" ]
2
3
6,515
3
0
2011-06-03T19:20:04.093000
2011-06-03T19:27:39.587000
6,231,650
6,231,702
PHP - Checking for return false;
Just a quick question - and I'm sure really basic! I have the following code: function checkThings($foo, $bar) {... if ($valid) { return $results; } else { return false; } } On the other end of this I am currently doing $check = checkThings($foo, $bar); if ($check === false) { echo "Error"; } else { echo $check; } Is w...
The triple-equal operator is type-sensitive. So when you check: if ($check === false)... it will only be true if $check is the boolean value "false". Wheras if ($check == false)... is not checking specifically for boolean false, but a "falsey" value. False, in PHP, equals zero, null is "falsey", as is an empty string (...
PHP - Checking for return false; Just a quick question - and I'm sure really basic! I have the following code: function checkThings($foo, $bar) {... if ($valid) { return $results; } else { return false; } } On the other end of this I am currently doing $check = checkThings($foo, $bar); if ($check === false) { echo "Err...
TITLE: PHP - Checking for return false; QUESTION: Just a quick question - and I'm sure really basic! I have the following code: function checkThings($foo, $bar) {... if ($valid) { return $results; } else { return false; } } On the other end of this I am currently doing $check = checkThings($foo, $bar); if ($check === ...
[ "php" ]
30
60
87,544
8
0
2011-06-03T19:20:31.503000
2011-06-03T19:25:08.107000
6,231,653
6,231,719
wordpress rounded boxes around each individual widget
I am working on creating a theme and need to know how to make a rounded box around each individual widget. I want to change each color. I need it rounded also and dynamic. I need if i add more things it will stretch or auto adjust the height. I have tried over and over but unable to find a good way. Here is my test boa...
You can accomplish the rounded corners on each widget via border-radius. In your theme's style sheet, add:.widget { border-radius:10px; -moz-border-radius:10px; -webkit-border-radius:10px; } For the different background colors, you'll have to target each widget individually and specify a color for them in your style sh...
wordpress rounded boxes around each individual widget I am working on creating a theme and need to know how to make a rounded box around each individual widget. I want to change each color. I need it rounded also and dynamic. I need if i add more things it will stretch or auto adjust the height. I have tried over and o...
TITLE: wordpress rounded boxes around each individual widget QUESTION: I am working on creating a theme and need to know how to make a rounded box around each individual widget. I want to change each color. I need it rounded also and dynamic. I need if i add more things it will stretch or auto adjust the height. I hav...
[ "css", "wordpress", "styling" ]
0
0
2,617
2
0
2011-06-03T19:21:04.193000
2011-06-03T19:26:40.567000
6,231,654
6,231,682
In which layer should contain AutoMapper configurations?
In which layer should contain AutoMapper configurations? AutoMapper is to map ViewModels to my Domain Entities. I have three layers in my app: Domain, UI (MVC), Infrastructure.
It should live in the top most layer that it is translating to/from. If you have mappers between domain and infra, then they should live in domain (assuming that uses infra). If you have mappers between UI and domain, then they should live in UI (assuming that uses domain). This means that the lower down layers do not ...
In which layer should contain AutoMapper configurations? In which layer should contain AutoMapper configurations? AutoMapper is to map ViewModels to my Domain Entities. I have three layers in my app: Domain, UI (MVC), Infrastructure.
TITLE: In which layer should contain AutoMapper configurations? QUESTION: In which layer should contain AutoMapper configurations? AutoMapper is to map ViewModels to my Domain Entities. I have three layers in my app: Domain, UI (MVC), Infrastructure. ANSWER: It should live in the top most layer that it is translating...
[ "c#", ".net", "automapper", "n-tier-architecture" ]
3
6
2,477
2
0
2011-06-03T19:21:16.200000
2011-06-03T19:23:34.397000
6,231,662
6,231,903
Publisher/Subscriber architecture with MassTransit
Where can I find a working example of a publisher/subscriber setup using MassTransit?
What you need is the Grid.Distributor sample. https://github.com/MassTransit/MassTransit/tree/develop/src/Samples/Distributor If you are using RabbitMQ instead of MSMQ, it is possible to use competing consumers. We don't recommend that with MSMQ though. If you want to try, it must be with transactional queues. If you h...
Publisher/Subscriber architecture with MassTransit Where can I find a working example of a publisher/subscriber setup using MassTransit?
TITLE: Publisher/Subscriber architecture with MassTransit QUESTION: Where can I find a working example of a publisher/subscriber setup using MassTransit? ANSWER: What you need is the Grid.Distributor sample. https://github.com/MassTransit/MassTransit/tree/develop/src/Samples/Distributor If you are using RabbitMQ inst...
[ "publish-subscribe", "masstransit" ]
2
3
2,239
1
0
2011-06-03T19:21:54.157000
2011-06-03T19:43:46.127000
6,231,663
6,231,976
Objective-C object placement iPad
I have a GUI class extending UIViewController. In its function viewDidLoad, I would like to have a UITextField instance. I would like that instance not aligned as a simple CGRect, setting its offset and width and height, but I want it rather to be resized dynamically, making it fill the whole width of the screen, with ...
You want to set the autoresizingMask property of the view. UIView *theParentView; // Assume this is the root view that owns the whole screen CGRect textFieldFrame = CGRectMake(5, // Top-left corner x position 5, // Top-left corner y position [theParentView bounds].width - 10, // Width 20); // Height UIView *myView = ...
Objective-C object placement iPad I have a GUI class extending UIViewController. In its function viewDidLoad, I would like to have a UITextField instance. I would like that instance not aligned as a simple CGRect, setting its offset and width and height, but I want it rather to be resized dynamically, making it fill th...
TITLE: Objective-C object placement iPad QUESTION: I have a GUI class extending UIViewController. In its function viewDidLoad, I would like to have a UITextField instance. I would like that instance not aligned as a simple CGRect, setting its offset and width and height, but I want it rather to be resized dynamically,...
[ "ios", "objective-c", "rotation", "position" ]
0
2
203
3
0
2011-06-03T19:21:54.870000
2011-06-03T19:52:37.617000
6,231,665
6,231,800
Why is this Doctype "DIV" not allowed?
I have created this piece of code. Want more? - check out my recent work And when I validate the code under W3 HTML validation, it's giving me an error: Line 163, Column 41: document type does not allow element "DIV" here; missing one of "OBJECT", "MAP", "BUTTON" start-tag I am using
A division is a block level element while an anchor is an inline element. From the w3c web site: Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements. Inherent in this structural distinction is the idea tha...
Why is this Doctype "DIV" not allowed? I have created this piece of code. Want more? - check out my recent work And when I validate the code under W3 HTML validation, it's giving me an error: Line 163, Column 41: document type does not allow element "DIV" here; missing one of "OBJECT", "MAP", "BUTTON" start-tag I am u...
TITLE: Why is this Doctype "DIV" not allowed? QUESTION: I have created this piece of code. Want more? - check out my recent work And when I validate the code under W3 HTML validation, it's giving me an error: Line 163, Column 41: document type does not allow element "DIV" here; missing one of "OBJECT", "MAP", "BUTTON...
[ "html", "doctype", "w3c-validation" ]
5
7
5,843
4
0
2011-06-03T19:22:20.577000
2011-06-03T19:33:57.610000