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
93,821
93,843
.NET Framework method to quickly build directories
Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in.NET, or do I need to handle this myself?
This is your friend: http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx
.NET Framework method to quickly build directories Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in.NET, or ...
TITLE: .NET Framework method to quickly build directories QUESTION: Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method fo...
[ ".net", "powershell" ]
1
7
172
4
0
2008-09-18T15:53:27.763000
2008-09-18T15:54:54.797000
93,832
93,877
How does one load a URL from a .NET client application
What is the preferred way to open a URL from a thick client application on Windows using C# and the.NET framework? I want it to use the default browser.
The following code surely works: Process.Start("http://www.yoururl.com/Blah.aspx"); It opens the default browser (technically, the default program that handles HTTP URIs).
How does one load a URL from a .NET client application What is the preferred way to open a URL from a thick client application on Windows using C# and the.NET framework? I want it to use the default browser.
TITLE: How does one load a URL from a .NET client application QUESTION: What is the preferred way to open a URL from a thick client application on Windows using C# and the.NET framework? I want it to use the default browser. ANSWER: The following code surely works: Process.Start("http://www.yoururl.com/Blah.aspx"); I...
[ "c#", ".net", "windows", "client" ]
2
8
1,480
4
0
2008-09-18T15:54:09.837000
2008-09-18T15:57:41.263000
93,834
93,987
When is multi-threading not a good idea?
I was recently working on an application that sent and received messages over Ethernet and Serial. I was then tasked to add the monitoring of DIO discretes. I throught, "No reason to interrupt the main thread which is involved in message processing, I'll just create another thread that monitors DIO." This decision, how...
On a single processor machine and a desktop application, you use multi threads so you don't freeze the app but for nothing else really. On a single processor server and a web based app, no need for multi threading because the web server handles most of it. On a multi-processor machine and desktop app, you are suggested...
When is multi-threading not a good idea? I was recently working on an application that sent and received messages over Ethernet and Serial. I was then tasked to add the monitoring of DIO discretes. I throught, "No reason to interrupt the main thread which is involved in message processing, I'll just create another thre...
TITLE: When is multi-threading not a good idea? QUESTION: I was recently working on an application that sent and received messages over Ethernet and Serial. I was then tasked to add the monitoring of DIO discretes. I throught, "No reason to interrupt the main thread which is involved in message processing, I'll just c...
[ "multithreading", "language-agnostic" ]
36
13
31,873
14
0
2008-09-18T15:54:28.493000
2008-09-18T16:08:51.407000
93,839
93,889
Bit manipulation and output in Java
If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file? This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks!
Easiest is to simply take 8 consecutive characters, turn them into a byte and output that byte. Pad with zeros at the end if you can recognize the end-of-stream, or add a header with length (in bits) at the beginning of the file. The inner loop would look something like: byte[] buffer = new byte[ ( string.length + 7 ) ...
Bit manipulation and output in Java If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file? This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks!
TITLE: Bit manipulation and output in Java QUESTION: If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file? This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks! ANSWER: Ea...
[ "java", "bit-manipulation" ]
5
6
4,158
4
0
2008-09-18T15:54:46.263000
2008-09-18T15:59:31.913000
93,853
94,243
How to fix / debug 'expected x.rb to define X.rb' in Rails
I have seen this problem arise in many different circumstances and would like to get the best practices for fixing / debugging it on StackOverflow. To use a real world example this occurred to me this morning: expected announcement.rb to define Announcement The class worked fine in development, testing and from a produ...
That is a tricky one. What generally works for me is to run "script/console production" on the production server, and type in: Announcement That will usually give you a better error message. But you said you already tried that?
How to fix / debug 'expected x.rb to define X.rb' in Rails I have seen this problem arise in many different circumstances and would like to get the best practices for fixing / debugging it on StackOverflow. To use a real world example this occurred to me this morning: expected announcement.rb to define Announcement The...
TITLE: How to fix / debug 'expected x.rb to define X.rb' in Rails QUESTION: I have seen this problem arise in many different circumstances and would like to get the best practices for fixing / debugging it on StackOverflow. To use a real world example this occurred to me this morning: expected announcement.rb to defin...
[ "ruby-on-rails", "ruby" ]
22
11
9,453
13
0
2008-09-18T15:55:46.930000
2008-09-18T16:36:57.907000
93,888
94,362
How do I explicitly set asp.net sessions to ONLY expire on closing the browser or explicit logou?
By default the session expiry seems to be 20 minutes. Update: I do not want the session to expire until the browser is closed. Update2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go for a shower (>20 mins;)). Comes back to computer and should be able to play around. He closes br...
If you want to extend the session beyond 20 minutes, you change the default using the IIS admin or you can set it in the web.config file. For example, to set the timeout to 60 minutes in web.config:... other elements omitted...... other elements omitted.... You can do the same for a particular user in code with: Sessio...
How do I explicitly set asp.net sessions to ONLY expire on closing the browser or explicit logou? By default the session expiry seems to be 20 minutes. Update: I do not want the session to expire until the browser is closed. Update2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go...
TITLE: How do I explicitly set asp.net sessions to ONLY expire on closing the browser or explicit logou? QUESTION: By default the session expiry seems to be 20 minutes. Update: I do not want the session to expire until the browser is closed. Update2: This is my scenario. User logs into site. Plays around the site. Lea...
[ "asp.net", "session" ]
6
6
8,735
9
0
2008-09-18T15:59:26.190000
2008-09-18T16:48:29.643000
93,900
702,024
Can't add server to a moved workspace
I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace. When I select Tomcat v6.0 I get a message Cannot create a server using the selected type Older tomcat versions are available, though. I...
I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition. Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomca...
Can't add server to a moved workspace I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace. When I select Tomcat v6.0 I get a message Cannot create a server using the selected type Older to...
TITLE: Can't add server to a moved workspace QUESTION: I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace. When I select Tomcat v6.0 I get a message Cannot create a server using the sele...
[ "eclipse", "tomcat", "jakarta-ee", "workspace" ]
44
74
50,109
17
0
2008-09-18T16:00:54.017000
2009-03-31T16:58:38.550000
93,911
94,318
How can you run Javascript using Rhino for Java in a sandbox?
Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly). My question is how can I setup the execution of these scripts to make sure scripting errors don't have a major negative i...
To guard against infinite loops, you'd need to put it in a separate process so that it could be killed. To guard against creating threads, you'd need to extend SecurityManager (the default implementation allows untrusted code to access non-root thread groups). Java security does allow you to prevent access to the file ...
How can you run Javascript using Rhino for Java in a sandbox? Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly). My question is how can I setup the execution of these scrip...
TITLE: How can you run Javascript using Rhino for Java in a sandbox? QUESTION: Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly). My question is how can I setup the execut...
[ "java", "javascript", "sandbox", "rhino" ]
36
10
13,539
6
0
2008-09-18T16:01:36.073000
2008-09-18T16:43:57.737000
93,932
94,179
Out of String Space in Visual Basic 6
We are getting an error in a VB6 application that sends data back and forth over TCP sockets. We get a runtime error "out of string space". Has anyone seen this or have any thoughts on why this would happen? It seems like we are hitting some VB6 threshhold so any other thoughts would be helpful as well.
As others have pointed out, every string concatenation in VB will allocate a new string and then copy the data over and then de-allocate the original once it can. In a loop this can cause issues. To work around this you can create a simple StringBuilder class like this one: Option Explicit Private data As String Priva...
Out of String Space in Visual Basic 6 We are getting an error in a VB6 application that sends data back and forth over TCP sockets. We get a runtime error "out of string space". Has anyone seen this or have any thoughts on why this would happen? It seems like we are hitting some VB6 threshhold so any other thoughts wou...
TITLE: Out of String Space in Visual Basic 6 QUESTION: We are getting an error in a VB6 application that sends data back and forth over TCP sockets. We get a runtime error "out of string space". Has anyone seen this or have any thoughts on why this would happen? It seems like we are hitting some VB6 threshhold so any ...
[ "string", "memory", "vb6" ]
11
12
21,893
6
0
2008-09-18T16:03:42.170000
2008-09-18T16:30:06.770000
93,944
94,110
How do you maintain java webapps in different staging environments?
You might have a set of properties that is used on the developer machine, which varies from developer to developer, another set for a staging environment, and yet another for the production environment. In a Spring application you may also have beans that you want to load in a local environment but not in a production ...
I just put the various properties in JNDI. This way each of the servers can be configured and I can have ONE war file. If the list of properties is large, then I'll host the properties (or XML) files on another server. I'll use JNDI to specify the URL of the file to use. If you are creating different app files (war/ear...
How do you maintain java webapps in different staging environments? You might have a set of properties that is used on the developer machine, which varies from developer to developer, another set for a staging environment, and yet another for the production environment. In a Spring application you may also have beans t...
TITLE: How do you maintain java webapps in different staging environments? QUESTION: You might have a set of properties that is used on the developer machine, which varies from developer to developer, another set for a staging environment, and yet another for the production environment. In a Spring application you may...
[ "java", "spring", "configuration", "web-applications" ]
12
8
6,102
13
0
2008-09-18T16:05:09
2008-09-18T16:22:10.847000
93,954
93,980
How to programmatically create videos?
Is there a freely available library to create a MPEG (or any other simple video format) out of an image sequence? It must run on Linux too, and ideally have Python bindings.
I know there's mencoder (part of the mplayer project), and ffmpeg, which both can do this.
How to programmatically create videos? Is there a freely available library to create a MPEG (or any other simple video format) out of an image sequence? It must run on Linux too, and ideally have Python bindings.
TITLE: How to programmatically create videos? QUESTION: Is there a freely available library to create a MPEG (or any other simple video format) out of an image sequence? It must run on Linux too, and ideally have Python bindings. ANSWER: I know there's mencoder (part of the mplayer project), and ffmpeg, which both ca...
[ "linux", "video", "mpeg" ]
10
4
12,088
7
0
2008-09-18T16:06:00.383000
2008-09-18T16:08:10.473000
93,976
93,979
How to determine whether a character is a letter in Java?
How do you check if a one-character String is a letter - including any letters with accents? I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.
Just checking if a letter is in A-Z because that doesn't include letters with accents or letters in other alphabets. I found out that you can use the regular expression class for 'Unicode letter', or one of its case-sensitive variations: string.matches("\\p{L}"); // Unicode letter string.matches("\\p{Lu}"); // Unicode ...
How to determine whether a character is a letter in Java? How do you check if a one-character String is a letter - including any letters with accents? I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.
TITLE: How to determine whether a character is a letter in Java? QUESTION: How do you check if a one-character String is a letter - including any letters with accents? I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me. ANSWER: Just checking if a letter is in A-Z beca...
[ "java", "unicode" ]
27
22
48,948
2
0
2008-09-18T16:07:48.790000
2008-09-18T16:08:06.933000
93,981
94,157
What is the correct way to design/implement two (or more) classes that have "has a" relationships with the same object?
Suppose I have a design like this: Object GUI has two objects: object aManager and object bManager, which don't ever talk to each other. Both aManager and bManager have object cManager as an attribute (or rather a pointer to cManager). So when aManager modifies its cManager, it's affecting bManager's cManager as well. ...
I'm going to interpret this as simply as possible, if I'm not answering your question, I apologize. When you really get the answer to this question, it's your first step to really thinking Object Orientedly. In OO, when two objects both "has a" 'nother object, it's perfectly acceptable for both to refer to that other o...
What is the correct way to design/implement two (or more) classes that have "has a" relationships with the same object? Suppose I have a design like this: Object GUI has two objects: object aManager and object bManager, which don't ever talk to each other. Both aManager and bManager have object cManager as an attribute...
TITLE: What is the correct way to design/implement two (or more) classes that have "has a" relationships with the same object? QUESTION: Suppose I have a design like this: Object GUI has two objects: object aManager and object bManager, which don't ever talk to each other. Both aManager and bManager have object cManag...
[ "design-patterns", "oop" ]
4
1
254
7
0
2008-09-18T16:08:14.543000
2008-09-18T16:28:27.803000
93,983
94,078
How can I split a string using regex to return a list of values?
How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks
In C# you can use capturing groups private void RegexTest() { String input = "foo[]=1&foo[]=5&foo[]=2"; String pattern = @"foo\[\]=(\d+)"; Regex regex = new Regex(pattern); foreach (Match match in regex.Matches(input)) { Console.Out.WriteLine(match.Groups[1]); } }
How can I split a string using regex to return a list of values? How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks
TITLE: How can I split a string using regex to return a list of values? QUESTION: How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks ANSWER: In C# you can use capturing groups private void RegexTest() { St...
[ "c#", "regex" ]
1
4
7,800
8
0
2008-09-18T16:08:21.067000
2008-09-18T16:17:56.190000
93,989
94,255
Prevent multiple instances of a given app in .NET?
In.NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it?
Use Mutex. One of the examples above using GetProcessByName has many caveats. Here is a good article on the subject: https://web.archive.org/web/20230610150623/https://odetocode.com/blogs/scott/archive/2004/08/20/the-misunderstood-mutex.aspx [STAThread] static void Main() { using(Mutex mutex = new Mutex(false, "Global\...
Prevent multiple instances of a given app in .NET? In.NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it?
TITLE: Prevent multiple instances of a given app in .NET? QUESTION: In.NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it? ANSWER: Use Mutex. One of the examples above using GetProcessByName has many caveats. Here is...
[ "c#", ".net" ]
148
177
123,096
18
0
2008-09-18T16:08:52.530000
2008-09-18T16:38:19.543000
94,007
95,656
Adobe ExtendScript development - How different than regular JavaScript?
Question I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part? Overview I'm working on a media database (or a so-called "multimedia library") project and it is based ...
If it's anything like the scripting used for the old Flash IDE, then I think it's just straight javascript/ECMAScript. The only real difference is the APIs you have avaialble. I expect anyone who's good with javascript would be able to pick it up fairly quickly.
Adobe ExtendScript development - How different than regular JavaScript? Question I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part? Overview I'm working on a media...
TITLE: Adobe ExtendScript development - How different than regular JavaScript? QUESTION: Question I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part? Overview I'm ...
[ "javascript", "adobe", "extendscript" ]
13
6
4,183
2
0
2008-09-18T16:10:55.083000
2008-09-18T18:54:04.117000
94,011
95,636
How to abort a thread in a fast and clean way in java?
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another value (or the same value again by clicking many times on ...
Try interrupt() as some have said to see if it makes any difference to your thread. If not, try destroying or closing a resource that will make the thread stop. That has a chance of being a little better than trying to throw Thread.stop() at it. If performance is tolerable, you might view each 3D update as a discrete n...
How to abort a thread in a fast and clean way in java? Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another va...
TITLE: How to abort a thread in a fast and clean way in java? QUESTION: Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user ...
[ "java", "multithreading" ]
28
12
53,286
15
0
2008-09-18T16:11:07.067000
2008-09-18T18:52:10.470000
94,023
94,041
Specifying model in controller?
I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller: class GenericController > ApplicationController # filters and such model:some_model Although the name of the model does not match the name of the model, is there any reason to specify this? Or is this something that...
This had to do with dependency injection. I don't recall the details. By now it's just a glorified require, which you don't need because rails auto-requires files for missing constants.
Specifying model in controller? I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller: class GenericController > ApplicationController # filters and such model:some_model Although the name of the model does not match the name of the model, is there any reason to specify...
TITLE: Specifying model in controller? QUESTION: I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller: class GenericController > ApplicationController # filters and such model:some_model Although the name of the model does not match the name of the model, is there any...
[ "ruby-on-rails", "ruby" ]
1
4
512
2
0
2008-09-18T16:12:03.333000
2008-09-18T16:14:02.707000
94,024
94,045
Inheriting a base class
I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RoleProvider. The error is: ADAuth.ActiveDirect...
You have to override any abstract elements of your base class. If they are marked abstract, it means the base class does not provide a default implementation, so you cannot call it.
Inheriting a base class I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RoleProvider. The error...
TITLE: Inheriting a base class QUESTION: I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RoleP...
[ "inheritance", "active-directory", "forms-authentication" ]
0
2
257
1
0
2008-09-18T16:12:05.330000
2008-09-18T16:14:50.223000
94,037
94,049
Convert character to ASCII code in JavaScript
How can I convert a character to its ASCII code using JavaScript? For example: get 10 from "\n".
"\n".charCodeAt(0); Here is the documentation for charCodeAt: The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index. The UTF-16 code unit matches the Unicode code point for code points which can be represented in a single UTF-16 code unit. If the Unicode cod...
Convert character to ASCII code in JavaScript How can I convert a character to its ASCII code using JavaScript? For example: get 10 from "\n".
TITLE: Convert character to ASCII code in JavaScript QUESTION: How can I convert a character to its ASCII code using JavaScript? For example: get 10 from "\n". ANSWER: "\n".charCodeAt(0); Here is the documentation for charCodeAt: The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 c...
[ "javascript" ]
1,239
1,808
1,396,988
18
0
2008-09-18T16:13:48.010000
2008-09-18T16:15:24.823000
94,042
94,055
What can cause an ASP.NET worker process to be recycled?
Here is my current question: I'm guessing that my problem (described below) is being caused by ASP.NET worker processes being recycled, per the answers below—I'm using InProc sessions storage and don't see much chance of moving away, due to the restriction for other types of storage that all session objects be serializ...
One solution would be to use a StateServer, rather than InProc session management. Lots of things can cause the session state to be lost: Editing Web.Config IIS resetting etc. If the session state is important to your app then use either SQL state management, or the State Server which ships with ASP. NET. Cheers, RB.
What can cause an ASP.NET worker process to be recycled? Here is my current question: I'm guessing that my problem (described below) is being caused by ASP.NET worker processes being recycled, per the answers below—I'm using InProc sessions storage and don't see much chance of moving away, due to the restriction for ot...
TITLE: What can cause an ASP.NET worker process to be recycled? QUESTION: Here is my current question: I'm guessing that my problem (described below) is being caused by ASP.NET worker processes being recycled, per the answers below—I'm using InProc sessions storage and don't see much chance of moving away, due to the ...
[ "asp.net", "ajax", "session" ]
4
3
3,284
5
0
2008-09-18T16:14:17.947000
2008-09-18T16:15:41.033000
94,047
94,337
Are .NET 3.5 XPath classes and methods XSLT 2.0 compatible?
I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this.
There are some things in XSLT 2.0 that aren't supported in the built in libraries (there was discussion on the mono mailing list about this but I can't find the information anymore). But most people never run into the corner cases that aren't supported. Another option is to check out the open source http://saxon.source...
Are .NET 3.5 XPath classes and methods XSLT 2.0 compatible? I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this.
TITLE: Are .NET 3.5 XPath classes and methods XSLT 2.0 compatible? QUESTION: I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this. ANSWER: There are some things in XSLT 2.0 that aren't supported in the built in librari...
[ "xml", "xslt", ".net-3.5", "xpath" ]
3
3
6,566
6
0
2008-09-18T16:14:57.337000
2008-09-18T16:45:24.783000
94,053
94,167
How are you using the Machine.config, or are you?
For ASP.Net application deployment what type of information (if any) are you storing in the machine.config? If you're not using it, how are you managing environment specific configuration settings that may change for each environment? I'm looking for some "best practices" and the benefits/pitfalls of each. We're about ...
We are considering using machine.config to add one key for the environment, and then have one section in the web.config which is excactly the same for all environments. This way we can do a "real" XCopy deployment. E.g. in the machine.config for every computer (local dev workstations, stage servers, build servers, prod...
How are you using the Machine.config, or are you? For ASP.Net application deployment what type of information (if any) are you storing in the machine.config? If you're not using it, how are you managing environment specific configuration settings that may change for each environment? I'm looking for some "best practice...
TITLE: How are you using the Machine.config, or are you? QUESTION: For ASP.Net application deployment what type of information (if any) are you storing in the machine.config? If you're not using it, how are you managing environment specific configuration settings that may change for each environment? I'm looking for s...
[ ".net", "asp.net", "deployment", "configuration" ]
13
8
5,368
4
0
2008-09-18T16:15:32.483000
2008-09-18T16:29:04.527000
94,057
95,617
Using Resharper Unit Test Runner for MSTest via Gallio
I am attempting to get the Resharper test runner to recognize my MSTest unit tests via Gallio. I have the following installed: VSTS 2005 8.0.50727.762 Resharper 4.1 Gallio 3.0.0.285 I am also running Windows XP x64. The unit test options only shows NUnit as being available. I am thinking that I must have some versionin...
It looks like this is a Gallio problem. It appears to only support the version of MSTest that comes with VS2k8. The XML format for vsmdi has changed between versions.
Using Resharper Unit Test Runner for MSTest via Gallio I am attempting to get the Resharper test runner to recognize my MSTest unit tests via Gallio. I have the following installed: VSTS 2005 8.0.50727.762 Resharper 4.1 Gallio 3.0.0.285 I am also running Windows XP x64. The unit test options only shows NUnit as being a...
TITLE: Using Resharper Unit Test Runner for MSTest via Gallio QUESTION: I am attempting to get the Resharper test runner to recognize my MSTest unit tests via Gallio. I have the following installed: VSTS 2005 8.0.50727.762 Resharper 4.1 Gallio 3.0.0.285 I am also running Windows XP x64. The unit test options only show...
[ "unit-testing", "resharper", "mstest", "gallio" ]
4
3
3,702
5
0
2008-09-18T16:15:57.380000
2008-09-18T18:50:12.363000
94,084
94,728
Number of Classes in a Visual Studio Solution
Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS. I am running Visual Studio 2008 and this is a VB.Net project through and through. thanks!
You could use a free tool like SourceMonitor, which has a reasonable set of metrics including number of classes. You could also use a tool like NDepend which is a lot more powerful, but also costs money. Either can be integrated into your build environment if you're using MSBuild or NAnt.
Number of Classes in a Visual Studio Solution Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS. I am running Visual Studio 2008 and this is a VB.Net project through and...
TITLE: Number of Classes in a Visual Studio Solution QUESTION: Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS. I am running Visual Studio 2008 and this is a VB.Net p...
[ "visual-studio" ]
13
8
12,041
4
0
2008-09-18T16:18:46.780000
2008-09-18T17:34:07.927000
94,101
94,137
How to type faster
I've typed around 75wpm for the last few years but I've always wondered how people type +100wpm. I've searched but I primarily find typing tutors that teach you to type.. not teach you to type faster. So far the only tip I've come across is to learn dvorak. Are there exercises or tips to help break through the 75wpm wa...
Setting yourself up in an ergonomic typing position is a good start. Take a look at the diagram here - notice the arms in a straight line, feet on the floor, etc. In my experience most people tend to slow down when they get to unusual keys - numbers, symbols, punctuation, etc, so maybe some focused practice on those ke...
How to type faster I've typed around 75wpm for the last few years but I've always wondered how people type +100wpm. I've searched but I primarily find typing tutors that teach you to type.. not teach you to type faster. So far the only tip I've come across is to learn dvorak. Are there exercises or tips to help break t...
TITLE: How to type faster QUESTION: I've typed around 75wpm for the last few years but I've always wondered how people type +100wpm. I've searched but I primarily find typing tutors that teach you to type.. not teach you to type faster. So far the only tip I've come across is to learn dvorak. Are there exercises or ti...
[ "typing", "touch-typing", "performance", "wpm" ]
25
12
11,890
25
0
2008-09-18T16:20:46.463000
2008-09-18T16:25:27
94,123
98,158
What might cause CSS to fail to load occasionally on all browsers?
I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files loaded, all within the same style block using @import: In any situation when we take ...
I've had a similar thing happen that I was able to fix by including a base style sheet first using the "link rel" method rather than "@import". i.e. move your [base css file] inclusion to: and put it before the others.
What might cause CSS to fail to load occasionally on all browsers? I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files loaded, all within...
TITLE: What might cause CSS to fail to load occasionally on all browsers? QUESTION: I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files ...
[ "css", "tomcat" ]
7
4
8,690
5
0
2008-09-18T16:23:47.910000
2008-09-18T23:58:26.117000
94,141
120,165
JavaScript's document.write Inline Script Execution Order
I have the following script, where the first and third document.writeline are static and the second is generated: Firefox and Chrome will display before, during and after, while Internet Explorer first shows during and only then does it show before and after. I've come across an article that states that I'm not the fir...
I've found an answer more to my liking: This will defer the loading of both during and after until the page has finished loading. I think this is as good as I can get. Hopefully, someone will be able to give a better answer.
JavaScript's document.write Inline Script Execution Order I have the following script, where the first and third document.writeline are static and the second is generated: Firefox and Chrome will display before, during and after, while Internet Explorer first shows during and only then does it show before and after. I'...
TITLE: JavaScript's document.write Inline Script Execution Order QUESTION: I have the following script, where the first and third document.writeline are static and the second is generated: Firefox and Chrome will display before, during and after, while Internet Explorer first shows during and only then does it show be...
[ "javascript", "cross-browser", "browser" ]
36
5
55,169
7
0
2008-09-18T16:25:52.507000
2008-09-23T10:04:13.433000
94,148
94,215
Appropriate design pattern for an event log parser?
Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about "getting it done" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly a self-teaching experiment. I am interested in what patterns more exp...
Well... for one thing rather than a single event class with a union of all the properties, or 61 event classes (1 base, 60 subs), in a scenario with that much variation, I'd be tempted to have a single event class that uses a property bag (dictionary, hashtable, w/e floats your boat) to store event information. The typ...
Appropriate design pattern for an event log parser? Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about "getting it done" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly a self-teaching e...
TITLE: Appropriate design pattern for an event log parser? QUESTION: Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about "getting it done" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly...
[ "java", "logging" ]
7
3
3,867
5
0
2008-09-18T16:26:51.940000
2008-09-18T16:34:19.070000
94,153
94,339
How do I persist to disk a temporary file using Python?
I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError: >>> import tempfile, shutil >>> f = tempfile.TemporaryFile(mode ='w+t') >>> f.wri...
The file you create with TemporaryFile or NamedTemporaryFile is automatically removed when it's closed, which is why you get an error. If you don't want this, you can use mkstemp instead (see the docs for tempfile ). >>> import tempfile, shutil, os >>> fd, path = tempfile.mkstemp() >>> os.write(fd, 'foo') >>> os.close(...
How do I persist to disk a temporary file using Python? I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError: >>> import tempfile, shut...
TITLE: How do I persist to disk a temporary file using Python? QUESTION: I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError: >>> imp...
[ "python", "temporary-files" ]
31
24
48,506
4
0
2008-09-18T16:27:26.900000
2008-09-18T16:45:37.793000
94,154
129,428
Inconsistent display behavior for Quick Launch menu in MOSS 2007
I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply: Given a site map of: RootSite --- SubSite1 = navigation set at "Display the current site, the navigation items bel...
I followed @Nat's guidance into the murky world Sharepoint webparts to achieve the behavior I described above. My approach was to roll my own version of the MossMenu webpart that Microsoft has released through the ECM Team Blog. This code is based on the native AspMenu control. I used this control to "intercept" the na...
Inconsistent display behavior for Quick Launch menu in MOSS 2007 I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply: Given a site map of: RootSite --- SubSite1 = navi...
TITLE: Inconsistent display behavior for Quick Launch menu in MOSS 2007 QUESTION: I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply: Given a site map of: RootSite -...
[ "sharepoint", "moss" ]
1
2
5,618
3
0
2008-09-18T16:27:30.380000
2008-09-24T19:47:08.093000
94,161
94,259
Where to put helper-scripts with GNU autoconf/automake?
I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries? Also, is there a wa...
Add something like this to Makefile.am scriptsdir = $(prefix)/bin scripts_DATA = awkscript1 awkscript2 In this case it will install awkscript in $(prefix)/bin (you can also use $(bindir)). Note: Dont forget that the first should be named name + dir (scripts -> scriptsdir) and the second should be name + _DATA (scripts ...
Where to put helper-scripts with GNU autoconf/automake? I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should...
TITLE: Where to put helper-scripts with GNU autoconf/automake? QUESTION: I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into t...
[ "autoconf", "automake" ]
2
3
2,930
4
0
2008-09-18T16:28:40.253000
2008-09-18T16:38:40.587000
94,171
95,143
What is the best way to display a 'loading' indicator on a WPF control
In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents?
I generally would create a layout like this:...... Then I load the data on a worker thread, and when it's finished I update the UI under the "MainContent" grid and enable the grid, then set the LoadingIndicatorPanel's Visibility to Collapsed. I'm not sure if this is what you were asking or if you wanted to know how to ...
What is the best way to display a 'loading' indicator on a WPF control In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents?
TITLE: What is the best way to display a 'loading' indicator on a WPF control QUESTION: In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents? ANSWER: I generally would create...
[ "c#", ".net", "wpf", "user-controls" ]
11
14
32,385
6
0
2008-09-18T16:29:26.040000
2008-09-18T18:12:33.483000
94,173
95,339
NAnt best practices
I have here 300 lines long NAnt file and it is quite a messy. I am wondering if there is a any style guide for writing NAnt scripts and what are the best practices for doing so. Any tips?
I'm not aware of any published style guide, but I can certainly share my experience. You can use many of the same techniques used in other programming environments, such as making the code modular and splitting it across multiple files. In the environment that I have set up, each project is laid out like so: "[ProjectN...
NAnt best practices I have here 300 lines long NAnt file and it is quite a messy. I am wondering if there is a any style guide for writing NAnt scripts and what are the best practices for doing so. Any tips?
TITLE: NAnt best practices QUESTION: I have here 300 lines long NAnt file and it is quite a messy. I am wondering if there is a any style guide for writing NAnt scripts and what are the best practices for doing so. Any tips? ANSWER: I'm not aware of any published style guide, but I can certainly share my experience. ...
[ ".net", "coding-style", "nant" ]
8
5
842
1
0
2008-09-18T16:29:34.040000
2008-09-18T18:28:49.090000
94,177
94,690
WPF Datatrigger not firing when expected
I have the following XAML: The first text block happily changes with SelectedItems.Count, showing 0,1,2, etc. The datatrigger on the second block never seems to fire to change the text. Any thoughts?
The DataTrigger is firing but the Text field for your second TextBlock is hard-coded as "items selected" so it won't be able to change. To see it firing, you can remove Text="items selected". Your problem is a good candidate for using a ValueConverter instead of DataTrigger. Here's how to create and use the ValueConver...
WPF Datatrigger not firing when expected I have the following XAML: The first text block happily changes with SelectedItems.Count, showing 0,1,2, etc. The datatrigger on the second block never seems to fire to change the text. Any thoughts?
TITLE: WPF Datatrigger not firing when expected QUESTION: I have the following XAML: The first text block happily changes with SelectedItems.Count, showing 0,1,2, etc. The datatrigger on the second block never seems to fire to change the text. Any thoughts? ANSWER: The DataTrigger is firing but the Text field for you...
[ "wpf", "datatrigger" ]
31
13
16,983
2
0
2008-09-18T16:29:45.680000
2008-09-18T17:29:00.810000
94,178
94,209
Why does StatSVN fail, claiming the directory is not a working copy?
I have a working copy of my project, checked out using Subversion 1.5.1. When I attempt to run StatSVN against it, I get the following error: Sep 18, 2008 12:25:22 PM net.sf.statsvn.util.JavaUtilTaskLogger info INFO: StatSVN - SVN statistics generation Sep 18, 2008 12:25:22 PM net.sf.statsvn.util.JavaUtilTaskLogger inf...
Just guessing here, but are you sure that statSVN is compatible with working copies created with version 1.5 of the client? The format changed with svn 1.5...
Why does StatSVN fail, claiming the directory is not a working copy? I have a working copy of my project, checked out using Subversion 1.5.1. When I attempt to run StatSVN against it, I get the following error: Sep 18, 2008 12:25:22 PM net.sf.statsvn.util.JavaUtilTaskLogger info INFO: StatSVN - SVN statistics generatio...
TITLE: Why does StatSVN fail, claiming the directory is not a working copy? QUESTION: I have a working copy of my project, checked out using Subversion 1.5.1. When I attempt to run StatSVN against it, I get the following error: Sep 18, 2008 12:25:22 PM net.sf.statsvn.util.JavaUtilTaskLogger info INFO: StatSVN - SVN st...
[ "svn", "statsvn" ]
1
2
1,579
2
0
2008-09-18T16:30:03.977000
2008-09-18T16:33:51.690000
94,204
94,232
What is the best way to have synchronized a collection of objects between various threads in .Net?
What is the best way to have synchronized a collection of objects between various threads in.Net? I need to have a List or Dictionary accessed from different threads in a thread safe mode. With Adds, Removes, Foreachs, etc.
You could implement a lock-free queue: http://www.boyet.com/Articles/LockfreeQueue.html Or handle the synchronization yourself using locks: http://www.albahari.com/threading/part2.html#_Locking
What is the best way to have synchronized a collection of objects between various threads in .Net? What is the best way to have synchronized a collection of objects between various threads in.Net? I need to have a List or Dictionary accessed from different threads in a thread safe mode. With Adds, Removes, Foreachs, et...
TITLE: What is the best way to have synchronized a collection of objects between various threads in .Net? QUESTION: What is the best way to have synchronized a collection of objects between various threads in.Net? I need to have a List or Dictionary accessed from different threads in a thread safe mode. With Adds, Rem...
[ "multithreading" ]
1
0
318
5
0
2008-09-18T16:33:41.753000
2008-09-18T16:35:42.887000
94,226
94,338
How to switch back to a previous version of a file without deleting its subsequent revisions?
I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use " svn update -r 2 A.txt " because this will delete all the revisions after r2, namely r3 and r4. So is there any way that I ...
I don't have a lot of experience with Subversion so please excuse me if this method doesn't work in this environment. In this situation I follow these steps: Check out the file in question ready for editing as r4 Overwrite your local copy of the file with the revision you require, in this case r2 Check in / commit this...
How to switch back to a previous version of a file without deleting its subsequent revisions? I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use " svn update -r 2 A.txt " beca...
TITLE: How to switch back to a previous version of a file without deleting its subsequent revisions? QUESTION: I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use " svn update...
[ "svn" ]
11
3
25,625
7
0
2008-09-18T16:35:11.127000
2008-09-18T16:45:33.130000
94,227
94,512
Smart pointers: who owns the object?
C++ is all about memory ownership - aka ownership semantics. It is the responsibility of the owner of a chunk of dynamically allocated memory to release that memory. So the question really becomes who owns the memory. In C++ ownership is documented by the type a raw pointer is wrapped inside thus in a good (IMO) C++ pr...
For me, these 3 kinds cover most of my needs: shared_ptr - reference-counted, deallocation when the counter reaches zero weak_ptr - same as above, but it's a 'slave' for a shared_ptr, can't deallocate auto_ptr - when the creation and deallocation happen inside the same function, or when the object has to be considered ...
Smart pointers: who owns the object? C++ is all about memory ownership - aka ownership semantics. It is the responsibility of the owner of a chunk of dynamically allocated memory to release that memory. So the question really becomes who owns the memory. In C++ ownership is documented by the type a raw pointer is wrapp...
TITLE: Smart pointers: who owns the object? QUESTION: C++ is all about memory ownership - aka ownership semantics. It is the responsibility of the owner of a chunk of dynamically allocated memory to release that memory. So the question really becomes who owns the memory. In C++ ownership is documented by the type a ra...
[ "c++", "memory-management", "smart-pointers", "ownership-semantics" ]
122
21
63,187
11
0
2008-09-18T16:35:17.117000
2008-09-18T17:07:05.887000
94,241
94,287
Does the CSS 'font-size: medium' set font to .Body font size or to the *browser*'s base font size?
in "CSS: The missing manual" the author says that font-size: medium (or other size keywords) sets the font relative to the browser's base font size. But what I'm seeing in FF2 and IE6 is that it sets the font size to what I specified in the.CSS HTML or BODY style (which is much preferred). If it works the latter way, t...
From the CSS 2.1 specification: The 'medium' value is the user's preferred font size and is used as the reference middle value. If a browser doesn't do this, then the browser is buggy.
Does the CSS 'font-size: medium' set font to .Body font size or to the *browser*'s base font size? in "CSS: The missing manual" the author says that font-size: medium (or other size keywords) sets the font relative to the browser's base font size. But what I'm seeing in FF2 and IE6 is that it sets the font size to what...
TITLE: Does the CSS 'font-size: medium' set font to .Body font size or to the *browser*'s base font size? QUESTION: in "CSS: The missing manual" the author says that font-size: medium (or other size keywords) sets the font relative to the browser's base font size. But what I'm seeing in FF2 and IE6 is that it sets the...
[ "css" ]
4
5
5,507
5
0
2008-09-18T16:36:54.443000
2008-09-18T16:40:50.020000
94,245
94,300
How to get a Flex project to load a plugin at runtime?
I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin from ...
You can use either Modules or RSL. RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer. Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet. Here is some docume...
How to get a Flex project to load a plugin at runtime? I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runt...
TITLE: How to get a Flex project to load a plugin at runtime? QUESTION: I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loadin...
[ "apache-flex", "plugins", "ria" ]
2
3
353
3
0
2008-09-18T16:37:08.237000
2008-09-18T16:42:06.600000
94,263
95,317
How to programmatically determine param name when constructing an ArgumentException?
When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's param name. Is there a simple way to do this using reflection? Update: thanks to the 2...
Reflection is not appropriate for this. You'll have to put up with remembering to get it right. Fortunately FxCop (or Team System Code Analysis) will help you by pointing out any mismatches.
How to programmatically determine param name when constructing an ArgumentException? When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's p...
TITLE: How to programmatically determine param name when constructing an ArgumentException? QUESTION: When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I cha...
[ ".net", "reflection", "refactoring", "duplication" ]
3
2
229
2
0
2008-09-18T16:39:04.923000
2008-09-18T18:27:09.423000
94,274
94,347
Return to an already open application when a user tries to open a new instance
This has been a problem that I haven't been able to figure out for sometime. Preventing the second instance is trivial and has many methods, however, bringing back the already running process isn't. I would like to: Minimized: Undo the minimize and bring the running instance to the front. Behind other windows: Bring th...
I found this code to be useful. It does the detection and optional activation of an existing application: http://www.codeproject.com/KB/cs/cssingprocess.aspx
Return to an already open application when a user tries to open a new instance This has been a problem that I haven't been able to figure out for sometime. Preventing the second instance is trivial and has many methods, however, bringing back the already running process isn't. I would like to: Minimized: Undo the minim...
TITLE: Return to an already open application when a user tries to open a new instance QUESTION: This has been a problem that I haven't been able to figure out for sometime. Preventing the second instance is trivial and has many methods, however, bringing back the already running process isn't. I would like to: Minimiz...
[ "c#", ".net", "windows", "vb.net" ]
23
13
12,175
6
0
2008-09-18T16:40:05.233000
2008-09-18T16:46:35.543000
94,305
126,507
What is quicker, switch on string or elseif on type?
Lets say I have the option of identifying a code path to take on the basis of a string comparison or else iffing the type: Which is quicker and why? switch(childNode.Name) { case "Bob": break; case "Jill": break; case "Marko": break; } if(childNode is Bob) { } elseif(childNode is Jill) { } else if(childNode is Marko) ...
Greg's profile results are great for the exact scenario he covered, but interestingly, the relative costs of the different methods change dramatically when considering a number of different factors including the number of types being compared, and the relative frequency and any patterns in the underlying data. The simp...
What is quicker, switch on string or elseif on type? Lets say I have the option of identifying a code path to take on the basis of a string comparison or else iffing the type: Which is quicker and why? switch(childNode.Name) { case "Bob": break; case "Jill": break; case "Marko": break; } if(childNode is Bob) { } elsei...
TITLE: What is quicker, switch on string or elseif on type? QUESTION: Lets say I have the option of identifying a code path to take on the basis of a string comparison or else iffing the type: Which is quicker and why? switch(childNode.Name) { case "Bob": break; case "Jill": break; case "Marko": break; } if(childNode...
[ "c#", "performance" ]
81
150
59,177
24
0
2008-09-18T16:42:40.030000
2008-09-24T11:03:59.770000
94,316
94,364
How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls)
I want to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls), instead of the [Browse...] text I want to use [...]
This isn't technically possible for security purposes, so the user cannot be misled. However, there are a couple of workarounds, although these require working with the raw HTML rather than the.NET server control - take a look at http://www.quirksmode.org/dom/inputfile.html for one example.
How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls) I want to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls), instead of the [Browse...] text I want to use [...]
TITLE: How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls) QUESTION: I want to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls), instead of the [Browse...] text I want to use [...] ANSWER: This isn't technically possible for secur...
[ "asp.net", "file-upload" ]
21
9
81,181
5
0
2008-09-18T16:43:49.547000
2008-09-18T16:48:37.600000
94,334
94,510
Distributed python
What is the best python framework to create distributed applications? For example to build a P2P app.
You could checkout pyprocessing which will be included in the standard library as of 2.6. It allows you to run tasks on multiple processes using an API similar to threading.
Distributed python What is the best python framework to create distributed applications? For example to build a P2P app.
TITLE: Distributed python QUESTION: What is the best python framework to create distributed applications? For example to build a P2P app. ANSWER: You could checkout pyprocessing which will be included in the standard library as of 2.6. It allows you to run tasks on multiple processes using an API similar to threading...
[ "python", "distributed" ]
6
2
2,561
5
0
2008-09-18T16:45:07.233000
2008-09-18T17:07:00.003000
94,361
94,411
When do you use Java's @Override annotation and why?
What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override?
Use it every time you override a method for two benefits. Do it so that you can take advantage of the compiler checking to make sure you actually are overriding a method when you think you are. This way, if you make a common mistake of misspelling a method name or not correctly matching the parameters, you will be warn...
When do you use Java's @Override annotation and why? What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others t...
TITLE: When do you use Java's @Override annotation and why? QUESTION: What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Ove...
[ "java", "annotations" ]
498
515
965,069
27
0
2008-09-18T16:48:26.740000
2008-09-18T16:53:19.833000
94,372
94,427
calculate elapsed time in flash
I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?
new Date().time returns the time in milliseconds. var nStart:Number = new Date().time; // Some time passes var nMillisElapsed:Number = new Date().time - nStart; var strTime:String = Math.floor(nMillisElapsed / (1000 * 60 * 60)) + "::" + (Math.floor(nMillisElapsed / (1000 * 60)) % 60) + "::" + (Math.floor(nMillisElap...
calculate elapsed time in flash I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?
TITLE: calculate elapsed time in flash QUESTION: I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers? ANSWER: new Date().time returns the time in milliseconds. var nStart:Number = new Date().time; // Some time passes var ...
[ "time", "elapsed" ]
3
4
7,455
4
0
2008-09-18T16:49:14.883000
2008-09-18T16:54:53.857000
94,380
96,724
Volume (Balance) Control for XP/Vista
Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista?
Vista has a new api for everything related to mixers and audio, per process legacy api's should still work, but to change global volume, you would have to look at the new COM interfaces added to Vista This should get you started
Volume (Balance) Control for XP/Vista Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista?
TITLE: Volume (Balance) Control for XP/Vista QUESTION: Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista? ANSWER: Vista has a new api for everything related to mixers and audio, per process legacy api's should still work, but to change global volume, you would have t...
[ "c++", "windows", "windows-vista", "audio" ]
3
4
2,829
2
0
2008-09-18T16:50:09.500000
2008-09-18T20:41:52.140000
94,382
3,419,406
Vim with Powershell
I'm using gvim on Windows. In my _vimrc I've added: set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test:call Test() If I execute this function (:Test) I see nonsense characters (non number/letter ASCII characters). ...
It is a bit of a hack, but the following works in Vim 7.2. Notice, I am running Powershell within a CMD session. if has("win32") set shell=cmd.exe set shellcmdflag=/c\ powershell.exe\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ RemoteSigned set shellpipe=| set shellredir=> endif function! Test() echo syste...
Vim with Powershell I'm using gvim on Windows. In my _vimrc I've added: set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test:call Test() If I execute this function (:Test) I see nonsense characters (non number/letter...
TITLE: Vim with Powershell QUESTION: I'm using gvim on Windows. In my _vimrc I've added: set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test:call Test() If I execute this function (:Test) I see nonsense characters ...
[ "vim", "powershell" ]
58
26
28,482
13
0
2008-09-18T16:50:26.190000
2010-08-05T21:38:59.793000
94,410
125,489
Windsor Interceptors AOP & Caching
I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site. Does anyone have any thoughts/experience with doing this? Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCacheD or Velocity (or another distributed cache) for the ...
I've been using caching decorators (not interceptors) with Windsor and they work great. Interceptors are good for this as well, see this for example.
Windsor Interceptors AOP & Caching I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site. Does anyone have any thoughts/experience with doing this? Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCacheD or Velocity (or ...
TITLE: Windsor Interceptors AOP & Caching QUESTION: I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site. Does anyone have any thoughts/experience with doing this? Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCache...
[ ".net", "castle-windsor", "aop" ]
7
2
5,175
6
0
2008-09-18T16:53:14.170000
2008-09-24T04:59:54.170000
94,445
94,458
Using OpenSSL what does "unable to write 'random state'" mean?
I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL: unable to write 'random state' What does this mean? This is on an Ubuntu server. I have upgraded libssl to fix the recent security vulnerability.
In practice, the most common reason for this happening seems to be that the.rnd file in your home directory is owned by root rather than your account. The quick fix: sudo rm ~/.rnd For more information, here's the entry from the OpenSSL FAQ: Sometimes the openssl command line utility does not abort with a "PRNG not see...
Using OpenSSL what does "unable to write 'random state'" mean? I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL: unable to write 'random state' What does this mean? This is on an Ubuntu server. I have upgraded libssl to fix the recent securi...
TITLE: Using OpenSSL what does "unable to write 'random state'" mean? QUESTION: I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL: unable to write 'random state' What does this mean? This is on an Ubuntu server. I have upgraded libssl to fix...
[ "openssl" ]
433
570
294,716
9
0
2008-09-18T16:56:43.447000
2008-09-18T16:58:48.840000
94,456
96,470
Load a WPF BitmapImage from a System.Drawing.Bitmap
I have an instance of a System.Drawing.Bitmap and would like to make it available to my WPF app in the form of a System.Windows.Media.Imaging.BitmapImage. What would be the best approach for this?
Thanks to Hallgrim, here is the code I ended up with: ScreenCapture = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( bmp.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(width, height)); I also ended up binding to a BitmapSource instead of a BitmapImage as i...
Load a WPF BitmapImage from a System.Drawing.Bitmap I have an instance of a System.Drawing.Bitmap and would like to make it available to my WPF app in the form of a System.Windows.Media.Imaging.BitmapImage. What would be the best approach for this?
TITLE: Load a WPF BitmapImage from a System.Drawing.Bitmap QUESTION: I have an instance of a System.Drawing.Bitmap and would like to make it available to my WPF app in the form of a System.Windows.Media.Imaging.BitmapImage. What would be the best approach for this? ANSWER: Thanks to Hallgrim, here is the code I ended...
[ "c#", "wpf", "bitmap" ]
239
91
245,614
10
0
2008-09-18T16:58:32.490000
2008-09-18T20:19:53.270000
94,486
94,572
Does the Gentoo install CD contain everything for C++ development?
I'd like to install Gentoo. I need it to develop GUI C++ applications using wxWidgets, so I need: build tools: make, automake, autoconf, etc. C++ compiler (GCC) X Window System for testing (Fluxbox or something minimal would be enough) Now, I have two options: download the small network installer (57MB) do a network in...
Gentoo is ultraminimalist by default. The install CD gets you a basic working system, a basic compile environment ( Some version of the GCC suite ), and package management. Its up to you then to install what you want to use. Its not like many other distributions where theres a big set of "default" packages to have inst...
Does the Gentoo install CD contain everything for C++ development? I'd like to install Gentoo. I need it to develop GUI C++ applications using wxWidgets, so I need: build tools: make, automake, autoconf, etc. C++ compiler (GCC) X Window System for testing (Fluxbox or something minimal would be enough) Now, I have two o...
TITLE: Does the Gentoo install CD contain everything for C++ development? QUESTION: I'd like to install Gentoo. I need it to develop GUI C++ applications using wxWidgets, so I need: build tools: make, automake, autoconf, etc. C++ compiler (GCC) X Window System for testing (Fluxbox or something minimal would be enough)...
[ "linux", "installation", "gentoo" ]
2
4
1,312
7
0
2008-09-18T17:03:07.207000
2008-09-18T17:15:53.947000
94,488
100,369
Make a custom .NET Exception serializable
More specifically, when the exception contains custom objects which may or may not themselves be serializable. Take this example: public class MyException: Exception { private readonly string resourceName; private readonly IList validationErrors; public MyException(string resourceName, IList validationErrors) { this.r...
Base implementation, without custom properties SerializableExceptionWithoutCustomProperties.cs: namespace SerializableExceptions { using System; using System.Runtime.Serialization; [Serializable] // Important: This attribute is NOT inherited from Exception, and MUST be specified // otherwise serialization will fail wi...
Make a custom .NET Exception serializable More specifically, when the exception contains custom objects which may or may not themselves be serializable. Take this example: public class MyException: Exception { private readonly string resourceName; private readonly IList validationErrors; public MyException(string reso...
TITLE: Make a custom .NET Exception serializable QUESTION: More specifically, when the exception contains custom objects which may or may not themselves be serializable. Take this example: public class MyException: Exception { private readonly string resourceName; private readonly IList validationErrors; public MyExc...
[ ".net", "exception", "serialization" ]
294
537
110,031
8
0
2008-09-18T17:03:32.697000
2008-09-19T08:00:25.490000
94,490
94,491
How do I read selected files from a remote Zip archive over HTTP using Python?
I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory). I've already written the code and it works, and I'm answering this myself so I can search for it later. But...
Here's how I did it (grabbing all files ending in ".ranks"): import urllib2, cStringIO, zipfile try: remotezip = urllib2.urlopen(url) zipinmemory = cStringIO.StringIO(remotezip.read()) zip = zipfile.ZipFile(zipinmemory) for fn in zip.namelist(): if fn.endswith(".ranks"): ranks_data = zip.read(fn) for line in ranks_dat...
How do I read selected files from a remote Zip archive over HTTP using Python? I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory). I've already written the cod...
TITLE: How do I read selected files from a remote Zip archive over HTTP using Python? QUESTION: I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory). I've alrea...
[ "python", "http", "zip" ]
13
10
5,153
4
0
2008-09-18T17:03:36.283000
2008-09-18T17:03:42.850000
94,502
94,519
in rails, how to return records as a csv file
I have a simple database table called "Entries": class CreateEntries < ActiveRecord::Migration def self.up create_table:entries do |t| t.string:firstName t.string:lastName #etc. t.timestamps end end def self.down drop_table:entries end end How do I write a handler that will return the contents of the Entries table as ...
There is a plugin called FasterCSV that handles this wonderfully.
in rails, how to return records as a csv file I have a simple database table called "Entries": class CreateEntries < ActiveRecord::Migration def self.up create_table:entries do |t| t.string:firstName t.string:lastName #etc. t.timestamps end end def self.down drop_table:entries end end How do I write a handler that wil...
TITLE: in rails, how to return records as a csv file QUESTION: I have a simple database table called "Entries": class CreateEntries < ActiveRecord::Migration def self.up create_table:entries do |t| t.string:firstName t.string:lastName #etc. t.timestamps end end def self.down drop_table:entries end end How do I write ...
[ "ruby-on-rails", "csv" ]
57
23
44,498
10
0
2008-09-18T17:05:01.227000
2008-09-18T17:07:43.840000
94,528
217,136
Is ">" (U+003E GREATER-THAN SIGN) allowed inside an html-element attribute value?
In other words may one use / ]*>.*?<\/tag>/ regex to match the tag html element which does not contain nested tag elements? For example (lt.html): greater than sign in attribute value 1 2 Regex: $ perl -nE"say $1 if m~ ]*>(.*?) ~" lt.html And screen-scraper: #!/usr/bin/env python import sys import BeautifulSoup soup =...
Yes, it is allowed (W3C Validator accepts it, only issues a warning). Unescaped < and > are also allowed inside comments, so such simple regexp can be fooled. If BeautifulSoup doesn't handle this, it could be a bug or perhaps a conscious design decision to make it more resilient to missing closing quotes in attributes.
Is ">" (U+003E GREATER-THAN SIGN) allowed inside an html-element attribute value? In other words may one use / ]*>.*?<\/tag>/ regex to match the tag html element which does not contain nested tag elements? For example (lt.html): greater than sign in attribute value 1 2 Regex: $ perl -nE"say $1 if m~ ]*>(.*?) ~" lt.html...
TITLE: Is ">" (U+003E GREATER-THAN SIGN) allowed inside an html-element attribute value? QUESTION: In other words may one use / ]*>.*?<\/tag>/ regex to match the tag html element which does not contain nested tag elements? For example (lt.html): greater than sign in attribute value 1 2 Regex: $ perl -nE"say $1 if m~ ]...
[ "html", "regex", "syntax" ]
13
12
4,237
7
0
2008-09-18T17:08:49.390000
2008-10-19T23:10:50.607000
94,542
94,588
Can I compose a Spring Configuration File from smaller ones?
I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it. I'd like to have a modelContext.xml file and another for my ui.xml, etc. Can I do this?
From the Spring Docs (v 2.5.5 Section 3.2.2.1.): It can often be useful to split up container definitions into multiple XML files. One way to then load an application context which is configured from all these XML fragments is to use the application context constructor which takes multiple Resource locations. With a be...
Can I compose a Spring Configuration File from smaller ones? I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it. I'd like to have a modelContext.xml file and another for my ui.xml, etc. ...
TITLE: Can I compose a Spring Configuration File from smaller ones? QUESTION: I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it. I'd like to have a modelContext.xml file and another fo...
[ "java", "spring" ]
15
19
15,590
7
0
2008-09-18T17:10:38.170000
2008-09-18T17:18:16.840000
94,556
1,783,572
Maven2 Multiproject Cobertura Reporting Problems During mvn site Build
We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the lines of code that were hit by the unit tests. We are using mvn 2.0.8. I ha...
I suspect that you're missing an execution of cobertura plugin during the compile phase so that the code only gets instrumented by the reporting plugins, in the site lifecycle, after the tests were run. So the test runs aren't picked up because they run on non-instrumented code. Analyze your build logs more carefully -...
Maven2 Multiproject Cobertura Reporting Problems During mvn site Build We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the line...
TITLE: Maven2 Multiproject Cobertura Reporting Problems During mvn site Build QUESTION: We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still ...
[ "maven-2", "code-coverage", "maven-plugin", "cobertura" ]
3
1
6,342
4
0
2008-09-18T17:13:55.213000
2009-11-23T14:46:57.057000
94,581
94,841
Profiling C# / .NET applications
How do you trace/profile your.NET applications? The MSDN online help mentions Visual Studio Team (which I do not possess) and there is the Windows Performance Toolkit. But, are there other solutions you can recommend? Preferably (of course) a solution that works without changing the code (manually) and that can be inte...
See also this question. JetBrains dotTrace is the best.NET profiler I have found (and I have tried pretty much every one there is), because it is the only one that has low enough overhead to handle a processor-intensive application. It is also simple, accurate and well-designed - highly recommended!
Profiling C# / .NET applications How do you trace/profile your.NET applications? The MSDN online help mentions Visual Studio Team (which I do not possess) and there is the Windows Performance Toolkit. But, are there other solutions you can recommend? Preferably (of course) a solution that works without changing the cod...
TITLE: Profiling C# / .NET applications QUESTION: How do you trace/profile your.NET applications? The MSDN online help mentions Visual Studio Team (which I do not possess) and there is the Windows Performance Toolkit. But, are there other solutions you can recommend? Preferably (of course) a solution that works withou...
[ "c#", ".net", "visual-studio", "profiling", "profiler" ]
11
9
12,784
10
0
2008-09-18T17:16:36.363000
2008-09-18T17:44:04.800000
94,591
94,608
What is the maximum value for an int32?
I can never remember the number. I need a memory rule.
It's 2,147,483,647. Easiest way to memorize it is via a tattoo.
What is the maximum value for an int32? I can never remember the number. I need a memory rule.
TITLE: What is the maximum value for an int32? QUESTION: I can never remember the number. I need a memory rule. ANSWER: It's 2,147,483,647. Easiest way to memorize it is via a tattoo.
[ "integer" ]
1,378
5,058
1,954,759
45
0
2008-09-18T17:18:23.720000
2008-09-18T17:20:17.460000
94,592
94,672
How do you visualize logfiles in realtime?
Sometimes it might be useful, but mostly just looking cool or impressive to visualize log files (anything from http requests and to bandwith usage to cups of coffee drunk per day). I know about Visitorville which I think look a bit silly, and then there's gltail. How do you "visualize" your log files in realtime?
You may take a look at Apache Chainsaw. This nifty tool allows Log incomes from nearly everyqhere and has live filtering and colering. If you have an already written Log, I'm not sure if it can read it, it's been a while since I used it last time (was very usefull for the prototyping phase of our JBoss server)
How do you visualize logfiles in realtime? Sometimes it might be useful, but mostly just looking cool or impressive to visualize log files (anything from http requests and to bandwith usage to cups of coffee drunk per day). I know about Visitorville which I think look a bit silly, and then there's gltail. How do you "v...
TITLE: How do you visualize logfiles in realtime? QUESTION: Sometimes it might be useful, but mostly just looking cool or impressive to visualize log files (anything from http requests and to bandwith usage to cups of coffee drunk per day). I know about Visitorville which I think look a bit silly, and then there's glt...
[ "statistics", "visualization", "logging" ]
9
4
8,737
10
0
2008-09-18T17:18:28.947000
2008-09-18T17:26:25.997000
94,594
107,358
Automated naming of AF_UNIX local datagram sockets?
I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP ). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fails unless the client is bound too. (the common error is Transport endp...
I assume that you are running Linux; I don't know if this advice applies to SunOS or any UNIX. First, the answer: after the socket() and before the connect() or first sendto(), try adding this code: struct sockaddr_un me; me.sun_family = AF_UNIX; int result = bind(fd, (void*)&me, sizeof(short)); Now, the explanation: t...
Automated naming of AF_UNIX local datagram sockets? I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP ). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fails unless the clie...
TITLE: Automated naming of AF_UNIX local datagram sockets? QUESTION: I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP ). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fai...
[ "unix", "sockets", "bind", "local", "datagram" ]
7
4
4,046
4
0
2008-09-18T17:18:31.757000
2008-09-20T06:15:00.623000
94,610
94,896
Best way to catch a WCF exception in Silverlight?
I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect. The...
I check the Error property of the event args in the service method completed event handler. I haven't had issues with the event handler not being called. In the case where the server goes down, the call takes a few seconds then comes back with a ProtocolException in the Error property. Assuming you have tried this and ...
Best way to catch a WCF exception in Silverlight? I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, ...
TITLE: Best way to catch a WCF exception in Silverlight? QUESTION: I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during on...
[ "wcf", "silverlight", "exception" ]
14
12
15,830
9
0
2008-09-18T17:20:31.703000
2008-09-18T17:49:32.070000
94,632
94,704
Parser error when using ScriptManager
I have an ASP.NET page which has a script manager on it. The page overrides an abstract property to return the ScriptManager in order to enable the base page to use it: public partial class ReportWebForm: ReportPageBase { protected override ScriptManager ScriptManager { get { return scriptManager2; } }... } And the bas...
I can compile your code sample fine, you should check your designer file to make sure everything is ok. EDIT: the only other thing I can think of is that this is some sort of reference problem. Is your System.Web.Extensions reference using the correct version for your targeted framework? (should be 3.5.0.0 for.net 3.5 ...
Parser error when using ScriptManager I have an ASP.NET page which has a script manager on it. The page overrides an abstract property to return the ScriptManager in order to enable the base page to use it: public partial class ReportWebForm: ReportPageBase { protected override ScriptManager ScriptManager { get { retur...
TITLE: Parser error when using ScriptManager QUESTION: I have an ASP.NET page which has a script manager on it. The page overrides an abstract property to return the ScriptManager in order to enable the base page to use it: public partial class ReportWebForm: ReportPageBase { protected override ScriptManager ScriptMan...
[ "asp.net", "asp.net-ajax", "scriptmanager" ]
3
5
8,266
2
0
2008-09-18T17:22:13.463000
2008-09-18T17:30:34.270000
94,660
94,883
Stateful Web Services
I'm building a java/spring application, and i may need to incorporate a stateful web service call. Any opinions if i should totally run away from a stateful services call, or it can be done and is enterprise ready?
Stateful web services are a pain to maintain. The mechanism I have seen for them is to have the first call return an id (basically a transaction id) that is used in subsequent calls. A problem with that is that the web service isn't really stateful so it has to load all the information that it needs from some other dat...
Stateful Web Services I'm building a java/spring application, and i may need to incorporate a stateful web service call. Any opinions if i should totally run away from a stateful services call, or it can be done and is enterprise ready?
TITLE: Stateful Web Services QUESTION: I'm building a java/spring application, and i may need to incorporate a stateful web service call. Any opinions if i should totally run away from a stateful services call, or it can be done and is enterprise ready? ANSWER: Stateful web services are a pain to maintain. The mechan...
[ "web-services", "stateful" ]
2
6
3,350
2
0
2008-09-18T17:24:56.483000
2008-09-18T17:48:05.740000
94,674
94,716
jQuery create select list options from JSON, not happening as advertised?
How come this doesn't work (operating on an empty select list $(function() { $.getJSON("/RequestX/GetRequestTypes/", showRequestTypes); } ); function showRequestTypes(data, textStatus) { $.each(data, function() { var option = new Option(this.RequestTypeName, this.RequestTypeID); // Use Jquery to get select list el...
$("#requestTypes") returns a jQuery object that contains all the selected elements. You are attempting to call the add() method of an individual element, but instead you are calling the add() method of the jQuery object, which does something very different. In order to access the DOM element itself, you need to treat t...
jQuery create select list options from JSON, not happening as advertised? How come this doesn't work (operating on an empty select list $(function() { $.getJSON("/RequestX/GetRequestTypes/", showRequestTypes); } ); function showRequestTypes(data, textStatus) { $.each(data, function() { var option = new Option(this...
TITLE: jQuery create select list options from JSON, not happening as advertised? QUESTION: How come this doesn't work (operating on an empty select list $(function() { $.getJSON("/RequestX/GetRequestTypes/", showRequestTypes); } ); function showRequestTypes(data, textStatus) { $.each(data, function() { var option...
[ "javascript", "jquery", "drop-down-menu", "html-select" ]
10
15
47,234
3
0
2008-09-18T17:26:31.893000
2008-09-18T17:33:12.890000
94,684
234,112
How to automate the test running process using TestComplete?
We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test script project and source files, etc). Basically we can open the TestComplete proje...
Answering my own question: The solution was writing a little C# application which sits on the system tray and monitors a folder. When a new folder (containing the tests source code) are added to the monitored folder TestComplete is called using the command line, then the application catch its ExitCode and send an email...
How to automate the test running process using TestComplete? We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test script project and sou...
TITLE: How to automate the test running process using TestComplete? QUESTION: We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test scri...
[ "build-automation", "automated-tests", "finalbuilder", "dailybuilds", "testcomplete" ]
5
4
13,733
10
0
2008-09-18T17:28:01.077000
2008-10-24T15:52:51.910000
94,685
94,782
What are the extents of the meaning of "distributing" under the LGPL license?
This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project? Many of the conditions of the LGPL license are based on the notion of distribution. My company does business as a consultant. We are contracted to create soft...
Yes it does. One of the reasons the GPL came into being in the first place was to prevent the situation where somebody had a binary, but no source to go with it. IANAL, so I can't speak to whether the consultancy-client relationship would constitute a loophole which you could use to avoid passing on source code, but it...
What are the extents of the meaning of "distributing" under the LGPL license? This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project? Many of the conditions of the LGPL license are based on the notion of distributi...
TITLE: What are the extents of the meaning of "distributing" under the LGPL license? QUESTION: This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project? Many of the conditions of the LGPL license are based on the no...
[ "licensing", "software-distribution", "lgpl" ]
3
3
745
6
0
2008-09-18T17:28:02.077000
2008-09-18T17:39:14.217000
94,689
94,712
Asp XML Parsing
I am new to asp and have a deadline in the next few days. i receive the following xml from within a webservice response. print(" 0 1 stuetd678 john doe john.doe@johnmail.com "); How can i parse this xml into asp attributes? Any help is greatly appreciated Thanks Damien On more analysis, some soap stuff is also returned...
You need to read about MSXML parser. Here is a link to a good all-in-one example http://oreilly.com/pub/h/466 Some reading on XPath will help as well. You could get all the information you need in MSDN. Stealing the code from Luke excellent reply for aggregation purposes: Dim oXML, oNode, sKey, sValue Set oXML = Serve...
Asp XML Parsing I am new to asp and have a deadline in the next few days. i receive the following xml from within a webservice response. print(" 0 1 stuetd678 john doe john.doe@johnmail.com "); How can i parse this xml into asp attributes? Any help is greatly appreciated Thanks Damien On more analysis, some soap stuff ...
TITLE: Asp XML Parsing QUESTION: I am new to asp and have a deadline in the next few days. i receive the following xml from within a webservice response. print(" 0 1 stuetd678 john doe john.doe@johnmail.com "); How can i parse this xml into asp attributes? Any help is greatly appreciated Thanks Damien On more analysis...
[ "xml", "parsing", "asp-classic" ]
5
9
21,869
3
0
2008-09-18T17:28:33.790000
2008-09-18T17:32:21.520000
94,696
94,701
In ASP.Net, during which page lifecycle event does viewstate get loaded?
I know it happens sometime before Load, but during what event exactly?
It's loaded into memory between init and load. See t his article for a full break down of the page lifecycle.
In ASP.Net, during which page lifecycle event does viewstate get loaded? I know it happens sometime before Load, but during what event exactly?
TITLE: In ASP.Net, during which page lifecycle event does viewstate get loaded? QUESTION: I know it happens sometime before Load, but during what event exactly? ANSWER: It's loaded into memory between init and load. See t his article for a full break down of the page lifecycle.
[ "asp.net", "webforms", "viewstate", "page-lifecycle" ]
25
24
52,299
6
0
2008-09-18T17:29:32.760000
2008-09-18T17:29:58.640000
94,707
95,148
Method to generate pdf from access+vb6 or just sql 2005?
The setup: Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf. The only way I can think of is send a request from access to the sql server for a web page. Something like: " http://sqlser...
Save the form as a report, then use Access MVP Stephen Lebans free A2000ReportToPDF utility to convert it to a pdf file. http://www.lebans.com/reporttopdf.htm If they have Access 2007 they can download and install the free Microsoft Office 2007 Add-in to save documents as PDF or XPS. http://www.microsoft.com/downloads/...
Method to generate pdf from access+vb6 or just sql 2005? The setup: Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf. The only way I can think of is send a request from access to the s...
TITLE: Method to generate pdf from access+vb6 or just sql 2005? QUESTION: The setup: Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf. The only way I can think of is send a request fr...
[ "sql-server-2005", "ms-access", "pdf", "adp" ]
0
2
696
3
0
2008-09-18T17:31:04.783000
2008-09-18T18:12:59.207000
94,729
94,754
Need a free datepicker for ASPX
What is the best FREE Datepicker that can be dropped into an ASPX application?
There's an excellent, free package that will AJAX enable the calendar control for use as a date picker. Here's the video tutorial: http://www.asp.net/LEARN/ajax-videos/video-124.aspx
Need a free datepicker for ASPX What is the best FREE Datepicker that can be dropped into an ASPX application?
TITLE: Need a free datepicker for ASPX QUESTION: What is the best FREE Datepicker that can be dropped into an ASPX application? ANSWER: There's an excellent, free package that will AJAX enable the calendar control for use as a date picker. Here's the video tutorial: http://www.asp.net/LEARN/ajax-videos/video-124.aspx
[ "asp.net", "date", "datepicker" ]
4
3
9,186
7
0
2008-09-18T17:34:14.680000
2008-09-18T17:37:14.923000
94,747
94,799
Offline lorem ipsum generator
What would be a good offline alternative of the online Lipsum generator? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.
If you have python available, google code has a CLI generator. http://code.google.com/p/lorem/
Offline lorem ipsum generator What would be a good offline alternative of the online Lipsum generator? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.
TITLE: Offline lorem ipsum generator QUESTION: What would be a good offline alternative of the online Lipsum generator? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs. ANSWER: If you have python ava...
[ "html", "lorem-ipsum" ]
14
8
8,443
18
0
2008-09-18T17:35:56.613000
2008-09-18T17:40:49.860000
94,755
94,979
Best container for double-indexing
What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-than-linear lookup to find the location of an object. I'...
I'm making several assumptions based on your writeup: Keys are cheap to copy and compare There should be only one copy of the object in the system The same key may refer to many objects, but only one object corresponds to a given key (one-to-many) You want to be able to efficiently look up which objects correspond to a...
Best container for double-indexing What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-than-linear lookup to...
TITLE: Best container for double-indexing QUESTION: What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-tha...
[ "c++", "stl", "containers" ]
4
5
8,170
3
0
2008-09-18T17:37:16.390000
2008-09-18T17:56:39.060000
94,757
98,813
What is the best method to detect offline mode in the browser?
I have a web application where there are number of Ajax components which refresh themselves every so often inside a page (it's a dashboard of sorts). Now, I want to add functionality to the page so that when there is no Internet connectivity, the current content of the page doesn't change and a message appears on the p...
One way to handle this might be to extend the XmlHTTPRequest object with an explicit timeout method, then use that to determine if you're working in offline mode (that is, for browsers that don't support navigator.onLine). Here's how I implemented Ajax timeouts on one site (a site that uses the Prototype library). Afte...
What is the best method to detect offline mode in the browser? I have a web application where there are number of Ajax components which refresh themselves every so often inside a page (it's a dashboard of sorts). Now, I want to add functionality to the page so that when there is no Internet connectivity, the current co...
TITLE: What is the best method to detect offline mode in the browser? QUESTION: I have a web application where there are number of Ajax components which refresh themselves every so often inside a page (it's a dashboard of sorts). Now, I want to add functionality to the page so that when there is no Internet connectivi...
[ "javascript", "ajax", "offline-mode" ]
5
3
7,144
9
0
2008-09-18T17:37:22.647000
2008-09-19T01:57:28.840000
94,767
102,517
Debugging my web app with JSON/Firefox - Firefox handling of JSON?
I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like regular text files and open up the JSON in the current tab? Thanks.
Try the Open in browser extension. [edit 30.05.2010 - updated the link]
Debugging my web app with JSON/Firefox - Firefox handling of JSON? I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like regular text files ...
TITLE: Debugging my web app with JSON/Firefox - Firefox handling of JSON? QUESTION: I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like r...
[ "json", "firefox" ]
20
14
11,234
8
0
2008-09-18T17:38:12.143000
2008-09-19T14:56:18.757000
94,779
400,668
What is the most accurate method of estimating peak bandwidth requirement for a web application?
I am working on a client proposal and they will need to upgrade their network infrastructure to support hosting an ASP.NET application. Essentially, I need to estimate peak usage for a system with a known quantity of users (currently 250). A simple answer like "you'll need a dedicated T1 line" would probably suffice, b...
In lieu of a good reporting tool for bandwidth usage, you can always do a rough guesstimate. N = Number of page views in busiest hour P = Average Page size (N * P) /3600) = Average traffic per second. The server itself will have a lot more internal traffic for probably db server/NAS/etc. But outward facing that should ...
What is the most accurate method of estimating peak bandwidth requirement for a web application? I am working on a client proposal and they will need to upgrade their network infrastructure to support hosting an ASP.NET application. Essentially, I need to estimate peak usage for a system with a known quantity of users ...
TITLE: What is the most accurate method of estimating peak bandwidth requirement for a web application? QUESTION: I am working on a client proposal and they will need to upgrade their network infrastructure to support hosting an ASP.NET application. Essentially, I need to estimate peak usage for a system with a known ...
[ "asp.net", "load", "bandwidth", "testing-strategies" ]
5
3
7,177
2
0
2008-09-18T17:39:03.843000
2008-12-30T16:05:09.633000
94,792
101,194
Using Vim for Lisp development
I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome. Please don't say "use emacs" as I've...
Limp aims to be a fully featured Common Lisp IDE for Vim. It defaults to SBCL, but can be changed to support most other implementations by replacing "sbcl" for your favourite lisp, in the file /usr/local/limp/latest/bin/lisp.sh When discussing Lisp these days, it is commonly assumed to be Common Lisp, the language stan...
Using Vim for Lisp development I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome. Pleas...
TITLE: Using Vim for Lisp development QUESTION: I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are ...
[ "vim", "ide", "lisp", "common-lisp" ]
95
50
50,116
11
0
2008-09-18T17:40:09.783000
2008-09-19T11:28:59.527000
94,794
95,079
What is the cost of a function call?
Compared to Simple memory access Disk access Memory access on another computer(on the same network) Disk access on another computer(on the same network) in C++ on windows.
relative timings (shouldn't be off by more than a factor of 100;-) memory-access in cache = 1 function call/return in cache = 2 memory-access out of cache = 10.. 300 disk access = 1000.. 1e8 (amortized depends upon the number of bytes transferred) depending mostly upon seek times the transfer itself can be pretty fast ...
What is the cost of a function call? Compared to Simple memory access Disk access Memory access on another computer(on the same network) Disk access on another computer(on the same network) in C++ on windows.
TITLE: What is the cost of a function call? QUESTION: Compared to Simple memory access Disk access Memory access on another computer(on the same network) Disk access on another computer(on the same network) in C++ on windows. ANSWER: relative timings (shouldn't be off by more than a factor of 100;-) memory-access in ...
[ "c++", "optimization", "architecture", "memory" ]
40
33
24,435
15
0
2008-09-18T17:40:12.203000
2008-09-18T18:07:01.420000
94,864
257,576
Tasklist replacement for Visual Studio
I would like to use the task-list in Visual Studio but it really lacks almost any useful feature a task-list should provide. So I use Todo-List externally, to keep track of the things I need to get done. Would be nice to have it all in one place. So does anyone know of a cool replacement Add-On for the tasklist in Visu...
How about the FogBugz add-in for Visual Studio 2005 and 2008? This requires a FogBugz account hosted either locally or by Fog Creek. A free Student and Startup version is available.
Tasklist replacement for Visual Studio I would like to use the task-list in Visual Studio but it really lacks almost any useful feature a task-list should provide. So I use Todo-List externally, to keep track of the things I need to get done. Would be nice to have it all in one place. So does anyone know of a cool repl...
TITLE: Tasklist replacement for Visual Studio QUESTION: I would like to use the task-list in Visual Studio but it really lacks almost any useful feature a task-list should provide. So I use Todo-List externally, to keep track of the things I need to get done. Would be nice to have it all in one place. So does anyone k...
[ "visual-studio", "task", "add-on" ]
7
0
3,145
6
0
2008-09-18T17:46:05.730000
2008-11-02T23:34:13.193000
94,866
95,723
How do I attach an .mdf to sql2005?
Running sp_attach_single_file_db gives this error: The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid Isn't it supposed to re-create the log file? How else would I be able to attach/repair that.mdf file?
It worked, when I installed another one (with.ldf log file) then the one in question, then detached the first one again. Don't ask me why.
How do I attach an .mdf to sql2005? Running sp_attach_single_file_db gives this error: The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid Isn't it supposed to re-create the log file? How else would I be able to attach/repair that.mdf file?
TITLE: How do I attach an .mdf to sql2005? QUESTION: Running sp_attach_single_file_db gives this error: The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid Isn't it supposed to re-create the log file? How else would I be able to attach/repair that.mdf file? ANSWER: It worked, when I i...
[ "sql-server-2005" ]
0
1
1,370
2
0
2008-09-18T17:46:18.443000
2008-09-18T18:59:39.110000
94,875
94,955
Image Processing, In Python?
I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what?
The best-known library is PIL. However if you are simply doing basic manipulation, you are probably better off with the Python bindings for ImageMagick, which will be a good deal more efficient than writing the transforms in Python.
Image Processing, In Python? I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what?
TITLE: Image Processing, In Python? QUESTION: I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what? ANSWER: The best-known library is PIL. However if you are simply doing basic manipulation, you are probably better off with the P...
[ "python", "image", "image-processing", "image-manipulation" ]
82
53
99,682
8
0
2008-09-18T17:47:04.883000
2008-09-18T17:54:46.410000
94,884
94,980
Generics vs. Array Lists
The system I work on here was written before.net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as objects. From performance perspective, how i...
Technically the performance of generics is, as you say, better. However, unless performance is hugely important AND you've already optimised in other areas you're likely to get MUCH better improvements by spending your time elsewhere. I would suggest: use generics going forward. if you have solid unit tests then refact...
Generics vs. Array Lists The system I work on here was written before.net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as objects. From perfo...
TITLE: Generics vs. Array Lists QUESTION: The system I work on here was written before.net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as o...
[ "c#", "performance", "generics" ]
16
14
6,664
12
0
2008-09-18T17:48:11.747000
2008-09-18T17:56:42.803000
94,885
202,926
looking for a good summary of SQL 2005 Partitioning
I'm looking at this as a baseline explanation of the SQL 2005 Enterprise partitioning. Is there a resource that goes deeper into fine points and considerations of this issue. Some more examples would be useful too. My main scenario is a time based partition system. With one partition that has the most accessed last X d...
I've found the SQL Server 2005 Books Online normally has all the information I'm looking for. I found a good resource in the 05 BOL on SQL Server 2005 Partitioning: http://technet.microsoft.com/en-us/library/ms188706(SQL.90).aspx This link goes over designing partitioned tables and indexes: http://technet.microsoft.com...
looking for a good summary of SQL 2005 Partitioning I'm looking at this as a baseline explanation of the SQL 2005 Enterprise partitioning. Is there a resource that goes deeper into fine points and considerations of this issue. Some more examples would be useful too. My main scenario is a time based partition system. Wi...
TITLE: looking for a good summary of SQL 2005 Partitioning QUESTION: I'm looking at this as a baseline explanation of the SQL 2005 Enterprise partitioning. Is there a resource that goes deeper into fine points and considerations of this issue. Some more examples would be useful too. My main scenario is a time based pa...
[ "sql-server", "partitioning" ]
3
1
807
5
0
2008-09-18T17:48:12.620000
2008-10-14T21:28:13.983000
94,906
491,502
How do I return random numbers as a column in SQL Server 2005?
I'm running a SQL query on SQL Server 2005, and in addition to 2 columns being queried from the database, I'd also like to return 1 column of random numbers along with them. I tried this: select column1, column2, floor(rand() * 10000) as column3 from table1 Which kinda works, but the problem is that this query returns ...
I realize this is an older post... but you don't need a view. select column1, column2, ABS(CAST(CAST(NEWID() AS VARBINARY) AS int)) % 10000 as column3 from table1
How do I return random numbers as a column in SQL Server 2005? I'm running a SQL query on SQL Server 2005, and in addition to 2 columns being queried from the database, I'd also like to return 1 column of random numbers along with them. I tried this: select column1, column2, floor(rand() * 10000) as column3 from table1...
TITLE: How do I return random numbers as a column in SQL Server 2005? QUESTION: I'm running a SQL query on SQL Server 2005, and in addition to 2 columns being queried from the database, I'd also like to return 1 column of random numbers along with them. I tried this: select column1, column2, floor(rand() * 10000) as c...
[ "sql", "sql-server", "sql-server-2005", "random" ]
21
41
20,946
12
0
2008-09-18T17:50:38.370000
2009-01-29T12:55:45.243000
94,912
94,922
How can I load xml from a url instead of a file path in .NET?
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we know how to do it currently is by using a file path and impersonation (since this file is on a secured network path). I've looked at XDocument.Load on MSDN, but I don't see anything.
I would suggest using a WebRequest to get a stream and load the stream into the document.
How can I load xml from a url instead of a file path in .NET? We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we know how to do it currently is by using a file path and impersonation (since this file is on a secured network path). I've looked at XDocument.Load on MSDN, but I don'...
TITLE: How can I load xml from a url instead of a file path in .NET? QUESTION: We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we know how to do it currently is by using a file path and impersonation (since this file is on a secured network path). I've looked at XDocument.Load o...
[ ".net", "xml" ]
2
5
3,986
3
0
2008-09-18T17:51:13.080000
2008-09-18T17:52:07.150000
94,930
95,016
Fetch one row per account id from list
I have a table with game scores, allowing multiple rows per account id: scores (id, score, accountid). I want a list of the top 10 scorer ids and their scores. Can you provide an sql statement to select the top 10 scores, but only one score per account id? Thanks!
First limit the selection to the highest score for each account id. Then take the top ten scores. SELECT TOP 10 AccountId, Score FROM Scores s1 WHERE AccountId NOT IN (SELECT AccountId s2 FROM Scores WHERE s1.AccountId = s2.AccountId and s1.Score > s2.Score) ORDER BY Score DESC
Fetch one row per account id from list I have a table with game scores, allowing multiple rows per account id: scores (id, score, accountid). I want a list of the top 10 scorer ids and their scores. Can you provide an sql statement to select the top 10 scores, but only one score per account id? Thanks!
TITLE: Fetch one row per account id from list QUESTION: I have a table with game scores, allowing multiple rows per account id: scores (id, score, accountid). I want a list of the top 10 scorer ids and their scores. Can you provide an sql statement to select the top 10 scores, but only one score per account id? Thanks...
[ "sql", "mysql", "database" ]
6
2
6,224
6
0
2008-09-18T17:52:37.697000
2008-09-18T18:00:26.007000
94,932
528,530
ColdFusion mail queue stops processing
Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage has occurred again. I am looking for suggesti...
What we ended up doing: I wrote two scheduled tasks. The first checked to see if there were any messages in the queue folder older than n minues (currently set to 30). The second reset the queue every night during low usage. Unfortunately, we never really discovered why the queue would come off the rails, but it only s...
ColdFusion mail queue stops processing Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage has oc...
TITLE: ColdFusion mail queue stops processing QUESTION: Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, t...
[ "coldfusion", "administration" ]
13
12
9,239
7
0
2008-09-18T17:52:44.480000
2009-02-09T15:11:24.750000
94,935
94,962
What is the difference between range and xrange functions in Python 2.X?
Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about for i in range(0, 20): for i in xrange(0, 20):
In Python 2.x: range creates a list, so if you do range(1, 10000000) it creates a list in memory with 9999999 elements. xrange is a sequence object that evaluates lazily. In Python 3: range does the equivalent of Python 2's xrange. To get the list, you have to explicitly use list(range(...)). xrange no longer exists.
What is the difference between range and xrange functions in Python 2.X? Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about for i in range(0, 20): for i in xrange(0, 20):
TITLE: What is the difference between range and xrange functions in Python 2.X? QUESTION: Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about for i in range(0, 20): for i in xrange(0, 20): ANSWER: In Pytho...
[ "python", "loops", "range", "python-2.x", "xrange" ]
848
1,035
491,148
28
0
2008-09-18T17:52:51.143000
2008-09-18T17:55:13.913000
94,952
95,014
Python implementation of Parsec?
I recently wrote a parser in Python using Ply (it's a python reimplementation of yacc). When I was almost done with the parser I discovered that the grammar I need to parse requires me to do some look up during parsing to inform the lexer. Without doing a look up to inform the lexer I cannot correctly parse the strings...
An option you may consider, if an LL parser is ok to you, is to give ANTLR a try, it can generate python too (actually it is LL(*) as they name it, * stands for the quantity of lookahead it can cope with).
Python implementation of Parsec? I recently wrote a parser in Python using Ply (it's a python reimplementation of yacc). When I was almost done with the parser I discovered that the grammar I need to parse requires me to do some look up during parsing to inform the lexer. Without doing a look up to inform the lexer I c...
TITLE: Python implementation of Parsec? QUESTION: I recently wrote a parser in Python using Ply (it's a python reimplementation of yacc). When I was almost done with the parser I discovered that the grammar I need to parse requires me to do some look up during parsing to inform the lexer. Without doing a look up to in...
[ "python", "parsing", "parsec", "combinators" ]
16
5
6,050
5
0
2008-09-18T17:54:39.547000
2008-09-18T18:00:05.213000
94,959
94,973
How do you priortize multiple triggers of a table?
I have a couple of triggers on a table that I want to keep separate and would like to priortize them. I could have just one trigger and do the logic there, but I was wondering if there was an easier/logical way of accomplishing this of having it in a pre-defined order?
Use sp_settriggerorder. You can specify the first and last trigger to fire depending on the operation. sp_settriggerorder on MSDN From the above link: A. Setting the firing order for a DML trigger The following example specifies that trigger uSalesOrderHeader be the first trigger to fire after an UPDATE operation occur...
How do you priortize multiple triggers of a table? I have a couple of triggers on a table that I want to keep separate and would like to priortize them. I could have just one trigger and do the logic there, but I was wondering if there was an easier/logical way of accomplishing this of having it in a pre-defined order?
TITLE: How do you priortize multiple triggers of a table? QUESTION: I have a couple of triggers on a table that I want to keep separate and would like to priortize them. I could have just one trigger and do the logic there, but I was wondering if there was an easier/logical way of accomplishing this of having it in a ...
[ "sql", "sql-server-2005", "t-sql", "triggers" ]
6
7
6,766
4
0
2008-09-18T17:55:05.753000
2008-09-18T17:56:12.053000
94,977
95,030
Why aren't variables declared in "try" in scope in "catch" or "finally"?
In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out...
Two things: Generally, Java has just 2 levels of scope: global and function. But, try/catch is an exception (no pun intended). When an exception is thrown and the exception object gets a variable assigned to it, that object variable is only available within the "catch" section and is destroyed as soon as the catch comp...
Why aren't variables declared in "try" in scope in "catch" or "finally"? In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "test"; // (more co...
TITLE: Why aren't variables declared in "try" in scope in "catch" or "finally"? QUESTION: In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "...
[ "c#", "java", "exception", "scope", "language-design" ]
165
191
97,260
28
0
2008-09-18T17:56:23.880000
2008-09-18T18:01:57.237000
94,997
95,187
How do you rate-limit an IO operation?
Suppose you have a program which reads from a socket. How do you keep the download rate below a certain given threshold?
At the application layer (using a Berkeley socket style API) you just watch the clock, and read or write data at the rate you want to limit at. If you only read 10kbps on average, but the source is sending more than that, then eventually all the buffers between it and you will fill up. TCP/IP allows for this, and the p...
How do you rate-limit an IO operation? Suppose you have a program which reads from a socket. How do you keep the download rate below a certain given threshold?
TITLE: How do you rate-limit an IO operation? QUESTION: Suppose you have a program which reads from a socket. How do you keep the download rate below a certain given threshold? ANSWER: At the application layer (using a Berkeley socket style API) you just watch the clock, and read or write data at the rate you want to...
[ "algorithm", "language-agnostic", "io" ]
6
16
4,168
8
0
2008-09-18T17:58:33.610000
2008-09-18T18:15:41.447000
94,999
107,300
Alternative to 'truss -p' instruction
I am looking for a command in Unix that returns the status of a process(active, dead, sleeping, waiting for another process, etc.) is there any available? A shell script maybe?
Try pflags, which will give you per-thread status information. Example: root@weetbix # pflags $$ 3384: bash data model = _ILP32 flags = ORPHAN|MSACCT|MSFORK /1: flags = ASLEEP waitid(0x7,0x0,0xffbfefc0,0xf) sigmask = 0x00020000,0x00000000 Also check out the manpage for pflags to see other useful tools like pstack, pfil...
Alternative to 'truss -p' instruction I am looking for a command in Unix that returns the status of a process(active, dead, sleeping, waiting for another process, etc.) is there any available? A shell script maybe?
TITLE: Alternative to 'truss -p' instruction QUESTION: I am looking for a command in Unix that returns the status of a process(active, dead, sleeping, waiting for another process, etc.) is there any available? A shell script maybe? ANSWER: Try pflags, which will give you per-thread status information. Example: root@w...
[ "unix", "process", "solaris", "status", "truss" ]
1
3
897
3
0
2008-09-18T17:58:41.860000
2008-09-20T05:49:01.713000
95,005
95,081
Simplest way to update a client-side javascript array variable during a ASP.NET AJAX postback in an UpdatePanel?
If I want to inject a globally scoped array variable into a page's client-side javascript during a full page postback, I can use: this.Page.ClientScript.RegisterArrayDeclaration("WorkCalendar", "\"" + date.ToShortDateString() + "\""); to declare and populate a client-side javascript array on the page. Nice and simple. ...
You could also update a hidden label inside the update panel which allows you to write out any javascript you like. I would suggest though using web services or even page methods to fetch the data you need instead of using update panels. Example: myLabel.Text = "....";... put your logic in this or you can add [WebMetho...
Simplest way to update a client-side javascript array variable during a ASP.NET AJAX postback in an UpdatePanel? If I want to inject a globally scoped array variable into a page's client-side javascript during a full page postback, I can use: this.Page.ClientScript.RegisterArrayDeclaration("WorkCalendar", "\"" + date.T...
TITLE: Simplest way to update a client-side javascript array variable during a ASP.NET AJAX postback in an UpdatePanel? QUESTION: If I want to inject a globally scoped array variable into a page's client-side javascript during a full page postback, I can use: this.Page.ClientScript.RegisterArrayDeclaration("WorkCalend...
[ "c#", "javascript", "asp.net-ajax" ]
3
0
3,433
3
0
2008-09-18T17:59:10.690000
2008-09-18T18:07:09.797000
95,007
1,463,249
Explain the quantile() function in R
I've been mystified by the R quantile function all day. I have an intuitive notion of how quantiles work, and an M.S. in stats, but boy oh boy, the documentation for it is confusing to me. From the docs: Q[i](p) = (1 - gamma) x[j] + gamma x[j+1], I'm with it so far. For a type i quantile, it's an interpolation between ...
You're understandably confused. That documentation is terrible. I had to go back to the paper its based on (Hyndman, R.J.; Fan, Y. (November 1996). "Sample Quantiles in Statistical Packages". American Statistician 50 (4): 361–365. doi:10.2307/2684934 ) to get an understanding. Let's start with the first problem. where ...
Explain the quantile() function in R I've been mystified by the R quantile function all day. I have an intuitive notion of how quantiles work, and an M.S. in stats, but boy oh boy, the documentation for it is confusing to me. From the docs: Q[i](p) = (1 - gamma) x[j] + gamma x[j+1], I'm with it so far. For a type i qua...
TITLE: Explain the quantile() function in R QUESTION: I've been mystified by the R quantile function all day. I have an intuitive notion of how quantiles work, and an M.S. in stats, but boy oh boy, the documentation for it is confusing to me. From the docs: Q[i](p) = (1 - gamma) x[j] + gamma x[j+1], I'm with it so far...
[ "math", "r", "statistics" ]
83
69
37,345
3
0
2008-09-18T17:59:19.583000
2009-09-22T23:58:43.997000
95,041
424,059
Deleting rows in joined tables using ADO
Now I have seen this question in another forum but it didn't had an acceptable answer. Suppose I have two tables, the Groups table and the Elements table. The tables have no defined relationships. The Elements table has an IdGroup field that refers to the IdGroup (PK) field of the Groups table. I use the following quer...
Rewrite you query to: replace the INNER JOIN with a WHERE clause consisting of an EXISTS; use a subquery in the SELECT clause to return the value of Groups.GroupName. Example: SELECT Elements.*, ( SELECT Groups.GroupName FROM Groups WHERE Elements.IdGroup = Groups.IdGroup ) FROM Elements WHERE EXISTS ( SELECT * FROM Gr...
Deleting rows in joined tables using ADO Now I have seen this question in another forum but it didn't had an acceptable answer. Suppose I have two tables, the Groups table and the Elements table. The tables have no defined relationships. The Elements table has an IdGroup field that refers to the IdGroup (PK) field of t...
TITLE: Deleting rows in joined tables using ADO QUESTION: Now I have seen this question in another forum but it didn't had an acceptable answer. Suppose I have two tables, the Groups table and the Elements table. The tables have no defined relationships. The Elements table has an IdGroup field that refers to the IdGro...
[ "ado", "dao" ]
1
1
514
1
0
2008-09-18T18:03:04.143000
2009-01-08T12:19:45.017000
95,053
95,067
learning drupal fast track: how to create a stackoverflow clone?
I've started figuring out drupal, and so far most of the results are just ugly. May be I need to learn it in something similar to a real-life project. I thought — to reproduce this site's functionality might be a good learning project. But I need help.:) Without assuming this site is based on drupal (it most likely is ...
Firstly, Drupal is by no means a slow system, actually it works quite well. Secondly, this has been already asked and answered here. By the way Drupal has a medium learning curve but, once you learn how to use you'll find it simple and you'll find it will satisfy almost everything you want to do with it. Its plugin sys...
learning drupal fast track: how to create a stackoverflow clone? I've started figuring out drupal, and so far most of the results are just ugly. May be I need to learn it in something similar to a real-life project. I thought — to reproduce this site's functionality might be a good learning project. But I need help.:) ...
TITLE: learning drupal fast track: how to create a stackoverflow clone? QUESTION: I've started figuring out drupal, and so far most of the results are just ugly. May be I need to learn it in something similar to a real-life project. I thought — to reproduce this site's functionality might be a good learning project. B...
[ "drupal" ]
2
2
2,096
3
0
2008-09-18T18:03:58.713000
2008-09-18T18:05:39.350000