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,205,459
6,206,189
Automatically add the SHA-1 checksum of a column as another column in a SQLAlchemy table
I am working with an SQLAlchemy database. I have a simple schema with columns id, data, and timestamp. The timestamp column is automatically populated with the current date/time as follows: Column('timestamp', DateTime, nullable=False, default=datetime.now) I want to add another column containing the SHA-1 checksum of ...
The SqlAlchemy MapperExtension allows you to create code-side triggers/hooks for events. http://www.sqlalchemy.org/docs/06/orm/interfaces.html? Basically you'd want to create a before_insert and before_update that performs the extra actions. I've got an example using this to help make sure I copy content from one colum...
Automatically add the SHA-1 checksum of a column as another column in a SQLAlchemy table I am working with an SQLAlchemy database. I have a simple schema with columns id, data, and timestamp. The timestamp column is automatically populated with the current date/time as follows: Column('timestamp', DateTime, nullable=Fa...
TITLE: Automatically add the SHA-1 checksum of a column as another column in a SQLAlchemy table QUESTION: I am working with an SQLAlchemy database. I have a simple schema with columns id, data, and timestamp. The timestamp column is automatically populated with the current date/time as follows: Column('timestamp', Dat...
[ "python", "sqlalchemy" ]
2
2
1,428
1
0
2011-06-01T17:45:21.493000
2011-06-01T18:51:19.130000
6,205,460
6,205,802
NSArray with days of the week and months of the year
Is there a way I can get an array of (string of days of the week) so: monday, tuesday, wednesday.... and also for months? I can manually create that array, but I was wondering if there a more eloquent way of doing this... Thanks.
This code; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSArray *weekdays = [dateFormatter weekdaySymbols]; will give you the the weekdays in the users current locale. If you want a particular locale set the desired locale on the dateFormatter. Creating an NSDateFormatter is expensive so create one ...
NSArray with days of the week and months of the year Is there a way I can get an array of (string of days of the week) so: monday, tuesday, wednesday.... and also for months? I can manually create that array, but I was wondering if there a more eloquent way of doing this... Thanks.
TITLE: NSArray with days of the week and months of the year QUESTION: Is there a way I can get an array of (string of days of the week) so: monday, tuesday, wednesday.... and also for months? I can manually create that array, but I was wondering if there a more eloquent way of doing this... Thanks. ANSWER: This code;...
[ "objective-c", "cocoa-touch", "nsarray" ]
4
9
881
1
0
2011-06-01T17:45:22.243000
2011-06-01T18:14:48.123000
6,205,463
6,205,490
Is there a way to sort duplicates into a group that are found in an array using jquery or javascript
I have an array such as: var aos = ["a","a","b","c","d"]; and I want to know if I can find duplicates of each index and store them into something such as an arraylist? For instance we start at: aos[0] That then checks to see if a is found, and it will keep running through the array taking all the elements with that val...
var uniq =_.uniq(aos) Or a long winded way (ES5): var uniq = aos.reduce(aos, function(memo, val) { if (!aos.some(function(elem) { return elem === val; })) { return memo.push(val); } }, []); And if you want to support ES3 then: var uniq = []; for (var i = 0, ii = aos.length; i < ii; i++) { var contains = false; for (var...
Is there a way to sort duplicates into a group that are found in an array using jquery or javascript I have an array such as: var aos = ["a","a","b","c","d"]; and I want to know if I can find duplicates of each index and store them into something such as an arraylist? For instance we start at: aos[0] That then checks t...
TITLE: Is there a way to sort duplicates into a group that are found in an array using jquery or javascript QUESTION: I have an array such as: var aos = ["a","a","b","c","d"]; and I want to know if I can find duplicates of each index and store them into something such as an arraylist? For instance we start at: aos[0] ...
[ "javascript", "jquery", "arrays", "sorting" ]
0
2
143
2
0
2011-06-01T17:45:39.993000
2011-06-01T17:47:38.730000
6,205,472
6,205,643
MVVM Passing EventArgs As Command Parameter
I'm using Microsoft Expression Blend 4 I have a Browser.., [ XAML ] ConnectionView " Empty Code Behind " [ C# ] AttachedProperties class public static class AttachedProperties { public static readonly DependencyProperty BrowserSourceProperty = DependencyProperty. RegisterAttached ( "BrowserSource", typeof ( string ), t...
It's not easily supported. Here's an article with instructions on how to pass EventArgs as command parameters. You might want to look into using MVVMLight - it supports EventArgs in command directly; your situation would look something like this:
MVVM Passing EventArgs As Command Parameter I'm using Microsoft Expression Blend 4 I have a Browser.., [ XAML ] ConnectionView " Empty Code Behind " [ C# ] AttachedProperties class public static class AttachedProperties { public static readonly DependencyProperty BrowserSourceProperty = DependencyProperty. RegisterAtta...
TITLE: MVVM Passing EventArgs As Command Parameter QUESTION: I'm using Microsoft Expression Blend 4 I have a Browser.., [ XAML ] ConnectionView " Empty Code Behind " [ C# ] AttachedProperties class public static class AttachedProperties { public static readonly DependencyProperty BrowserSourceProperty = DependencyProp...
[ "wpf", "browser", "expression-blend", "eventargs" ]
75
79
128,641
13
0
2011-06-01T17:45:57.347000
2011-06-01T18:01:07.630000
6,205,475
6,205,679
jQueryMobile Checkbox fires change event for entire controlgroup
I have a set of checkboxes setup in a series of div fieldcontain + fieldset controlgroups. They are grouped by topic with 12 main topics and 2-5 sub-topic under each. When I "change" a checkbox, it fires the change event for the entire controlgroup. If I remove the control group fieldset, it fires the change event (whe...
Thanks @Matt Ball but I found this did what I needed: $('input[name="subtopics_chosen"]:checked').live('change',function() Before I had $('input[name="subtopics_chosen"]').live('change',function() I'll keep your StopPropagation tip for another day, though, I did not know about it.
jQueryMobile Checkbox fires change event for entire controlgroup I have a set of checkboxes setup in a series of div fieldcontain + fieldset controlgroups. They are grouped by topic with 12 main topics and 2-5 sub-topic under each. When I "change" a checkbox, it fires the change event for the entire controlgroup. If I ...
TITLE: jQueryMobile Checkbox fires change event for entire controlgroup QUESTION: I have a set of checkboxes setup in a series of div fieldcontain + fieldset controlgroups. They are grouped by topic with 12 main topics and 2-5 sub-topic under each. When I "change" a checkbox, it fires the change event for the entire c...
[ "jquery" ]
0
0
6,103
2
0
2011-06-01T17:46:20.960000
2011-06-01T18:03:55.650000
6,205,476
6,206,011
Is there an elegant way to keep track of sets of connected items in Python?
For a certain piece of code, I needed to find a way to recognise certain aliases. Thing is, it is not known beforehand what those aliases are. These are my requirements: If A and B are aliases, and B and C are aliases, A and C should be aliases as well. Two sets of aliases should be merged when they are connected in an...
This is something you can map on a graph so I'd do: from networkx import Graph from networkx.algorithms.components.connected import connected_components # see aliases as the edges between nodes in a graph aliases = [('A', 'B'), ('B', 'C'), ('D','E')] g = Graph( aliases ) # connected components are alias groups print...
Is there an elegant way to keep track of sets of connected items in Python? For a certain piece of code, I needed to find a way to recognise certain aliases. Thing is, it is not known beforehand what those aliases are. These are my requirements: If A and B are aliases, and B and C are aliases, A and C should be aliases...
TITLE: Is there an elegant way to keep track of sets of connected items in Python? QUESTION: For a certain piece of code, I needed to find a way to recognise certain aliases. Thing is, it is not known beforehand what those aliases are. These are my requirements: If A and B are aliases, and B and C are aliases, A and C...
[ "python" ]
1
2
270
2
0
2011-06-01T17:46:25.037000
2011-06-01T18:34:34.577000
6,205,477
6,206,112
Chrome not honouring ado.stream filename
The ASP code below grabs the content of a file (thisoutfile - which has a GUID as its file name) and streams it to the browser, providing the suggested filename to save as. This works in all browsers except chrome where the filename offered is the name of the script itself, even when the file name (thisfname) is a sing...
There is a missing double-quote in the Content-Disposition header and it seems Chrome is not that forgiving. Change that line of code to Response.AddHeader "Content-Disposition","attachment;filename=""" & thisfname & """"
Chrome not honouring ado.stream filename The ASP code below grabs the content of a file (thisoutfile - which has a GUID as its file name) and streams it to the browser, providing the suggested filename to save as. This works in all browsers except chrome where the filename offered is the name of the script itself, even...
TITLE: Chrome not honouring ado.stream filename QUESTION: The ASP code below grabs the content of a file (thisoutfile - which has a GUID as its file name) and streams it to the browser, providing the suggested filename to save as. This works in all browsers except chrome where the filename offered is the name of the s...
[ "google-chrome", "asp-classic", "ado" ]
1
2
1,244
1
0
2011-06-01T17:46:27.683000
2011-06-01T18:43:29.120000
6,205,479
6,205,537
How long may parameters in a get request be?
I am currently programming an API that gets passed data via get parameters so I was wondering if the total length of the URL or of the parameters value is limited in best practice or by the protocol.
Basically, 2K is the most you can rely on in a cross-browser fashion, but if you drop support for IE 8 and below, you can get to like 64K. Although I feel I need to question your need to know this, anything over say.. 100 characters would best be handled through a POST request instead of a GET.
How long may parameters in a get request be? I am currently programming an API that gets passed data via get parameters so I was wondering if the total length of the URL or of the parameters value is limited in best practice or by the protocol.
TITLE: How long may parameters in a get request be? QUESTION: I am currently programming an API that gets passed data via get parameters so I was wondering if the total length of the URL or of the parameters value is limited in best practice or by the protocol. ANSWER: Basically, 2K is the most you can rely on in a c...
[ "http", "url", "rest", "get", "web-standards" ]
15
18
12,463
3
0
2011-06-01T17:46:33.240000
2011-06-01T17:51:53.223000
6,205,485
6,206,405
problem with AsyncTask thread
I'm reading some data from a DB in an AsyncTask thread.... in this way: protected Void doInBackground(DBAdapter... db) { try { db[0].openDataBase(); Cursor c = db[0].getCursor3(db[0].TABLE_3, user_id); float[] viteza = new float[c.getCount()]; String[] time = new String[c.getCount()]; if (c.moveToFirst()) { do {...
The following should work assuming you've got the data values in right order (getString(3) should be a number and getString(4) should be a time value). protected Void doInBackground(DBAdapter... db) { //... some db work if (c.moveToFirst()) { publishProgress(c.getString(3), c.getString(4)); //... } } protected void on...
problem with AsyncTask thread I'm reading some data from a DB in an AsyncTask thread.... in this way: protected Void doInBackground(DBAdapter... db) { try { db[0].openDataBase(); Cursor c = db[0].getCursor3(db[0].TABLE_3, user_id); float[] viteza = new float[c.getCount()]; String[] time = new String[c.getCount()];...
TITLE: problem with AsyncTask thread QUESTION: I'm reading some data from a DB in an AsyncTask thread.... in this way: protected Void doInBackground(DBAdapter... db) { try { db[0].openDataBase(); Cursor c = db[0].getCursor3(db[0].TABLE_3, user_id); float[] viteza = new float[c.getCount()]; String[] time = new Str...
[ "android", "android-asynctask" ]
1
0
2,038
3
0
2011-06-01T17:47:28.590000
2011-06-01T19:10:16.380000
6,205,491
6,223,314
Unit Tests for designs that use notifications
I'm having difficulty testing some logic that uses notifications. I've read about enforcing that particular NSNotifications are sent, but that doesn't really address the problem I'm seeing. [SomeObject PerformAsyncOperation] creates an NSURLRequest and sets itself as the response delegate. Depending on the content of t...
The problem you face is not notifications, which are synchronous. Rather, it is that you are firing off an asynchronous operation. To make this a repeatable test, you need to resynchronize things. NSTimeInterval timeout = 2.0; // Number of seconds before giving up NSTimeInterval idle = 0.01; // Number of seconds to pau...
Unit Tests for designs that use notifications I'm having difficulty testing some logic that uses notifications. I've read about enforcing that particular NSNotifications are sent, but that doesn't really address the problem I'm seeing. [SomeObject PerformAsyncOperation] creates an NSURLRequest and sets itself as the re...
TITLE: Unit Tests for designs that use notifications QUESTION: I'm having difficulty testing some logic that uses notifications. I've read about enforcing that particular NSNotifications are sent, but that doesn't really address the problem I'm seeing. [SomeObject PerformAsyncOperation] creates an NSURLRequest and set...
[ "xcode", "unit-testing", "ios4", "ocunit", "observer-pattern" ]
6
15
3,662
2
0
2011-06-01T17:47:45.023000
2011-06-03T05:28:07.390000
6,205,492
6,205,936
Android: Retrieve Zip code from phone
I have a very basic question. I want to retrieve a zip code automatically from the phone. I have been doing research and I've seen geocoder mentioned several times. But it seems overly complex for what I am trying to do and also that it returns a long/lat coordinate not a basic zip code. My end game is basically to hav...
I want to retrieve a zip code automatically from the phone. There is nothing in Android -- or any other mobile OS that I am aware of -- that supports this. For starters, nobody has to provide a physical address to their Android devices. I've seen geocoder mentioned several times. But it seems overly complex for what I ...
Android: Retrieve Zip code from phone I have a very basic question. I want to retrieve a zip code automatically from the phone. I have been doing research and I've seen geocoder mentioned several times. But it seems overly complex for what I am trying to do and also that it returns a long/lat coordinate not a basic zip...
TITLE: Android: Retrieve Zip code from phone QUESTION: I have a very basic question. I want to retrieve a zip code automatically from the phone. I have been doing research and I've seen geocoder mentioned several times. But it seems overly complex for what I am trying to do and also that it returns a long/lat coordina...
[ "android", "gps", "zipcode" ]
0
1
618
1
0
2011-06-01T17:47:46.080000
2011-06-01T18:27:03.877000
6,205,493
6,205,820
Does Single Sign on work for Facebook on Android?
I attempted single sign on with Facebook on android about 6 months ago and it was not working. Today, I try again and I'm still getting "invalid_key" My steps: Create keystore Create KEY-SIGNATURE as per (http://developers.facebook.com/docs/guides/mobile/) keytool -exportcert -alias androiddebugkey -keystore ~/.android...
i had issues with the key generation under windows. i switched under linux and did the same process and it all went good and the key worked.. this happened also to some other devs i know so its a common thing. again the same exact process but under linux instead of windows (Both xp and windows 7)
Does Single Sign on work for Facebook on Android? I attempted single sign on with Facebook on android about 6 months ago and it was not working. Today, I try again and I'm still getting "invalid_key" My steps: Create keystore Create KEY-SIGNATURE as per (http://developers.facebook.com/docs/guides/mobile/) keytool -expo...
TITLE: Does Single Sign on work for Facebook on Android? QUESTION: I attempted single sign on with Facebook on android about 6 months ago and it was not working. Today, I try again and I'm still getting "invalid_key" My steps: Create keystore Create KEY-SIGNATURE as per (http://developers.facebook.com/docs/guides/mobi...
[ "android", "facebook" ]
0
1
503
1
0
2011-06-01T17:47:54.410000
2011-06-01T18:16:48.240000
6,205,495
6,205,525
PHP get anchor attribute
Possible Duplicate: How to get the value after the hash in “somepage.php#name”? Is it possible to get an anchor name with PHP? For example, for this URL: http://domain.com/#departments How can I get the text "departments"?
There is no way to get things after "#" in php, because this data is not provided to server, only url without data after "#", but if you are executing php script through JavaScript, you can Always split url into "#" and send the data as parameter or value of some hidden field.
PHP get anchor attribute Possible Duplicate: How to get the value after the hash in “somepage.php#name”? Is it possible to get an anchor name with PHP? For example, for this URL: http://domain.com/#departments How can I get the text "departments"?
TITLE: PHP get anchor attribute QUESTION: Possible Duplicate: How to get the value after the hash in “somepage.php#name”? Is it possible to get an anchor name with PHP? For example, for this URL: http://domain.com/#departments How can I get the text "departments"? ANSWER: There is no way to get things after "#" in ph...
[ "php", "url", "get", "anchor" ]
1
5
6,787
1
0
2011-06-01T17:48:05.253000
2011-06-01T17:51:07.683000
6,205,501
6,205,665
How to replace spaces with %20 in <img> tags
I would like to replace all spaces in the image tags of a html text. Example: to I didn't find a soultion with preg_replace, but it may be a simple regexp line. Thanks! Edit: Sorry guys, my description was not very clear. So, I have a full html page and I only want to replace inside the img tags. I can't use urlencode ...
The space is represented by a %20 in the url but there are other chars that you might want to have converted for other images so you should use the general urlencode function instead of using a "simple regex" as stated in the OP.
How to replace spaces with %20 in <img> tags I would like to replace all spaces in the image tags of a html text. Example: to I didn't find a soultion with preg_replace, but it may be a simple regexp line. Thanks! Edit: Sorry guys, my description was not very clear. So, I have a full html page and I only want to replac...
TITLE: How to replace spaces with %20 in <img> tags QUESTION: I would like to replace all spaces in the image tags of a html text. Example: to I didn't find a soultion with preg_replace, but it may be a simple regexp line. Thanks! Edit: Sorry guys, my description was not very clear. So, I have a full html page and I o...
[ "php", "regex", "preg-replace" ]
3
6
12,380
5
0
2011-06-01T17:48:35.707000
2011-06-01T18:02:55.270000
6,205,503
6,233,220
Invalid access code error in MSBuild script
I'm developing a MSBuild project and am getting an odd error when I try to access the Visual SourceSafe from the script (the script is based on other successful scripts we are using, and is using the VssLabel task from MSBuild.Community.Tasks). The error is "Invalid access code (bad parameter)" There is a Microsoft sup...
It has become clear that the problem isn't MSBuild, but there is something wrong with MSBuild.Community.Tasks, and since that library still works with our VS2008 projects, it appears that the problem is with MSBuild v4 and VS2010. As I checked further I found that the MSBuild.Community.Tasks community site at Tigris.or...
Invalid access code error in MSBuild script I'm developing a MSBuild project and am getting an odd error when I try to access the Visual SourceSafe from the script (the script is based on other successful scripts we are using, and is using the VssLabel task from MSBuild.Community.Tasks). The error is "Invalid access co...
TITLE: Invalid access code error in MSBuild script QUESTION: I'm developing a MSBuild project and am getting an odd error when I try to access the Visual SourceSafe from the script (the script is based on other successful scripts we are using, and is using the VssLabel task from MSBuild.Community.Tasks). The error is ...
[ "msbuild", "visual-sourcesafe", "msbuildcommunitytasks" ]
0
0
321
1
0
2011-06-01T17:48:47.423000
2011-06-03T22:19:53.133000
6,205,518
6,205,540
Disable Textbox suggestions
Hi all you all have experienced that when you use a textbox again and again by writing something in it and submitting the values the textbox starts to give you suggestion on the onfocus event based on previous written values. Can we disable this attribute of the textbox that it shouldn't suggest previous values?
autocomplete="off" add this as attribute to your control e.g.
Disable Textbox suggestions Hi all you all have experienced that when you use a textbox again and again by writing something in it and submitting the values the textbox starts to give you suggestion on the onfocus event based on previous written values. Can we disable this attribute of the textbox that it shouldn't sug...
TITLE: Disable Textbox suggestions QUESTION: Hi all you all have experienced that when you use a textbox again and again by writing something in it and submitting the values the textbox starts to give you suggestion on the onfocus event based on previous written values. Can we disable this attribute of the textbox tha...
[ "html", "textbox" ]
22
95
44,913
2
0
2011-06-01T17:50:24.483000
2011-06-01T17:52:16.293000
6,205,521
6,205,610
Conditional sql based on string content
How to judge an image url that if the link contains words ads ad, then pass insert into the database. Then it should be insert into first data, and pass the second one. Thanks, PHP CODE foreach($data['image'] as $item) { $title = $item['title']; $image = $item['image_url']; mysql_query("SET NAMES utf8"); mysql_query("I...
I'll assume you want to insert all images that do NOT have "ad" in the image url... if you want ONLY ads, change the === in the if statement to a!==. Make sure to keep it as either a triple-equals or exclamation-double-equals. Also note that this is not a very reliable method - what if the image were called "my_dad_and...
Conditional sql based on string content How to judge an image url that if the link contains words ads ad, then pass insert into the database. Then it should be insert into first data, and pass the second one. Thanks, PHP CODE foreach($data['image'] as $item) { $title = $item['title']; $image = $item['image_url']; mysql...
TITLE: Conditional sql based on string content QUESTION: How to judge an image url that if the link contains words ads ad, then pass insert into the database. Then it should be insert into first data, and pass the second one. Thanks, PHP CODE foreach($data['image'] as $item) { $title = $item['title']; $image = $item['...
[ "php", "foreach" ]
1
1
101
2
0
2011-06-01T17:50:43.663000
2011-06-01T17:58:07.507000
6,205,524
6,205,954
REST WCF error responses sent before service is finished processing (without error)
In our application, some of our REST-style WCF calls are failing. These calls are part of a C# class of service implementations that have many other peer service calls that work. Also, the service calls for the failing methods do not fail in all circumstances. Basically, the situation I'm seeing is that when watching a...
I have seen the same problem in a slightly different context. What happens is: The http request comes into the server The server starts to respond The part that gets sent out first is the http header When the header has already been sent to the client some code tries to write to the header Since the header is already o...
REST WCF error responses sent before service is finished processing (without error) In our application, some of our REST-style WCF calls are failing. These calls are part of a C# class of service implementations that have many other peer service calls that work. Also, the service calls for the failing methods do not fa...
TITLE: REST WCF error responses sent before service is finished processing (without error) QUESTION: In our application, some of our REST-style WCF calls are failing. These calls are part of a C# class of service implementations that have many other peer service calls that work. Also, the service calls for the failing...
[ ".net", "wcf", "rest" ]
0
1
395
1
0
2011-06-01T17:51:02.180000
2011-06-01T18:29:03.457000
6,205,527
6,206,096
Linkedlist keep track of min in constant time?
EDIT: This isn't as trivial as you think. Consider the fact that each addition of a new number pushes out an old number from the linkedlist. The solution doesn't seem to be as simple as keeping track of a min number with a variable. What if the minimum gets pushed out of the linkedlist? Then what? How do you know what ...
First, O(1) storage is not the same as an a single register. It means constant space usage. Second, I am going to call your LL a constant size queue (CSQ). When initializing your queue, also initialize a min-heap where all elements of the queue keep a reference (pointer) to the heap node corresponding to them. 1 op on ...
Linkedlist keep track of min in constant time? EDIT: This isn't as trivial as you think. Consider the fact that each addition of a new number pushes out an old number from the linkedlist. The solution doesn't seem to be as simple as keeping track of a min number with a variable. What if the minimum gets pushed out of t...
TITLE: Linkedlist keep track of min in constant time? QUESTION: EDIT: This isn't as trivial as you think. Consider the fact that each addition of a new number pushes out an old number from the linkedlist. The solution doesn't seem to be as simple as keeping track of a min number with a variable. What if the minimum ge...
[ "algorithm", "language-agnostic", "linked-list" ]
5
9
2,319
6
0
2011-06-01T17:51:08.080000
2011-06-01T18:42:04.687000
6,205,538
6,205,593
Only allow textbox values from 1 to 11 using JavaScript
I plan for using this with 'number of month'. I would like to have one textbox where the user can only enter a number between 1 to 11.
Honestly, a dropdown ( ) is far better suited for picking months. It works without JavaScript, provides better accessibility, and will be less error-prone for nerds ( "dangit, why isn't this zero-based‽" ) and normal users alike ( "Why do I always forget that July is 7, not 6?" ).
Only allow textbox values from 1 to 11 using JavaScript I plan for using this with 'number of month'. I would like to have one textbox where the user can only enter a number between 1 to 11.
TITLE: Only allow textbox values from 1 to 11 using JavaScript QUESTION: I plan for using this with 'number of month'. I would like to have one textbox where the user can only enter a number between 1 to 11. ANSWER: Honestly, a dropdown ( ) is far better suited for picking months. It works without JavaScript, provide...
[ "php", "javascript", "numbers", "format" ]
0
6
560
3
0
2011-06-01T17:51:57.233000
2011-06-01T17:56:30.223000
6,205,548
6,205,589
Question of LINQ optimisation
If I have the following code, is the compiler instantiating each result or is it wise enough to just count how many corresponding records are in the table? If not, it may force me to use a different strategy on larger queries. from c in context.RendezVous where c.RepID == repID && c.DateHeureRV!= null && c.DateHeureRV....
It depends on the type of context. If this is an Entity Framework or Linq to SQL query, and context is IQueryable, then the query gets turned into a SQL query on the server which just returns the count as a single integer. If this is an in-memory collection (ie: IEnumerable ), each item is iterated in sequence (Linq to...
Question of LINQ optimisation If I have the following code, is the compiler instantiating each result or is it wise enough to just count how many corresponding records are in the table? If not, it may force me to use a different strategy on larger queries. from c in context.RendezVous where c.RepID == repID && c.DateHe...
TITLE: Question of LINQ optimisation QUESTION: If I have the following code, is the compiler instantiating each result or is it wise enough to just count how many corresponding records are in the table? If not, it may force me to use a different strategy on larger queries. from c in context.RendezVous where c.RepID ==...
[ "c#", ".net", "linq", "performance" ]
4
4
326
3
0
2011-06-01T17:52:53.927000
2011-06-01T17:56:12.430000
6,205,551
6,205,584
My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent?
I am on Debian Squeeze. My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent? what is the latest package I should be having?
Checkout alternatives It seems your different java programs are pointing to different executables. Debian uses a redirect with links for program for which alternative implementations exists, like java with the gcj, kaffe, sun-java5 and sun-java6, openjdk,... In the past you had to swap them all individually with the up...
My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent? I am on Debian Squeeze. My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent? what is the latest package I should be having?
TITLE: My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent? QUESTION: I am on Debian Squeeze. My java is 1.5.0 & javac is 1.6.0_24, does it mean that my Java installation is inconsistent? what is the latest package I should be having? ANSWER: Checkout alternatives It seems you...
[ "java", "debian" ]
3
3
408
3
0
2011-06-01T17:53:10.543000
2011-06-01T17:55:58.197000
6,205,552
6,206,452
Distinct subsets from a set
I wrote an extension method which returns me 2-dimensional array of YUV values from a bitmap i.e.: public static YUV[,] ToYuvLattice(this System.Drawing.Bitmap bm) { var lattice = new YUV[bm.Width, bm.Height]; for(var ix = 0; ix < bm.Width; ix++) { for(var iy = 0; iy < bm.Height; iy++) { lattice[ix, iy] = bm.GetPixel(i...
It sounds like you have an equivalence relation and you want to partition the data. By equivalence relation, I mean: A r A A r B => B r A A r B and B r C => A r C If that is what you have then this should work. public static class PartitionExtension { static IEnumerable > Partition (this IEnumerable source, Func equiva...
Distinct subsets from a set I wrote an extension method which returns me 2-dimensional array of YUV values from a bitmap i.e.: public static YUV[,] ToYuvLattice(this System.Drawing.Bitmap bm) { var lattice = new YUV[bm.Width, bm.Height]; for(var ix = 0; ix < bm.Width; ix++) { for(var iy = 0; iy < bm.Height; iy++) { lat...
TITLE: Distinct subsets from a set QUESTION: I wrote an extension method which returns me 2-dimensional array of YUV values from a bitmap i.e.: public static YUV[,] ToYuvLattice(this System.Drawing.Bitmap bm) { var lattice = new YUV[bm.Width, bm.Height]; for(var ix = 0; ix < bm.Width; ix++) { for(var iy = 0; iy < bm.H...
[ "c#", "algorithm", "collections", "distinct" ]
0
1
279
1
0
2011-06-01T17:53:27.033000
2011-06-01T19:14:27.867000
6,205,566
6,205,739
MSTest + CHESS in VS 2010
Can I unit test my multi-threaded code using CHESS & MSTest in VS 2010. I tried this [TestMethod] [HostType("Chess")] [TestProperty("ChessExpectedResult", "deadlock")] public void TestMyMethod() {... } but I get the following error The host type 'Chess' cannot be loaded for the following reason: The key 'Chess' cannot ...
No, CHESS only supports Visual Studio 2008. http://research.microsoft.com/en-us/projects/chess/download.aspx
MSTest + CHESS in VS 2010 Can I unit test my multi-threaded code using CHESS & MSTest in VS 2010. I tried this [TestMethod] [HostType("Chess")] [TestProperty("ChessExpectedResult", "deadlock")] public void TestMyMethod() {... } but I get the following error The host type 'Chess' cannot be loaded for the following reaso...
TITLE: MSTest + CHESS in VS 2010 QUESTION: Can I unit test my multi-threaded code using CHESS & MSTest in VS 2010. I tried this [TestMethod] [HostType("Chess")] [TestProperty("ChessExpectedResult", "deadlock")] public void TestMyMethod() {... } but I get the following error The host type 'Chess' cannot be loaded for t...
[ "c#", "visual-studio-2010", "mstest" ]
5
3
435
1
0
2011-06-01T17:54:46.780000
2011-06-01T18:08:53.457000
6,205,569
6,206,713
Creating a fixed light source that preserves its world coordinates
I want to put a light in the scene that is fixed at a certain spot. Here's what the OpenGL site has to say about this: How can I make my light stay fixed relative to my scene? How can I put a light in the corner and make it stay there while I change my view? As your view changes, your ModelView matrix also changes. Thi...
I'm not entirely sure if this is what is causing your symptoms, however: glMatrixMode(GL_MODELVIEW); glPushMatrix(); gluLookAt(0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); There are a few things you would want to look at here. First, according to the documentation online, gluLookAt multiplies the matrix at the top of ...
Creating a fixed light source that preserves its world coordinates I want to put a light in the scene that is fixed at a certain spot. Here's what the OpenGL site has to say about this: How can I make my light stay fixed relative to my scene? How can I put a light in the corner and make it stay there while I change my ...
TITLE: Creating a fixed light source that preserves its world coordinates QUESTION: I want to put a light in the scene that is fixed at a certain spot. Here's what the OpenGL site has to say about this: How can I make my light stay fixed relative to my scene? How can I put a light in the corner and make it stay there ...
[ "opengl" ]
3
4
3,637
1
0
2011-06-01T17:54:51.043000
2011-06-01T19:41:15.960000
6,205,575
6,205,664
How to serialize a regular expression type using .NET XML serialization
How can I serialize a string from XML into a class property of type Regex? Here's the elements in the XML file: #include\\s*\\\"\\s*(?<FileName>.+\\\\*\\.*.+)\\s*\\\" #define\s*[A-Za-z_0-9]+\s*\""\s*(?<FileName>.+\.[a-zA-Z0-9]+)\s*\"" In my class, that I serialize, I have these properties: public Regex IncludeRegex { g...
I don't think you can do that with regular XML serialization, you have to implement IXmlSerializable to control the serialization directly.
How to serialize a regular expression type using .NET XML serialization How can I serialize a string from XML into a class property of type Regex? Here's the elements in the XML file: #include\\s*\\\"\\s*(?<FileName>.+\\\\*\\.*.+)\\s*\\\" #define\s*[A-Za-z_0-9]+\s*\""\s*(?<FileName>.+\.[a-zA-Z0-9]+)\s*\"" In my class, ...
TITLE: How to serialize a regular expression type using .NET XML serialization QUESTION: How can I serialize a string from XML into a class property of type Regex? Here's the elements in the XML file: #include\\s*\\\"\\s*(?<FileName>.+\\\\*\\.*.+)\\s*\\\" #define\s*[A-Za-z_0-9]+\s*\""\s*(?<FileName>.+\.[a-zA-Z0-9]+)\s...
[ "c#", ".net", "xml", "regex" ]
6
2
2,560
2
0
2011-06-01T17:55:21.977000
2011-06-01T18:02:42.133000
6,205,581
6,205,622
"Scan now to download" QR code for iPhone App Download
I have recently heard of and ran across QR codes being scanned for app downloads. I would like to know how this works? Can someone explain to me what program they use to "scan" and what happens after that? I would love to implement this into my apps.
They are QR Codes, (note these are not barcodes, barcodes are the lines) which can be linked to many things such as websites, provide contact information (such as vcard or email etc). Checkout the Link for more information. You can create QR Codes using programs or online tools. You basically setup your QR-Code then wh...
"Scan now to download" QR code for iPhone App Download I have recently heard of and ran across QR codes being scanned for app downloads. I would like to know how this works? Can someone explain to me what program they use to "scan" and what happens after that? I would love to implement this into my apps.
TITLE: "Scan now to download" QR code for iPhone App Download QUESTION: I have recently heard of and ran across QR codes being scanned for app downloads. I would like to know how this works? Can someone explain to me what program they use to "scan" and what happens after that? I would love to implement this into my ap...
[ "ios", "app-store", "qr-code" ]
3
3
13,509
2
0
2011-06-01T17:55:45.237000
2011-06-01T17:59:24.740000
6,205,592
6,206,154
How to write small DSL parser with operator module in python
See below matrix data: A B C D E F G 1 89 92 18 7 90 35 60 2 62 60 90 91 38 30 50 3 59 91 98 81 67 88 70 4 20 28 31 9 91 6 18 5 80 27 66 1 33 91 18 6 82 30 47 8 39 22 32 7 14 11 70 39 18 10 56 8 98 95 84 47 28 62 99 I need to define "rule" function can return "true" or "false" for below asserts string for each row data...
Like this. class Rule( object ): def __init__( self, text ): self.text= text def test( self, A, B, C, D, E, F, G ): return eval( self.text ) r1= Rule( "A==B" ) r2= Rule( "A==B and B==C" ) r3= Rule( "A in {listname!s}".format( listname=someList ) ) etc. >>> r1.test( 89, 92, 18, 7, 90, 35, 60 ) False Edit. str(A) march ...
How to write small DSL parser with operator module in python See below matrix data: A B C D E F G 1 89 92 18 7 90 35 60 2 62 60 90 91 38 30 50 3 59 91 98 81 67 88 70 4 20 28 31 9 91 6 18 5 80 27 66 1 33 91 18 6 82 30 47 8 39 22 32 7 14 11 70 39 18 10 56 8 98 95 84 47 28 62 99 I need to define "rule" function can return...
TITLE: How to write small DSL parser with operator module in python QUESTION: See below matrix data: A B C D E F G 1 89 92 18 7 90 35 60 2 62 60 90 91 38 30 50 3 59 91 98 81 67 88 70 4 20 28 31 9 91 6 18 5 80 27 66 1 33 91 18 6 82 30 47 8 39 22 32 7 14 11 70 39 18 10 56 8 98 95 84 47 28 62 99 I need to define "rule" f...
[ "python", "dsl", "operation" ]
2
1
987
2
0
2011-06-01T17:56:29.560000
2011-06-01T18:47:44.420000
6,205,599
6,205,620
jQuery AJAX callback
I'm having a difficult time trying to get this javascript function to return false inside of a.post() function. Is this even possible? or is there another way to do a simple ajax check to validate the voucher code is in the database. function check_options(){ var voucher_code = $('#voucher_code').val(); $.post(baseURL+...
You can't return false for the main function because it's already processed by the time the ajax call completes. You'll need to use callbacks. function check_options(callback) { var voucher_code = $('#voucher_code').val(); $.post(baseURL + "ajax.php", { tool: "vouchers", action: "check_voucher", voucher_code: voucher_c...
jQuery AJAX callback I'm having a difficult time trying to get this javascript function to return false inside of a.post() function. Is this even possible? or is there another way to do a simple ajax check to validate the voucher code is in the database. function check_options(){ var voucher_code = $('#voucher_code').v...
TITLE: jQuery AJAX callback QUESTION: I'm having a difficult time trying to get this javascript function to return false inside of a.post() function. Is this even possible? or is there another way to do a simple ajax check to validate the voucher code is in the database. function check_options(){ var voucher_code = $(...
[ "javascript", "jquery" ]
1
4
1,852
4
0
2011-06-01T17:56:52.117000
2011-06-01T17:58:53.677000
6,205,605
6,206,317
Drupal 6 user password import to Drupal 7
I don't really need to import any data into my D7 build other than users. I have (by SQL) imported my user data however, the D7 password encryption method is now different. I'm not an expert by any stretch of the imagination and I've never used Drush, but I have come across this user_update_7000 code snippet found user...
I think you can create a page named something like rehash.php (in your root, same place as update.php). Then, log in as administrator first, browse to this page second. See code below (most taken from user_update_7200 in the latest drupal 7 install)... Worse case, you could create a simple custom module and put this co...
Drupal 6 user password import to Drupal 7 I don't really need to import any data into my D7 build other than users. I have (by SQL) imported my user data however, the D7 password encryption method is now different. I'm not an expert by any stretch of the imagination and I've never used Drush, but I have come across thi...
TITLE: Drupal 6 user password import to Drupal 7 QUESTION: I don't really need to import any data into my D7 build other than users. I have (by SQL) imported my user data however, the D7 password encryption method is now different. I'm not an expert by any stretch of the imagination and I've never used Drush, but I ha...
[ "drupal", "import", "passwords", "md5" ]
7
8
6,610
3
0
2011-06-01T17:57:36.343000
2011-06-01T19:02:40.097000
6,205,618
6,205,657
"Break" a While Loop in ASP.NET (C#)
I'm using the following code to output entries from my database: while(reader.Read()) { Label1.Text += " " + reader["Title"] + " "; } However, I'd like for every 2nd entry for a "class" to be added to my div. So ultimately, my HTML could look like: Title1 Title2 Title3 Title4... Many thanks for any pointers.
Something like this should work. Just have a counter, and for every odd number change to int count; while(reader.Read()) { Label1.Text += (count % 2 == 0? " ": " ") + reader["Title"] + " "; count++; }
"Break" a While Loop in ASP.NET (C#) I'm using the following code to output entries from my database: while(reader.Read()) { Label1.Text += " " + reader["Title"] + " "; } However, I'd like for every 2nd entry for a "class" to be added to my div. So ultimately, my HTML could look like: Title1 Title2 Title3 Title4... M...
TITLE: "Break" a While Loop in ASP.NET (C#) QUESTION: I'm using the following code to output entries from my database: while(reader.Read()) { Label1.Text += " " + reader["Title"] + " "; } However, I'd like for every 2nd entry for a "class" to be added to my div. So ultimately, my HTML could look like: Title1 Title2 ...
[ "asp.net", "sql-server", "loops", "while-loop" ]
0
0
1,331
5
0
2011-06-01T17:58:42.193000
2011-06-01T18:02:15.773000
6,205,619
6,205,683
Django tying subprocesses to logged in user
I have some sub process that may get started while a user is logged in. When the user logs out, I would like to go through all pids associated with the user and kill them. I am currently using django registration to handle logins. What should I extend to hold the pids (max of four) to a authenticated users session?
I'd set up a model to handle these processes and then have a M2M field in the user profile. When the user logins in create the model. On logout kill the processes. Edit: Here's possible source. class SubP(models.Model): pid = models.IntegerField() def run_command(self): # runs command self.pid = pid_from_command self....
Django tying subprocesses to logged in user I have some sub process that may get started while a user is logged in. When the user logs out, I would like to go through all pids associated with the user and kill them. I am currently using django registration to handle logins. What should I extend to hold the pids (max of...
TITLE: Django tying subprocesses to logged in user QUESTION: I have some sub process that may get started while a user is logged in. When the user logs out, I would like to go through all pids associated with the user and kill them. I am currently using django registration to handle logins. What should I extend to hol...
[ "django", "authentication", "subprocess" ]
0
0
90
2
0
2011-06-01T17:58:44.410000
2011-06-01T18:04:14.640000
6,205,626
6,205,762
Sum of data for current week using projection queries
I want to do a total of fields in database for the current week. For eg, If today is wednesday, I want to do a total of current Monday through Wednesday, if its Thursday then Monday through Thursday.. How will I do this using projection queries in NHibernate? In my below code how will I group the data so it displays su...
The simplest way to do this probably would be to calculate the start/end date outside of the query and add a Between restriction to your projection list..Add(Restrictions.Between("MyDate", startDate, endDate))
Sum of data for current week using projection queries I want to do a total of fields in database for the current week. For eg, If today is wednesday, I want to do a total of current Monday through Wednesday, if its Thursday then Monday through Thursday.. How will I do this using projection queries in NHibernate? In my ...
TITLE: Sum of data for current week using projection queries QUESTION: I want to do a total of fields in database for the current week. For eg, If today is wednesday, I want to do a total of current Monday through Wednesday, if its Thursday then Monday through Thursday.. How will I do this using projection queries in ...
[ "c#", "nhibernate", "hibernate-criteria", "nhibernate-projections" ]
1
2
487
1
0
2011-06-01T17:59:30.807000
2011-06-01T18:10:42.037000
6,205,627
6,206,158
Returning value from Javascript *reliably* to Webview
There is a way to call javascript function from webview and then let it call a method in Java to return the result. Like described in How to get return value from javascript in webview of android? Now, the javascript function can fail (say due to a typo in javascript file). In that case, I would like to carry out some ...
You can use a synchronization object for notifying and waiting: public class EventManager { private final ConditionVariable eventHandled = new ConditionVariable(); public void setEventHandled() { eventHandled.open(); } void waitForEvent() { eventHandled.block(); } } private final EventManager eventManager = new Even...
Returning value from Javascript *reliably* to Webview There is a way to call javascript function from webview and then let it call a method in Java to return the result. Like described in How to get return value from javascript in webview of android? Now, the javascript function can fail (say due to a typo in javascrip...
TITLE: Returning value from Javascript *reliably* to Webview QUESTION: There is a way to call javascript function from webview and then let it call a method in Java to return the result. Like described in How to get return value from javascript in webview of android? Now, the javascript function can fail (say due to a...
[ "android", "webview", "android-webview" ]
1
5
3,089
1
0
2011-06-01T17:59:34.240000
2011-06-01T18:47:59.347000
6,205,633
6,205,901
Is XSS input a threat if ONLY the same user will see it?
What exactly can a malicious user gain if the XSS input he enters will be viewed only by him? Is there anything he can gain? I understand how XSS is a problem when the malicious user input will be viewed by all site users. But if each user view only his own input, his malicious input will be viewed only by him, so my q...
What an attacker can gain with viewing that the xss attack vector he found works, is just that:-) But! Then he can use that attack vector, and there are several ways to do that. If it's a non-persistent XSS vulnerability (aka reflected), then probably by sending a link (most probably obfuscated via a urlshortener) to p...
Is XSS input a threat if ONLY the same user will see it? What exactly can a malicious user gain if the XSS input he enters will be viewed only by him? Is there anything he can gain? I understand how XSS is a problem when the malicious user input will be viewed by all site users. But if each user view only his own input...
TITLE: Is XSS input a threat if ONLY the same user will see it? QUESTION: What exactly can a malicious user gain if the XSS input he enters will be viewed only by him? Is there anything he can gain? I understand how XSS is a problem when the malicious user input will be viewed by all site users. But if each user view ...
[ "php", "security", "xss", "user-input" ]
5
7
521
6
0
2011-06-01T18:00:07.903000
2011-06-01T18:24:11.020000
6,205,637
6,224,595
Hit testing child controls added to a canvas does not work
I am trying to do hit testing on a collection of user controls added to a canvas at runtime. My canvas: My canvas code: public MainPage() { InitializeComponent(); var uiElement = new MyUserControl(); this.Carrier.Children.Add(uiElement); MouseLeftButtonDown += MouseLeftButtonDownHandler; } private List HitSprite(Poi...
There are a couple of things you have to be aware of about hit testing: Elements without a background won't appear in the hit test, so set the background, even setting it to transparent work. This happens because objects need to be "solid" for hit testing. Elements without a width and height won't appear in the hit tes...
Hit testing child controls added to a canvas does not work I am trying to do hit testing on a collection of user controls added to a canvas at runtime. My canvas: My canvas code: public MainPage() { InitializeComponent(); var uiElement = new MyUserControl(); this.Carrier.Children.Add(uiElement); MouseLeftButtonDown +...
TITLE: Hit testing child controls added to a canvas does not work QUESTION: I am trying to do hit testing on a collection of user controls added to a canvas at runtime. My canvas: My canvas code: public MainPage() { InitializeComponent(); var uiElement = new MyUserControl(); this.Carrier.Children.Add(uiElement); Mou...
[ "wpf", "silverlight-4.0", "sprite" ]
2
7
6,044
2
0
2011-06-01T18:00:40.103000
2011-06-03T08:12:56.150000
6,205,638
6,205,689
Is Microsoft discontinuing the "Visual Studio Installer" or not?
Is Microsoft discontinuing the "Visual Studio Installer" or not? Somewhere I remember reading that they were, in favor of going with InstallShield LE. But I can't find this on MS's site anywhere. Does anyone else have any info on this? Thanks
Yes, this seems to be the case. Check the announcement at the top of the MSDN forum. With InstallShield available, the Visual Studio Installer project types will not be available in future versions of Visual Studio. To preserve existing customer investments in Visual Studio Installer projects, Microsoft will continue t...
Is Microsoft discontinuing the "Visual Studio Installer" or not? Is Microsoft discontinuing the "Visual Studio Installer" or not? Somewhere I remember reading that they were, in favor of going with InstallShield LE. But I can't find this on MS's site anywhere. Does anyone else have any info on this? Thanks
TITLE: Is Microsoft discontinuing the "Visual Studio Installer" or not? QUESTION: Is Microsoft discontinuing the "Visual Studio Installer" or not? Somewhere I remember reading that they were, in favor of going with InstallShield LE. But I can't find this on MS's site anywhere. Does anyone else have any info on this? T...
[ "visual-studio-2010", "installation", "installshield" ]
2
3
263
1
0
2011-06-01T18:00:47.373000
2011-06-01T18:04:39.890000
6,205,639
6,205,675
Why would I see "Unable to emit assembly: Referenced assembly ... does not have a strong name" when trying to add a reference?
I'm wanting to include a system tray icon in my WPF project, and found this resource: http://www.hardcodet.net/projects/wpf-notifyicon which looks like it will work beautifully, but it's written for C# and I'm using VB.net for this project. I downloaded his project and built the notifyicon as a DLL, then added as a ref...
You will need to add a strong name to the other assembly, or make your project not include a strong name. Since you're already building it, you can just add a strong name in the project properties, and rebuild. Once you do that, it should work (without changing the code at all).
Why would I see "Unable to emit assembly: Referenced assembly ... does not have a strong name" when trying to add a reference? I'm wanting to include a system tray icon in my WPF project, and found this resource: http://www.hardcodet.net/projects/wpf-notifyicon which looks like it will work beautifully, but it's writte...
TITLE: Why would I see "Unable to emit assembly: Referenced assembly ... does not have a strong name" when trying to add a reference? QUESTION: I'm wanting to include a system tray icon in my WPF project, and found this resource: http://www.hardcodet.net/projects/wpf-notifyicon which looks like it will work beautifull...
[ "wpf", "vb.net", "visual-studio-2010", "dll" ]
5
10
11,526
3
0
2011-06-01T18:00:48.607000
2011-06-01T18:03:45.330000
6,205,640
6,206,575
SQL: select all records not selected by another query
I am looking for an SQL query to select all records not selected by another query on the same table. Specifically I want to select all records which have duplicates of a particular field('fieldA') and then delete all but one of those records. So a select statement might be something like the following (which doesn't wo...
Specifically I want to select all records which have duplicates of a particular field('fieldA') and then delete all but one of those records. In that case, join it: delete x from myTable x join myTable z on x.field = z.field where x.id > z.id
SQL: select all records not selected by another query I am looking for an SQL query to select all records not selected by another query on the same table. Specifically I want to select all records which have duplicates of a particular field('fieldA') and then delete all but one of those records. So a select statement m...
TITLE: SQL: select all records not selected by another query QUESTION: I am looking for an SQL query to select all records not selected by another query on the same table. Specifically I want to select all records which have duplicates of a particular field('fieldA') and then delete all but one of those records. So a ...
[ "mysql", "sql" ]
4
3
8,875
3
0
2011-06-01T18:00:51.943000
2011-06-01T19:27:19.860000
6,205,649
6,205,821
How long does it take for an iOS app to recognize a DNS change?
I recently changed the DNS records for a domain name to point to a new IP. An iPhone app of mine that pings this domain doesn't seem to be picking up the change, although my desktop web browser quickly picked up the new IP. How long does it take for an iPhone to flush its DNS cache for a particular domain and detect th...
I had this problem I just did two steps: Step 1 - Turn off iPhone Step 2 - Turn on Phone, Reload page. Otherwise I've read it takes about 24 hours for a DNS refresh to occur on the iPhone.
How long does it take for an iOS app to recognize a DNS change? I recently changed the DNS records for a domain name to point to a new IP. An iPhone app of mine that pings this domain doesn't seem to be picking up the change, although my desktop web browser quickly picked up the new IP. How long does it take for an iPh...
TITLE: How long does it take for an iOS app to recognize a DNS change? QUESTION: I recently changed the DNS records for a domain name to point to a new IP. An iPhone app of mine that pings this domain doesn't seem to be picking up the change, although my desktop web browser quickly picked up the new IP. How long does ...
[ "ios", "dns" ]
10
8
9,544
3
0
2011-06-01T18:01:21.293000
2011-06-01T18:16:50.073000
6,205,652
6,208,045
URL not loading in WebView properly
I have a WebView that I want to point to a certain URL. For some reason the following code just opens the regular Android browser. I want it to load in my webview. webView = (WebView) this.findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://www.google.com");
I followed this example and it worked: http://marakana.com/forums/android/examples/58.html
URL not loading in WebView properly I have a WebView that I want to point to a certain URL. For some reason the following code just opens the regular Android browser. I want it to load in my webview. webView = (WebView) this.findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("...
TITLE: URL not loading in WebView properly QUESTION: I have a WebView that I want to point to a certain URL. For some reason the following code just opens the regular Android browser. I want it to load in my webview. webView = (WebView) this.findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true);...
[ "java", "javascript", "android", "browser", "webview" ]
0
0
370
1
0
2011-06-01T18:01:44.347000
2011-06-01T21:39:04.033000
6,205,663
6,205,696
Javascript AJAX return special characters
I've been trying to return special characters from an AJAX request to a PHP script. The responding character string: abcde1’2’3’4’5“6”7–8é9é10’11’12’13ñ14ñ15’16ñ17ñ18 19 20é21é22í23ñ24ñ25’26ñ27ó28ú29’fghij Using a JavaScript alert, it displays: abcde1â2â3â4â5â6â7â8é9é10â11â12â13ñ14ñ15â16ñ17ñ18 19 20é21é22í23ñ...
Your charset in the HTML code may say ISO-8859-1 but are you sure you saved the data in ISO-8859-1? The data may be saved in UTF-8 or Windows CP-1252
Javascript AJAX return special characters I've been trying to return special characters from an AJAX request to a PHP script. The responding character string: abcde1’2’3’4’5“6”7–8é9é10’11’12’13ñ14ñ15’16ñ17ñ18 19 20é21é22í23ñ24ñ25’26ñ27ó28ú29’fghij Using a JavaScript alert, it displays: abcde1â2â3â4â5â6â7â8é9é10â11â12...
TITLE: Javascript AJAX return special characters QUESTION: I've been trying to return special characters from an AJAX request to a PHP script. The responding character string: abcde1’2’3’4’5“6”7–8é9é10’11’12’13ñ14ñ15’16ñ17ñ18 19 20é21é22í23ñ24ñ25’26ñ27ó28ú29’fghij Using a JavaScript alert, it displays: abcde1â2â3â4â5â...
[ "javascript", "ajax", "character-encoding" ]
1
0
2,715
2
0
2011-06-01T18:02:33.007000
2011-06-01T18:05:07.467000
6,205,666
6,206,227
Is it safe to store username + passwords in a local SQLite db in Android?
I'm at the point where I can allow the user to store credentials for a simple web app in my up coming Android app. My fear (being new to Android) is that other (evil) apps could get at this seemingly local database (local to my app that is) When writing this feature should I fear other apps getting at this data? If so ...
I have a similar situation, and found the SimpleCrypto class enough for my needs to get the passwords encrypted to avoid plain text output of passwords being easily read. How you decide to use a key for the encryption is another question. As shown here, you could use the unique Id of the phone (obvious problems being t...
Is it safe to store username + passwords in a local SQLite db in Android? I'm at the point where I can allow the user to store credentials for a simple web app in my up coming Android app. My fear (being new to Android) is that other (evil) apps could get at this seemingly local database (local to my app that is) When ...
TITLE: Is it safe to store username + passwords in a local SQLite db in Android? QUESTION: I'm at the point where I can allow the user to store credentials for a simple web app in my up coming Android app. My fear (being new to Android) is that other (evil) apps could get at this seemingly local database (local to my ...
[ "android", "security", "sqlite" ]
10
5
5,950
2
0
2011-06-01T18:03:00.867000
2011-06-01T18:54:09.617000
6,205,668
6,206,134
IE leaving unnecessary space after image
I am creating an HTML email as Para with lots of text However an unnecessary space is left at the bottom of the image when seen in Internet Explorer. How can I get rid of this space?
This isn't a bug or anything like that. Depending on the doctype in use, different browsers apply specific values to margin, padding, and border to various elements. Looking at your code I don't see where you set the border on the image to 0. Do this. Generally speaking the best doctype to use is simply This results in...
IE leaving unnecessary space after image I am creating an HTML email as Para with lots of text However an unnecessary space is left at the bottom of the image when seen in Internet Explorer. How can I get rid of this space?
TITLE: IE leaving unnecessary space after image QUESTION: I am creating an HTML email as Para with lots of text However an unnecessary space is left at the bottom of the image when seen in Internet Explorer. How can I get rid of this space? ANSWER: This isn't a bug or anything like that. Depending on the doctype in u...
[ "css", "internet-explorer", "html-table", "html-email" ]
3
2
3,621
5
0
2011-06-01T18:03:08.287000
2011-06-01T18:45:28.727000
6,205,674
6,206,429
Emacs flymake prevents loading of files when directory is not writeable
When I open a file in a directory that is not writeable I get Opening output file: Permission denied, /path/to/file At the same time the file is not loaded. When I repeat the find-file command, the file is loaded fine the second time. The functionality I would like is: open the file right away and maybe show a message ...
you could configure flymake to not start syntax checking when loading the file (i always do that just to speed things up). (setq flymake-start-syntax-check-on-find-file nil)
Emacs flymake prevents loading of files when directory is not writeable When I open a file in a directory that is not writeable I get Opening output file: Permission denied, /path/to/file At the same time the file is not loaded. When I repeat the find-file command, the file is loaded fine the second time. The functiona...
TITLE: Emacs flymake prevents loading of files when directory is not writeable QUESTION: When I open a file in a directory that is not writeable I get Opening output file: Permission denied, /path/to/file At the same time the file is not loaded. When I repeat the find-file command, the file is loaded fine the second t...
[ "emacs", "flymake" ]
2
1
525
2
0
2011-06-01T18:03:39.977000
2011-06-01T19:12:05.870000
6,205,681
6,207,150
How and when is the memory of a global or static array allocated?
When defining a global or static array in c++ its memory is not immediately reserved at the start of the programme but only once we write to the array. What I found surprising is, if we only write to a small part of the array it still does not reserve the entire memory. Consider the following small example which writes...
There are two things in play here viz. virtual memory and physical memory. The virtual memory for for the static data, just like the instructions for your program are assigned before your program begins execution. By this I mean that the address, for your program is always defined. The operating system might be lazy, h...
How and when is the memory of a global or static array allocated? When defining a global or static array in c++ its memory is not immediately reserved at the start of the programme but only once we write to the array. What I found surprising is, if we only write to a small part of the array it still does not reserve th...
TITLE: How and when is the memory of a global or static array allocated? QUESTION: When defining a global or static array in c++ its memory is not immediately reserved at the start of the programme but only once we write to the array. What I found surprising is, if we only write to a small part of the array it still d...
[ "c++", "arrays", "static", "global", "contiguous" ]
4
2
1,362
4
0
2011-06-01T18:04:09.573000
2011-06-01T20:20:27.377000
6,205,685
6,205,760
Is there a better way to convert byte array to an int?
The first 3 bytes of a byte array are just integers, is there a better way to convert them? So far I have this but it just feels like a bad way of doing it. public int parse_code(byte[] bs) { char[] array = new char[3]; for(int i = 0; i < 3; i++) { array[i] = (char) bs[i]; } // Dirty way of doing it return Integer.par...
If you know that there will always be 3 decimal digits at the beginning of the byte array you can just convert them into a integer directly: public int parse_code( byte[] bs ) { int intval = 0; for( int i = 0; i < 3; i++ ) intval = intval * 10 + ( bs[ i ] - '0' ); return intval; }
Is there a better way to convert byte array to an int? The first 3 bytes of a byte array are just integers, is there a better way to convert them? So far I have this but it just feels like a bad way of doing it. public int parse_code(byte[] bs) { char[] array = new char[3]; for(int i = 0; i < 3; i++) { array[i] = (char...
TITLE: Is there a better way to convert byte array to an int? QUESTION: The first 3 bytes of a byte array are just integers, is there a better way to convert them? So far I have this but it just feels like a bad way of doing it. public int parse_code(byte[] bs) { char[] array = new char[3]; for(int i = 0; i < 3; i++) ...
[ "java" ]
2
3
823
4
0
2011-06-01T18:04:24.240000
2011-06-01T18:10:36.780000
6,205,697
6,205,891
Soft Keyboard comes over the EditText
I am using Eclipse ADT to develop an Android application. When focus comes over one of the EditText(at lower end of page) the keypad covers the EditText so when I am keying text, I can't see what's being keyed in. What are my options? Layout of Index Activity AndroidManifest.xml Keyboard
Wrap your outer LinerLayout in a ScrollView, e.g., This should allow scrolling your layout to see the lower EditText
Soft Keyboard comes over the EditText I am using Eclipse ADT to develop an Android application. When focus comes over one of the EditText(at lower end of page) the keypad covers the EditText so when I am keying text, I can't see what's being keyed in. What are my options? Layout of Index Activity AndroidManifest.xml Ke...
TITLE: Soft Keyboard comes over the EditText QUESTION: I am using Eclipse ADT to develop an Android application. When focus comes over one of the EditText(at lower end of page) the keypad covers the EditText so when I am keying text, I can't see what's being keyed in. What are my options? Layout of Index Activity Andr...
[ "android", "user-interface" ]
2
9
7,808
3
0
2011-06-01T18:05:14.010000
2011-06-01T18:23:11.930000
6,205,708
6,206,428
Symmetric Bandstop Filter in Matlab?
I'm using Matlab to find effective ways of deconvolving the output of a spectrometer to get the original input. The function deconvwnr() works well, except it introduces a lot of sinusoidal-esque noise which I have been getting rid of with matlab's built-in band-stop butterworth filtering: [b,a] = butter(3,[iters-freq,...
All filters produce a "shift" or "delay" in the output by as many number of samples as the length of the filter. This is the behaviour using the filter command. To get no delay in the output, you should filter it once forward and once backward (+shift -shift =0). This is easily implemented using the filtfilt command. T...
Symmetric Bandstop Filter in Matlab? I'm using Matlab to find effective ways of deconvolving the output of a spectrometer to get the original input. The function deconvwnr() works well, except it introduces a lot of sinusoidal-esque noise which I have been getting rid of with matlab's built-in band-stop butterworth fil...
TITLE: Symmetric Bandstop Filter in Matlab? QUESTION: I'm using Matlab to find effective ways of deconvolving the output of a spectrometer to get the original input. The function deconvwnr() works well, except it introduces a lot of sinusoidal-esque noise which I have been getting rid of with matlab's built-in band-st...
[ "matlab", "filter" ]
1
2
780
1
0
2011-06-01T18:06:02.040000
2011-06-01T19:12:05.477000
6,205,709
6,206,004
PowerShell: Redirecting mysqldump.exe's errors
Here is the command I have been using to back up one of my MySQL databases: mysqldump.exe --user=myuser --password=mypassword --databases --opt MyDatabase > "C:\MyDatabase.sql" I'd like to use this command in a PowerShell script. However, if an error occurs, I don't want it to be outputted to the console. Instead, I wo...
Firstly, beware > if your database dump does not need to be in Unicode, but rather ASCII. You would instead use | out-file $filepath -enc ascii to make sure it writes in ASCII encoding. (My databases are in latin1. If I use Powershell's > the dump file is twice as large as when dumped using > from normal console.) That...
PowerShell: Redirecting mysqldump.exe's errors Here is the command I have been using to back up one of my MySQL databases: mysqldump.exe --user=myuser --password=mypassword --databases --opt MyDatabase > "C:\MyDatabase.sql" I'd like to use this command in a PowerShell script. However, if an error occurs, I don't want i...
TITLE: PowerShell: Redirecting mysqldump.exe's errors QUESTION: Here is the command I have been using to back up one of my MySQL databases: mysqldump.exe --user=myuser --password=mypassword --databases --opt MyDatabase > "C:\MyDatabase.sql" I'd like to use this command in a PowerShell script. However, if an error occu...
[ "powershell", "error-handling", "mysql" ]
1
2
1,767
1
0
2011-06-01T18:06:05.237000
2011-06-01T18:33:29.680000
6,205,712
6,205,737
Good xcode alternative for writing objective-C code
As Xcode 4 is likely to stay as slow as it is now, are there any editors out there that are code aware and good with objective-C? I will not stop using xcode, it still has great features but just for the writing of the code.
There is: TextMate (commercial) Kod (open source) SubEthaEdit (commercial) MacVim (open source) Smultron (open source) BBEdit (commercial) TextWrangler (free) You could even use one of these with the appropriate plugins: Coda (commercial) Espresso (commercial) …just to name a few.
Good xcode alternative for writing objective-C code As Xcode 4 is likely to stay as slow as it is now, are there any editors out there that are code aware and good with objective-C? I will not stop using xcode, it still has great features but just for the writing of the code.
TITLE: Good xcode alternative for writing objective-C code QUESTION: As Xcode 4 is likely to stay as slow as it is now, are there any editors out there that are code aware and good with objective-C? I will not stop using xcode, it still has great features but just for the writing of the code. ANSWER: There is: TextMa...
[ "objective-c", "xcode", "cocoa", "macos" ]
5
4
8,760
2
0
2011-06-01T18:06:21.880000
2011-06-01T18:08:44.503000
6,205,722
6,205,789
Execute javascript on href
I have an asp website and am trying to automatically generate some javascript. I have an ashx file that generates the javascript and then I would like to like to this javascript in a href. I have seen it done on other websites but can't work out how its done. The ashx file called 'Hello.ashx' outputs something like ale...
You want to load the javascript file when the anchor is clicked: function loadjs() { var head = document.getElementsByTagName('head'); var s = document.createElement('script'); s.setAttribute('type', 'text/javascript'); s.setAttribute('src', 'Hello.ashx'); head[0].appendChild(s); return false; } Text If you're using jQ...
Execute javascript on href I have an asp website and am trying to automatically generate some javascript. I have an ashx file that generates the javascript and then I would like to like to this javascript in a href. I have seen it done on other websites but can't work out how its done. The ashx file called 'Hello.ashx'...
TITLE: Execute javascript on href QUESTION: I have an asp website and am trying to automatically generate some javascript. I have an ashx file that generates the javascript and then I would like to like to this javascript in a href. I have seen it done on other websites but can't work out how its done. The ashx file c...
[ "javascript", "asp.net", "html" ]
1
3
603
1
0
2011-06-01T18:07:30.540000
2011-06-01T18:13:28.630000
6,205,725
6,206,046
assigning range of lines to a variable in vimscript
I'm looking for a more elegant way of doing this function PasteBin() range let l:stdin = join(getline(a:firstline, a:lastline), "^M") let l:output = system("pb", l:stdin) echo l:output endfunction Specifically, how can I avoid using getline() and join()?
Looks like you're just reinventing:w_c. If you already have a visual selection, you can just run:'<,'>w!pb to use the visual selection as the stdin for pb.
assigning range of lines to a variable in vimscript I'm looking for a more elegant way of doing this function PasteBin() range let l:stdin = join(getline(a:firstline, a:lastline), "^M") let l:output = system("pb", l:stdin) echo l:output endfunction Specifically, how can I avoid using getline() and join()?
TITLE: assigning range of lines to a variable in vimscript QUESTION: I'm looking for a more elegant way of doing this function PasteBin() range let l:stdin = join(getline(a:firstline, a:lastline), "^M") let l:output = system("pb", l:stdin) echo l:output endfunction Specifically, how can I avoid using getline() and joi...
[ "vim" ]
2
5
394
1
0
2011-06-01T18:07:39.633000
2011-06-01T18:37:35.893000
6,205,730
6,205,847
c# + autocad mirror command
var commandString = string.Format("_.mirror _C\r{0}\r{1}\r {2}\r{3} _n\r", pEnd.ToString2D(), pStart.ToString2D(), axialPStart.ToString2D(), axialPEnd.ToString2D()); _acadCurrentDocument.SendCommand(commandString); does not work, i believe it is because \r. How to pass trough this situation?
I don't have an AutoCAD handy to test here, but I believe \r alone is not recognized by the command interpreter as a press on the ENTER key. Try using \n instead: "_.mirror _C\n{0}\n{1}\n {2}\n{3} _n\n"
c# + autocad mirror command var commandString = string.Format("_.mirror _C\r{0}\r{1}\r {2}\r{3} _n\r", pEnd.ToString2D(), pStart.ToString2D(), axialPStart.ToString2D(), axialPEnd.ToString2D()); _acadCurrentDocument.SendCommand(commandString); does not work, i believe it is because \r. How to pass trough this situation?
TITLE: c# + autocad mirror command QUESTION: var commandString = string.Format("_.mirror _C\r{0}\r{1}\r {2}\r{3} _n\r", pEnd.ToString2D(), pStart.ToString2D(), axialPStart.ToString2D(), axialPEnd.ToString2D()); _acadCurrentDocument.SendCommand(commandString); does not work, i believe it is because \r. How to pass trou...
[ "c#", "autocad" ]
1
0
669
2
0
2011-06-01T18:08:05.333000
2011-06-01T18:19:52.550000
6,205,734
6,205,794
jQuery reference <object>
I'm having trouble trouble referencing my This is what I have: I've tried these: alert($(".video1 embed").attr('src') ); // undefined alert($("#video1").attr('src') ); // undefined alert( $("#video1" ).get(0).attr('src') ); // undefined
Do you want the value of the element with name="src"? // /-------------- Select tag with id=video1 // | /------ Select child param tag // | | /- Filter to tags with a "name" attribute with value "src" // | | | $("#video1 param[name=src]").attr("value") // return value of "value" attribute
jQuery reference <object> I'm having trouble trouble referencing my This is what I have: I've tried these: alert($(".video1 embed").attr('src') ); // undefined alert($("#video1").attr('src') ); // undefined alert( $("#video1" ).get(0).attr('src') ); // undefined
TITLE: jQuery reference <object> QUESTION: I'm having trouble trouble referencing my This is what I have: I've tried these: alert($(".video1 embed").attr('src') ); // undefined alert($("#video1").attr('src') ); // undefined alert( $("#video1" ).get(0).attr('src') ); // undefined ANSWER: Do you want the value of the e...
[ "jquery", "object", "video" ]
0
5
196
1
0
2011-06-01T18:08:38.853000
2011-06-01T18:13:55.937000
6,205,738
6,205,867
An Access Form:How to get PDF of a access form
I have a Icon of PDF in my form that i have created in Access 2010. There are 3 tabs in that form; each tab have a separate form page and PDF icon is common for all the tabs. Now I want that whenever a user click on that icon a PDF file of that form get created. I have written this code: Private Sub cmdPrintReportPDF_C...
Try the Open method of Application.Documents, e.g. Application.Documents.Open "C:\mydoc.pdf".
An Access Form:How to get PDF of a access form I have a Icon of PDF in my form that i have created in Access 2010. There are 3 tabs in that form; each tab have a separate form page and PDF icon is common for all the tabs. Now I want that whenever a user click on that icon a PDF file of that form get created. I have wri...
TITLE: An Access Form:How to get PDF of a access form QUESTION: I have a Icon of PDF in my form that i have created in Access 2010. There are 3 tabs in that form; each tab have a separate form page and PDF icon is common for all the tabs. Now I want that whenever a user click on that icon a PDF file of that form get c...
[ "ms-access" ]
0
0
447
1
0
2011-06-01T18:08:47.387000
2011-06-01T18:21:06.077000
6,205,745
6,205,776
Codeigniter extending exception class
I am trying to load a custom exception class that I created according to the instructions here: http://codeigniter.com/user_guide/general/core_classes.html MY_Exceptions.php is stored at application/core/ Somehow, when I try loading it, I keep getting this error: Fatal error: Class 'MY_Exceptions' not found in C:\xampp...
MY_Exception.php is stored at application/core/ Name the class and file MY_Exceptions with an s You do not need to autoload or manually load anything in the core directory, nor should you. They are required classes for CI to run that are automatically loaded. For creating core classes, use this documentation instead: h...
Codeigniter extending exception class I am trying to load a custom exception class that I created according to the instructions here: http://codeigniter.com/user_guide/general/core_classes.html MY_Exceptions.php is stored at application/core/ Somehow, when I try loading it, I keep getting this error: Fatal error: Class...
TITLE: Codeigniter extending exception class QUESTION: I am trying to load a custom exception class that I created according to the instructions here: http://codeigniter.com/user_guide/general/core_classes.html MY_Exceptions.php is stored at application/core/ Somehow, when I try loading it, I keep getting this error: ...
[ "php", "codeigniter" ]
2
2
5,459
2
0
2011-06-01T18:09:13.913000
2011-06-01T18:12:22.523000
6,205,746
6,207,119
Populating and passing complex object from MVC2 view to controller action
I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.StartHour.Hour.ToString("0,0")))%> <%= Html.DropDownList("drpStartTimem", new SelectList(Model.M...
Frist of all the link will result in a Get instead of Post. You need to use javascript function attached to the hyperlink to perform a POST to the action on the controller. function SomeFunction(obj) { document.forms[0].action = obj.href; document.forms[0].submit(); return false; } please also store the whiteout.white...
Populating and passing complex object from MVC2 view to controller action I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.StartHour.Hour.ToStrin...
TITLE: Populating and passing complex object from MVC2 view to controller action QUESTION: I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.Star...
[ "asp.net", "asp.net-mvc-2", "entity-framework-4" ]
0
0
373
1
0
2011-06-01T18:09:23.100000
2011-06-01T20:17:11.683000
6,205,751
6,205,929
A registration already exists for URI after stop/start
I am currently working on an application where I am creating a ServiceHost, then getting rid of it, then recreating it later. The problem is that once I get rid of the service host when I try to recreate it I get the exception "A registration already exists for URI after stop/start." The weird thing is I have three sep...
Though I am not sure about the exact issue, I can give you a little thought on it and some workaround. If you are working in Windows 7, any URL you create as part of your hosting has to get registered. Netsh command usually helps us register and unregister the URLs. For both registering and unregistering URIs you need ...
A registration already exists for URI after stop/start I am currently working on an application where I am creating a ServiceHost, then getting rid of it, then recreating it later. The problem is that once I get rid of the service host when I try to recreate it I get the exception "A registration already exists for URI...
TITLE: A registration already exists for URI after stop/start QUESTION: I am currently working on an application where I am creating a ServiceHost, then getting rid of it, then recreating it later. The problem is that once I get rid of the service host when I try to recreate it I get the exception "A registration alre...
[ "c#", "exception", "service", "servicehost" ]
2
1
2,286
1
0
2011-06-01T18:09:48.043000
2011-06-01T18:26:18.793000
6,205,757
6,205,810
Selector for multiple tags inside a div with id
In jQuery, how can I build a selector for tags h1, h2, h3 and p inside #con? Like $('#con h1, #con h2, #con h3, #con p') but without repeating the #con
You can do any of the following: $("#con h1, #con h2, #con h3, #con p") // your original $("h1, h2, h3, p", $("#con")) // pass jQuery object in as context $("h1, h2, h3, p", "#con") // pass selector in as context $("#con").find("h1, h2, h3, p") // do what jQuery ultimately does // in the end when passing context // ...
Selector for multiple tags inside a div with id In jQuery, how can I build a selector for tags h1, h2, h3 and p inside #con? Like $('#con h1, #con h2, #con h3, #con p') but without repeating the #con
TITLE: Selector for multiple tags inside a div with id QUESTION: In jQuery, how can I build a selector for tags h1, h2, h3 and p inside #con? Like $('#con h1, #con h2, #con h3, #con p') but without repeating the #con ANSWER: You can do any of the following: $("#con h1, #con h2, #con h3, #con p") // your original $("...
[ "jquery" ]
9
21
13,103
2
0
2011-06-01T18:10:18.293000
2011-06-01T18:15:58.497000
6,205,761
6,206,199
Safely rendering a user's template/view?
I have a model which has a template field. This template is HTML and has variables which get substituted. This template is then converted into a PDF using wicked_pdf. How should I take the template which the user enters and safely do variable substitution? Allowing it to be an ERB template seems to be setting myself up...
Rails provides a couple of helper functions, namely h to escape values on display for preventing such behavior. <%= h @user.name %> h is an alias of html_escape
Safely rendering a user's template/view? I have a model which has a template field. This template is HTML and has variables which get substituted. This template is then converted into a PDF using wicked_pdf. How should I take the template which the user enters and safely do variable substitution? Allowing it to be an E...
TITLE: Safely rendering a user's template/view? QUESTION: I have a model which has a template field. This template is HTML and has variables which get substituted. This template is then converted into a PDF using wicked_pdf. How should I take the template which the user enters and safely do variable substitution? Allo...
[ "ruby-on-rails" ]
2
0
158
1
0
2011-06-01T18:10:37.697000
2011-06-01T18:52:02.627000
6,205,768
6,210,582
Maven - Java EE 6 Web Profile Javadocs
By declaring the following dependency: javax javaee-web-api 6.0 provided I can use about everything I need for a Java EE 6 Project (Servlet 3.0, JPA 2, EJB, CDI, etc). The problem is: Maven can not download the Javadocs for the dependency (or at least m2eclipse "Download JavaDoc" feature don't work), so Eclipse don't s...
Assuming you have Java EE javadocs, you can install them to your local maven repository using the maven install plugin. Look at this usage link You would use the -Dclassifier=sources to indicate you are installing sources. See this example for this.
Maven - Java EE 6 Web Profile Javadocs By declaring the following dependency: javax javaee-web-api 6.0 provided I can use about everything I need for a Java EE 6 Project (Servlet 3.0, JPA 2, EJB, CDI, etc). The problem is: Maven can not download the Javadocs for the dependency (or at least m2eclipse "Download JavaDoc" ...
TITLE: Maven - Java EE 6 Web Profile Javadocs QUESTION: By declaring the following dependency: javax javaee-web-api 6.0 provided I can use about everything I need for a Java EE 6 Project (Servlet 3.0, JPA 2, EJB, CDI, etc). The problem is: Maven can not download the Javadocs for the dependency (or at least m2eclipse "...
[ "maven", "dependencies", "javadoc", "java-ee-6" ]
6
8
5,576
1
0
2011-06-01T18:11:15.760000
2011-06-02T04:56:15.830000
6,205,770
6,206,576
IIS Web gardens and performance
Is there any performance benefit in configuring web gardens in IIS? Anyone have any real life examples?
Under most circumstances, there is very little benefit to setting up web gardens and can actually cause issues if your application uses session state. The initial request may have come into one worker process, but then the next request might come into another. Here is a reference: The reference is specific to IIS6 but ...
IIS Web gardens and performance Is there any performance benefit in configuring web gardens in IIS? Anyone have any real life examples?
TITLE: IIS Web gardens and performance QUESTION: Is there any performance benefit in configuring web gardens in IIS? Anyone have any real life examples? ANSWER: Under most circumstances, there is very little benefit to setting up web gardens and can actually cause issues if your application uses session state. The in...
[ "performance", "iis", "web-garden" ]
5
7
3,892
1
0
2011-06-01T18:11:26.627000
2011-06-01T19:27:39.973000
6,205,771
6,205,796
Alphabet constant in Java?
I have a situation where I need to find a letter's index in the alphabet. In Python I could use string.ascii_lowercase or string.ascii_uppercase. Is there something similar in Java? Obviously I could do: private static char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray(); But after so much Python, it makes me w...
You can get the index like this: char lowercaseLetter =... int index = lowercaseLetter - 'a';
Alphabet constant in Java? I have a situation where I need to find a letter's index in the alphabet. In Python I could use string.ascii_lowercase or string.ascii_uppercase. Is there something similar in Java? Obviously I could do: private static char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray(); But after so...
TITLE: Alphabet constant in Java? QUESTION: I have a situation where I need to find a letter's index in the alphabet. In Python I could use string.ascii_lowercase or string.ascii_uppercase. Is there something similar in Java? Obviously I could do: private static char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArr...
[ "java", "constants" ]
8
11
6,778
2
0
2011-06-01T18:11:34.147000
2011-06-01T18:14:28.247000
6,205,780
6,222,446
Replace Dojo NumberTextBox separator comma with a hyphen
How do I replace the comma formatting in a Dojo NumberTextBox with hyphen? For example: Convert 123,456,789 into 123-456-789.
It's not really a number anymore as much as a string pattern you want to preserve that happens to have numbers in it (I suppose you could say you want the thousands separator to be a dash instead of a comma? dojo.number.format supports overriding the thousands separator, but I don't think NumberTextBox does) I owe you ...
Replace Dojo NumberTextBox separator comma with a hyphen How do I replace the comma formatting in a Dojo NumberTextBox with hyphen? For example: Convert 123,456,789 into 123-456-789.
TITLE: Replace Dojo NumberTextBox separator comma with a hyphen QUESTION: How do I replace the comma formatting in a Dojo NumberTextBox with hyphen? For example: Convert 123,456,789 into 123-456-789. ANSWER: It's not really a number anymore as much as a string pattern you want to preserve that happens to have numbers...
[ "javascript", "dojo" ]
1
0
853
2
0
2011-06-01T18:12:42.663000
2011-06-03T02:38:23.437000
6,205,782
6,207,710
Can I run locally and debug a Web App that uses Google API's? [GWT+GAE]
I'm working on a web-app using Google App Engine with GWT, and I need to use Google API's (Google Calendar, Documents and so...). As I know, I must configure a domain with Google to set my domain as callback of an OAuth Authentication. Am I right? If so, am I forced to deploy on GAE to test? I mean, I can't run locally...
If you use AuthSub instead I don't think you need to register a domain. The user just need a google account. I have in the past used AuthSub together with Google Docs/Spreadsheet APIs on GAE and also been able to test it locally. I can unfortunately not give you my code and exact solution (it was a while ago). But one ...
Can I run locally and debug a Web App that uses Google API's? [GWT+GAE] I'm working on a web-app using Google App Engine with GWT, and I need to use Google API's (Google Calendar, Documents and so...). As I know, I must configure a domain with Google to set my domain as callback of an OAuth Authentication. Am I right? ...
TITLE: Can I run locally and debug a Web App that uses Google API's? [GWT+GAE] QUESTION: I'm working on a web-app using Google App Engine with GWT, and I need to use Google API's (Google Calendar, Documents and so...). As I know, I must configure a domain with Google to set my domain as callback of an OAuth Authentica...
[ "java", "google-app-engine", "gwt", "oauth", "google-api" ]
1
0
295
1
0
2011-06-01T18:12:51.650000
2011-06-01T21:07:40.120000
6,205,786
6,205,997
How to detect Bluetooth activated laptops in range in Windows using C#
I'm interested in creating a wireless network of laptops using Bluetooth developed in C#. I want to get the list of Bluetooth activated devices in range ( preferable computers, not dongles, headsets or phones). I don't think I need to use a Bluetooth adapter specific stack coz I have seen Windows searching for Bluetoot...
There is a nice C# Bluetooth library available in 32feet.NET. If you have no need for any of the additional features it offers and you wish to do the P/Invoke on your own, documentation can be found here; specifically the BluetoothFindFirstDevice and BluetoothFindNextDevice for device discovery. Additionally, you can u...
How to detect Bluetooth activated laptops in range in Windows using C# I'm interested in creating a wireless network of laptops using Bluetooth developed in C#. I want to get the list of Bluetooth activated devices in range ( preferable computers, not dongles, headsets or phones). I don't think I need to use a Bluetoot...
TITLE: How to detect Bluetooth activated laptops in range in Windows using C# QUESTION: I'm interested in creating a wireless network of laptops using Bluetooth developed in C#. I want to get the list of Bluetooth activated devices in range ( preferable computers, not dongles, headsets or phones). I don't think I need...
[ "c#", "sockets", "networking", "network-programming", "bluetooth" ]
1
3
2,801
1
0
2011-06-01T18:13:07.403000
2011-06-01T18:33:09.520000
6,205,790
6,205,907
posting array through JQuery $.post
so I am new to using JQuery and more so.post and what I want to know is: PHP allows me to post an array of multiple form input values like so: so can I do the same with JQuery post? if so, what is the syntax? my current use of it has been like so: $.post('search_item.php', { unit: form.unit.value }... many thanks,
yes! $.post("test.php", { 'choices[]': ["Jon", "Susan"] }); answer to comment one way would be to map them var choices = $('input[name="choices[]"]').map(function() { return this.value; }).get(); // then post would look like $.post("test.php", { 'choices[]':choices });
posting array through JQuery $.post so I am new to using JQuery and more so.post and what I want to know is: PHP allows me to post an array of multiple form input values like so: so can I do the same with JQuery post? if so, what is the syntax? my current use of it has been like so: $.post('search_item.php', { unit: fo...
TITLE: posting array through JQuery $.post QUESTION: so I am new to using JQuery and more so.post and what I want to know is: PHP allows me to post an array of multiple form input values like so: so can I do the same with JQuery post? if so, what is the syntax? my current use of it has been like so: $.post('search_ite...
[ "php", "jquery", "arrays", "post" ]
2
2
2,063
4
0
2011-06-01T18:13:28.750000
2011-06-01T18:24:31.583000
6,205,792
6,205,824
Get character typed, cross-browser
Simple question -- Does anyone know of a reliable cross-browser function to get the character typed from a keydown event? I can write one from the quirksmode grid but would rather not re-invent the wheel for something so simple yet so non-standard. Let me clarify: There is no way to do this simply using event.keyCode o...
Are you willing to use jQuery? $("input").bind("keydown",function(e){ var value = this.value + String.fromCharCode(e.keyCode); } I believe that switching to the keypress event would solve the issue mentioned in your comment. Would the code below meet your requirments? $("input").bind("keypress",function(e){ var value =...
Get character typed, cross-browser Simple question -- Does anyone know of a reliable cross-browser function to get the character typed from a keydown event? I can write one from the quirksmode grid but would rather not re-invent the wheel for something so simple yet so non-standard. Let me clarify: There is no way to d...
TITLE: Get character typed, cross-browser QUESTION: Simple question -- Does anyone know of a reliable cross-browser function to get the character typed from a keydown event? I can write one from the quirksmode grid but would rather not re-invent the wheel for something so simple yet so non-standard. Let me clarify: Th...
[ "javascript", "dom-events" ]
4
6
4,720
2
0
2011-06-01T18:13:30.913000
2011-06-01T18:17:16.013000
6,205,803
6,207,352
What is the difference between src/main/java and src in Springsource Tool
I'm learning to use Springsource Tool Suite (STS) and the Spring framework for development. I am trying out the Amazon AWS SDK for eclipse and decided to install it into STS. When I follow create a new AWS project, it puts the.java file under src instead of src/main/java and when I try to build that, it says "There is ...
Answer: Each Java project in Eclipse (and STS as well), has associated build path, where it is specified, which folders in the project contains java classes. Thus, the difference between src/ and src/main/java is that src/main/java is configured as a folder, containing java classes (or source folder in Eclipse terminol...
What is the difference between src/main/java and src in Springsource Tool I'm learning to use Springsource Tool Suite (STS) and the Spring framework for development. I am trying out the Amazon AWS SDK for eclipse and decided to install it into STS. When I follow create a new AWS project, it puts the.java file under src...
TITLE: What is the difference between src/main/java and src in Springsource Tool QUESTION: I'm learning to use Springsource Tool Suite (STS) and the Spring framework for development. I am trying out the Amazon AWS SDK for eclipse and decided to install it into STS. When I follow create a new AWS project, it puts the.j...
[ "eclipse", "sts-springsourcetoolsuite" ]
4
6
15,763
1
0
2011-06-01T18:14:50.107000
2011-06-01T20:38:32.073000
6,205,805
6,205,894
How to correctly use CultureInfo.InvariantCulture
I'm trying to read a number from a user input (string) like: ' Where "." is grouping separator and "," is the decimal character dim strUserInput as string = "172.500,00" dim ret as double ' Produces 172.5 ("." is the decimal separator) ret = val(strUserInput) ' ' Alternative Way ' Still producing 172.5 strUserInput = ...
From the MSDN documentation for val: The Val function recognizes only the period (.) as a valid decimal separator. When different decimal separators are used, as in international applications, use CDbl or CInt instead to convert a string to a number. To convert the string representation of a number in a particular cult...
How to correctly use CultureInfo.InvariantCulture I'm trying to read a number from a user input (string) like: ' Where "." is grouping separator and "," is the decimal character dim strUserInput as string = "172.500,00" dim ret as double ' Produces 172.5 ("." is the decimal separator) ret = val(strUserInput) ' ' Alter...
TITLE: How to correctly use CultureInfo.InvariantCulture QUESTION: I'm trying to read a number from a user input (string) like: ' Where "." is grouping separator and "," is the decimal character dim strUserInput as string = "172.500,00" dim ret as double ' Produces 172.5 ("." is the decimal separator) ret = val(strUs...
[ ".net", "vb.net" ]
0
1
2,512
2
0
2011-06-01T18:15:13.943000
2011-06-01T18:23:26.823000
6,205,807
6,206,291
How are Authorize.net Silent Post refunds identified?
I have successfully integrated the Silent Post feature with our system for ARB subscriptions. What I am now trying to do is when we refund a payment via the merchant interface, how do I distinguish a refund from all other transactions? Is the a special variable that is set for a refunded payment?
x_type will be set to "credit" Here is an actual Silent Post verifying that (sensitive info is removed/changed) Array ( [x_response_code] => 1 [x_response_subcode] => 1 [x_response_reason_code] => 1 [x_response_reason_text] => This transaction has been approved. [x_auth_code] => 056187 [x_avs_code] => P [x_trans_id] =>...
How are Authorize.net Silent Post refunds identified? I have successfully integrated the Silent Post feature with our system for ARB subscriptions. What I am now trying to do is when we refund a payment via the merchant interface, how do I distinguish a refund from all other transactions? Is the a special variable that...
TITLE: How are Authorize.net Silent Post refunds identified? QUESTION: I have successfully integrated the Silent Post feature with our system for ARB subscriptions. What I am now trying to do is when we refund a payment via the merchant interface, how do I distinguish a refund from all other transactions? Is the a spe...
[ "void", "authorize.net", "silent-post" ]
0
0
430
1
0
2011-06-01T18:15:24.567000
2011-06-01T19:00:08.447000
6,205,808
6,206,794
How to handle long tap on ListView item?
How can I catch such event? onCreateContextMenu is quite similiar, but I don't need menu.
It's hard to know what you need to achieve. But my guess is that you want to perform some acion over the item that receives the long click. For that, you have two options: add an AdapterView.OnItemLongClickListener. See setOnItemLongClickListener.. listView.setOnItemLongClickListener (new OnItemLongClickListener() { pu...
How to handle long tap on ListView item? How can I catch such event? onCreateContextMenu is quite similiar, but I don't need menu.
TITLE: How to handle long tap on ListView item? QUESTION: How can I catch such event? onCreateContextMenu is quite similiar, but I don't need menu. ANSWER: It's hard to know what you need to achieve. But my guess is that you want to perform some acion over the item that receives the long click. For that, you have two...
[ "android", "android-listview" ]
9
26
22,316
4
0
2011-06-01T18:15:26.607000
2011-06-01T19:48:24.327000
6,205,812
6,207,974
Why do these two NHibernate queries produce different results?
This is for a M:N relationship, with the collection being mapped in NHibernate as a Set. The criteria query we were using previously "worked" but it did not populate the Skills collection properly, in that only the first/looking-for skill was brought down, even if the employee had multiple skills. I changed it to a LIN...
Off the bat, the first query is doing the distinct separation after retrieving all rows, while the second query actually does a select distinct.... What's likely happening is that it hydrates the Employee model with just the one Skill retrieved To make the first query actually do a select distinct... you will need to u...
Why do these two NHibernate queries produce different results? This is for a M:N relationship, with the collection being mapped in NHibernate as a Set. The criteria query we were using previously "worked" but it did not populate the Skills collection properly, in that only the first/looking-for skill was brought down, ...
TITLE: Why do these two NHibernate queries produce different results? QUESTION: This is for a M:N relationship, with the collection being mapped in NHibernate as a Set. The criteria query we were using previously "worked" but it did not populate the Skills collection properly, in that only the first/looking-for skill ...
[ "nhibernate", "criteria", "linq-to-nhibernate" ]
0
0
241
1
0
2011-06-01T18:16:04.080000
2011-06-01T21:32:23.317000
6,205,818
6,205,833
Setting HTTP_REFERER for URLS on webpages?
I have a webpage which refers other pages. I want to be able to set the HTTP_REFERER on the URL's that are clicked. What options do I have?
What options do I have? None really. The browser sets this automatically. The only thing you can do is redirect to a script (under your control) like http://example.com/redirect.php?url=........ That file (in this case, PHP) would then do a header redirect to the target, and show up in the receiving site's HTTP_REFERER...
Setting HTTP_REFERER for URLS on webpages? I have a webpage which refers other pages. I want to be able to set the HTTP_REFERER on the URL's that are clicked. What options do I have?
TITLE: Setting HTTP_REFERER for URLS on webpages? QUESTION: I have a webpage which refers other pages. I want to be able to set the HTTP_REFERER on the URL's that are clicked. What options do I have? ANSWER: What options do I have? None really. The browser sets this automatically. The only thing you can do is redirec...
[ "java", "javascript", "http", "http-headers" ]
0
4
1,097
1
0
2011-06-01T18:16:32.240000
2011-06-01T18:18:22.457000
6,205,822
6,205,896
Catch 500 internal server error with System.WebClient
I have some code that does DownloadStringAsync. with my brower i can get some information about the error since I turned on send error message to browser in IIS. I was wondering if it's possible to catch it in the code. void Process( Job job ) { using( WebClient client = new WebClient() ) { client.DownloadStringComplet...
If args.Error!= null it will likely contain an instance of WebException; if this is the case, then you can cast it to WebException, then access its Response property, which you can cast to HttpWebResponse (for HTTP calls), and from there you can get the headers / body / etc.
Catch 500 internal server error with System.WebClient I have some code that does DownloadStringAsync. with my brower i can get some information about the error since I turned on send error message to browser in IIS. I was wondering if it's possible to catch it in the code. void Process( Job job ) { using( WebClient cli...
TITLE: Catch 500 internal server error with System.WebClient QUESTION: I have some code that does DownloadStringAsync. with my brower i can get some information about the error since I turned on send error message to browser in IIS. I was wondering if it's possible to catch it in the code. void Process( Job job ) { us...
[ "c#" ]
2
4
6,200
1
0
2011-06-01T18:17:00.290000
2011-06-01T18:23:43.147000
6,205,826
6,206,640
Open CV 2.2 Include Directory Missing
I have several Windows 7 64bit systems with OpenCV 2.2 installed on them using CMake and Visual Studio 2008 Standard. CMake generates everything in C:\libs\OpenCV-2.2.0\build just fine and Visual Studio 2008 compiles everything without complaint. However, every time I do this process on various machines I find that the...
To solve this problem compile everything in release and debug then right click the INSTALL project in Visual Studio 2008 and choose Build. This will "install" numerous files and move all the include files into the proper location. Now /include will contain subfolders opencv opencv2 and /include/opencv2 will contain num...
Open CV 2.2 Include Directory Missing I have several Windows 7 64bit systems with OpenCV 2.2 installed on them using CMake and Visual Studio 2008 Standard. CMake generates everything in C:\libs\OpenCV-2.2.0\build just fine and Visual Studio 2008 compiles everything without complaint. However, every time I do this proce...
TITLE: Open CV 2.2 Include Directory Missing QUESTION: I have several Windows 7 64bit systems with OpenCV 2.2 installed on them using CMake and Visual Studio 2008 Standard. CMake generates everything in C:\libs\OpenCV-2.2.0\build just fine and Visual Studio 2008 compiles everything without complaint. However, every ti...
[ "c++", "visual-studio", "opencv" ]
4
7
2,381
4
0
2011-06-01T18:17:17.173000
2011-06-01T19:34:55.560000
6,205,827
6,205,922
How to open standard Google Map application from my application?
Once user presses button in my application, I would like to open standard Google Map application and to show particular location. How can I do it? (without using com.google.android.maps.MapView )
You should create an Intent object with a geo-URI: String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); context.startActivity(intent); If you want to specify an address, you should use another form of geo-URI: geo:0,0?q=address. re...
How to open standard Google Map application from my application? Once user presses button in my application, I would like to open standard Google Map application and to show particular location. How can I do it? (without using com.google.android.maps.MapView )
TITLE: How to open standard Google Map application from my application? QUESTION: Once user presses button in my application, I would like to open standard Google Map application and to show particular location. How can I do it? (without using com.google.android.maps.MapView ) ANSWER: You should create an Intent obje...
[ "android", "google-maps" ]
153
260
180,486
11
0
2011-06-01T18:17:21.100000
2011-06-01T18:25:51.060000
6,205,835
6,205,870
Sql injection prevention techniques still vulnerable?
If I'm using mysql_real_escape_string and addslashes to avoid sql Injection attack in my website is this two are enough to stop SQL Injection so its 100% sure no one can now attack using SQL Injection?
It depends on your query; if you are talking about just the values you want to insert in your database, mysql_real_escape_string is enough, you don´t need addslashes. If you also are talking about variable table or column names, you'll need white-lists as well as mysql_real_escape_string will not prevent sql injection ...
Sql injection prevention techniques still vulnerable? If I'm using mysql_real_escape_string and addslashes to avoid sql Injection attack in my website is this two are enough to stop SQL Injection so its 100% sure no one can now attack using SQL Injection?
TITLE: Sql injection prevention techniques still vulnerable? QUESTION: If I'm using mysql_real_escape_string and addslashes to avoid sql Injection attack in my website is this two are enough to stop SQL Injection so its 100% sure no one can now attack using SQL Injection? ANSWER: It depends on your query; if you are ...
[ "php", "security", "sql-injection" ]
1
4
293
5
0
2011-06-01T18:18:29.907000
2011-06-01T18:21:19.420000
6,205,836
6,205,952
Need help using varybycontrol
I am learning ASP.Net and I am trying to use OutputCache - varybycontrol based on tutorial like this: <%@ OutputCache duration="15" varybyparam= "none" varybycontrol="txtName" %> Somehow txtName which is my textbox doesn't get cache, without the varybycontrol it works fine for caching all controls in the form. Can some...
If you're using Master/content pages then VaryByControl won't work. See explanation here: http://connect.microsoft.com/VisualStudio/feedback/details/465461/outputcache-varybycontrol-cannot-be-used-in-content-pages
Need help using varybycontrol I am learning ASP.Net and I am trying to use OutputCache - varybycontrol based on tutorial like this: <%@ OutputCache duration="15" varybyparam= "none" varybycontrol="txtName" %> Somehow txtName which is my textbox doesn't get cache, without the varybycontrol it works fine for caching all ...
TITLE: Need help using varybycontrol QUESTION: I am learning ASP.Net and I am trying to use OutputCache - varybycontrol based on tutorial like this: <%@ OutputCache duration="15" varybyparam= "none" varybycontrol="txtName" %> Somehow txtName which is my textbox doesn't get cache, without the varybycontrol it works fin...
[ "c#", ".net", "asp.net" ]
0
1
278
1
0
2011-06-01T18:18:41.633000
2011-06-01T18:28:34.707000
6,205,844
6,205,909
How to create 1000 rows with the same values in columns?
I would like to create e.g. 1000 rows with the same values for each column in my table (the only difference would be the autoincrement first id column), however I do not know how to write this mysql statement. Any suggestion?
create table mytest ( id int not null auto_increment primary key, col1 varchar(10), col2 varchar(10) ) engine = myisam; delimiter // create procedure populate (in num int) begin declare i int default 0; while i < num do insert into mytest (col1,col2) values ('col1_value','col2_value'); set i = i + 1; end while; end //...
How to create 1000 rows with the same values in columns? I would like to create e.g. 1000 rows with the same values for each column in my table (the only difference would be the autoincrement first id column), however I do not know how to write this mysql statement. Any suggestion?
TITLE: How to create 1000 rows with the same values in columns? QUESTION: I would like to create e.g. 1000 rows with the same values for each column in my table (the only difference would be the autoincrement first id column), however I do not know how to write this mysql statement. Any suggestion? ANSWER: create tab...
[ "mysql" ]
7
18
12,379
2
0
2011-06-01T18:19:18.980000
2011-06-01T18:24:47.463000
6,205,846
6,207,067
Is it possible to create a custom notification with controls such as buttons in Android? How?
According to the Android Developers' Guide, it is possible to create a custom notification view. However, is it possible to create one with controls such as buttons and text views? If yes, how? Note that I think it has something to do with PendingIntent.
Create a RemoteViews object -- like you would for an app widget -- and put it in the contentView public data member of the Notification.
Is it possible to create a custom notification with controls such as buttons in Android? How? According to the Android Developers' Guide, it is possible to create a custom notification view. However, is it possible to create one with controls such as buttons and text views? If yes, how? Note that I think it has somethi...
TITLE: Is it possible to create a custom notification with controls such as buttons in Android? How? QUESTION: According to the Android Developers' Guide, it is possible to create a custom notification view. However, is it possible to create one with controls such as buttons and text views? If yes, how? Note that I th...
[ "android" ]
2
1
358
1
0
2011-06-01T18:19:44.977000
2011-06-01T20:12:05.833000
6,205,856
6,205,877
What is returned if a select statement returns no rows?
I'm working with SQL now in my programming, and I'm querying a database, like so. scCommand = new SqlCommand("SELECT LegislationID FROM Legislation WHERE Number = @ECERegulation", sconConnection); scCommand.Parameters.Add("@ECERegulation", SqlDbType.NVarChar); scCommand.Parameters["@ECERegulation"].Value = strECERegula...
The docs: Return Value The first column of the first row in the result set, or a null reference (Nothing in Visual Basic) if the result set is empty. Returns a maximum of 2033 characters.
What is returned if a select statement returns no rows? I'm working with SQL now in my programming, and I'm querying a database, like so. scCommand = new SqlCommand("SELECT LegislationID FROM Legislation WHERE Number = @ECERegulation", sconConnection); scCommand.Parameters.Add("@ECERegulation", SqlDbType.NVarChar); scC...
TITLE: What is returned if a select statement returns no rows? QUESTION: I'm working with SQL now in my programming, and I'm querying a database, like so. scCommand = new SqlCommand("SELECT LegislationID FROM Legislation WHERE Number = @ECERegulation", sconConnection); scCommand.Parameters.Add("@ECERegulation", SqlDbT...
[ "c#", "sql", "select" ]
2
4
2,600
3
0
2011-06-01T18:20:28.277000
2011-06-01T18:22:20.850000
6,205,861
6,206,441
Can a List.Sort using a randomized Comparison delegate run infinitely?
I'm investigating and performance testing various ways of randomizing ordered collections, and I was looking at the option of passing a Comparison delegate that just randomly returns the comparison result. For example: int RandomComparison (T x, T y) { return this.random.Next (-1, 2); } However, as I do not know the so...
List.Sort in fact is documented to use QuickSort (no additional details given), but I'll ignore that in favour of talking about sorting in general... I suspect that for any sensible sort algorithm, this comparator results in the operation terminating with probability 1, in the sense that the probability of it lasting N...
Can a List.Sort using a randomized Comparison delegate run infinitely? I'm investigating and performance testing various ways of randomizing ordered collections, and I was looking at the option of passing a Comparison delegate that just randomly returns the comparison result. For example: int RandomComparison (T x, T y...
TITLE: Can a List.Sort using a randomized Comparison delegate run infinitely? QUESTION: I'm investigating and performance testing various ways of randomizing ordered collections, and I was looking at the option of passing a Comparison delegate that just randomly returns the comparison result. For example: int RandomCo...
[ ".net", "algorithm", "sorting", "random" ]
3
3
152
6
0
2011-06-01T18:20:46.967000
2011-06-01T19:12:44.620000
6,205,876
6,205,977
At what point is the Thread.CurrentThread evaluated?
In the following code: ThreadStart ts = new ThreadStart((MethodInvoker)delegate { executingThreads.Add(Thread.CurrentThread); // work done here. executingThreads.Remove(Thread.CurrentThread); }); Thread t = new Thread(ts); t.Start(); Perhaps you can see that I'd like to keep track of the threads that I start, so I can ...
Aborting threads is never a good idea. If you are 100% positive that whatever task you are performing in the thread you want to abort will not corrupt any state information anywhere else then you can probably get away with it, but its best to avoid doing so even in those cases. There are better solutions like flagging ...
At what point is the Thread.CurrentThread evaluated? In the following code: ThreadStart ts = new ThreadStart((MethodInvoker)delegate { executingThreads.Add(Thread.CurrentThread); // work done here. executingThreads.Remove(Thread.CurrentThread); }); Thread t = new Thread(ts); t.Start(); Perhaps you can see that I'd like...
TITLE: At what point is the Thread.CurrentThread evaluated? QUESTION: In the following code: ThreadStart ts = new ThreadStart((MethodInvoker)delegate { executingThreads.Add(Thread.CurrentThread); // work done here. executingThreads.Remove(Thread.CurrentThread); }); Thread t = new Thread(ts); t.Start(); Perhaps you can...
[ "c#", "multithreading" ]
2
6
170
4
0
2011-06-01T18:22:15.100000
2011-06-01T18:31:07.810000
6,205,880
6,206,131
What happened to the -e option for pip?
The pip documentation mentions -e option to pip, and this is also used on some BuildBot developer 'getting started' notes. However, I have pip 1.0.1 and that running: pip -e master reports Usage: pip COMMAND [OPTIONS] pip: error: no such option: -e Version 1.0.1 of pip seems to be the latest, in that running pip to up...
It's still there! But, -e is an option only to pip install, not to pip itself. $ pip install -e Usage: /usr/local/bin/pip install [OPTIONS] PACKAGE_NAMES... /usr/local/bin/pip install: error: -e option requires an argument
What happened to the -e option for pip? The pip documentation mentions -e option to pip, and this is also used on some BuildBot developer 'getting started' notes. However, I have pip 1.0.1 and that running: pip -e master reports Usage: pip COMMAND [OPTIONS] pip: error: no such option: -e Version 1.0.1 of pip seems to ...
TITLE: What happened to the -e option for pip? QUESTION: The pip documentation mentions -e option to pip, and this is also used on some BuildBot developer 'getting started' notes. However, I have pip 1.0.1 and that running: pip -e master reports Usage: pip COMMAND [OPTIONS] pip: error: no such option: -e Version 1.0....
[ "python", "virtualenv", "pip" ]
8
15
10,962
1
0
2011-06-01T18:22:34.567000
2011-06-01T18:45:01.083000
6,205,883
6,205,906
Jquery load data from URL or go to URL
I have 2 php pages named "personal_info" and "portfolio". I load them via php functions in codeigniter http://www.mysite.com/controller/personal_info and http://www.mysite.com/controller/portfolio. I have a page with menu tabs linked to personal_info and portfolio and I want to load the pages via ajax when a tab is cli...
For the first issue: put return false; at the end of each 'click' function: $('#personal_info').click(function() { $('#result').load('personal_info'); return false; }); Edit: For the second issue, maybe pull out any jquery/javascript and run it from a central application.js file?
Jquery load data from URL or go to URL I have 2 php pages named "personal_info" and "portfolio". I load them via php functions in codeigniter http://www.mysite.com/controller/personal_info and http://www.mysite.com/controller/portfolio. I have a page with menu tabs linked to personal_info and portfolio and I want to lo...
TITLE: Jquery load data from URL or go to URL QUESTION: I have 2 php pages named "personal_info" and "portfolio". I load them via php functions in codeigniter http://www.mysite.com/controller/personal_info and http://www.mysite.com/controller/portfolio. I have a page with menu tabs linked to personal_info and portfoli...
[ "php", "jquery", "ajax", "url" ]
1
3
1,312
3
0
2011-06-01T18:22:48.343000
2011-06-01T18:24:23.103000
6,205,897
6,206,006
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
I'm trying to build an application using ant. Everything appears to be fine when I build but I continually get the above error for what I've tried so far. java -jar dist/pmml_export.jar java -cp ".:log4j-1.2.16.jar" -jar dist/pmml_export.jar java -cp log4j-1.2.16.jar -jar dist/pmml_export.jar I doubled checked to see i...
When you use the -jar option, the -cp and -classpath options are ignored. The proper way to embed the classpath with the -jar option is to set a Class-Path directive in the jar's MANIFEST.MF file.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout I'm trying to build an application using ant. Everything appears to be fine when I build but I continually get the above error for what I've tried so far. java -jar dist/pmml_export.jar java -cp ".:log4j-1.2.16.jar" -jar dist/pmml_export...
TITLE: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout QUESTION: I'm trying to build an application using ant. Everything appears to be fine when I build but I continually get the above error for what I've tried so far. java -jar dist/pmml_export.jar java -cp ".:log4j-1.2.16.jar" -ja...
[ "java", "ant", "log4j" ]
0
1
3,163
1
0
2011-06-01T18:23:52.427000
2011-06-01T18:33:37.010000
6,205,898
6,205,913
read plist iphone sdk
I am trying to read a plist file using this - NSData *data = [NSData dataWithContentsOfFile:SettingsFilePath]; NSPropertyListFormat format; NSArray *array = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:&format errorDescription:nil]; but its not working.. is the...
try with this way - NSArray *arr= [[NSArray alloc] initWithContentsOfFile:plistPath];
read plist iphone sdk I am trying to read a plist file using this - NSData *data = [NSData dataWithContentsOfFile:SettingsFilePath]; NSPropertyListFormat format; NSArray *array = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:&format errorDescription:nil]; but it...
TITLE: read plist iphone sdk QUESTION: I am trying to read a plist file using this - NSData *data = [NSData dataWithContentsOfFile:SettingsFilePath]; NSPropertyListFormat format; NSArray *array = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:&format errorDescri...
[ "iphone", "objective-c", "plist" ]
0
2
707
2
0
2011-06-01T18:23:53.613000
2011-06-01T18:25:02.427000
6,205,904
6,206,115
Function keys replacement for vim in a mac?
I would like to know which keys (or keystrokes) would you use to replace the function keys for command mapping. I'm using vim in a macbook pro and the function keys are used for some system/desktop/multimedia commands as the first option while the regular function key is accessed through the Fn modifier. Still, some of...
Vim's help has a topic about this. I generally opt for the last suggestion and use as the prefix for my mappings since I know it doesn't conflict with any default keybindings and it can easily be changed if I decide I don't want to use \.
Function keys replacement for vim in a mac? I would like to know which keys (or keystrokes) would you use to replace the function keys for command mapping. I'm using vim in a macbook pro and the function keys are used for some system/desktop/multimedia commands as the first option while the regular function key is acce...
TITLE: Function keys replacement for vim in a mac? QUESTION: I would like to know which keys (or keystrokes) would you use to replace the function keys for command mapping. I'm using vim in a macbook pro and the function keys are used for some system/desktop/multimedia commands as the first option while the regular fu...
[ "vim", "macvim" ]
0
2
3,274
2
0
2011-06-01T18:24:18.823000
2011-06-01T18:43:41.133000
6,205,908
6,205,935
Determing type of DataTable event in C++
I am creating an inheritance model for event handling (particularly for DataTables and XmlNode ). I have a super class called EventManager with the following virtual functions: DataChanged(EventArgs *arg) DataChanging(EventArgs *arg) DataInserted(EventArgs *arg) DataInserting(EventArgs *arg) DataRemoved(EventArgs *arg)...
Normally, you should invoke derived-class functionality using virtual functions. However, if you really must test for a type, do this: DataRowChangeEventArgs* foo = dynamic_cast (arg); if (foo) { // is a DataRowChangeEventArgs } Of course, you can also roll that into a single line: if (DataRowChangeEventArgs* foo = dyn...
Determing type of DataTable event in C++ I am creating an inheritance model for event handling (particularly for DataTables and XmlNode ). I have a super class called EventManager with the following virtual functions: DataChanged(EventArgs *arg) DataChanging(EventArgs *arg) DataInserted(EventArgs *arg) DataInserting(Ev...
TITLE: Determing type of DataTable event in C++ QUESTION: I am creating an inheritance model for event handling (particularly for DataTables and XmlNode ). I have a super class called EventManager with the following virtual functions: DataChanged(EventArgs *arg) DataChanging(EventArgs *arg) DataInserted(EventArgs *arg...
[ "c++", "events", "inheritance", "datatable" ]
1
5
105
1
0
2011-06-01T18:24:41.367000
2011-06-01T18:27:02.067000
6,205,910
6,207,751
PHP largest whole number from sum of unsorted array
Can someone tell me the best way to find the largest whole number summed from an unsorted array? e.g. {0.1, 0.2, 0.9, 0.5} Largest whole number possible is 1 (0.1 + 0.9). {0.9, 0.2, 0.5, 0.3, 0.9} Largest possible is 2 (0.9 + 0.9 + 0.2) thanks Update I've accepted the method that i used but some of the below will be...
I would suggest summing up the whole array and then finding the smallest sum with the decimal part equal to that of the whole sum. Unless the numbers have very high precision after the decimal point, whatever the approach to finding the exact number is, this reversal should save a lot of computation. Also, sorting the ...
PHP largest whole number from sum of unsorted array Can someone tell me the best way to find the largest whole number summed from an unsorted array? e.g. {0.1, 0.2, 0.9, 0.5} Largest whole number possible is 1 (0.1 + 0.9). {0.9, 0.2, 0.5, 0.3, 0.9} Largest possible is 2 (0.9 + 0.9 + 0.2) thanks Update I've accepted ...
TITLE: PHP largest whole number from sum of unsorted array QUESTION: Can someone tell me the best way to find the largest whole number summed from an unsorted array? e.g. {0.1, 0.2, 0.9, 0.5} Largest whole number possible is 1 (0.1 + 0.9). {0.9, 0.2, 0.5, 0.3, 0.9} Largest possible is 2 (0.9 + 0.9 + 0.2) thanks Upd...
[ "php", "math", "sum" ]
8
3
836
6
0
2011-06-01T18:24:50.320000
2011-06-01T21:10:56.153000
6,205,917
6,219,022
Silverlight - how to call a command based upon a property wihtin the view
I have been banging my head on this one for hours and I am hoping someone can point me in the correct direction. I have a button within my view which has a click event and a command attached. The click event sets the visibility of a grid row to collapsed or visible based upon the current state. xaml The click command c...
Set your Command property in a DataTrigger The Command will be set when the MyDetail panel is collapsed. Otherwise, it is unbound and nothing will happen.
Silverlight - how to call a command based upon a property wihtin the view I have been banging my head on this one for hours and I am hoping someone can point me in the correct direction. I have a button within my view which has a click event and a command attached. The click event sets the visibility of a grid row to c...
TITLE: Silverlight - how to call a command based upon a property wihtin the view QUESTION: I have been banging my head on this one for hours and I am hoping someone can point me in the correct direction. I have a button within my view which has a click event and a command attached. The click event sets the visibility ...
[ "silverlight", "mvvm", "icommand" ]
1
1
919
3
0
2011-06-01T18:25:19.063000
2011-06-02T18:55:34.607000
6,205,918
6,206,003
UIPinchGestureRecognizer not responding
I have a universal binary application and currently working on the iPad version of the application. The iPad is using a uitabbarcontroller and on the second tab I have 6 images and when adding a UIPinchGesture it is not responding. I have userInteractionEnabled=YES; I tried adding the image view programmatically and th...
Set userInteractionEnabled to YES. The default is NO. Also, in order to handle multi-touches, which is what the pinch is, multipleTouchEnabled needs to be set to YES.
UIPinchGestureRecognizer not responding I have a universal binary application and currently working on the iPad version of the application. The iPad is using a uitabbarcontroller and on the second tab I have 6 images and when adding a UIPinchGesture it is not responding. I have userInteractionEnabled=YES; I tried addin...
TITLE: UIPinchGestureRecognizer not responding QUESTION: I have a universal binary application and currently working on the iPad version of the application. The iPad is using a uitabbarcontroller and on the second tab I have 6 images and when adding a UIPinchGesture it is not responding. I have userInteractionEnabled=...
[ "iphone", "ios", "gesture", "pinch" ]
3
12
3,430
2
0
2011-06-01T18:25:22.020000
2011-06-01T18:33:26.590000
6,205,919
6,206,049
missing closing div tag
I have a website which is composed of Master page and a ascx that fits into it. Unfortenatly I see the page doesn't look the way I expect it to. After a short investigation I figured out it can be a missing closing div tag in my ascx. The problem is that the code is very very long. Is there any automated online tool th...
You can use W3C validator: http://validator.w3.org/ or you can install (if you are using Firefox) https://addons.mozilla.org/en-US/firefox/addon/html-validator/
missing closing div tag I have a website which is composed of Master page and a ascx that fits into it. Unfortenatly I see the page doesn't look the way I expect it to. After a short investigation I figured out it can be a missing closing div tag in my ascx. The problem is that the code is very very long. Is there any ...
TITLE: missing closing div tag QUESTION: I have a website which is composed of Master page and a ascx that fits into it. Unfortenatly I see the page doesn't look the way I expect it to. After a short investigation I figured out it can be a missing closing div tag in my ascx. The problem is that the code is very very l...
[ "html", "css" ]
0
4
5,002
1
0
2011-06-01T18:25:32.660000
2011-06-01T18:37:47.230000
6,205,921
6,205,980
Button underneath a ListView
My problem is similar to what this person has posted: http://groups.google.com/group/android-developers/browse_thread/thread/216839d1c45cefa9/a1b9517d2064726b?show_docid=a1b9517d2064726b That is, my button disappears when the listview grows too large for the screen. However, the solution here is to anchor the button to...
Use listView.addFooterView(button); http://developer.android.com/reference/android/widget/ListView.html#addFooterView%28android.view.View%29
Button underneath a ListView My problem is similar to what this person has posted: http://groups.google.com/group/android-developers/browse_thread/thread/216839d1c45cefa9/a1b9517d2064726b?show_docid=a1b9517d2064726b That is, my button disappears when the listview grows too large for the screen. However, the solution he...
TITLE: Button underneath a ListView QUESTION: My problem is similar to what this person has posted: http://groups.google.com/group/android-developers/browse_thread/thread/216839d1c45cefa9/a1b9517d2064726b?show_docid=a1b9517d2064726b That is, my button disappears when the listview grows too large for the screen. Howeve...
[ "android", "listview", "button" ]
0
1
346
1
0
2011-06-01T18:25:37.190000
2011-06-01T18:31:22.257000
6,205,934
6,206,014
linq how to query a specific date's data
I'm using Linq querying today's date. There is one column in my table called VisitTime which is a Datetime type. I want to know how to write query statement to search today's data. Can anyone help me on this? WebStatDataContext dc = new WebStatDataContext(_connString); var query= from v in dc. VisitorInfors where v.Vi...
When working with DateTime.Now, you should always store it in a local variable otherwise you can get really nasty bugs from the clock changing between calls: var now = DateTime.Now; var query = from v in dc.VisitorInfors where v.VisitTime.Date == now.Date select v;
linq how to query a specific date's data I'm using Linq querying today's date. There is one column in my table called VisitTime which is a Datetime type. I want to know how to write query statement to search today's data. Can anyone help me on this? WebStatDataContext dc = new WebStatDataContext(_connString); var quer...
TITLE: linq how to query a specific date's data QUESTION: I'm using Linq querying today's date. There is one column in my table called VisitTime which is a Datetime type. I want to know how to write query statement to search today's data. Can anyone help me on this? WebStatDataContext dc = new WebStatDataContext(_conn...
[ "linq" ]
2
3
642
2
0
2011-06-01T18:26:39.030000
2011-06-01T18:34:49.900000
6,205,949
6,206,013
Textbox or Datepicker in DataTemplate. Based on the data type I want one, but not both
I have a datatemplate for my listbox: However the items in the list that the listbox is bound to are not all String types. Some are DateTime and a few are Integers. I would like to have a datetimepicker displayed instead of a textbox for the DateTime types. How can I make this happen. To clarify some points the list is...
Within the Resources block of the ListBox, you could specify a DataTemplate for each type (pseudocode): Note that you don't refer to these template by an identifier; they will simply be applied to any instance of the specified DataType in their scope (the ListBox). Alternatively, you can implement a DataTemplateSelecto...
Textbox or Datepicker in DataTemplate. Based on the data type I want one, but not both I have a datatemplate for my listbox: However the items in the list that the listbox is bound to are not all String types. Some are DateTime and a few are Integers. I would like to have a datetimepicker displayed instead of a textbox...
TITLE: Textbox or Datepicker in DataTemplate. Based on the data type I want one, but not both QUESTION: I have a datatemplate for my listbox: However the items in the list that the listbox is bound to are not all String types. Some are DateTime and a few are Integers. I would like to have a datetimepicker displayed in...
[ "wpf", "vb.net" ]
0
2
801
1
0
2011-06-01T18:28:23.657000
2011-06-01T18:34:35.410000
6,205,953
6,206,008
jQuery -- selection or picker plugin capable of displaying colours
I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of the things this UI needs to do is allow users to select one option from a predefined list of colours. Ideally, elements within this list would have both a visual representation of the colour being selected, and a label (ie, a r...
if you look at the planning page for jquery UI color picker they list a bunch of color pickers edit you may like to build your own maybe start super simple with something like this (fiddle)
jQuery -- selection or picker plugin capable of displaying colours I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of the things this UI needs to do is allow users to select one option from a predefined list of colours. Ideally, elements within this list would have both a visua...
TITLE: jQuery -- selection or picker plugin capable of displaying colours QUESTION: I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of the things this UI needs to do is allow users to select one option from a predefined list of colours. Ideally, elements within this list would...
[ "javascript", "jquery", "jquery-ui", "jquery-plugins" ]
2
2
448
1
0
2011-06-01T18:28:51.643000
2011-06-01T18:34:15.483000
6,205,955
6,206,651
Algorithm for color quantization/reduced image color palette in JavaScript?
I'm writing a web app that takes a user-submitted image, gets the pixel data via a canvas element, does some processing, and then renders the image using vector shapes (using Protovis ). It's working well, but I end up with several thousand colors, and I'd like to let the user pick a target palette size and reduce the ...
With the caveat that I don't claim any expertise at all in any field of image processing: I read over the Wikipedia article you linked, and from there found Dan Bloomberg's Leptonica. From there you can download the sources for the algorithms discussed and explained. The source code is in C, which hopefully is close en...
Algorithm for color quantization/reduced image color palette in JavaScript? I'm writing a web app that takes a user-submitted image, gets the pixel data via a canvas element, does some processing, and then renders the image using vector shapes (using Protovis ). It's working well, but I end up with several thousand col...
TITLE: Algorithm for color quantization/reduced image color palette in JavaScript? QUESTION: I'm writing a web app that takes a user-submitted image, gets the pixel data via a canvas element, does some processing, and then renders the image using vector shapes (using Protovis ). It's working well, but I end up with se...
[ "javascript", "algorithm", "colors", "palette" ]
20
9
13,204
2
0
2011-06-01T18:29:06.467000
2011-06-01T19:36:29.597000