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,232,214
6,232,349
How do MemoryStream handle an assigned buffer?
Let's say that I'm assigning a buffer in the MemoryStream constructor (buffer, offset, count). How do the MemoryStream handle it? Will it copy the buffer, or use it? Will it use another buffer (autogrow) if I try to write more bytes than the length of the buffer? Couldn't find any relevant info at MSDN.
From MSDN: "Initializes a new non-resizable instance of the MemoryStream class based on the specified region (index) of a byte array." I've used the (buffer) constructor before; it uses the array as the storage, with no copying involved.
How do MemoryStream handle an assigned buffer? Let's say that I'm assigning a buffer in the MemoryStream constructor (buffer, offset, count). How do the MemoryStream handle it? Will it copy the buffer, or use it? Will it use another buffer (autogrow) if I try to write more bytes than the length of the buffer? Couldn't ...
TITLE: How do MemoryStream handle an assigned buffer? QUESTION: Let's say that I'm assigning a buffer in the MemoryStream constructor (buffer, offset, count). How do the MemoryStream handle it? Will it copy the buffer, or use it? Will it use another buffer (autogrow) if I try to write more bytes than the length of the...
[ ".net", "allocation", "memorystream" ]
2
3
237
2
0
2011-06-03T20:18:23.947000
2011-06-03T20:31:02.053000
6,232,238
6,232,639
Where is the MySql table data stored (Mac)?
I am working on syncing my MySql database on two computers (using dropbox with symlinks). The current database information is stored here: /usr/local/mysql/data When syncing the db, only the database displays along with the table names, but the data does not display. Is there another place that data is stored?
well... if you type show variables where Variable_name ='datadir'; you will see something like +---------------+---------------+ | Variable_name | Value | +---------------+---------------+ | datadir | /path/to/data | +---------------+---------------+ But to access them manually, you'll need administrator privileges
Where is the MySql table data stored (Mac)? I am working on syncing my MySql database on two computers (using dropbox with symlinks). The current database information is stored here: /usr/local/mysql/data When syncing the db, only the database displays along with the table names, but the data does not display. Is there...
TITLE: Where is the MySql table data stored (Mac)? QUESTION: I am working on syncing my MySql database on two computers (using dropbox with symlinks). The current database information is stored here: /usr/local/mysql/data When syncing the db, only the database displays along with the table names, but the data does not...
[ "mysql", "macos", "dropbox" ]
4
25
8,462
1
0
2011-06-03T20:21:21.723000
2011-06-03T20:59:10.793000
6,232,244
6,232,956
JQuery Toggle not working as it should
I have a problem with JQuery Toggle. I have the following code: var $_ = jQuery; $_(document).ready(function(){ $_("#sh-zone-buttons").delegate("#sh-zone-button-login-menu", "click", function(event) { event.stopPropagation(); event.preventDefault(); var elem_core = $_(this); $_("#sh-zone-login-menu").toggle(0, functio...
I seem to have figured this one out, but it spooks the daylight out of me. Here the HTML code for the DIV I wanted to toggle: Username or Email Password Remember me Forgot your password? Using this code above, the toggle doesn't work. But when I take out the fieldset tags, the toggle works. For the life of me I can't e...
JQuery Toggle not working as it should I have a problem with JQuery Toggle. I have the following code: var $_ = jQuery; $_(document).ready(function(){ $_("#sh-zone-buttons").delegate("#sh-zone-button-login-menu", "click", function(event) { event.stopPropagation(); event.preventDefault(); var elem_core = $_(this); $_("...
TITLE: JQuery Toggle not working as it should QUESTION: I have a problem with JQuery Toggle. I have the following code: var $_ = jQuery; $_(document).ready(function(){ $_("#sh-zone-buttons").delegate("#sh-zone-button-login-menu", "click", function(event) { event.stopPropagation(); event.preventDefault(); var elem_cor...
[ "jquery" ]
1
1
2,364
5
0
2011-06-03T20:22:07.620000
2011-06-03T21:41:25.817000
6,232,246
6,232,465
How to create a collection of singletons from all classes in a namespace
Lets say we have a namespace called AllFoos. And Lets say all classes in the AllFoos namespace implement a specific interface called IFoo and are all singletons. Now we have: HashSet myFoos = new HashSet (); What would be the code to populate the collection MyFoos with the singleton instances of all the classes in AllF...
If you would use a dependency injection framework you could: register your classes as "singleton" in the container register all implementations easily (good frameworks allow mass-registration based on some patterns) resolve all implementations of your interface as a list If you want to go the classic way, you have to t...
How to create a collection of singletons from all classes in a namespace Lets say we have a namespace called AllFoos. And Lets say all classes in the AllFoos namespace implement a specific interface called IFoo and are all singletons. Now we have: HashSet myFoos = new HashSet (); What would be the code to populate the ...
TITLE: How to create a collection of singletons from all classes in a namespace QUESTION: Lets say we have a namespace called AllFoos. And Lets say all classes in the AllFoos namespace implement a specific interface called IFoo and are all singletons. Now we have: HashSet myFoos = new HashSet (); What would be the cod...
[ "c#", "interface", "generated-code" ]
0
4
190
1
0
2011-06-03T20:22:10.687000
2011-06-03T20:43:53.797000
6,232,248
6,232,327
PHP file download gives garbage for anything BUT .pdf files
I am having an issue in which the only filetype capable of being downloaded correctly from the server is ".pdf". Other files of other file types exist in the same location, upload perfectly fine, have the correct permissions, and load just fine when I scp them off to my local machine. I can't show the entirety of the c...
What types are the other files? Are they supposed to be served as octet-streams as you're doing?: header("Content-type: application/octet-stream"); If, for example, you serve a text file with that header then how the browser interprets that file (or, more accurately, that response) may not be guaranteed.
PHP file download gives garbage for anything BUT .pdf files I am having an issue in which the only filetype capable of being downloaded correctly from the server is ".pdf". Other files of other file types exist in the same location, upload perfectly fine, have the correct permissions, and load just fine when I scp them...
TITLE: PHP file download gives garbage for anything BUT .pdf files QUESTION: I am having an issue in which the only filetype capable of being downloaded correctly from the server is ".pdf". Other files of other file types exist in the same location, upload perfectly fine, have the correct permissions, and load just fi...
[ "php", "apache", "freebsd" ]
0
1
1,056
3
0
2011-06-03T20:22:37.260000
2011-06-03T20:28:59.573000
6,232,256
6,232,354
Are there special permissions in Windows 7 to prevent file creation?
I created a program that takes in an excel file and pastes in an image of a graphical timeline based on the events in the document. But when trying this on a PC with windows 7 coming from XP and Vista I was unsuccessful in even creating the image. Is there a permission in Windows 7 that disallows a java program called ...
An application is not allowed to write under Program Files unless it's run elevated (and you don't want it to run elevated.) Write to a per-user location instead, either AppData if the user should never need to see the files, or under the user's Documents if they might (eg an export that they are supposed to upload or ...
Are there special permissions in Windows 7 to prevent file creation? I created a program that takes in an excel file and pastes in an image of a graphical timeline based on the events in the document. But when trying this on a PC with windows 7 coming from XP and Vista I was unsuccessful in even creating the image. Is ...
TITLE: Are there special permissions in Windows 7 to prevent file creation? QUESTION: I created a program that takes in an excel file and pastes in an image of a graphical timeline based on the events in the document. But when trying this on a PC with windows 7 coming from XP and Vista I was unsuccessful in even creat...
[ "java", "excel", "windows-7" ]
2
3
1,928
1
0
2011-06-03T20:23:24.420000
2011-06-03T20:31:28.680000
6,232,257
6,232,293
2D dynamic array using ArrayList in Java
I need to implement a 2D dynamic array. The number of rows is fixed, say n. But the number of columns for each row is not fixed and equivalent. For instance, the first row has 3 elements and the second row has 5 elements. How to do this in Java using Arraylist. Thanks.
How about List >? For Example: List > list = new ArrayList >(); List row1 = new ArrayList (); row1.add(new Foo()); row1.add(new Foo()); row1.add(new Foo()); list.add(row1); List row2 = new ArrayList (); row2.add(new Foo()); row2.add(new Foo()); list.add(row2);
2D dynamic array using ArrayList in Java I need to implement a 2D dynamic array. The number of rows is fixed, say n. But the number of columns for each row is not fixed and equivalent. For instance, the first row has 3 elements and the second row has 5 elements. How to do this in Java using Arraylist. Thanks.
TITLE: 2D dynamic array using ArrayList in Java QUESTION: I need to implement a 2D dynamic array. The number of rows is fixed, say n. But the number of columns for each row is not fixed and equivalent. For instance, the first row has 3 elements and the second row has 5 elements. How to do this in Java using Arraylist....
[ "java", "multidimensional-array", "arraylist" ]
4
3
12,317
9
0
2011-06-03T20:23:26.597000
2011-06-03T20:26:01.113000
6,232,264
6,235,109
JRuby 1.6.1 string function in 1.9 mode
I have just upgraded to jruby 1.6.1 and when I run in 1.9 mode, the following function fails when it encounters certain charaters. The job of the function is to strip out unwanted characters and also leading and trailing characters. I am adding the following function to the string class: class String def strip_noise() ...
I am fairly sure this is a jruby bug as it works in normal ruby 1.9.2, I have created the following jira.
JRuby 1.6.1 string function in 1.9 mode I have just upgraded to jruby 1.6.1 and when I run in 1.9 mode, the following function fails when it encounters certain charaters. The job of the function is to strip out unwanted characters and also leading and trailing characters. I am adding the following function to the strin...
TITLE: JRuby 1.6.1 string function in 1.9 mode QUESTION: I have just upgraded to jruby 1.6.1 and when I run in 1.9 mode, the following function fails when it encounters certain charaters. The job of the function is to strip out unwanted characters and also leading and trailing characters. I am adding the following fun...
[ "jruby", "jrubyonrails" ]
0
0
102
1
0
2011-06-03T20:24:13.090000
2011-06-04T06:14:15.810000
6,232,274
6,232,400
Can I mix text with binary in linux?
I want to simplify installation of the app on Linux system, to make it sort of one click. To do that I hope to combine bash script with compressed tar. So I have install.sh and some_app.tar.gz files. Then I have an Ant task that does this: cat install.sh some_app.tar.gz > some_app.exe In short, file reads itself, decom...
Perfectly feasible. Example: http://www.stuartwells.net/slides/selfextract.htm
Can I mix text with binary in linux? I want to simplify installation of the app on Linux system, to make it sort of one click. To do that I hope to combine bash script with compressed tar. So I have install.sh and some_app.tar.gz files. Then I have an Ant task that does this: cat install.sh some_app.tar.gz > some_app.e...
TITLE: Can I mix text with binary in linux? QUESTION: I want to simplify installation of the app on Linux system, to make it sort of one click. To do that I hope to combine bash script with compressed tar. So I have install.sh and some_app.tar.gz files. Then I have an Ant task that does this: cat install.sh some_app.t...
[ "linux", "bash", "unix", "fedora" ]
4
4
305
3
0
2011-06-03T20:24:55.137000
2011-06-03T20:35:18.917000
6,232,284
6,232,960
Battling with Xcode not displaying my UIWindow
See edit at the end of the question I'm trying to get a simple iPhone app up and running and failing miserably:( I have a very simple set up. I have an app delegate, a view controller, and an xib file containing a UIWindow with a UIImageView and three UIButton s on it. The problem is that when I start my app, the UIWin...
Are you adding controls to the window nib or the view controller's nib? Add your controls to the view controller nib.
Battling with Xcode not displaying my UIWindow See edit at the end of the question I'm trying to get a simple iPhone app up and running and failing miserably:( I have a very simple set up. I have an app delegate, a view controller, and an xib file containing a UIWindow with a UIImageView and three UIButton s on it. The...
TITLE: Battling with Xcode not displaying my UIWindow QUESTION: See edit at the end of the question I'm trying to get a simple iPhone app up and running and failing miserably:( I have a very simple set up. I have an app delegate, a view controller, and an xib file containing a UIWindow with a UIImageView and three UIB...
[ "objective-c", "cocoa-touch", "ios", "xib", "uiwindow" ]
1
1
1,231
2
0
2011-06-03T20:25:33.170000
2011-06-03T21:41:56.023000
6,232,288
6,232,652
Opening a browser link through notification isn't working
My problem is the following: I'm posting a notification to the notifications bar, and i've put a URI link in the intent being sent with it. As soon as i click on the notification i get a dialog what i want to do, but it's showing rubbish like Application info, Barcode scanner, Call dialog. instead of Browser. I present...
I think the problem is you're setting the data to "notificationIntent" after you give it to PendingIntent. Try this: Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); PendingIntent contentIntent = PendingIntent.getActivity(contexta, 0, notificationIntent, 0); notification....
Opening a browser link through notification isn't working My problem is the following: I'm posting a notification to the notifications bar, and i've put a URI link in the intent being sent with it. As soon as i click on the notification i get a dialog what i want to do, but it's showing rubbish like Application info, B...
TITLE: Opening a browser link through notification isn't working QUESTION: My problem is the following: I'm posting a notification to the notifications bar, and i've put a URI link in the intent being sent with it. As soon as i click on the notification i get a dialog what i want to do, but it's showing rubbish like A...
[ "android" ]
28
50
35,522
2
0
2011-06-03T20:25:43.500000
2011-06-03T21:00:24.987000
6,232,294
6,232,526
Which compiler is right? 'template' before templated return type needed?
This snippet (taken from this question ) compiles fine with g++ (as seen), so long the template before the return type is there. In contrast, VC10 does not compile that code with the following error: error C2244: 'A::getAttr': unable to match function definition to an existing declaration If I remove the template, VC10...
GCC is right. AttributeType is a dependent template-name which is followed by angle bracket <, so the keyword template is required here to remove the ambiguity 1, making it clear to the compiler that what is followed is a template-name. The rule is mentioned in §14.2/4: When the name of a member template specialization...
Which compiler is right? 'template' before templated return type needed? This snippet (taken from this question ) compiles fine with g++ (as seen), so long the template before the return type is there. In contrast, VC10 does not compile that code with the following error: error C2244: 'A::getAttr': unable to match func...
TITLE: Which compiler is right? 'template' before templated return type needed? QUESTION: This snippet (taken from this question ) compiles fine with g++ (as seen), so long the template before the return type is there. In contrast, VC10 does not compile that code with the following error: error C2244: 'A::getAttr': un...
[ "c++", "templates", "visual-c++", "g++", "correctness" ]
15
10
772
1
0
2011-06-03T20:26:04.013000
2011-06-03T20:49:35.920000
6,232,299
6,232,484
a template pattern variant problem
the implementer class 'thefoo' takes an integer from its constructor. but the base class 'foo' can not see its constructor value 'input'. because the base ctor works first. i'm need of some way to tell the base that implementer's ctor value. without changing the base can i make passed the following failingtest? public ...
You can't. Not unless you change the base class. Well, I suppose you could make protected override int intro () { return 0; } protected override int outtro () { return 100 + value; } But I think that's not what you mean. And it doesn't solve the general case of this problem (for instance, if instead of int there would ...
a template pattern variant problem the implementer class 'thefoo' takes an integer from its constructor. but the base class 'foo' can not see its constructor value 'input'. because the base ctor works first. i'm need of some way to tell the base that implementer's ctor value. without changing the base can i make passed...
TITLE: a template pattern variant problem QUESTION: the implementer class 'thefoo' takes an integer from its constructor. but the base class 'foo' can not see its constructor value 'input'. because the base ctor works first. i'm need of some way to tell the base that implementer's ctor value. without changing the base...
[ "c#", "design-patterns" ]
1
2
87
3
0
2011-06-03T20:26:18.300000
2011-06-03T20:45:52.627000
6,232,304
6,232,585
Inserting to PetaPoco with entity relationships
I have the following POCO's: [PetaPoco.TableName("Customer")] [PetaPoco.PrimaryKey("ID")] public class User { [Required(ErrorMessage = "Please enter a Forename")] [PetaPoco.Column("Name")] public string Forename { get; set; } } public class Product { public int Id { get { return 1; } } public string Name { get { retu...
After looking at Gareth Elms' blog post I see I can do it like so: db.Insert("Order", "OrderID", new { TxCode = order.VendorTxCode, CustomerID = order.WebsiteUser.ID }); Essentially you mapping again in the Insert method. Not very pretty but it does the trick. Hope there is a tidier way of doing this in the future
Inserting to PetaPoco with entity relationships I have the following POCO's: [PetaPoco.TableName("Customer")] [PetaPoco.PrimaryKey("ID")] public class User { [Required(ErrorMessage = "Please enter a Forename")] [PetaPoco.Column("Name")] public string Forename { get; set; } } public class Product { public int Id { get...
TITLE: Inserting to PetaPoco with entity relationships QUESTION: I have the following POCO's: [PetaPoco.TableName("Customer")] [PetaPoco.PrimaryKey("ID")] public class User { [Required(ErrorMessage = "Please enter a Forename")] [PetaPoco.Column("Name")] public string Forename { get; set; } } public class Product { p...
[ "petapoco" ]
2
3
2,632
2
0
2011-06-03T20:26:59.187000
2011-06-03T20:54:46.813000
6,232,305
6,237,172
Cant get a control from a TabControl DataTemplate
I've been googling this for the last 2 days and cant get anywhere, I just cant do anything to any control in a datatemplate of a tabcontrol. First off, the code: private void Window_Loaded(object sender, RoutedEventArgs e) { tabControl1.ItemsSource = new string[] { "TabA", "TabB", "TabC" }; } private void tabControl1_...
Looks like it's issue with the way the TabControl is being instantiated by the run time. It appears that the first time the SelectionChanged event is being raised the ContentTemplate is not quite ready to be accessed. If you run your code again and skip over the first access of ContentTemplate you'll see that in subseq...
Cant get a control from a TabControl DataTemplate I've been googling this for the last 2 days and cant get anywhere, I just cant do anything to any control in a datatemplate of a tabcontrol. First off, the code: private void Window_Loaded(object sender, RoutedEventArgs e) { tabControl1.ItemsSource = new string[] { "Tab...
TITLE: Cant get a control from a TabControl DataTemplate QUESTION: I've been googling this for the last 2 days and cant get anywhere, I just cant do anything to any control in a datatemplate of a tabcontrol. First off, the code: private void Window_Loaded(object sender, RoutedEventArgs e) { tabControl1.ItemsSource = n...
[ "wpf", "datatemplate", "tabcontrol" ]
5
9
3,962
1
0
2011-06-03T20:27:02.023000
2011-06-04T14:05:24
6,232,309
6,232,566
How to push a List<> to a subdocument in mongodb?
I am trying to push a List to the subdocument of a document. If I insert just a single object as BsonDocument it works as shown below: BsonDocument subdoc = new BsonDocument { { "_id", ObjectId.GenerateNewId()}, {"name", "Mr Bob"} }; var query = Query.EQ("_id", new ObjectId("1234..")); var upd = Update.Push("members",...
Since newMembers already List of BsonDocument you no need convert it to BsonDocument again. If you want push more than one document to the a nested array you need to use $pushAll: var upd = Update.PushAll("members", newMembers.ToArray()); In case if you will need push List items of some class you need convert each item...
How to push a List<> to a subdocument in mongodb? I am trying to push a List to the subdocument of a document. If I insert just a single object as BsonDocument it works as shown below: BsonDocument subdoc = new BsonDocument { { "_id", ObjectId.GenerateNewId()}, {"name", "Mr Bob"} }; var query = Query.EQ("_id", new Obj...
TITLE: How to push a List<> to a subdocument in mongodb? QUESTION: I am trying to push a List to the subdocument of a document. If I insert just a single object as BsonDocument it works as shown below: BsonDocument subdoc = new BsonDocument { { "_id", ObjectId.GenerateNewId()}, {"name", "Mr Bob"} }; var query = Query...
[ ".net", "c#-4.0", "mongodb", "mongodb-.net-driver" ]
2
1
3,218
1
0
2011-06-03T20:27:22.953000
2011-06-03T20:53:19.080000
6,232,313
6,232,577
Changing file type Paperclip
I have an existing Paperclip setup that converts all uploaded images to JPG's. However, I've noticed that PNG's and GIF's uploaded and converted to JPG's end up with a strange colors and some kind of in-versing effect. I know JPG's don't support transparency, but I've recently found the need to accept PNG's and GIF's a...
Try changing the key then using rake paperclip:refresh CLASS=User Which will regenerate all your images. Make sure you replace the class with the correct one for your app. See this link on thumbnail generation for more info.
Changing file type Paperclip I have an existing Paperclip setup that converts all uploaded images to JPG's. However, I've noticed that PNG's and GIF's uploaded and converted to JPG's end up with a strange colors and some kind of in-versing effect. I know JPG's don't support transparency, but I've recently found the nee...
TITLE: Changing file type Paperclip QUESTION: I have an existing Paperclip setup that converts all uploaded images to JPG's. However, I've noticed that PNG's and GIF's uploaded and converted to JPG's end up with a strange colors and some kind of in-versing effect. I know JPG's don't support transparency, but I've rece...
[ "ruby-on-rails", "ruby", "ruby-on-rails-3", "rubygems", "paperclip" ]
3
4
2,944
1
0
2011-06-03T20:27:51.650000
2011-06-03T20:54:09.467000
6,232,315
6,258,886
Rails 2.3.8 app working on a computer and not in another (same code and db)
In the computer that doesn't work it throws me the following error then I access the website: Expected C:/path/to/app/app/helpers/admin/dashboard_helper.rb to define Admin::DashboardHelper Do you know why is that? I don't think it's the code because I has never happened to me in my computer... Edit There's no much to s...
It turned out to be HPricot gem that was missing...whay a clear error message it threw, ha!
Rails 2.3.8 app working on a computer and not in another (same code and db) In the computer that doesn't work it throws me the following error then I access the website: Expected C:/path/to/app/app/helpers/admin/dashboard_helper.rb to define Admin::DashboardHelper Do you know why is that? I don't think it's the code be...
TITLE: Rails 2.3.8 app working on a computer and not in another (same code and db) QUESTION: In the computer that doesn't work it throws me the following error then I access the website: Expected C:/path/to/app/app/helpers/admin/dashboard_helper.rb to define Admin::DashboardHelper Do you know why is that? I don't thin...
[ "ruby-on-rails" ]
1
0
213
1
0
2011-06-03T20:28:02.380000
2011-06-06T22:48:29.893000
6,232,325
6,232,824
creating a-z bar
below is the code i am using currently but wondering is there a better way of doing what i am doing... i am creating a-z model like A B C D E....Z any thoughts? if (myEnum.MoveNext()) { MyNames t = myEnum.Current; if (t.Name.ToLower().StartsWith("a")) { if (_a == 0) { l = new Literal(); //..... _a = 1; } } if (t.Name....
You can also use "Aggregate" function provided with LINQ. string[] list = { "a", "b", "c" }; var output = list.Aggregate("", (current, listitem) => current + (Environment.NewLine + " " + listitem.ToUpper() + " "));
creating a-z bar below is the code i am using currently but wondering is there a better way of doing what i am doing... i am creating a-z model like A B C D E....Z any thoughts? if (myEnum.MoveNext()) { MyNames t = myEnum.Current; if (t.Name.ToLower().StartsWith("a")) { if (_a == 0) { l = new Literal(); //..... _a = 1...
TITLE: creating a-z bar QUESTION: below is the code i am using currently but wondering is there a better way of doing what i am doing... i am creating a-z model like A B C D E....Z any thoughts? if (myEnum.MoveNext()) { MyNames t = myEnum.Current; if (t.Name.ToLower().StartsWith("a")) { if (_a == 0) { l = new Literal...
[ "c#", "asp.net" ]
0
1
159
3
0
2011-06-03T20:28:40.663000
2011-06-03T21:22:30.573000
6,232,329
6,232,386
Extracting details from a cookie in the front end in asp.net
I have a authentication cookie and I was wondering if it would be possible extract data from the cookie in the asp.net part of the code (i.e in the HTML part).I am able to pull it out in the backend using the code below IPrincipal p = HttpContext.Current.User; // p.Identity.Name: this is what we will use to call the st...
That depends on how the auth cookie is set. If HTTPOnly is used it cannot be accessed by javascript or (if the browser is secure) client side. To access a cookie in Javascript just use var myCookieArray = document.cookie.split(";"); And loop through the array to find the cookie you are looking for. More info available ...
Extracting details from a cookie in the front end in asp.net I have a authentication cookie and I was wondering if it would be possible extract data from the cookie in the asp.net part of the code (i.e in the HTML part).I am able to pull it out in the backend using the code below IPrincipal p = HttpContext.Current.User...
TITLE: Extracting details from a cookie in the front end in asp.net QUESTION: I have a authentication cookie and I was wondering if it would be possible extract data from the cookie in the asp.net part of the code (i.e in the HTML part).I am able to pull it out in the backend using the code below IPrincipal p = HttpCo...
[ "asp.net", "asp.net-mvc" ]
0
1
696
2
0
2011-06-03T20:29:09.047000
2011-06-03T20:34:19.477000
6,232,331
6,232,364
Setting Cookies using JavaScript in a local html file
I have the following directory tree: + folder1 |--- folder2 |------ page1.html |--- page2.html If I set some cookie in page1.html using JavaScript, what is the path used for that cookie? Edit: Let me explain it better. I'm working with a local file. page1.html is being accessed through /home/user/.../folder1/folder2/pa...
From the MDC page for document.cookie: If not specified, [the path argument] defaults to the current path of the current document location. So in your case, it will be /folder1/folder2/. I didn't initially see that you'd specified "local" in the question title -- not sure if this was updated while I was writing my answ...
Setting Cookies using JavaScript in a local html file I have the following directory tree: + folder1 |--- folder2 |------ page1.html |--- page2.html If I set some cookie in page1.html using JavaScript, what is the path used for that cookie? Edit: Let me explain it better. I'm working with a local file. page1.html is be...
TITLE: Setting Cookies using JavaScript in a local html file QUESTION: I have the following directory tree: + folder1 |--- folder2 |------ page1.html |--- page2.html If I set some cookie in page1.html using JavaScript, what is the path used for that cookie? Edit: Let me explain it better. I'm working with a local file...
[ "javascript", "cookies", "cross-browser", "local-files" ]
42
25
53,468
6
0
2011-06-03T20:29:28.150000
2011-06-03T20:32:19.137000
6,232,332
6,232,653
Android WebView does not display web page correctly
I have simple WebView code like this: WebView wv = (WebView) findViewById(R.id.webview1); wv.loadUrl("http://en.wikipedia.org/wiki/Book"); But the displayed page shows wikipedia content like as if it was desktop browser which looks pretty ugly on a mobile phone. If I go to wikipedia website on my mobile phone using th...
Many sites use JavaScript for browser detection. You need to enable JavaScript for your webview. This works for me: WebView wv = (WebView) findViewById(R.id.webview1); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl("http://en.wikipedia.org/wiki/Book");
Android WebView does not display web page correctly I have simple WebView code like this: WebView wv = (WebView) findViewById(R.id.webview1); wv.loadUrl("http://en.wikipedia.org/wiki/Book"); But the displayed page shows wikipedia content like as if it was desktop browser which looks pretty ugly on a mobile phone. If I...
TITLE: Android WebView does not display web page correctly QUESTION: I have simple WebView code like this: WebView wv = (WebView) findViewById(R.id.webview1); wv.loadUrl("http://en.wikipedia.org/wiki/Book"); But the displayed page shows wikipedia content like as if it was desktop browser which looks pretty ugly on a ...
[ "android" ]
2
8
2,969
3
0
2011-06-03T20:29:32.363000
2011-06-03T21:00:25.860000
6,232,338
6,280,317
Are there Python 2.4 bindings for WebDriver?
Are there Python 2.4 bindings for WebDriver? My team is stuck using Python 2.4. Currently we're using Selenium 's WebDriver to do web testing, but we use JPype to interface with Java bindings. This has resulted in us being unable to wait for pages to load, which means we use sleeps instead, which dramatically increases...
Seemingly no, but there is a version of JPype for Python 2.4, and JPype can be used to access the Java bindings to webdriver, so in that manner python 2.4 can be used with webdriver.
Are there Python 2.4 bindings for WebDriver? Are there Python 2.4 bindings for WebDriver? My team is stuck using Python 2.4. Currently we're using Selenium 's WebDriver to do web testing, but we use JPype to interface with Java bindings. This has resulted in us being unable to wait for pages to load, which means we use...
TITLE: Are there Python 2.4 bindings for WebDriver? QUESTION: Are there Python 2.4 bindings for WebDriver? My team is stuck using Python 2.4. Currently we're using Selenium 's WebDriver to do web testing, but we use JPype to interface with Java bindings. This has resulted in us being unable to wait for pages to load, ...
[ "python", "webdriver" ]
2
0
237
1
0
2011-06-03T20:30:07.173000
2011-06-08T14:24:32.093000
6,232,344
6,233,255
Developing a subscription plan for a website
I have been working on a website that has to do with a subscription system where users will have to upgrade from one level to another. Let me explain a bit. There are four plans namely; Basic, Silver, Gold, Platimum. The cost is as follows: Basic: $0.00 Silver: $20.00 Gold: $30.00 Platimum: $50.00 The pre-payment optio...
You also need the actual sign-up-date to calculate the missing days. Lets use this example: We have a sign-up on the 15th of May (2011-05-15) and an expiration of assumed 30 days (which results in an expiration on 15th of June (2011-06-15). The PHP calculation could work like this: $signupDate = strtotime('2011-05-15')...
Developing a subscription plan for a website I have been working on a website that has to do with a subscription system where users will have to upgrade from one level to another. Let me explain a bit. There are four plans namely; Basic, Silver, Gold, Platimum. The cost is as follows: Basic: $0.00 Silver: $20.00 Gold: ...
TITLE: Developing a subscription plan for a website QUESTION: I have been working on a website that has to do with a subscription system where users will have to upgrade from one level to another. Let me explain a bit. There are four plans namely; Basic, Silver, Gold, Platimum. The cost is as follows: Basic: $0.00 Sil...
[ "php", "subscription", "subscriptions" ]
2
1
5,509
1
0
2011-06-03T20:30:43.917000
2011-06-03T22:26:39.357000
6,232,352
6,253,239
WPF MediaPlayer: How to play in sequence, sync?
I have this function: public static void Play(string FileName, bool Async = false) { System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer(); mp.Open(FileName.ToUri()); mp.Play(); } When i call Play(@"file1.mp3"); Play(@"file2.mp3"); Play(@"file3.mp3"); Play(@"file4.mp3"); all them play at same ti...
I will share my Solution with you: I created a Window: WindowPlay.xaml WindowPlay.xaml.cs: using System; using System.Windows; namespace Sistema.Util { /// /// Interaction logic for WindowPlay.xaml /// public partial class WindowPlay: Window { public WindowPlay() { try { InitializeComponent(); } catch { this.Close(); ...
WPF MediaPlayer: How to play in sequence, sync? I have this function: public static void Play(string FileName, bool Async = false) { System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer(); mp.Open(FileName.ToUri()); mp.Play(); } When i call Play(@"file1.mp3"); Play(@"file2.mp3"); Play(@"file3.mp3...
TITLE: WPF MediaPlayer: How to play in sequence, sync? QUESTION: I have this function: public static void Play(string FileName, bool Async = false) { System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer(); mp.Open(FileName.ToUri()); mp.Play(); } When i call Play(@"file1.mp3"); Play(@"file2.mp3")...
[ "c#", "wpf", "media-player" ]
0
1
6,031
2
0
2011-06-03T20:31:18.107000
2011-06-06T14:06:00.103000
6,232,353
6,232,492
rails using file in lib folder - rails 2.3.5
Normally I put files in the rails lib folder and they seem to be loaded automatically. I recently tried putting this file: https://gist.github.com/85632 in my lib folder. From one of my models when I try to do: ftp = Net::FTPS::Implicit::new( I get: NameError: uninitialized constant Net::FTPS from /Library/Ruby/Gems/1....
Rails 2 will load up files by convention. So when you request: Net::FTPS::Implicit::new... it will look for the file: lib/net/ftps/implicit... to define that class. I don't think Rails 2 actually loads everything up in the lib folder - it only looks in there for a file when something is requested.
rails using file in lib folder - rails 2.3.5 Normally I put files in the rails lib folder and they seem to be loaded automatically. I recently tried putting this file: https://gist.github.com/85632 in my lib folder. From one of my models when I try to do: ftp = Net::FTPS::Implicit::new( I get: NameError: uninitialized ...
TITLE: rails using file in lib folder - rails 2.3.5 QUESTION: Normally I put files in the rails lib folder and they seem to be loaded automatically. I recently tried putting this file: https://gist.github.com/85632 in my lib folder. From one of my models when I try to do: ftp = Net::FTPS::Implicit::new( I get: NameErr...
[ "ruby-on-rails", "require" ]
0
1
1,089
2
0
2011-06-03T20:31:23.830000
2011-06-03T20:46:14.570000
6,232,355
6,232,436
Deleting all the rows in a JTable
I need to remove all the rows in my JTable. I have tried both of the following: /** * Removes all the rows in the table */ public void clearTable() { DefaultTableModel dm = (DefaultTableModel) getModel(); dm.getDataVector().removeAllElements(); revalidate(); } and ((DefaultTableModel)table.getModel()).setNumRows(0); Ne...
The following code worked for me: DefaultTableModel dm = (DefaultTableModel) getModel(); int rowCount = dm.getRowCount(); //Remove rows one by one from the end of the table for (int i = rowCount - 1; i >= 0; i--) { dm.removeRow(i); }
Deleting all the rows in a JTable I need to remove all the rows in my JTable. I have tried both of the following: /** * Removes all the rows in the table */ public void clearTable() { DefaultTableModel dm = (DefaultTableModel) getModel(); dm.getDataVector().removeAllElements(); revalidate(); } and ((DefaultTableModel)t...
TITLE: Deleting all the rows in a JTable QUESTION: I need to remove all the rows in my JTable. I have tried both of the following: /** * Removes all the rows in the table */ public void clearTable() { DefaultTableModel dm = (DefaultTableModel) getModel(); dm.getDataVector().removeAllElements(); revalidate(); } and ((D...
[ "java", "swing", "jtable" ]
33
41
122,414
15
0
2011-06-03T20:31:30.020000
2011-06-03T20:39:57.737000
6,232,370
6,232,418
How do I change C file operation to Objective C?
char buf[32]; FILE *fp = fopen("test.txt", "r"); fscanf(fp, "%s", buf); fclose(fp); I want to change above C file operations to Objective-C. How do I change? Is not there fscanf kind of thing in Objective-C?
You don't. You can't scan from FILE * directly into an NSString. However, once you've read into the buffer, you can create an NSString from it: NSString *str = [NSString stringWithCString: buf encoding: NSASCIIStringEncoding]; // or whatever NOTE, however, that using fscanf as you have here will cause a buffer overflow...
How do I change C file operation to Objective C? char buf[32]; FILE *fp = fopen("test.txt", "r"); fscanf(fp, "%s", buf); fclose(fp); I want to change above C file operations to Objective-C. How do I change? Is not there fscanf kind of thing in Objective-C?
TITLE: How do I change C file operation to Objective C? QUESTION: char buf[32]; FILE *fp = fopen("test.txt", "r"); fscanf(fp, "%s", buf); fclose(fp); I want to change above C file operations to Objective-C. How do I change? Is not there fscanf kind of thing in Objective-C? ANSWER: You don't. You can't scan from FILE ...
[ "ios", "objective-c" ]
0
2
415
3
0
2011-06-03T20:32:53.510000
2011-06-03T20:37:56.270000
6,232,373
6,232,987
Converting a Telerik ASP.NET application to MVC?
I've done a little bit of poking around with this, and I am hoping it is not as bad as I think. I have an ASP.NET project using Telerik Control for ASP.NET AJAX integrated into an MVC solution. The.NET project runs fine, but is a circular block in a square hole. The interactions between my Telerik controls are complex....
If you are just trying to update the content of one of the panels you can do it using the client side API (http://demos.telerik.com/aspnet-mvc/splitter/clientsideapi) splitter.ajaxRequest(pane [, URL]) - refreshes the content of a pane with specified content URL (load-on-demand). If URL is specified, data is fetched fr...
Converting a Telerik ASP.NET application to MVC? I've done a little bit of poking around with this, and I am hoping it is not as bad as I think. I have an ASP.NET project using Telerik Control for ASP.NET AJAX integrated into an MVC solution. The.NET project runs fine, but is a circular block in a square hole. The inte...
TITLE: Converting a Telerik ASP.NET application to MVC? QUESTION: I've done a little bit of poking around with this, and I am hoping it is not as bad as I think. I have an ASP.NET project using Telerik Control for ASP.NET AJAX integrated into an MVC solution. The.NET project runs fine, but is a circular block in a squ...
[ "asp.net-mvc", "telerik" ]
0
1
751
2
0
2011-06-03T20:33:04.900000
2011-06-03T21:46:09.967000
6,232,377
6,232,450
How to merge path in Eclipse package explorer hierarchical view
I'm using eclipse in MacOS,and I set package explorer to hierarchical view now,package look like this: util org abc db sql Connection.java but in win7,look like this: util org.abc.db.sql Connection.java they can auto merge empty package path how can I merge empty package path in eclipse @ MacOS?
Open the little triangle menu on the top of the view and select filters. This will open a dialog window where you can configure several aspect of the view. One of them is "empty parent packages" which will hide those packages if it is enable.
How to merge path in Eclipse package explorer hierarchical view I'm using eclipse in MacOS,and I set package explorer to hierarchical view now,package look like this: util org abc db sql Connection.java but in win7,look like this: util org.abc.db.sql Connection.java they can auto merge empty package path how can I merg...
TITLE: How to merge path in Eclipse package explorer hierarchical view QUESTION: I'm using eclipse in MacOS,and I set package explorer to hierarchical view now,package look like this: util org abc db sql Connection.java but in win7,look like this: util org.abc.db.sql Connection.java they can auto merge empty package p...
[ "eclipse" ]
2
2
2,576
1
0
2011-06-03T20:33:24.477000
2011-06-03T20:42:25.993000
6,232,383
6,232,448
Little help with JavaScript code involving setTimeout() method
I am trying to understand two things about this code: var updateFn = function(num){ return function(){ if(num == 6){ console.info("100%, all items saved!") } else{ var i = num/6; var pct = Math.round(100 * i); console.info(pct + "% saved"); } }; }; for (var i = 1; i < 7; i++){ setTimeout(updateFn(i), i * 500); } Accor...
It seems it is setting 6 timeouts to occur every 500ms. I think setInterval may be better here. You want to return a function because if you pass a string to setTimeout it gets eval ed, and if you pass a function it just runs it. It seems this code is making a progress meter for a save operation, though assuming the sa...
Little help with JavaScript code involving setTimeout() method I am trying to understand two things about this code: var updateFn = function(num){ return function(){ if(num == 6){ console.info("100%, all items saved!") } else{ var i = num/6; var pct = Math.round(100 * i); console.info(pct + "% saved"); } }; }; for (va...
TITLE: Little help with JavaScript code involving setTimeout() method QUESTION: I am trying to understand two things about this code: var updateFn = function(num){ return function(){ if(num == 6){ console.info("100%, all items saved!") } else{ var i = num/6; var pct = Math.round(100 * i); console.info(pct + "% saved")...
[ "javascript", "settimeout" ]
2
1
1,345
3
0
2011-06-03T20:33:48.200000
2011-06-03T20:42:00.030000
6,232,390
6,233,282
Is there a proved mouseOver workaround for FirefoxDriver in Selenium2?
I'm using Selenium Java 2.0b3. I have this code:... WebDriver driver = new InternetExplorerDriver(); Selenium seleniumDriver = new WebDriverBackedSelenium(driver, "http://localhost:8088/Sistema/");...... RenderedWebElement menuRegistrar = (RenderedWebElement)driver.findElement(By.xpath("//a[normalize-space()='Registrar...
I would suggest trying the Advanced User Actions API that was added in the 2.0rc1 release yesterday, as it looks like you're using the Selenium 1 API still (going through WebDriverBackedSelenium), and I'm not sure how much Firefox 4 support that provides. I'm not using Java for my Selenium tests, but it looks to me lik...
Is there a proved mouseOver workaround for FirefoxDriver in Selenium2? I'm using Selenium Java 2.0b3. I have this code:... WebDriver driver = new InternetExplorerDriver(); Selenium seleniumDriver = new WebDriverBackedSelenium(driver, "http://localhost:8088/Sistema/");...... RenderedWebElement menuRegistrar = (RenderedW...
TITLE: Is there a proved mouseOver workaround for FirefoxDriver in Selenium2? QUESTION: I'm using Selenium Java 2.0b3. I have this code:... WebDriver driver = new InternetExplorerDriver(); Selenium seleniumDriver = new WebDriverBackedSelenium(driver, "http://localhost:8088/Sistema/");...... RenderedWebElement menuRegi...
[ "java", "webdriver", "selenium-webdriver" ]
19
18
27,936
3
0
2011-06-03T20:34:33.477000
2011-06-03T22:29:44.470000
6,232,391
6,232,449
Windows Mobile Development Unavailable in Visual Studio 2010
OK, everyone knows that Windows Mobile Development has been abandoned by Microsoft's Visual Studio Team when it came to Visual Studio 2010. Instead, we are supposed to use the Windows 7 Phone SDK. Meanwhile, our manufacturing plant still has hundreds of the older Windows Mobile 5 and 6 handheld devices for scanning pac...
I don't think there's an official way of using VS2010 for older mobile development. Instead, it's suggested that you stick with VS2008 or VS2005 SE for development.
Windows Mobile Development Unavailable in Visual Studio 2010 OK, everyone knows that Windows Mobile Development has been abandoned by Microsoft's Visual Studio Team when it came to Visual Studio 2010. Instead, we are supposed to use the Windows 7 Phone SDK. Meanwhile, our manufacturing plant still has hundreds of the o...
TITLE: Windows Mobile Development Unavailable in Visual Studio 2010 QUESTION: OK, everyone knows that Windows Mobile Development has been abandoned by Microsoft's Visual Studio Team when it came to Visual Studio 2010. Instead, we are supposed to use the Windows 7 Phone SDK. Meanwhile, our manufacturing plant still has...
[ "silverlight", "visual-studio-2010", "windows-mobile" ]
0
2
2,662
2
0
2011-06-03T20:34:40.030000
2011-06-03T20:42:17.997000
6,232,393
6,268,532
DataContext SubmitChanges
I am using LINQ-to-SQL. I have retrieved an Entity called FileType using FileTypeID from the respository. Now I have created an entity called ExportFile. ExportFile is a child of FileType. so here is what I have done: var itemType = Repository.Current.ItemRepository.GetItemTypeByID(100); Now I create a ExportFile Entit...
DomainRepositoryManager.Current.SubmitAllChanges(); would be good to save the changes in the database.
DataContext SubmitChanges I am using LINQ-to-SQL. I have retrieved an Entity called FileType using FileTypeID from the respository. Now I have created an entity called ExportFile. ExportFile is a child of FileType. so here is what I have done: var itemType = Repository.Current.ItemRepository.GetItemTypeByID(100); Now I...
TITLE: DataContext SubmitChanges QUESTION: I am using LINQ-to-SQL. I have retrieved an Entity called FileType using FileTypeID from the respository. Now I have created an entity called ExportFile. ExportFile is a child of FileType. so here is what I have done: var itemType = Repository.Current.ItemRepository.GetItemTy...
[ "linq-to-sql" ]
0
0
458
1
0
2011-06-03T20:34:49.697000
2011-06-07T16:31:46.370000
6,232,394
6,232,495
Move several commits from one branch to another?
I started with branches master and develop. I made branch foo based off of develop. 7 commits later and now I realize I wish I made it off of master. I can cherry pick each commit, no big deal, but is there a slicker way?
Try this. You can leave off the foo if it's the currently checked-out branch. git rebase --onto master develop foo
Move several commits from one branch to another? I started with branches master and develop. I made branch foo based off of develop. 7 commits later and now I realize I wish I made it off of master. I can cherry pick each commit, no big deal, but is there a slicker way?
TITLE: Move several commits from one branch to another? QUESTION: I started with branches master and develop. I made branch foo based off of develop. 7 commits later and now I realize I wish I made it off of master. I can cherry pick each commit, no big deal, but is there a slicker way? ANSWER: Try this. You can leav...
[ "git", "rebase", "cherry-pick" ]
6
4
214
1
0
2011-06-03T20:34:51.597000
2011-06-03T20:46:47.263000
6,232,395
6,232,440
jQuery append not working in Internet Explorer 8
I'm having a problem with jQuery append just in Internet Explorer 8 (I didn't check earlier versions). On launch (in a ready() function) I append a div to my container div. This doesn't work in IE8 though, no div is added. I checked this by returning the length of $('div#options') in the console. Why isn't this working...
Perhaps your broken links are causing the issue $('div#container').append(' Delete Edit ');
jQuery append not working in Internet Explorer 8 I'm having a problem with jQuery append just in Internet Explorer 8 (I didn't check earlier versions). On launch (in a ready() function) I append a div to my container div. This doesn't work in IE8 though, no div is added. I checked this by returning the length of $('div...
TITLE: jQuery append not working in Internet Explorer 8 QUESTION: I'm having a problem with jQuery append just in Internet Explorer 8 (I didn't check earlier versions). On launch (in a ready() function) I append a div to my container div. This doesn't work in IE8 though, no div is added. I checked this by returning th...
[ "jquery", "html", "internet-explorer-8", "append" ]
3
10
10,488
3
0
2011-06-03T20:34:53.587000
2011-06-03T20:40:10.677000
6,232,396
6,232,686
Google-alike search algorithm
I am trying to implement a search algorithm in my simple datastructure. However, this is not a "HOW DO I DO THIS?"-question, but rather a "how could i optimize the algorithm?" I am trying to keep a index of files, and each file can be associated with any number of tags (which acts like a category) This is how my data i...
You could use a kind of Bloom filter (at least this is part of Google's strategy). First you look up for entries with all of the entered tags. If you find nothing, try out all combinations with one tag missing, then with two tags missing... until you have enough matches. The lookup in the Bloom filter is very fast, so ...
Google-alike search algorithm I am trying to implement a search algorithm in my simple datastructure. However, this is not a "HOW DO I DO THIS?"-question, but rather a "how could i optimize the algorithm?" I am trying to keep a index of files, and each file can be associated with any number of tags (which acts like a c...
TITLE: Google-alike search algorithm QUESTION: I am trying to implement a search algorithm in my simple datastructure. However, this is not a "HOW DO I DO THIS?"-question, but rather a "how could i optimize the algorithm?" I am trying to keep a index of files, and each file can be associated with any number of tags (w...
[ "php", "sql", "algorithm", "search-engine" ]
3
6
2,454
2
0
2011-06-03T20:34:58.260000
2011-06-03T21:03:48.020000
6,232,408
6,232,453
Rails-like escaping javascript with PHP
I'm trying to write the equivalent of Rails escape_javascript() in php with a preg_match() Is there any php built in function? Can someone help? http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-escape_javascript # File actionpack/lib/action_view/helpers/javascript_helper.rb, line 50 ...
json_encode() I can't say that it's a one-to-one match, but it's a straightforward way to escape JavaScript values in PHP.
Rails-like escaping javascript with PHP I'm trying to write the equivalent of Rails escape_javascript() in php with a preg_match() Is there any php built in function? Can someone help? http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-escape_javascript # File actionpack/lib/action_vie...
TITLE: Rails-like escaping javascript with PHP QUESTION: I'm trying to write the equivalent of Rails escape_javascript() in php with a preg_match() Is there any php built in function? Can someone help? http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-escape_javascript # File actionp...
[ "php", "javascript", "ruby-on-rails", "escaping" ]
1
4
163
1
0
2011-06-03T20:36:34.990000
2011-06-03T20:42:46.147000
6,232,411
6,250,554
Is there a way to tell when reintegrate option used with svn merge?
Is there a way in Subversion 1.6, using logs, mergeinfo, etc., to determine when a merge was done with the --reintegrate option? (This presumes one knows which commits are the results of merges.)
The only information stored is the list of revisions that were merged. How they were merged is not recorded. You can make a good guess by examining the file contents, though: After a reintegrate merge, the only difference between merge source and merge destination will be those revisions of the merge destination that w...
Is there a way to tell when reintegrate option used with svn merge? Is there a way in Subversion 1.6, using logs, mergeinfo, etc., to determine when a merge was done with the --reintegrate option? (This presumes one knows which commits are the results of merges.)
TITLE: Is there a way to tell when reintegrate option used with svn merge? QUESTION: Is there a way in Subversion 1.6, using logs, mergeinfo, etc., to determine when a merge was done with the --reintegrate option? (This presumes one knows which commits are the results of merges.) ANSWER: The only information stored i...
[ "svn", "svn-merge", "svn-reintegrate" ]
0
0
81
1
0
2011-06-03T20:37:00.990000
2011-06-06T10:14:30.680000
6,232,412
6,232,479
Reason for DOMElement::getAttribute() returning an empty string when there is no such attribute
In the php docs it says: Return Values The value of the attribute, or an empty string if no attribute with the given name is found. Does anybody know the reason for returning an empty string instead of just NULL?
The point is that the DOM specification is not platform-specific. It was written to be implemented in a wide variety of programming languages, so it tends not to assume the existence of types such as null. The W3C can assume the existence of a string type, so it's safe to use an empty string. So the specification reads...
Reason for DOMElement::getAttribute() returning an empty string when there is no such attribute In the php docs it says: Return Values The value of the attribute, or an empty string if no attribute with the given name is found. Does anybody know the reason for returning an empty string instead of just NULL?
TITLE: Reason for DOMElement::getAttribute() returning an empty string when there is no such attribute QUESTION: In the php docs it says: Return Values The value of the attribute, or an empty string if no attribute with the given name is found. Does anybody know the reason for returning an empty string instead of just...
[ "php", "dom" ]
1
2
1,313
2
0
2011-06-03T20:37:08.847000
2011-06-03T20:45:07.667000
6,232,415
6,236,865
Posting a message on FB that a user has installed an application (like FB app)
Is there a way to post if a user of my application has installed the app? Just like when Facebook for Android posts "USER installed the Facebook for Android application on his phone." What type of message is this? I can't find it in the documentation of Graph API or maybe i just missed something. Anybody with some expe...
Ok i've got the answer on FB dev forums. It's called discovery (feed) story and it's handled by FB only. So it cannot be controlled by the app/developer. So it's kind of automatic for our apps in a FB way if this message appears or not.
Posting a message on FB that a user has installed an application (like FB app) Is there a way to post if a user of my application has installed the app? Just like when Facebook for Android posts "USER installed the Facebook for Android application on his phone." What type of message is this? I can't find it in the docu...
TITLE: Posting a message on FB that a user has installed an application (like FB app) QUESTION: Is there a way to post if a user of my application has installed the app? Just like when Facebook for Android posts "USER installed the Facebook for Android application on his phone." What type of message is this? I can't f...
[ "android", "facebook" ]
0
1
605
3
0
2011-06-03T20:37:14.443000
2011-06-04T12:59:24.037000
6,232,434
6,232,451
custom UITextField with image as a background blinking cursor issue
I have a custom UITextField with a UIImage as a background. Now when I type in a text into this UITextField and the cursor is blinking I get this: I don't want to have a white image on the cursor blinking as it destroys the aesthetics. I tried playing around with this and tried setting the background view to have the s...
Have you tried setting textField.backgroundColor = [UIColor clearColor]? You can use a UIImageView for the image and then add a UITextField as a subview with clear background. Just create UIImageView *imageView and UITextField *textField, either programmatically or in the IB. If you go programmatically, use [imageView ...
custom UITextField with image as a background blinking cursor issue I have a custom UITextField with a UIImage as a background. Now when I type in a text into this UITextField and the cursor is blinking I get this: I don't want to have a white image on the cursor blinking as it destroys the aesthetics. I tried playing ...
TITLE: custom UITextField with image as a background blinking cursor issue QUESTION: I have a custom UITextField with a UIImage as a background. Now when I type in a text into this UITextField and the cursor is blinking I get this: I don't want to have a white image on the cursor blinking as it destroys the aesthetics...
[ "iphone", "objective-c", "ipad", "uitextfield" ]
1
2
3,815
3
0
2011-06-03T20:39:53.440000
2011-06-03T20:42:32.650000
6,232,441
6,253,556
Struts 2 JUnit Plugin v2.2.3: Test Class Extending StrutsTestCase; 'request' is null
I am attempting to use the Struts2 JUnit Plugin (v2.2.3 w/ Struts2 v2.2.3) and have run into several issues. I attempted to use the Struts2 JUnit Plugin Tutorial as a guide. The first change I needed to make (not in the guide) is to annotate my test class with: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfigurat...
I do not use Spring w/in my struts app, but I assume these jars are needed to use the mock request object and such in the StrutsTestCase. Given the exception messages you're seeing above your application believes that it uses Spring. Do you have the Struts2-Spring-Plugin on your classpath? If you're not using Spring fo...
Struts 2 JUnit Plugin v2.2.3: Test Class Extending StrutsTestCase; 'request' is null I am attempting to use the Struts2 JUnit Plugin (v2.2.3 w/ Struts2 v2.2.3) and have run into several issues. I attempted to use the Struts2 JUnit Plugin Tutorial as a guide. The first change I needed to make (not in the guide) is to an...
TITLE: Struts 2 JUnit Plugin v2.2.3: Test Class Extending StrutsTestCase; 'request' is null QUESTION: I am attempting to use the Struts2 JUnit Plugin (v2.2.3 w/ Struts2 v2.2.3) and have run into several issues. I attempted to use the Struts2 JUnit Plugin Tutorial as a guide. The first change I needed to make (not in t...
[ "plugins", "struts2", "junit4" ]
1
3
6,692
1
0
2011-06-03T20:40:35.247000
2011-06-06T14:30:38.210000
6,232,443
6,234,449
Obtain cookies of the page being visited
I want to know how can we obtain the cookies of the current page being accessed using a communication link between the content script and background page. This is for an extension.
You can use Content Scripts to access document.cookie for each website you visit. Then you can use Message Passing to pass the cookies from your Content Script to your Background Page. There are many examples on Stack Overflow for example: Chrome Extension: how to capture selected text and send to a web service Chrome ...
Obtain cookies of the page being visited I want to know how can we obtain the cookies of the current page being accessed using a communication link between the content script and background page. This is for an extension.
TITLE: Obtain cookies of the page being visited QUESTION: I want to know how can we obtain the cookies of the current page being accessed using a communication link between the content script and background page. This is for an extension. ANSWER: You can use Content Scripts to access document.cookie for each website ...
[ "google-chrome", "google-chrome-extension", "messaging" ]
1
1
792
1
0
2011-06-03T20:40:57.720000
2011-06-04T03:06:50.087000
6,232,444
6,233,516
sub object functions in javascript
I know you can create literal objects with subobjects and functions: var obj = { val: 1, level1: { val: 2, val2: 3, func: function(){ return this.val2 } } } console.log(obj.val); console.log(obj.level1.val); console.log(obj.level1.func()); outputs: 1 2 3 What I would like to do is do the same thing with methods in a o...
you can do this easily with chaining function Box() { this.show = function(){ //your code goes here return this; }, this.message = function(message){ //code goes here return this; } } var aBox = new Box(); aBox.message('the message').show()
sub object functions in javascript I know you can create literal objects with subobjects and functions: var obj = { val: 1, level1: { val: 2, val2: 3, func: function(){ return this.val2 } } } console.log(obj.val); console.log(obj.level1.val); console.log(obj.level1.func()); outputs: 1 2 3 What I would like to do is do...
TITLE: sub object functions in javascript QUESTION: I know you can create literal objects with subobjects and functions: var obj = { val: 1, level1: { val: 2, val2: 3, func: function(){ return this.val2 } } } console.log(obj.val); console.log(obj.level1.val); console.log(obj.level1.func()); outputs: 1 2 3 What I woul...
[ "javascript" ]
3
3
11,279
3
0
2011-06-03T20:41:03.257000
2011-06-03T23:13:08.563000
6,232,446
6,232,459
Float or Double?
Which is faster, double or float, when preforming arithimic (+-*/%), and is it worth just using float for memory reasons? Precision is not an issue much of an issue. Feel free to call me crazy for even thinking this. Just curious as I see the amount of floats I'm using is getting larger. EDIT 1: The only reason this is...
I wouldn't advise either for fast operations but I would believe that a operations on floats would be faster as they are 32 bit vs 64 bit in doubles.
Float or Double? Which is faster, double or float, when preforming arithimic (+-*/%), and is it worth just using float for memory reasons? Precision is not an issue much of an issue. Feel free to call me crazy for even thinking this. Just curious as I see the amount of floats I'm using is getting larger. EDIT 1: The on...
TITLE: Float or Double? QUESTION: Which is faster, double or float, when preforming arithimic (+-*/%), and is it worth just using float for memory reasons? Precision is not an issue much of an issue. Feel free to call me crazy for even thinking this. Just curious as I see the amount of floats I'm using is getting larg...
[ "android", "performance", "memory", "floating-point" ]
30
6
39,046
8
0
2011-06-03T20:41:33.820000
2011-06-03T20:43:17.780000
6,232,464
6,232,644
How to determine the length of a graphic string?
I'm creating a graphical timeline out of an excel document and I need to have small tags of the name of the event next to the marker for that event. Some of these are easy and are right justified but others are left justified and I need to figure out their width so that I can properly offset them. window.drawString("7/...
This thread explains how to do it: Calculate the display width of a string in Java You should first get the font metrics, and then ask the metrics how wide a certain string is.
How to determine the length of a graphic string? I'm creating a graphical timeline out of an excel document and I need to have small tags of the name of the event next to the marker for that event. Some of these are easy and are right justified but others are left justified and I need to figure out their width so that ...
TITLE: How to determine the length of a graphic string? QUESTION: I'm creating a graphical timeline out of an excel document and I need to have small tags of the name of the event next to the marker for that event. Some of these are easy and are right justified but others are left justified and I need to figure out th...
[ "java", "swing", "graphics", "font-size" ]
9
8
7,620
5
0
2011-06-03T20:43:46.627000
2011-06-03T20:59:43.037000
6,232,470
6,232,500
Storing data for desktop application
I mainly develop Java EE webapps so I don't have any experiences with desktop application at all. Now a friend of mine needed a little tool for daily business which I've build with Seam and a MySQL db in the background. In case of my experience this was done really fast. Now I want to go further and produce a real smal...
XML would work for small sets up data, but if you are going to have larger sets I would recommend something like sqlite. http://www.sqlite.org/
Storing data for desktop application I mainly develop Java EE webapps so I don't have any experiences with desktop application at all. Now a friend of mine needed a little tool for daily business which I've build with Seam and a MySQL db in the background. In case of my experience this was done really fast. Now I want ...
TITLE: Storing data for desktop application QUESTION: I mainly develop Java EE webapps so I don't have any experiences with desktop application at all. Now a friend of mine needed a little tool for daily business which I've build with Seam and a MySQL db in the background. In case of my experience this was done really...
[ "c#", "mono" ]
2
5
277
4
0
2011-06-03T20:44:21.213000
2011-06-03T20:47:16.457000
6,232,483
6,232,572
MVC design issue
I'm having an application using MVC. It has a canvas and property grid. When an item is selected in the canvas. The property grid should display its details. So I made an event listener and when item is selected in the canvas it raises an event to the controller which pass the selected item to the property grid to disp...
Bind to a source rather than DataContext, sources are provided by ElementName, RelativeSource & Source, so you can name the View for example and use ElementName to get it as source then the Path could be DataContext.LookupValues or whatever your property in the model (- the DataContext of the View is your model -) is c...
MVC design issue I'm having an application using MVC. It has a canvas and property grid. When an item is selected in the canvas. The property grid should display its details. So I made an event listener and when item is selected in the canvas it raises an event to the controller which pass the selected item to the prop...
TITLE: MVC design issue QUESTION: I'm having an application using MVC. It has a canvas and property grid. When an item is selected in the canvas. The property grid should display its details. So I made an event listener and when item is selected in the canvas it raises an event to the controller which pass the selecte...
[ "c#", "wpf", "model-view-controller", "grid", "datacontext" ]
1
2
236
1
0
2011-06-03T20:45:48.667000
2011-06-03T20:53:36.183000
6,232,497
6,232,507
Difference between echo and print_r in php?
Possible Duplicate: What’s the difference between echo, print, and print_r in PHP? I am able to use both of these with seemingly the same effect. Is there a difference between the two? And is one preferred over the other? Thanks!
The difference is that print_r recursively prints an array (or object, but it doesn't look as nice), showing all keys and values. echo does not, and is intended for scalar values.
Difference between echo and print_r in php? Possible Duplicate: What’s the difference between echo, print, and print_r in PHP? I am able to use both of these with seemingly the same effect. Is there a difference between the two? And is one preferred over the other? Thanks!
TITLE: Difference between echo and print_r in php? QUESTION: Possible Duplicate: What’s the difference between echo, print, and print_r in PHP? I am able to use both of these with seemingly the same effect. Is there a difference between the two? And is one preferred over the other? Thanks! ANSWER: The difference is t...
[ "php" ]
0
10
15,507
5
0
2011-06-03T20:47:02.033000
2011-06-03T20:48:00.840000
6,232,499
6,232,517
Stop external program when Java program is stopped
I'm executing an external program which runs alongside Java using this: Process p = Runtime.getRuntime().exec("/path/to/binary"); When I stop the Java application, the external program continues to run but I want this to stop too.
To trigger the shutdown, you could add a shutdown hook to your Java application. See Runtime.addShutdownHook(). To effect the shutdown, you could either communicate to the external process a request to stop gracefully, or call Process.destroy()
Stop external program when Java program is stopped I'm executing an external program which runs alongside Java using this: Process p = Runtime.getRuntime().exec("/path/to/binary"); When I stop the Java application, the external program continues to run but I want this to stop too.
TITLE: Stop external program when Java program is stopped QUESTION: I'm executing an external program which runs alongside Java using this: Process p = Runtime.getRuntime().exec("/path/to/binary"); When I stop the Java application, the external program continues to run but I want this to stop too. ANSWER: To trigger ...
[ "java", "executable" ]
5
4
1,498
2
0
2011-06-03T20:47:06.640000
2011-06-03T20:49:06.717000
6,232,504
6,232,640
How to set User-Agent with LWP?
I have the Perl & LWP book, but how do I set the user-agent string? This is what I've got: use LWP::UserAgent; use LWP::Simple; # Used to download files my $u = URI->new($url); my $response_u = LWP::UserAgent->new->get($u); die "Error: ", $response_u->status_line unless $response_u->is_success; Any suggestions, if I w...
From the LWP cookbook: use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("$0/0.1 ". $ua->agent); # $ua->agent("Mozilla/8.0") # pretend we are very capable browser $req = new HTTP::Request 'GET' => 'http://www.sn.no/libwww-perl'; $req->header('Accept' => 'text/html'); # send request $res = $ua->request($req);
How to set User-Agent with LWP? I have the Perl & LWP book, but how do I set the user-agent string? This is what I've got: use LWP::UserAgent; use LWP::Simple; # Used to download files my $u = URI->new($url); my $response_u = LWP::UserAgent->new->get($u); die "Error: ", $response_u->status_line unless $response_u->is_...
TITLE: How to set User-Agent with LWP? QUESTION: I have the Perl & LWP book, but how do I set the user-agent string? This is what I've got: use LWP::UserAgent; use LWP::Simple; # Used to download files my $u = URI->new($url); my $response_u = LWP::UserAgent->new->get($u); die "Error: ", $response_u->status_line unles...
[ "perl" ]
9
13
12,853
2
0
2011-06-03T20:47:33.570000
2011-06-03T20:59:14.880000
6,232,519
6,233,947
Generating OL LI tree structure from a recursive call of Java method
I have list of objects type Node ( items ). And Node class has children in it ( childItems ). I Want to print this structure in ol li html markup. Preparing in a recursive method. But there is some issue in my logic. Have a look on my code. The the size of the items will be 2. According to given sample markup. Means 2 ...
Here is one example (my comment about functions calling each other): public class LiOl { static StringBuilder sb = new StringBuilder(); static void printList(List l) { if (l == null || l.size() == 0) { return; } sb.append(" "); for (Node n: l) { printNode(n); } sb.append(" "); } static void printNode(Node n) { sb.app...
Generating OL LI tree structure from a recursive call of Java method I have list of objects type Node ( items ). And Node class has children in it ( childItems ). I Want to print this structure in ol li html markup. Preparing in a recursive method. But there is some issue in my logic. Have a look on my code. The the si...
TITLE: Generating OL LI tree structure from a recursive call of Java method QUESTION: I have list of objects type Node ( items ). And Node class has children in it ( childItems ). I Want to print this structure in ol li html markup. Preparing in a recursive method. But there is some issue in my logic. Have a look on m...
[ "java", "recursion" ]
1
1
806
2
0
2011-06-03T20:49:23.900000
2011-06-04T00:50:26.920000
6,232,523
6,240,794
Adding POM type dependency using m2eclipse, unable to resolve
I am trying to add Hector dependencies to my POM. My IDE is Eclipse, and I am also using m2eclipse. Adding dependencies of JAR type is not a problem, but this dependency is of type POM. I have tried almost everything usual including cleaning, building, and using import scope but nothing seem to have helped. When I try ...
The error indicates that the relevant class is missing in your classpath. A search of this class indicates, it is available in hector-core This discussion indicates how this dependency can be imported, viz. adding the following entry to your project pom (or choosing this appropriately in m2eclipse). me.prettyprint hect...
Adding POM type dependency using m2eclipse, unable to resolve I am trying to add Hector dependencies to my POM. My IDE is Eclipse, and I am also using m2eclipse. Adding dependencies of JAR type is not a problem, but this dependency is of type POM. I have tried almost everything usual including cleaning, building, and u...
TITLE: Adding POM type dependency using m2eclipse, unable to resolve QUESTION: I am trying to add Hector dependencies to my POM. My IDE is Eclipse, and I am also using m2eclipse. Adding dependencies of JAR type is not a problem, but this dependency is of type POM. I have tried almost everything usual including cleanin...
[ "maven", "dependencies", "m2eclipse", "pom.xml" ]
1
1
1,374
2
0
2011-06-03T20:49:30.743000
2011-06-05T03:15:47.280000
6,232,527
6,232,537
MySQL Error 1064 - Am I blind? Strange error
My query: UDPATE message_recipients SET recipient_status = 2 WHERE mid = 3 AND recipient_id = 4 Table fields: id, mid, recipient_status, recipient_id Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UDPATE message_recipi...
You need UPDATE instead of UDPATE. I do this myself at least three times a week:)
MySQL Error 1064 - Am I blind? Strange error My query: UDPATE message_recipients SET recipient_status = 2 WHERE mid = 3 AND recipient_id = 4 Table fields: id, mid, recipient_status, recipient_id Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ri...
TITLE: MySQL Error 1064 - Am I blind? Strange error QUESTION: My query: UDPATE message_recipients SET recipient_status = 2 WHERE mid = 3 AND recipient_id = 4 Table fields: id, mid, recipient_status, recipient_id Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ...
[ "mysql", "sql", "sql-update" ]
8
15
596
1
0
2011-06-03T20:49:38.017000
2011-06-03T20:50:38.227000
6,232,532
6,232,627
DIVs that are aware of their position, or the window's scroll position?
In jQuery, how do you make it so a DIV will stay put until the user scrolling down would make it no longer visible (at which point it sets its own CSS position to "fixed")? It's a trick I see a lot, just not sure how it's done. Example: http://www.yelp.com/search?find_desc=sushi&ns=1&find_loc=San+Francisco%2C+CA
Here's a quick example of some code: var standardPosition = $('div').offset().top; $(window).scroll(function() { if ($(this).scrollTop() > standardPosition) $('div').css('position','fixed'); else $('div').css('position','relative'); }); It's important to store the starting position somewhere, so you know when you've s...
DIVs that are aware of their position, or the window's scroll position? In jQuery, how do you make it so a DIV will stay put until the user scrolling down would make it no longer visible (at which point it sets its own CSS position to "fixed")? It's a trick I see a lot, just not sure how it's done. Example: http://www....
TITLE: DIVs that are aware of their position, or the window's scroll position? QUESTION: In jQuery, how do you make it so a DIV will stay put until the user scrolling down would make it no longer visible (at which point it sets its own CSS position to "fixed")? It's a trick I see a lot, just not sure how it's done. Ex...
[ "jquery" ]
2
3
521
3
0
2011-06-03T20:50:13.540000
2011-06-03T20:58:35.527000
6,232,539
6,235,258
Rails 3 Polymorphic Associations Question
I've been trying to switch my Orders model to a polymorphic association with my Product and Service models. However, I have a few questions that I haven't been able to find answers to, even after watching the RailsCast and reading the documentation (so, those suggestions are appreciated, but I need a more concrete answ...
Answers to your questions: If your business login implies that multiple models will have related model with the same fields so you should use polymorphic association. (In your case you can use it). If set up polymorphic association Rails will automatically handle setting *_id and *_type fields depending on associated p...
Rails 3 Polymorphic Associations Question I've been trying to switch my Orders model to a polymorphic association with my Product and Service models. However, I have a few questions that I haven't been able to find answers to, even after watching the RailsCast and reading the documentation (so, those suggestions are ap...
TITLE: Rails 3 Polymorphic Associations Question QUESTION: I've been trying to switch my Orders model to a polymorphic association with my Product and Service models. However, I have a few questions that I haven't been able to find answers to, even after watching the RailsCast and reading the documentation (so, those ...
[ "ruby-on-rails", "ruby-on-rails-3", "associations" ]
1
0
907
1
0
2011-06-03T20:50:44.873000
2011-06-04T06:50:45.443000
6,232,540
6,232,636
what's best way to leave empty database cells?
I'm not that experienced with databases. If I have a database table containing a lot of empty cells, what's the best way to leave them (e.g. so performance isn't degraded, memory is not consumed, if this is even possible)? I know there's a "null" value. Is there a "none" value or equivalent that has no drawbacks? Or by...
The convention is to use null to signify a missing value. That's the purpose of null in SQL. Noted database researcher C. J. Date writes frequently about his objections to the handling of null in SQL at a logical level, and he would say any column that may be missing belongs in a separate table, so that the absence of ...
what's best way to leave empty database cells? I'm not that experienced with databases. If I have a database table containing a lot of empty cells, what's the best way to leave them (e.g. so performance isn't degraded, memory is not consumed, if this is even possible)? I know there's a "null" value. Is there a "none" v...
TITLE: what's best way to leave empty database cells? QUESTION: I'm not that experienced with databases. If I have a database table containing a lot of empty cells, what's the best way to leave them (e.g. so performance isn't degraded, memory is not consumed, if this is even possible)? I know there's a "null" value. I...
[ "database" ]
4
4
4,588
5
0
2011-06-03T20:50:49.953000
2011-06-03T20:59:03.757000
6,232,541
6,233,161
Android: measureText() Return Pixels Based on Scaled Pixels
So I use Paint's measureText() method to measure the width of a segment of text, but I wanted to measure text based on a certain text size. Say I wanted to get the width of a text segment that will be 20 scaled pixels when it occupies a certain TextView. I tried the following: Paint paint = new Paint(); paint.setTextSi...
You need to get the densityMultiplier like so: final float densityMultiplier = getContext().getResources().getDisplayMetrics().density; final float scaledPx = 20 * densityMultiplier; paint.setTextSize(scaledPx); final float size = paint.measureText("sample text");
Android: measureText() Return Pixels Based on Scaled Pixels So I use Paint's measureText() method to measure the width of a segment of text, but I wanted to measure text based on a certain text size. Say I wanted to get the width of a text segment that will be 20 scaled pixels when it occupies a certain TextView. I tri...
TITLE: Android: measureText() Return Pixels Based on Scaled Pixels QUESTION: So I use Paint's measureText() method to measure the width of a segment of text, but I wanted to measure text based on a certain text size. Say I wanted to get the width of a text segment that will be 20 scaled pixels when it occupies a certa...
[ "android", "paint", "text-size" ]
17
38
21,464
4
0
2011-06-03T20:50:50.943000
2011-06-03T22:10:24
6,232,543
6,232,873
Customize how Time field is populated from HTTP request
I have a java.sql.Time field in a model that I'm trying to populate from a form submission. Whatever format it's expecting for those values isn't the one(s) I want to use, validation always results in "Incorrect value". How can I customize the parsing for these values? I thought I'd seen how to do it a while back but I...
The magic word was "binding". What I need to do is create a custom global binder. Update: here's my custom binder that will handle several different time formats: import play.data.binding.*; import org.joda.time.format.*; import java.lang.annotation.*; import java.sql.Time; import java.text.ParseException; import jav...
Customize how Time field is populated from HTTP request I have a java.sql.Time field in a model that I'm trying to populate from a form submission. Whatever format it's expecting for those values isn't the one(s) I want to use, validation always results in "Incorrect value". How can I customize the parsing for these va...
TITLE: Customize how Time field is populated from HTTP request QUESTION: I have a java.sql.Time field in a model that I'm trying to populate from a form submission. Whatever format it's expecting for those values isn't the one(s) I want to use, validation always results in "Incorrect value". How can I customize the pa...
[ "playframework" ]
1
1
466
1
0
2011-06-03T20:51:00.523000
2011-06-03T21:29:10.050000
6,232,544
6,232,689
Schema/Code for respecting different schedules
We accept leads from lead providers. We only allow certain providers to post leads to us during certain days/times. Currently, we have 3 schedules, but we might add 1 or n more in the future: Sunday @ 8AM - Friday @ 3PM -- all hours in between. Monday - Friday from 8AM - 5 PM. 24 hours a day, every day. In addition, we...
This looks like somewhat complex rule-based logic, so the best way in my opinion would be to create a set of objects representing the entities involved. To clarify, I mean to model the rules to objects, applying the most appropriate design patterns applicable. For example, just out of my head now, if you say that a cus...
Schema/Code for respecting different schedules We accept leads from lead providers. We only allow certain providers to post leads to us during certain days/times. Currently, we have 3 schedules, but we might add 1 or n more in the future: Sunday @ 8AM - Friday @ 3PM -- all hours in between. Monday - Friday from 8AM - 5...
TITLE: Schema/Code for respecting different schedules QUESTION: We accept leads from lead providers. We only allow certain providers to post leads to us during certain days/times. Currently, we have 3 schedules, but we might add 1 or n more in the future: Sunday @ 8AM - Friday @ 3PM -- all hours in between. Monday - F...
[ "c#", "sql-server", "schema", "scheduling" ]
1
1
60
1
0
2011-06-03T20:51:01.887000
2011-06-03T21:04:17.807000
6,232,547
6,232,618
Array cloning on access?
I was reading XNA library code and inside the type VertexPositionColor, they supress the CA2105:ArrayFieldsShouldNotBeReadOnly message with the justification "The performance cost of cloning the array each time it is used is too great." public struct VertexPositionColor { public static readonly VertexElement [ ] Vertex...
I guess they are justifying the fact that they are exposing an array field more than anything else and the underlying reason of why they are doing so is performance: The alternative they probably had in mind was making the array field private with a property exposing an IEnumerable or returning a copy of the array each...
Array cloning on access? I was reading XNA library code and inside the type VertexPositionColor, they supress the CA2105:ArrayFieldsShouldNotBeReadOnly message with the justification "The performance cost of cloning the array each time it is used is too great." public struct VertexPositionColor { public static readonly...
TITLE: Array cloning on access? QUESTION: I was reading XNA library code and inside the type VertexPositionColor, they supress the CA2105:ArrayFieldsShouldNotBeReadOnly message with the justification "The performance cost of cloning the array each time it is used is too great." public struct VertexPositionColor { publ...
[ "c#", ".net", "arrays", "performance", "xna" ]
3
3
150
2
0
2011-06-03T20:51:16.033000
2011-06-03T20:57:20.543000
6,232,558
6,232,637
Is Endianness always an issue that needs to be considered?
Suppose we're sending some data over the network... it is my understanding that Endianness is unconditionally an issue as we don't know what receving machine expects and what sending machine will send. As a rule of thumb is this correct? Does the answer depend on the type of data is being sent, say, does it matter if w...
Yes, endianness always needs to be considered and defined in a network protocol. It affects all types that are larger than a single byte. So a char based C-string will not be affected by it since it is just an array of single bytes, but a wchar_t based string needs to be converted if one of the machines is little endia...
Is Endianness always an issue that needs to be considered? Suppose we're sending some data over the network... it is my understanding that Endianness is unconditionally an issue as we don't know what receving machine expects and what sending machine will send. As a rule of thumb is this correct? Does the answer depend ...
TITLE: Is Endianness always an issue that needs to be considered? QUESTION: Suppose we're sending some data over the network... it is my understanding that Endianness is unconditionally an issue as we don't know what receving machine expects and what sending machine will send. As a rule of thumb is this correct? Does ...
[ "types", "endianness" ]
2
2
58
1
0
2011-06-03T20:52:38.150000
2011-06-03T20:59:07.233000
6,232,562
6,232,592
Can I create a C++ "zap" function that works on a pointer if it hasn't had memory allocated to it?
I have a zap() function written to deallocate a 1-d array as follows. void zap(double *(&data)) { if (data!= NULL) { delete [] data; data = NULL; } return; } I was under the impression that if data!= NULL would not try to deallocate memory that had never been allocated, but I think I am mistaken. I am having the follow...
Pointers do not get magically initialized to 0, only when they are global or static. You need to do so: double *xvec = NULL; double *yvec = NULL; If you do not, they contain random junk that was left on the stack where they are created. And this junk is most of the time not NULL. Also, you do not need to check against ...
Can I create a C++ "zap" function that works on a pointer if it hasn't had memory allocated to it? I have a zap() function written to deallocate a 1-d array as follows. void zap(double *(&data)) { if (data!= NULL) { delete [] data; data = NULL; } return; } I was under the impression that if data!= NULL would not try to...
TITLE: Can I create a C++ "zap" function that works on a pointer if it hasn't had memory allocated to it? QUESTION: I have a zap() function written to deallocate a 1-d array as follows. void zap(double *(&data)) { if (data!= NULL) { delete [] data; data = NULL; } return; } I was under the impression that if data!= NUL...
[ "c++", "memory-management" ]
2
7
388
4
0
2011-06-03T20:52:46.253000
2011-06-03T20:55:43.687000
6,232,563
6,232,651
Android: how to dynamically load resource images in a ListView?
I have a bunch of resource images, and I want to display a certain one for each element of a ListView. Currently I have a row.xml file that has each element displaying the "icon" image. I want to use the same format that I specified in row.xml, but change the image to whatever I want each time. I have done some researc...
You should override the getView method of you listview's adapter so that it will return a component that will inflate your row.xml. This component can then be customized before being returned. Here is an example: @Override public View getView(int position, View convertView, ViewGroup parent) { //where myview is your cu...
Android: how to dynamically load resource images in a ListView? I have a bunch of resource images, and I want to display a certain one for each element of a ListView. Currently I have a row.xml file that has each element displaying the "icon" image. I want to use the same format that I specified in row.xml, but change ...
TITLE: Android: how to dynamically load resource images in a ListView? QUESTION: I have a bunch of resource images, and I want to display a certain one for each element of a ListView. Currently I have a row.xml file that has each element displaying the "icon" image. I want to use the same format that I specified in ro...
[ "android", "image", "listview" ]
2
1
1,975
3
0
2011-06-03T20:52:53.600000
2011-06-03T21:00:22.903000
6,232,564
6,232,612
How to continuously run a Python script on an EC2 server?
I've setup an Amazon EC2 server. I have a Python script that is supposed to download large amounts of data from the web onto the server. I can run the script from the terminal through ssh, however very often I loose the ssh connection. When I loose the connection, the script stops. Is there a method where I tell the sc...
You have a few options. You can add your script to cron to be run regularly. You can run your script manually, and detach+background it using nohup. You can run a tool such as GNU Screen, and detach your terminal and log out, only to continue where you left off later. I use this a lot. For example: Log in to your machi...
How to continuously run a Python script on an EC2 server? I've setup an Amazon EC2 server. I have a Python script that is supposed to download large amounts of data from the web onto the server. I can run the script from the terminal through ssh, however very often I loose the ssh connection. When I loose the connectio...
TITLE: How to continuously run a Python script on an EC2 server? QUESTION: I've setup an Amazon EC2 server. I have a Python script that is supposed to download large amounts of data from the web onto the server. I can run the script from the terminal through ssh, however very often I loose the ssh connection. When I l...
[ "python", "amazon-ec2" ]
25
43
19,576
4
0
2011-06-03T20:53:01.183000
2011-06-03T20:56:54.160000
6,232,568
6,252,988
View nicely formatted version of HTML source
I need to edit this HTML page and re-upload it. The problem is that somehow all of the newlines have been eliminated from it so that its just one long line. I'm using Notepad++ now, although I don't have to be. What is a good way to view and edit this HTML/PHP/Javascript source in a way that a reasonable human being ca...
You can tidy this up (as @AR suggested) with notepad++. Go into Notepad++, go to the plugin manager and select textFX and install that. among other things, it will install a new menu item in the toolbar called "textFX" select it, then select Text Fx HTML Tidy. This will give you a selection of formatting objects and ou...
View nicely formatted version of HTML source I need to edit this HTML page and re-upload it. The problem is that somehow all of the newlines have been eliminated from it so that its just one long line. I'm using Notepad++ now, although I don't have to be. What is a good way to view and edit this HTML/PHP/Javascript sou...
TITLE: View nicely formatted version of HTML source QUESTION: I need to edit this HTML page and re-upload it. The problem is that somehow all of the newlines have been eliminated from it so that its just one long line. I'm using Notepad++ now, although I don't have to be. What is a good way to view and edit this HTML/...
[ "dom", "text-editor", "notepad++", "text-formatting" ]
0
1
241
1
0
2011-06-03T20:53:23.580000
2011-06-06T13:48:47.700000
6,232,574
6,232,610
Is it bad practice to pass a string to settimeout? If yes, why?
Possible Duplicate: Is there ever a good reason to pass a string to setTimeout? I just read a comment stating it is bad practice.. Is that so? And why?
Yes, it is. The string must be eval 'd, which is evil (and very slow). It also prevents you from using local variables in the callback.
Is it bad practice to pass a string to settimeout? If yes, why? Possible Duplicate: Is there ever a good reason to pass a string to setTimeout? I just read a comment stating it is bad practice.. Is that so? And why?
TITLE: Is it bad practice to pass a string to settimeout? If yes, why? QUESTION: Possible Duplicate: Is there ever a good reason to pass a string to setTimeout? I just read a comment stating it is bad practice.. Is that so? And why? ANSWER: Yes, it is. The string must be eval 'd, which is evil (and very slow). It als...
[ "javascript", "settimeout" ]
2
4
4,648
2
0
2011-06-03T20:53:48.383000
2011-06-03T20:56:44.560000
6,232,579
6,232,694
Returning Raw XML From a WCF Service
I am trying to get my webservice to reply with a particular form of XML, which I thought I could do with just putting the data in a string and returning this to the webpage. I am trying to return: But when I return the string I'm getting: <tradeHistory><trade tradeid="1933" ExtId="1933" Instrument="EUA" quantity"1500" ...
The default return format is XML, so when your operation returns String, it will be formatted as XML - with the string content inside the element. The easiest way to return anything would be to use the raw programming model. Your operation would look something like this: _ _ Function GetClientTrades(ByVal ClientID As S...
Returning Raw XML From a WCF Service I am trying to get my webservice to reply with a particular form of XML, which I thought I could do with just putting the data in a string and returning this to the webpage. I am trying to return: But when I return the string I'm getting: <tradeHistory><trade tradeid="1933" ExtId="1...
TITLE: Returning Raw XML From a WCF Service QUESTION: I am trying to get my webservice to reply with a particular form of XML, which I thought I could do with just putting the data in a string and returning this to the webpage. I am trying to return: But when I return the string I'm getting: <tradeHistory><trade trade...
[ "wcf", "web-services" ]
2
4
5,704
1
0
2011-06-03T20:54:11.597000
2011-06-03T21:04:53.610000
6,232,600
6,232,745
How to use broadcast and receivers
How can I use my Broadcast receiver? Like when my app starts how do I make the receiver continually run its code? My Reciver code: private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { ConnectivityManager mConnectivity; mConnectivi...
You need to set an intent filter associated with your receiver in your manifest.xml file like this: then, in you activities, when you want to call your receiver, you just sendBroadcast( new Intent( "package name + your action name" ) ); And then you should update your app, but within the ui thread to change a widget: f...
How to use broadcast and receivers How can I use my Broadcast receiver? Like when my app starts how do I make the receiver continually run its code? My Reciver code: private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Connectivit...
TITLE: How to use broadcast and receivers QUESTION: How can I use my Broadcast receiver? Like when my app starts how do I make the receiver continually run its code? My Reciver code: private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent inte...
[ "android", "broadcastreceiver" ]
0
1
687
1
0
2011-06-03T20:56:18.420000
2011-06-03T21:12:14.200000
6,232,603
6,232,643
jQuery .attr('id') returns empty
Here is my code $('.sort').click(function(){ console.log($(this).attr('id')); $.cookie('sortby', $(this).attr('id'), { expires: 25 }); //window.location.reload(true); }); HTML Name Price Popularity My cookie ends up empty and the console shows up as popular (an empty string) It seems it is getting the correct id but th...
In your second call the $(this) object has changed scope. The following should work: $('.sort').click(function(){ console.log($(this).attr('id')); var $this = $(this); $.cookie('sortby', $this.attr('id'), { expires: 25 }); //window.location.reload(true); });
jQuery .attr('id') returns empty Here is my code $('.sort').click(function(){ console.log($(this).attr('id')); $.cookie('sortby', $(this).attr('id'), { expires: 25 }); //window.location.reload(true); }); HTML Name Price Popularity My cookie ends up empty and the console shows up as popular (an empty string) It seems it...
TITLE: jQuery .attr('id') returns empty QUESTION: Here is my code $('.sort').click(function(){ console.log($(this).attr('id')); $.cookie('sortby', $(this).attr('id'), { expires: 25 }); //window.location.reload(true); }); HTML Name Price Popularity My cookie ends up empty and the console shows up as popular (an empty s...
[ "jquery", "attr" ]
1
3
5,953
3
0
2011-06-03T20:56:23.047000
2011-06-03T20:59:38.423000
6,232,607
6,235,764
Problem with versions: Errno::ENOENT in Rails 3.1 RC
I am using Rails 3.1 RC and Carrierwave 0.5.4. Don't know if this is an issue with 3.1. I verified that the path and file exists (http://bucket_name.s3.amazonaws.com/unencoded/users/1/photos/test.gif) in my S3 bucket. When I do: Photo.first.update_attributes!(:job_state => 'processing',:remote_attachment_url => 'http:/...
Hmmmm, I don't know exactly what the problem is, but I switched my gem file from: gem 'carrierwave',:git => 'http://github.com/jnicklas/carrierwave.git' to gem 'carrierwave', '0.5.4' The problem seems to have gone away. There is something definitely wrong with the master version... Hope this helps someone who comes acr...
Problem with versions: Errno::ENOENT in Rails 3.1 RC I am using Rails 3.1 RC and Carrierwave 0.5.4. Don't know if this is an issue with 3.1. I verified that the path and file exists (http://bucket_name.s3.amazonaws.com/unencoded/users/1/photos/test.gif) in my S3 bucket. When I do: Photo.first.update_attributes!(:job_st...
TITLE: Problem with versions: Errno::ENOENT in Rails 3.1 RC QUESTION: I am using Rails 3.1 RC and Carrierwave 0.5.4. Don't know if this is an issue with 3.1. I verified that the path and file exists (http://bucket_name.s3.amazonaws.com/unencoded/users/1/photos/test.gif) in my S3 bucket. When I do: Photo.first.update_a...
[ "ruby-on-rails", "ruby-on-rails-3", "carrierwave" ]
0
1
1,861
3
0
2011-06-03T20:56:36.177000
2011-06-04T08:57:57.490000
6,232,621
6,232,836
Calling scala abstract classes with parameters and inner classes from Java
If I define a Scala class: class X(i:Int) { println (i) } How do I use this class in Java code? [EDIT] Actually, my problem is slightly more complicated I have an abstract class abstract class X(i:Int) { println (i) def hello(s:String):Unit } I need to use this in Java code. Is it possible to do it easily? [EDIT2] Cons...
The generated bytecode for your class will be identical to the Java definition: abstract class X implements scala.ScalaObject { public X(int i) { System.out.println(i); } public abstract void hello(String s); //possibly other fields/methods mixed-in from ScalaObject } Use it exactly as you would for this equivalent J...
Calling scala abstract classes with parameters and inner classes from Java If I define a Scala class: class X(i:Int) { println (i) } How do I use this class in Java code? [EDIT] Actually, my problem is slightly more complicated I have an abstract class abstract class X(i:Int) { println (i) def hello(s:String):Unit } I ...
TITLE: Calling scala abstract classes with parameters and inner classes from Java QUESTION: If I define a Scala class: class X(i:Int) { println (i) } How do I use this class in Java code? [EDIT] Actually, my problem is slightly more complicated I have an abstract class abstract class X(i:Int) { println (i) def hello(s...
[ "java", "scala", "scala-java-interop" ]
3
7
680
3
0
2011-06-03T20:57:29.350000
2011-06-03T21:24:09.423000
6,232,623
6,232,680
why does getContentResolver() within Application cause NullPointerException?
in the following code: public class ApplicationContext extends Application { private static ApplicationContext instance; public ApplicationContext() { instance = this; final String strID = Secure.getString(getContentResolver(), Secure.ANDROID_ID); } public static Context getContext() { return instance; } } getConten...
Do this when overriding oncreate better than in your constructor. I guess your app doesn't have a context yet. Actually, here is what I did yesterday for some LVL code: /** Called when the activity is first created. */ @Override public void onCreate() { super.onCreate(); LICENSED_APP_ID = Secure.getString(getContentRe...
why does getContentResolver() within Application cause NullPointerException? in the following code: public class ApplicationContext extends Application { private static ApplicationContext instance; public ApplicationContext() { instance = this; final String strID = Secure.getString(getContentResolver(), Secure.ANDROI...
TITLE: why does getContentResolver() within Application cause NullPointerException? QUESTION: in the following code: public class ApplicationContext extends Application { private static ApplicationContext instance; public ApplicationContext() { instance = this; final String strID = Secure.getString(getContentResolve...
[ "android" ]
0
4
3,495
2
0
2011-06-03T20:57:52.437000
2011-06-03T21:02:42.170000
6,232,629
6,232,781
Battling with wxpython
I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far: If you are running python 2.6 or greater you can only work with wxpython if you access the...
I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it. As for the 32-bit question, with wxP...
Battling with wxpython I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far: If you are running python 2.6 or greater you can only work with wxp...
TITLE: Battling with wxpython QUESTION: I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far: If you are running python 2.6 or greater you can ...
[ "macos", "wxpython", "32bit-64bit" ]
5
11
670
1
0
2011-06-03T20:58:38.077000
2011-06-03T21:17:11.220000
6,232,631
6,232,726
How to recursively create a directory in Qt?
Is there a function that given an absolute path will attempt to create all directories in the path that do not exist?
You can use bool QDir::mkpath(const QString &dirPath) const as described in the Qt4.x documentation and Qt5.x documentation Creates the directorypath dirPath. The function will create all parent directories necessary to create the directory. Returns true if successful; otherwise returns false. If the path already exist...
How to recursively create a directory in Qt? Is there a function that given an absolute path will attempt to create all directories in the path that do not exist?
TITLE: How to recursively create a directory in Qt? QUESTION: Is there a function that given an absolute path will attempt to create all directories in the path that do not exist? ANSWER: You can use bool QDir::mkpath(const QString &dirPath) const as described in the Qt4.x documentation and Qt5.x documentation Create...
[ "qt", "recursion", "directory" ]
23
40
13,240
1
0
2011-06-03T20:58:45.557000
2011-06-03T21:09:03.170000
6,232,633
6,234,593
Entity Framework Timeouts
I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue: I added Default Command Timeout=300000 to the connection string in the App.Config file in the project that has the EDMX file as s...
There is a known bug with specifying default command timeout within the EF connection string. http://bugs.mysql.com/bug.php?id=56806 Remove the value from the connection string and set it on the data context object itself. This will work if you remove the conflicting value from the connection string. Entity Framework C...
Entity Framework Timeouts I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue: I added Default Command Timeout=300000 to the connection string in the App.Config file in the project t...
TITLE: Entity Framework Timeouts QUESTION: I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue: I added Default Command Timeout=300000 to the connection string in the App.Config fil...
[ "c#", "sql-server", "entity-framework", "entity-framework-4", "connection-string" ]
394
658
415,255
10
0
2011-06-03T20:58:51.923000
2011-06-04T03:59:04.590000
6,232,642
6,232,912
Call Hierarchy Eclipse feature in Vim?
I am considering migrating from eclipse to vim for c++ development- I've recently "rediscovered" Vim, and finally went beyond the basics. I'm loving it, but there are still a few features that I use constantly in Eclipse that I'd also like to see in Vim. One of them is call hierarchy. It's extremely helpful to know whe...
https://stackoverflow.com/questions/149558/recommended-vim-plugins-for-c-coding A combination of the cscope and taglist plugins (linked from above) should give you what you want. Possibly cctree. All of these have problems with templates, however. Also check out eclim
Call Hierarchy Eclipse feature in Vim? I am considering migrating from eclipse to vim for c++ development- I've recently "rediscovered" Vim, and finally went beyond the basics. I'm loving it, but there are still a few features that I use constantly in Eclipse that I'd also like to see in Vim. One of them is call hierar...
TITLE: Call Hierarchy Eclipse feature in Vim? QUESTION: I am considering migrating from eclipse to vim for c++ development- I've recently "rediscovered" Vim, and finally went beyond the basics. I'm loving it, but there are still a few features that I use constantly in Eclipse that I'd also like to see in Vim. One of t...
[ "c++", "eclipse", "vim" ]
10
7
6,267
2
0
2011-06-03T20:59:29.157000
2011-06-03T21:35:07.420000
6,232,646
6,232,756
Errors when referencing Silverlight class library from WPF application
I have a WPF application and a Silverlight application. They are both used to display a map and share some of the same functionality. I have created a Silverlight class library project in order to stay DRY. I'm referencing this from both Silverlight and WPF. It contains some utility methods that are useful in both proj...
You are right, Silverlight uses a completely separate version of the framework. It's much, much smaller than event the.NET client runtime. This means you can't mix WPF and Silverlight assemblies in the same application.
Errors when referencing Silverlight class library from WPF application I have a WPF application and a Silverlight application. They are both used to display a map and share some of the same functionality. I have created a Silverlight class library project in order to stay DRY. I'm referencing this from both Silverlight...
TITLE: Errors when referencing Silverlight class library from WPF application QUESTION: I have a WPF application and a Silverlight application. They are both used to display a map and share some of the same functionality. I have created a Silverlight class library project in order to stay DRY. I'm referencing this fro...
[ "wpf", "silverlight-4.0", ".net-4.0" ]
3
5
4,759
3
0
2011-06-03T20:59:48.147000
2011-06-03T21:13:41.893000
6,232,648
6,234,915
Bugs with LinkedIn Invitation request through their REST API with PHP using PECL OAuth
I'm using PECL OAuth with LinkedIn because it is working fine with Twitter and LinkedIn's GET requests. Will switch to LinkedIn's own OAuth libraries if this fails to work, but would prefer to do everything through the same OAuth library. Code: $xmlString = " ". " ". " ". " ". " PersonEmail}\">". " {$person->PersonFirs...
Found the solution, it was replacing $oauth = new OAuth(self::$apiKey, self::$secretKey, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_FORM); with $oauth = new OAuth(self::$apiKey, self::$secretKey, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
Bugs with LinkedIn Invitation request through their REST API with PHP using PECL OAuth I'm using PECL OAuth with LinkedIn because it is working fine with Twitter and LinkedIn's GET requests. Will switch to LinkedIn's own OAuth libraries if this fails to work, but would prefer to do everything through the same OAuth lib...
TITLE: Bugs with LinkedIn Invitation request through their REST API with PHP using PECL OAuth QUESTION: I'm using PECL OAuth with LinkedIn because it is working fine with Twitter and LinkedIn's GET requests. Will switch to LinkedIn's own OAuth libraries if this fails to work, but would prefer to do everything through ...
[ "php", "oauth", "linkedin-api", "pecl" ]
2
1
1,176
1
0
2011-06-03T20:59:56.793000
2011-06-04T05:22:50.760000
6,232,650
6,234,169
Converting HTML Bullets to PlainText
I'm in the process of creating an app for android, and one of the things it does is take existing Html on a server and uses TextView to display it to the user. Most Html tags are fine (e.g. bold), but things like unordered lists (aka bullets) are not rendered properly when using Html.fromHtml(txt) I noticed that a Bull...
Looking at the source code for android.text.Html (available at here ), it looks like the following tags are converted by fromHtml(String). br, p, div, em, b, strong, cite, dfn, i, big, small, font, blockquote, tt, a, u, sup, sub, h1, h2, h3, h4, h5, h6, img Some of these tags have additional attributes that are convert...
Converting HTML Bullets to PlainText I'm in the process of creating an app for android, and one of the things it does is take existing Html on a server and uses TextView to display it to the user. Most Html tags are fine (e.g. bold), but things like unordered lists (aka bullets) are not rendered properly when using Htm...
TITLE: Converting HTML Bullets to PlainText QUESTION: I'm in the process of creating an app for android, and one of the things it does is take existing Html on a server and uses TextView to display it to the user. Most Html tags are fine (e.g. bold), but things like unordered lists (aka bullets) are not rendered prope...
[ "java", "android", "html", "html-parsing" ]
3
2
1,184
2
0
2011-06-03T21:00:21.383000
2011-06-04T01:46:47.913000
6,232,667
6,232,704
C++: how to use a template on both classes and primitives?
I have a question about templates that can be used with parameters that are either a class or a primitive type. Here's some sample code: (Note: I have real code that's more complex, the following code is useless but it reproduces the same issue) template class Foo { T value; public: Foo() {} const T& getValue() const ...
It is perfectly legal to bind temporaries to const references as you do in setValue(). Intel C++, which issues this remark, is not being helpful in this case. EDIT: I am guessing that TI compiler is based on Intel, which, for me, issues the following diagnostic on that line: test.cc(28): remark #383: value copied to te...
C++: how to use a template on both classes and primitives? I have a question about templates that can be used with parameters that are either a class or a primitive type. Here's some sample code: (Note: I have real code that's more complex, the following code is useless but it reproduces the same issue) template class ...
TITLE: C++: how to use a template on both classes and primitives? QUESTION: I have a question about templates that can be used with parameters that are either a class or a primitive type. Here's some sample code: (Note: I have real code that's more complex, the following code is useless but it reproduces the same issu...
[ "c++", "templates", "reference" ]
5
8
318
4
0
2011-06-03T21:01:26.933000
2011-06-03T21:07:05.427000
6,232,671
6,232,767
Swapping endiannes in C
I have this string c1eb044f0708015b267913fc4dff5aabe3dd4a97f10f7ba935cd360000000000 How does one swap it so it becomes 000000000036cd35a97b0ff1974adde3ab5aff4dfc1379265b0108074f04ebc1 Those two are basically examples, but that is what i need to do, but not know how as i have very little knowledge of C. The above two st...
Something like this; probably not perfect but gives you the idea. You'll want appropriate error checking, initialization of your buffer, etc. Edit: I made an assumption I shouldn't have, possibly. I interpreted your string as hex representations of bytes, so I took c1 as an unsigned char and switched it with 00, for ex...
Swapping endiannes in C I have this string c1eb044f0708015b267913fc4dff5aabe3dd4a97f10f7ba935cd360000000000 How does one swap it so it becomes 000000000036cd35a97b0ff1974adde3ab5aff4dfc1379265b0108074f04ebc1 Those two are basically examples, but that is what i need to do, but not know how as i have very little knowledg...
TITLE: Swapping endiannes in C QUESTION: I have this string c1eb044f0708015b267913fc4dff5aabe3dd4a97f10f7ba935cd360000000000 How does one swap it so it becomes 000000000036cd35a97b0ff1974adde3ab5aff4dfc1379265b0108074f04ebc1 Those two are basically examples, but that is what i need to do, but not know how as i have ve...
[ "c", "endianness" ]
1
1
516
5
0
2011-06-03T21:01:53.190000
2011-06-03T21:15:09.810000
6,232,674
6,233,075
Facebook API: Including an image in the wall post
According to the Facebook Documentation all I have to do is add a "picture" property to the post object... But this is not working, here's my code: [CanvasAuthorize(Permissions = "publish_stream,offline_access")] public ActionResult Share(string message, string link, string picture, string name) { var fb = new Facebook...
What value are you sending for picture? It needs to be a full url, eg http://www.example.com/photo.jpg. Also, it needs to be a URL that Facebook servers can access because Facebook will cache the image and then turn your link into their cached image url.
Facebook API: Including an image in the wall post According to the Facebook Documentation all I have to do is add a "picture" property to the post object... But this is not working, here's my code: [CanvasAuthorize(Permissions = "publish_stream,offline_access")] public ActionResult Share(string message, string link, st...
TITLE: Facebook API: Including an image in the wall post QUESTION: According to the Facebook Documentation all I have to do is add a "picture" property to the post object... But this is not working, here's my code: [CanvasAuthorize(Permissions = "publish_stream,offline_access")] public ActionResult Share(string messag...
[ "facebook", "api", "facebook-graph-api", "facebook-c#-sdk" ]
1
1
6,419
1
0
2011-06-03T21:02:07.663000
2011-06-03T21:58:57.573000
6,232,679
6,232,884
How to mantain session in classic asp sharing it with .net?
we are developing into an asp classic application introducing new asp.net pages. The session variables are shared through the login.asp, everything works fine... The problem that we are facing now is that the asp classic session expires meanwhile the user is navigating the.net pages and tries to go again into an asp pa...
May be you can keep your Classic ASP session alive when a user browse in a ASPX page by: adding a hidden iframe in your ASPX page that load an ASP Page ' aspx page.... OR use an AJAX post from your ASPX page every 10 minutes to an ASP page to keep the ASP session active
How to mantain session in classic asp sharing it with .net? we are developing into an asp classic application introducing new asp.net pages. The session variables are shared through the login.asp, everything works fine... The problem that we are facing now is that the asp classic session expires meanwhile the user is n...
TITLE: How to mantain session in classic asp sharing it with .net? QUESTION: we are developing into an asp classic application introducing new asp.net pages. The session variables are shared through the login.asp, everything works fine... The problem that we are facing now is that the asp classic session expires meanw...
[ "asp.net", "session", "asp-classic" ]
5
3
2,518
3
0
2011-06-03T21:02:38.683000
2011-06-03T21:31:45.377000
6,232,683
6,275,804
Using Spring Security 3 with cookies
I have an application that is built in Java that requires authorization. However, the authentication piece is handled by a different/separate application (not in Java). The user logs in to the authentication app, and that app sets a cookie. If the user is authorized to access the Java app, they will be redirected by th...
You can do this by making your own UsernamePasswordAuthenticationFilter. Inside the filter you can check for the cookies you need. You should only need to override the attemptAuthentication() method. You have the request and response objects there so checking for the cookies should be easy. You will also need to implem...
Using Spring Security 3 with cookies I have an application that is built in Java that requires authorization. However, the authentication piece is handled by a different/separate application (not in Java). The user logs in to the authentication app, and that app sets a cookie. If the user is authorized to access the Ja...
TITLE: Using Spring Security 3 with cookies QUESTION: I have an application that is built in Java that requires authorization. However, the authentication piece is handled by a different/separate application (not in Java). The user logs in to the authentication app, and that app sets a cookie. If the user is authorize...
[ "cookies", "spring-security" ]
5
4
5,997
2
0
2011-06-03T21:03:09.177000
2011-06-08T07:58:07.590000
6,232,695
6,232,730
Why doesn't mysql_real_escape_string consider these characters as dangerous?
I'm learning how to sanitize my forms and know that using the PHP function mysql_real_escape_string() helps escape characters that are consider "dangerous" or will break the syntax of your SQL. I was testing it out and noticed that it doesn't escape character sequences such as -- or /* */. Aren't these comments in SQL ...
They will never break a SQL statement as they will never break out of a string, and therefore your string remains intact, protecting you from any nasty injections. That does not mean you don't want to remove them from the string however. From a MySQL point of view they are safe, but depending on your application that m...
Why doesn't mysql_real_escape_string consider these characters as dangerous? I'm learning how to sanitize my forms and know that using the PHP function mysql_real_escape_string() helps escape characters that are consider "dangerous" or will break the syntax of your SQL. I was testing it out and noticed that it doesn't ...
TITLE: Why doesn't mysql_real_escape_string consider these characters as dangerous? QUESTION: I'm learning how to sanitize my forms and know that using the PHP function mysql_real_escape_string() helps escape characters that are consider "dangerous" or will break the syntax of your SQL. I was testing it out and notice...
[ "php", "sql", "sanitization" ]
3
5
253
3
0
2011-06-03T21:05:03.133000
2011-06-03T21:09:27.090000
6,232,711
6,238,290
Hadoop Fair Scheduler not assigning tasks to some nodes
I'm trying to run the Fair Scheduler, but it's not assigning Map tasks to some nodes with only one job running. My understanding is that the Fair Scheduler will use the conf slot limits unless multiple jobs exist, at which point the fairness calculations kick in. I've also tried setting all queues to FIFO in fair-sched...
The reason was the undocumented mapred.fairscheduler.locality.delay parameter. The problematic nodes were located on a different rack with HDFS disabled, making all tasks on these nodes non-rack local. Because of this, they were incurring large delays due to the Fair Scheduler's Delay Scheduling algorithm, described he...
Hadoop Fair Scheduler not assigning tasks to some nodes I'm trying to run the Fair Scheduler, but it's not assigning Map tasks to some nodes with only one job running. My understanding is that the Fair Scheduler will use the conf slot limits unless multiple jobs exist, at which point the fairness calculations kick in. ...
TITLE: Hadoop Fair Scheduler not assigning tasks to some nodes QUESTION: I'm trying to run the Fair Scheduler, but it's not assigning Map tasks to some nodes with only one job running. My understanding is that the Fair Scheduler will use the conf slot limits unless multiple jobs exist, at which point the fairness calc...
[ "hadoop", "scheduler" ]
0
3
1,346
1
0
2011-06-03T21:07:37.493000
2011-06-04T17:27:24.720000
6,232,736
6,232,975
In MS Access VBA, how do I call a stored append query with parameters?
In my Access 2007 database, I've got an append query with parameters in it. How do I call this query from a VBA script? I realize that I could just generate the query text on the fly in the VBA code, but that's much more awkward.
I got the following to work: Dim db As DAO.Database Dim qry As DAO.QueryDef Set db = CurrentDb Set qry= db.QueryDefs("NameOfMyStoredQuery") qry.Parameters(0) = FirstParamValue qry.Parameters(1) = SecondParamValue qry.Parameters(2) = ThirdParamValue qry.Execute
In MS Access VBA, how do I call a stored append query with parameters? In my Access 2007 database, I've got an append query with parameters in it. How do I call this query from a VBA script? I realize that I could just generate the query text on the fly in the VBA code, but that's much more awkward.
TITLE: In MS Access VBA, how do I call a stored append query with parameters? QUESTION: In my Access 2007 database, I've got an append query with parameters in it. How do I call this query from a VBA script? I realize that I could just generate the query text on the fly in the VBA code, but that's much more awkward. ...
[ "ms-access", "vba", "parameters" ]
3
8
10,613
1
0
2011-06-03T21:10:37.057000
2011-06-03T21:44:22.967000
6,232,738
6,232,949
Converting an ASCII number to a Hex number in C without using library functions
I want to convert an 32-bit ASCII number (e.g. "FE257469") to the equivalent 32-bit hex number which will be stored on a 32-bit variable. Most importnatly, I want to do that without using any library function like sscanf(), atoi(), etc. Any ideas on that? Thank in advance.
Here is an implementation of such a function based on a switch: unsigned int parseHex( char *str ) { unsigned int value = 0; for(;; ++str ) switch( *str ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value = value << 4 | *str & 0xf; break; case 'A': case 'B': ca...
Converting an ASCII number to a Hex number in C without using library functions I want to convert an 32-bit ASCII number (e.g. "FE257469") to the equivalent 32-bit hex number which will be stored on a 32-bit variable. Most importnatly, I want to do that without using any library function like sscanf(), atoi(), etc. Any...
TITLE: Converting an ASCII number to a Hex number in C without using library functions QUESTION: I want to convert an 32-bit ASCII number (e.g. "FE257469") to the equivalent 32-bit hex number which will be stored on a 32-bit variable. Most importnatly, I want to do that without using any library function like sscanf()...
[ "c", "ascii", "hex" ]
0
1
4,256
2
0
2011-06-03T21:10:42.767000
2011-06-03T21:40:29.900000
6,232,741
6,232,791
ofstream ifilestream and using cin to get an array of chars?
So I am learning how to use streams to make files of my own type, I have a simple version of it working like this struct Appointment { Appointment() { } // //and int to represent a certain doctor int doctorID; // an enum to be made later int year; // 1950 - 2050 100 years total int month; // 0 - 11 int day; // 0 ...
To input a string that contains spaces, use cin.getline(), which reads up to a newline: char doctorID[20];... cout << "\nEnter a Doctor ID:" << endl; cin.getline(appoint.doctorID, 20); If you want a string whose size is determined at runtime, you should use std::string, which can be dynamically resized. However, if you...
ofstream ifilestream and using cin to get an array of chars? So I am learning how to use streams to make files of my own type, I have a simple version of it working like this struct Appointment { Appointment() { } // //and int to represent a certain doctor int doctorID; // an enum to be made later int year; // 1950...
TITLE: ofstream ifilestream and using cin to get an array of chars? QUESTION: So I am learning how to use streams to make files of my own type, I have a simple version of it working like this struct Appointment { Appointment() { } // //and int to represent a certain doctor int doctorID; // an enum to be made later ...
[ "c++", "stl", "filesystems", "filestream" ]
2
3
574
2
0
2011-06-03T21:11:13.847000
2011-06-03T21:18:38.230000
6,232,747
6,232,782
Changing input value using javascript
I've been looking for a reason why this doesn't work, but I can't find one. In my asp.net application I create a a bunch of hidden inputs in c# and then try to modify them in javascript before I call them back to the server. My c# code: hidden3 = new HtmlInputHidden(); hidden3.ID = "total"; hidden3.Value = index.ToStri...
These controls are dynamically created and they have to be created in each postback. However, these should be built before Page_Load preferably in Page_Init event handler. If these are created in Page_Load, the view state has already been processed and the control can't be set from the posted value.
Changing input value using javascript I've been looking for a reason why this doesn't work, but I can't find one. In my asp.net application I create a a bunch of hidden inputs in c# and then try to modify them in javascript before I call them back to the server. My c# code: hidden3 = new HtmlInputHidden(); hidden3.ID =...
TITLE: Changing input value using javascript QUESTION: I've been looking for a reason why this doesn't work, but I can't find one. In my asp.net application I create a a bunch of hidden inputs in c# and then try to modify them in javascript before I call them back to the server. My c# code: hidden3 = new HtmlInputHidd...
[ "c#", "javascript", "asp.net" ]
1
1
447
2
0
2011-06-03T21:12:22.353000
2011-06-03T21:17:35.903000
6,232,753
6,232,943
Convert delimited string into hierarchical JSON with JQuery
I have an array of strings that describe the parent/child relationship by being delimited with dashes. So, if Bob's boss was Jim and Jim's boss was Fred, Bob's entry in the array would be "Fred-Jim-Bob" and Jim's entry would be "Fred-Jim." I don't have the ability to change the way the data is coming in so I was lookin...
var input = ["Fred-Jim-Bob", "Fred-Jim", "Fred-Thomas-Rob", "Fred"]; var output = []; for (var i = 0; i < input.length; i++) { var chain = input[i].split("-"); var currentNode = output; for (var j = 0; j < chain.length; j++) { var wantedNode = chain[j]; var lastNode = currentNode; for (var k = 0; k < currentNode.length...
Convert delimited string into hierarchical JSON with JQuery I have an array of strings that describe the parent/child relationship by being delimited with dashes. So, if Bob's boss was Jim and Jim's boss was Fred, Bob's entry in the array would be "Fred-Jim-Bob" and Jim's entry would be "Fred-Jim." I don't have the abi...
TITLE: Convert delimited string into hierarchical JSON with JQuery QUESTION: I have an array of strings that describe the parent/child relationship by being delimited with dashes. So, if Bob's boss was Jim and Jim's boss was Fred, Bob's entry in the array would be "Fred-Jim-Bob" and Jim's entry would be "Fred-Jim." I ...
[ "jquery", "json", "hierarchy", "organization" ]
17
35
6,316
1
0
2011-06-03T21:13:03.597000
2011-06-03T21:39:43.083000
6,232,762
6,254,875
How to add a nuget package in a MVC3 project template
I'm trying to hack a MVC 3 project template to automatically install elmah via nuget. Since MVC 3 Tools update, MVC3 project templates contains this section: So i've tried to add elmah package like this:... I've also downloaded and added elmah.1.2.0.1.nupkg file in C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3...
I just blogged about how to do this: http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx This walks through creating and registering a custom project template.
How to add a nuget package in a MVC3 project template I'm trying to hack a MVC 3 project template to automatically install elmah via nuget. Since MVC 3 Tools update, MVC3 project templates contains this section: So i've tried to add elmah package like this:... I've also downloaded and added elmah.1.2.0.1.nupkg file in ...
TITLE: How to add a nuget package in a MVC3 project template QUESTION: I'm trying to hack a MVC 3 project template to automatically install elmah via nuget. Since MVC 3 Tools update, MVC3 project templates contains this section: So i've tried to add elmah package like this:... I've also downloaded and added elmah.1.2....
[ "visual-studio-2010", "asp.net-mvc-3", "nuget", "visual-studio-templates" ]
2
4
1,192
1
0
2011-06-03T21:14:19.310000
2011-06-06T16:09:45.600000
6,232,764
6,233,170
Anonymous types in general
This came up in another question, and I've been searching for a conclusive answer for a while now. What makes something definitively an anonymous type? Is it just simply a type created without a name, or are there more structural nuances than that? When I say anonymous type I mean something like an anonymous class in J...
In general the term anonymous really just means without name. This is also the case with anonymous types. The different nuances are probably the patterns and circumstances in which anonymous types are used, compared to named types. But other than that, I don't see any differences.
Anonymous types in general This came up in another question, and I've been searching for a conclusive answer for a while now. What makes something definitively an anonymous type? Is it just simply a type created without a name, or are there more structural nuances than that? When I say anonymous type I mean something l...
TITLE: Anonymous types in general QUESTION: This came up in another question, and I've been searching for a conclusive answer for a while now. What makes something definitively an anonymous type? Is it just simply a type created without a name, or are there more structural nuances than that? When I say anonymous type ...
[ "anonymous-types" ]
0
1
77
1
0
2011-06-03T21:14:25.697000
2011-06-03T22:11:39.933000
6,232,777
6,232,841
Extra loop iteration happening when looping through array of objects
I made this object array $trailheads[] = new StdClass; Then I was putting an object in there each time it looped $trailheads[] = $trailhead; Then I returned the whole thing from the function like this: $ret->ok = empty($errors); $ret->errors = $errors; $ret->o = $trailheads; return $ret; Once I got the values back, an...
After this: $trailheads[] = new StdClass; your $trailheads array contains on element, an instance of StdClass. Then you add more elements, but there will be that first one. Maybe you wanted to initialize the $trailheads[] like that, but instead you gave value to one of the array elements. Use this instead: $trailheads ...
Extra loop iteration happening when looping through array of objects I made this object array $trailheads[] = new StdClass; Then I was putting an object in there each time it looped $trailheads[] = $trailhead; Then I returned the whole thing from the function like this: $ret->ok = empty($errors); $ret->errors = $errors...
TITLE: Extra loop iteration happening when looping through array of objects QUESTION: I made this object array $trailheads[] = new StdClass; Then I was putting an object in there each time it looped $trailheads[] = $trailhead; Then I returned the whole thing from the function like this: $ret->ok = empty($errors); $ret...
[ "php" ]
0
2
319
3
0
2011-06-03T21:16:59.673000
2011-06-03T21:24:23.300000
6,232,780
6,232,816
Capturing CAPTCHA image with Python
I tried using mechanize to see the URL of the image, but its a dynamic page generating a different image each time. I was wondering if there was any way to "capture" this image for viewing/saving. Thanks!
The only way to save the image would be to make a single call to the CATPCHA URL programatically, save the result, and then present that saved result to the user. The whole point of CAPTCHA is that each request generates a unique/different reponse/image.
Capturing CAPTCHA image with Python I tried using mechanize to see the URL of the image, but its a dynamic page generating a different image each time. I was wondering if there was any way to "capture" this image for viewing/saving. Thanks!
TITLE: Capturing CAPTCHA image with Python QUESTION: I tried using mechanize to see the URL of the image, but its a dynamic page generating a different image each time. I was wondering if there was any way to "capture" this image for viewing/saving. Thanks! ANSWER: The only way to save the image would be to make a si...
[ "python" ]
0
4
578
1
0
2011-06-03T21:17:09.463000
2011-06-03T21:20:32.810000
6,232,796
6,233,044
Is passing parameters for controller overload from view good practice in .Net MVC
So right now I have a partial view that just has a list of possible actions, here is the main portion: <%= Html.ActionLink("Show", "Show", new { id = dbId, css="/Content/Site.css" }) %> | <%= Html.ActionLink("Edit", "Edit", new { id = dbId }) %> | <%= Html.ActionLink("Delete", "Delete", new { id = dbId }, new { @class ...
If the css is the only thing that is different, you could just include the css and set the media type to be picked up when the user prints from the browser, e.g.:
Is passing parameters for controller overload from view good practice in .Net MVC So right now I have a partial view that just has a list of possible actions, here is the main portion: <%= Html.ActionLink("Show", "Show", new { id = dbId, css="/Content/Site.css" }) %> | <%= Html.ActionLink("Edit", "Edit", new { id = dbI...
TITLE: Is passing parameters for controller overload from view good practice in .Net MVC QUESTION: So right now I have a partial view that just has a list of possible actions, here is the main portion: <%= Html.ActionLink("Show", "Show", new { id = dbId, css="/Content/Site.css" }) %> | <%= Html.ActionLink("Edit", "Edi...
[ "asp.net-mvc-2" ]
1
0
224
1
0
2011-06-03T21:19:02.413000
2011-06-03T21:53:41.927000
6,232,799
6,233,110
For WPF TreeView, how can I use a theme while also setting the TreeView.ItemContainerStyle
I use this in XAML to load the treeview children from a view model based on Josh Smith's sample code here: This causes the theme I'm using for TreeViewItem to be ignored. It makes the selected item text black and the background darkblue so it's hard to read. Is there a way to use both the theme and the code above at th...
Try setting BasedOn to {StaticResource {x:Type TreeViewItem}}. This will take the default style for TreeViewItems (which is provided by the theme) as the base for your style.
For WPF TreeView, how can I use a theme while also setting the TreeView.ItemContainerStyle I use this in XAML to load the treeview children from a view model based on Josh Smith's sample code here: This causes the theme I'm using for TreeViewItem to be ignored. It makes the selected item text black and the background d...
TITLE: For WPF TreeView, how can I use a theme while also setting the TreeView.ItemContainerStyle QUESTION: I use this in XAML to load the treeview children from a view model based on Josh Smith's sample code here: This causes the theme I'm using for TreeViewItem to be ignored. It makes the selected item text black an...
[ "wpf", "treeview", "treeviewitem" ]
2
3
1,002
2
0
2011-06-03T21:19:14.630000
2011-06-03T22:03:22.353000
6,232,810
6,233,361
Check whether a value in a list of type IEnumerable<XAtrribute> exist in another list of same type + LINQ to XML
How can I check whether a value of XTclist exist in Xrclist. XR: Full scope 02/28/2009 Full scope 12/8/2010 XT: Full scope 24/1/2011 code: var XRclist = XR.Descendants("claims").Attributes("type"); var xTclist = XT.Descendants("claims").Attributes("type"); foreach (var c in xTclist) { if (XRclist.Contains(c.value)) //...
You could use the extension method Any: instead of if (XRclist.Contains(c.value)) use if (XRclist.Any(x => x.Value.Equals(c.Value))
Check whether a value in a list of type IEnumerable<XAtrribute> exist in another list of same type + LINQ to XML How can I check whether a value of XTclist exist in Xrclist. XR: Full scope 02/28/2009 Full scope 12/8/2010 XT: Full scope 24/1/2011 code: var XRclist = XR.Descendants("claims").Attributes("type"); var xTcli...
TITLE: Check whether a value in a list of type IEnumerable<XAtrribute> exist in another list of same type + LINQ to XML QUESTION: How can I check whether a value of XTclist exist in Xrclist. XR: Full scope 02/28/2009 Full scope 12/8/2010 XT: Full scope 24/1/2011 code: var XRclist = XR.Descendants("claims").Attributes(...
[ "linq-to-xml", "xattribute" ]
2
3
3,301
1
0
2011-06-03T21:20:15.127000
2011-06-03T22:43:03.260000