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
128,035
397,642
How do I pull from a Git repository through an HTTP proxy?
Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP. I have a project under Git control. I'd like to add a submodule: git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu But I get... got 1b0313f01...
What finally worked was setting the http_proxy environment variable. I had set HTTP_PROXY correctly, but Git apparently likes the lower-case version better.
How do I pull from a Git repository through an HTTP proxy? Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP. I have a project under Git control. I'd like to add a submodule: git submodule add http://github.com/jscruggs/metric...
TITLE: How do I pull from a Git repository through an HTTP proxy? QUESTION: Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP. I have a project under Git control. I'd like to add a submodule: git submodule add http://github.c...
[ "git", "proxy", "git-submodules" ]
540
139
855,163
30
0
2008-09-24T15:58:32.607000
2008-12-29T12:34:18.373000
128,038
128,168
How can I lock a file using java (if possible)
I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exception if the file is open (which solves my problem) or do I have...
FileChannel.lock is probably what you want. try ( FileInputStream in = new FileInputStream(file); java.nio.channels.FileLock lock = in.getChannel().lock(); Reader reader = new InputStreamReader(in, charset) ) {... } (Disclaimer: Code not compiled and certainly not tested.) Note the section entitled "platform dependenci...
How can I lock a file using java (if possible) I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exception if the file...
TITLE: How can I lock a file using java (if possible) QUESTION: I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exc...
[ "java", "file-io" ]
134
124
185,191
8
0
2008-09-24T15:59:23.040000
2008-09-24T16:20:47.403000
128,042
128,220
What to do with null fields in compare()?
In Java, I use a class in which some fields can be null. For example: class Foo { String bar; //.... } I want to write a BarComparator for this class, private static class BarComparator implements Comparator { public int compare( final Foo o1, final Foo o2 ) { // Implementation goes here } } Is there a standard way to ...
I guess you could wrap the call to the field compareTo method with a small static method to sort nulls high or low: static > int cp(T a, T b) { return a==null? (b==null? 0: Integer.MIN_VALUE): (b==null? Integer.MAX_VALUE: a.compareTo(b)); } Simple usage (multiple fields is as you would normally): public int compare( fi...
What to do with null fields in compare()? In Java, I use a class in which some fields can be null. For example: class Foo { String bar; //.... } I want to write a BarComparator for this class, private static class BarComparator implements Comparator { public int compare( final Foo o1, final Foo o2 ) { // Implementation...
TITLE: What to do with null fields in compare()? QUESTION: In Java, I use a class in which some fields can be null. For example: class Foo { String bar; //.... } I want to write a BarComparator for this class, private static class BarComparator implements Comparator { public int compare( final Foo o1, final Foo o2 ) {...
[ "java", "comparison", "null" ]
23
37
26,318
10
0
2008-09-24T16:00:09.293000
2008-09-24T16:30:06.103000
128,043
128,097
Algorithm for merging large files
I have several log files of events (one event per line). The logs can possibly overlap. The logs are generated on separate client machines from possibly multiple time zones (but I assume I know the time zone). Each event has a timestamp that was normalized into a common time (by instantianting each log parsers calendar...
Read the first line from each of the log files LOOP a. Find the "earliest" line. b. Insert the "earliest" line into the master log file c. Read the next line from the file that contained the earliest line You could check for duplicates between b and c, advancing the pointer for each of those files.
Algorithm for merging large files I have several log files of events (one event per line). The logs can possibly overlap. The logs are generated on separate client machines from possibly multiple time zones (but I assume I know the time zone). Each event has a timestamp that was normalized into a common time (by instan...
TITLE: Algorithm for merging large files QUESTION: I have several log files of events (one event per line). The logs can possibly overlap. The logs are generated on separate client machines from possibly multiple time zones (but I assume I know the time zone). Each event has a timestamp that was normalized into a comm...
[ "java", "sorting", "file", "merge" ]
4
11
7,918
6
0
2008-09-24T16:00:15.347000
2008-09-24T16:09:10.177000
128,057
128,128
What are the benefits of functional programming?
What do you think the benefits of functional programming are? And how do they apply to programmers today? What are the greatest differences between functional programming and OOP?
The style of functional programming is to describe what you want, rather than how to get it. ie: instead of creating a for-loop with an iterator variable and marching through an array doing something to each cell, you'd say the equivalent of "this label refers to a version of this array where this function has been don...
What are the benefits of functional programming? What do you think the benefits of functional programming are? And how do they apply to programmers today? What are the greatest differences between functional programming and OOP?
TITLE: What are the benefits of functional programming? QUESTION: What do you think the benefits of functional programming are? And how do they apply to programmers today? What are the greatest differences between functional programming and OOP? ANSWER: The style of functional programming is to describe what you want...
[ "functional-programming" ]
113
87
62,488
9
0
2008-09-24T16:03:25.277000
2008-09-24T16:14:36.327000
128,083
128,101
Dynamically adding controls in ASP.NET Repeater
I find my self having a repeater control which is being databound to an xml document. My client is now requesting that the Textbox's which are being repeater can be either a Textbox or a Checkbox. I cannot seem to find an easyway to essentially do the following: if ((System.Xml.XmlNode)e.Item.DataItem.Attributes["type"...
What about something similar to this in your markup in each the textbox and checkbox controls? Visible=<%= Eval("type").tostring() == "text") %>
Dynamically adding controls in ASP.NET Repeater I find my self having a repeater control which is being databound to an xml document. My client is now requesting that the Textbox's which are being repeater can be either a Textbox or a Checkbox. I cannot seem to find an easyway to essentially do the following: if ((Syst...
TITLE: Dynamically adding controls in ASP.NET Repeater QUESTION: I find my self having a repeater control which is being databound to an xml document. My client is now requesting that the Textbox's which are being repeater can be either a Textbox or a Checkbox. I cannot seem to find an easyway to essentially do the fo...
[ "asp.net", "controls", "repeater" ]
6
3
24,106
4
0
2008-09-24T16:07:06.563000
2008-09-24T16:09:57.773000
128,086
128,143
How can I write a unit test for a controller class that uses winforms for views?
Has anyone been able to successfully unit test methods that are, by necessity, coupled to the System.Windows.Forms.Form class? I've recently been working on a C# winforms application, trying to build it with an MVC structure. This is difficult enough, given that the framework isn't really built with this in mind. Howev...
The best method I've heard of/used for unit testing with GUI elements is the Humble Dialog pattern/method. In essence, the Forms are just the interface, and all the real work is done in other classes. You unit test the classes that provide the functionality, and then just tie your GUI events to the appropriate methods ...
How can I write a unit test for a controller class that uses winforms for views? Has anyone been able to successfully unit test methods that are, by necessity, coupled to the System.Windows.Forms.Form class? I've recently been working on a C# winforms application, trying to build it with an MVC structure. This is diffi...
TITLE: How can I write a unit test for a controller class that uses winforms for views? QUESTION: Has anyone been able to successfully unit test methods that are, by necessity, coupled to the System.Windows.Forms.Form class? I've recently been working on a C# winforms application, trying to build it with an MVC struct...
[ ".net", "winforms", "unit-testing", "model-view-controller", "mocking" ]
5
3
581
2
0
2008-09-24T16:07:20.617000
2008-09-24T16:16:52.280000
128,103
128,355
Determining the index of an Item on a Form (J2ME)
Given an Item that has been appended to a Form, whats the best way to find out what index that item is at on the Form? Form.append(Item) will give me the index its initially added at, but if I later insert items before that the index will be out of sync.
This was the best I could come up with: private int getItemIndex(Item item, Form form) { for(int i = 0, size = form.size(); i < size; i++) { if(form.get(i).equals(item)) { return i; } } return -1; } I haven't actually tested this but it should work, I just don't like having to enumerate every item but then there should...
Determining the index of an Item on a Form (J2ME) Given an Item that has been appended to a Form, whats the best way to find out what index that item is at on the Form? Form.append(Item) will give me the index its initially added at, but if I later insert items before that the index will be out of sync.
TITLE: Determining the index of an Item on a Form (J2ME) QUESTION: Given an Item that has been appended to a Form, whats the best way to find out what index that item is at on the Form? Form.append(Item) will give me the index its initially added at, but if I later insert items before that the index will be out of syn...
[ "java", "java-me", "lcdui" ]
0
1
1,565
2
0
2008-09-24T16:10:25.557000
2008-09-24T16:58:47.127000
128,104
128,105
How do you find Leapyear in VBA?
What is a good implementation of a IsLeapYear function in VBA? Edit: I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1 average cell worksheet formula also working).
Public Function isLeapYear(Yr As Integer) As Boolean ' returns FALSE if not Leap Year, TRUE if Leap Year isLeapYear = (Month(DateSerial(Yr, 2, 29)) = 2) End Function I originally got this function from Chip Pearson's great Excel site. Pearson's site
How do you find Leapyear in VBA? What is a good implementation of a IsLeapYear function in VBA? Edit: I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1 average cell worksheet formula also work...
TITLE: How do you find Leapyear in VBA? QUESTION: What is a good implementation of a IsLeapYear function in VBA? Edit: I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1 average cell worksheet...
[ "function", "vba", "excel", "code-snippets" ]
14
29
26,228
10
0
2008-09-24T16:10:30.843000
2008-09-24T16:10:43.857000
128,120
128,495
Assembler file as input for a driver build with the WDK tools
How to get an assembler file to be compiled and linked into a driver build. To clarify a bit The SOURCES file: TARGETTYPE=DRIVER DRIVERTYPE=WDM TARGETPATH=obj TARGETNAME=bla INCLUDES=$(DDK_INC_PATH) TARGETLIBS=$(DDK_LIB_PATH)\ks.lib SOURCES=x.cpp y.cpp z.asm The problem occurs with the z.asm file. NMAKE complains th...
Have you tried the I386_SOURCES? E.g SOURCES=x.cpp y.cpp I386_SOURCES=i386\z.asm And putting the file in the i386 directory. Also see MSDN regarding the SOURCES macro
Assembler file as input for a driver build with the WDK tools How to get an assembler file to be compiled and linked into a driver build. To clarify a bit The SOURCES file: TARGETTYPE=DRIVER DRIVERTYPE=WDM TARGETPATH=obj TARGETNAME=bla INCLUDES=$(DDK_INC_PATH) TARGETLIBS=$(DDK_LIB_PATH)\ks.lib SOURCES=x.cpp y.cpp z....
TITLE: Assembler file as input for a driver build with the WDK tools QUESTION: How to get an assembler file to be compiled and linked into a driver build. To clarify a bit The SOURCES file: TARGETTYPE=DRIVER DRIVERTYPE=WDM TARGETPATH=obj TARGETNAME=bla INCLUDES=$(DDK_INC_PATH) TARGETLIBS=$(DDK_LIB_PATH)\ks.lib SOUR...
[ "windows", "assembly", "build", "driver", "wdk" ]
7
15
1,835
1
0
2008-09-24T16:13:46.313000
2008-09-24T17:25:44.987000
128,129
128,357
What does "Create Statistics" do in SQL Server 2005?
The Database Tuning Advisor is recommending that I create a bunch of statistics in my Database. I'm something of a SQL n00b, so this was the first time I'd ever come across such a creature. The entry in MSDN was a little obtuse - could someone explain what exactly this does, and why it's a good idea?
Cost Based Query Optimisation is a technique that uses histograms and row counts to heuristically estimate the cost of executing a query plan. When you submit a query to SQL Server, it evaluates it and generates a series of Query Plans for which it uses heuristics to estimate the costs. It then selects the cheapest que...
What does "Create Statistics" do in SQL Server 2005? The Database Tuning Advisor is recommending that I create a bunch of statistics in my Database. I'm something of a SQL n00b, so this was the first time I'd ever come across such a creature. The entry in MSDN was a little obtuse - could someone explain what exactly th...
TITLE: What does "Create Statistics" do in SQL Server 2005? QUESTION: The Database Tuning Advisor is recommending that I create a bunch of statistics in my Database. I'm something of a SQL n00b, so this was the first time I'd ever come across such a creature. The entry in MSDN was a little obtuse - could someone expla...
[ "sql-server", "t-sql", "statistics", "database-tuning-advisor" ]
43
38
15,948
5
0
2008-09-24T16:14:59.070000
2008-09-24T16:58:53.927000
128,162
143,702
Unicode in PDF
My program generates relatively simple PDF documents on request, but I'm having trouble with unicode characters, like kanji or odd math symbols. To write a normal string in PDF, you place it in brackets: (something) There is also the option to escape a character with octal codes: (\527) but this only goes up to 512 cha...
The simple answer is that there's no simple answer. If you take a look at the PDF specification, you'll see an entire chapter — and a long one at that — devoted to the mechanisms of text display. I implemented all of the PDF support for my company, and handling text was by far the most complex part of exercise. The sol...
Unicode in PDF My program generates relatively simple PDF documents on request, but I'm having trouble with unicode characters, like kanji or odd math symbols. To write a normal string in PDF, you place it in brackets: (something) There is also the option to escape a character with octal codes: (\527) but this only goe...
TITLE: Unicode in PDF QUESTION: My program generates relatively simple PDF documents on request, but I'm having trouble with unicode characters, like kanji or odd math symbols. To write a normal string in PDF, you place it in brackets: (something) There is also the option to escape a character with octal codes: (\527)...
[ "pdf", "unicode", "utf-8", "pdf-generation" ]
37
14
66,063
8
0
2008-09-24T16:19:35.673000
2008-09-27T14:28:03.880000
128,203
211,392
Embedding non-edit widgets in a DataGridView
Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode? For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the text. We could create a custom cell and overri...
You should derive your own type from DataGridViewColumn (e.g. a DataGridViewCalendarColumn ) and return a DataGridViewCalendarCell (that you have to create yourself, too) as the CellTemplate. A detailed description can be found in the MSDN article Build a Custom RadioButton Cell and Column for the DataGridView Control
Embedding non-edit widgets in a DataGridView Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode? For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the t...
TITLE: Embedding non-edit widgets in a DataGridView QUESTION: Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode? For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calenda...
[ "c#", "visual-studio", "user-interface" ]
1
1
400
2
0
2008-09-24T16:25:36.753000
2008-10-17T08:21:35.597000
128,239
572,165
Dynamically change an image in a Crystal Report at runtime
I'm using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the image file and then have that image displayed on the report. Has anyone been able to accomplish this with this version of Crystal Reports?
At work we do this by pushing the image(s) into the report as fields of a datatable. It's not pretty, but it gets the job done. Of course, this solution requires that you push data into the reports via a DataSet. I've always felt this was a hack at best. I really wish that image parameters were a possibility with CR. E...
Dynamically change an image in a Crystal Report at runtime I'm using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the image file and then have that image displayed on the report. Has anyone been able to acc...
TITLE: Dynamically change an image in a Crystal Report at runtime QUESTION: I'm using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the image file and then have that image displayed on the report. Has anyon...
[ "image", "crystal-reports", "report" ]
13
8
78,596
8
0
2008-09-24T16:36:06.010000
2009-02-21T03:45:50.787000
128,241
136,808
Seeking CSS Browser compatibility information for setting width using left and right
Here's a question that's been haunting me for a year now. The root question is how do I set the size of an element relative to its parent so that it is inset by N pixels from every edge? Setting the width would be nice, but you don't know the width of the parent, and you want the elements to resize with the window. (Yo...
The The CSS Box model might provide insight for you, but my guess is that you're not going to achieve pixel-perfect layout with CSS alone. If I understand correctly, you want the parent to be 25% wide and exactly the height of the browser display area. Then you want the child to be 25% - 2n pixels wide and 100%-2n pixe...
Seeking CSS Browser compatibility information for setting width using left and right Here's a question that's been haunting me for a year now. The root question is how do I set the size of an element relative to its parent so that it is inset by N pixels from every edge? Setting the width would be nice, but you don't k...
TITLE: Seeking CSS Browser compatibility information for setting width using left and right QUESTION: Here's a question that's been haunting me for a year now. The root question is how do I set the size of an element relative to its parent so that it is inset by N pixels from every edge? Setting the width would be nic...
[ "css", "cross-browser", "resize", "compatibility", "positioning" ]
1
1
1,556
5
0
2008-09-24T16:36:30.063000
2008-09-25T23:17:38.687000
128,243
128,266
UI Performance with custom border
I am creating a user control in C# and I am adding my own border and background. Currently the background is 16 small images that I change depending on the status of the object. Performance wise, would I be better off using GDI+ instead of the images?
I doubt it will make a difference. If you just blit a bunch of images that's fine and very fast with GDI and GDI+
UI Performance with custom border I am creating a user control in C# and I am adding my own border and background. Currently the background is 16 small images that I change depending on the status of the object. Performance wise, would I be better off using GDI+ instead of the images?
TITLE: UI Performance with custom border QUESTION: I am creating a user control in C# and I am adding my own border and background. Currently the background is 16 small images that I change depending on the status of the object. Performance wise, would I be better off using GDI+ instead of the images? ANSWER: I doubt...
[ "c#", ".net", "user-interface" ]
0
2
181
1
0
2008-09-24T16:36:40.983000
2008-09-24T16:40:03.317000
128,258
128,278
Displaying tabular type data in .net winforms
I want to display tabular type data, but it will not be coming from a single datasource. I am currently using a label, but the alignment doesn't look that great. Any ideas? Again, the data is not being loaded from a datagrid or anything, each row is basically a label and a number e.g. Total Users: 10123 Total Logins: 2...
Options: organize your data into a datatable and use a grid control. use the TableLayoutPanel to align you information.
Displaying tabular type data in .net winforms I want to display tabular type data, but it will not be coming from a single datasource. I am currently using a label, but the alignment doesn't look that great. Any ideas? Again, the data is not being loaded from a datagrid or anything, each row is basically a label and a ...
TITLE: Displaying tabular type data in .net winforms QUESTION: I want to display tabular type data, but it will not be coming from a single datasource. I am currently using a label, but the alignment doesn't look that great. Any ideas? Again, the data is not being loaded from a datagrid or anything, each row is basica...
[ ".net", "winforms" ]
0
2
682
2
0
2008-09-24T16:38:56.160000
2008-09-24T16:42:30.223000
128,263
128,457
How do you determine a valid SoapAction?
I'm calling a webservice using the NuSoap PHP library. The webservice appears to use.NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?
You can see the SoapAction that the service operation you're calling expects by looking at the WSDL for the service. For.NET services, you can access the WSDL by opening a web browser to the url of the service and appending?wsdl on the end. Inside the WSDL document, you can see the SoapActions defined under the 'Operat...
How do you determine a valid SoapAction? I'm calling a webservice using the NuSoap PHP library. The webservice appears to use.NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?
TITLE: How do you determine a valid SoapAction? QUESTION: I'm calling a webservice using the NuSoap PHP library. The webservice appears to use.NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is ex...
[ "php", "web-services", "soap" ]
17
41
61,005
1
0
2008-09-24T16:39:51.397000
2008-09-24T17:17:57.343000
128,267
134,563
Unconditionally execute a task in ant?
I'm trying to define a task that emits (using echo) a message when a target completes execution, regardless of whether that target was successful or not. Specifically, the target executes a task to run some unit tests, and I want to emit a message indicating where the results are available:... Tests complete. Results a...
The solution to your problem is to use the failureProperty in conjunction with the haltOnFailure property of the testng task like this:... Tests complete. Results available in ${results} Then, elsewhere when you want the build to fail you add ant code like this:...... You can then call doSomethingIfTestsFailed where yo...
Unconditionally execute a task in ant? I'm trying to define a task that emits (using echo) a message when a target completes execution, regardless of whether that target was successful or not. Specifically, the target executes a task to run some unit tests, and I want to emit a message indicating where the results are ...
TITLE: Unconditionally execute a task in ant? QUESTION: I'm trying to define a task that emits (using echo) a message when a target completes execution, regardless of whether that target was successful or not. Specifically, the target executes a task to run some unit tests, and I want to emit a message indicating wher...
[ "java", "unit-testing", "ant" ]
6
4
4,471
5
0
2008-09-24T16:40:15.453000
2008-09-25T17:05:04.357000
128,274
128,514
Incorrectly set up APC for PHP?
I decided to install APC to speed up the site that I work for. Sadly, I found out that it was already installed and enabled(The developer who first worked on the servers has moved on). Then I decided to check the usage of it to see if it needs more memory allocated to it or not. This is when I discovered something weir...
Has anyone upgraded the version of php on the server since apc.so was created? It may be that apc.so was compiled against a different version of php. If possible, try re-compiling apc.so against the current version of php. Or if you are using a package manager, try removing the apc package entirely and reinstall it.
Incorrectly set up APC for PHP? I decided to install APC to speed up the site that I work for. Sadly, I found out that it was already installed and enabled(The developer who first worked on the servers has moved on). Then I decided to check the usage of it to see if it needs more memory allocated to it or not. This is ...
TITLE: Incorrectly set up APC for PHP? QUESTION: I decided to install APC to speed up the site that I work for. Sadly, I found out that it was already installed and enabled(The developer who first worked on the servers has moved on). Then I decided to check the usage of it to see if it needs more memory allocated to i...
[ "php", "apache", "caching", "apc" ]
2
3
1,825
1
0
2008-09-24T16:41:06.527000
2008-09-24T17:28:56.477000
128,277
443,471
Using custom column names in LINQ
I'm binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName. How do you create your own custom column names in LINQ? For example: Dim query = From u In db.Users _ Select u.FirstName AS 'First Name'
I solved my own problem but all of your answers were very helpful and pointed me in the right direction. In my LINQ query, if a column name had more than one word I would separate the words with an underscore: Dim query = From u In Users _ Select First_Name = u.FirstName Then, within the Paint method of the DataGridVie...
Using custom column names in LINQ I'm binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName. How do you create your own custom column names in LINQ? For example: Dim query = From u In db.Users _ S...
TITLE: Using custom column names in LINQ QUESTION: I'm binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName. How do you create your own custom column names in LINQ? For example: Dim query = From...
[ "asp.net", "linq", "linq-to-sql", "datagridview" ]
22
18
69,431
12
0
2008-09-24T16:41:39.070000
2009-01-14T15:55:53.463000
128,282
128,322
How do you call an Asynchronous Web Request in VB.NET?
I am currently using the following code to create a web request: Dim myRequest As WebRequest = WebRequest.Create("http://foo.com/bar") Dim myResponse As WebResponse = myRequest.GetResponse() The problem is that this "locks" up the program until the request is completed (and program will hang if the request never comple...
You'll use BeginGetResponse to add a AsyncCallback, which basically points to some other method in your code that will be called when the WebRequest returns. There is a good sample here. http://www.sitepoint.com/forums/showpost.php?p=3753215
How do you call an Asynchronous Web Request in VB.NET? I am currently using the following code to create a web request: Dim myRequest As WebRequest = WebRequest.Create("http://foo.com/bar") Dim myResponse As WebResponse = myRequest.GetResponse() The problem is that this "locks" up the program until the request is compl...
TITLE: How do you call an Asynchronous Web Request in VB.NET? QUESTION: I am currently using the following code to create a web request: Dim myRequest As WebRequest = WebRequest.Create("http://foo.com/bar") Dim myResponse As WebResponse = myRequest.GetResponse() The problem is that this "locks" up the program until th...
[ "vb.net", "web-services" ]
3
3
11,534
2
0
2008-09-24T16:43:06.087000
2008-09-24T16:51:24.537000
128,287
131,440
What is the best framework for Unit Testing in JavaME?
What is currently the best tool for JavaME unit testing? I´ve never really used unit testing before (shame on me!), so learning curve is important. I would appreciate some pros and cons with your answer.:)
I think it will depend on what kind of tests are you planning to do. Will you be using continuous integration. Is running tests on handsets a must. If tests are more logic/data processing tests, the you can do fine with JUnit. But if you need to use some classes from javax.microedition.*, then the things will become a ...
What is the best framework for Unit Testing in JavaME? What is currently the best tool for JavaME unit testing? I´ve never really used unit testing before (shame on me!), so learning curve is important. I would appreciate some pros and cons with your answer.:)
TITLE: What is the best framework for Unit Testing in JavaME? QUESTION: What is currently the best tool for JavaME unit testing? I´ve never really used unit testing before (shame on me!), so learning curve is important. I would appreciate some pros and cons with your answer.:) ANSWER: I think it will depend on what k...
[ "unit-testing", "java-me", "frameworks" ]
2
2
565
4
0
2008-09-24T16:44:11.513000
2008-09-25T04:11:26.040000
128,294
128,310
What do I need in order to create 64 bit .NET applications
If I want to compile my.NET applications for a 64 bit environment. Do I need 64 bit OS version or 64 bit Visual Studio version Or both?
You actually need neither of those for building the application. A pure.NET 2.0+ application will -- in the absence of specific compiler flags to the contrary -- run as a 64-bit application under a 64-bit OS and as a 32-bit application under a 32-bit OS. Edit: Also, there's no such thing as a 64-bit version of Visual S...
What do I need in order to create 64 bit .NET applications If I want to compile my.NET applications for a 64 bit environment. Do I need 64 bit OS version or 64 bit Visual Studio version Or both?
TITLE: What do I need in order to create 64 bit .NET applications QUESTION: If I want to compile my.NET applications for a 64 bit environment. Do I need 64 bit OS version or 64 bit Visual Studio version Or both? ANSWER: You actually need neither of those for building the application. A pure.NET 2.0+ application will ...
[ ".net", "visual-studio", "64-bit" ]
1
8
1,299
6
0
2008-09-24T16:45:37.920000
2008-09-24T16:48:58.647000
128,343
128,409
Is there a better way to initialize a Hastable in .NET without using Add method?
I am currently initializing a Hashtable in the following way: Hashtable filter = new Hashtable(); filter.Add("building", "A-51"); filter.Add("apartment", "210"); I am looking for a nicer way to do this. I tried something like Hashtable filter2 = new Hashtable() { {"building", "A-51"}, {"apartment", "210"} }; However th...
The exact code you posted: Hashtable filter2 = new Hashtable() { {"building", "A-51"}, {"apartment", "210"} }; Compiles perfectly in C# 3. Given you reported compilation problems, I'm guessing you are using C# 2? In this case you can at least do this: Hashtable filter2 = new Hashtable(); filter2["building"] = "A-51"; f...
Is there a better way to initialize a Hastable in .NET without using Add method? I am currently initializing a Hashtable in the following way: Hashtable filter = new Hashtable(); filter.Add("building", "A-51"); filter.Add("apartment", "210"); I am looking for a nicer way to do this. I tried something like Hashtable fil...
TITLE: Is there a better way to initialize a Hastable in .NET without using Add method? QUESTION: I am currently initializing a Hashtable in the following way: Hashtable filter = new Hashtable(); filter.Add("building", "A-51"); filter.Add("apartment", "210"); I am looking for a nicer way to do this. I tried something ...
[ "c#" ]
22
36
23,671
5
0
2008-09-24T16:55:45.837000
2008-09-24T17:07:46.963000
128,349
128,370
String Format Date - C# or VB.NET
Date coming out of a database, need to format as "mm/dd/yy" For Each dr as DataRow in ds.Tables(0).Rows Response.Write(dr("CreateDate")) Next
string.Format( "{0:MM/dd/yy}", dr("CreateDate") ) Edit: If dr("CreateDate") is DBNull, this returns "".
String Format Date - C# or VB.NET Date coming out of a database, need to format as "mm/dd/yy" For Each dr as DataRow in ds.Tables(0).Rows Response.Write(dr("CreateDate")) Next
TITLE: String Format Date - C# or VB.NET QUESTION: Date coming out of a database, need to format as "mm/dd/yy" For Each dr as DataRow in ds.Tables(0).Rows Response.Write(dr("CreateDate")) Next ANSWER: string.Format( "{0:MM/dd/yy}", dr("CreateDate") ) Edit: If dr("CreateDate") is DBNull, this returns "".
[ ".net", "string", "formatting" ]
3
11
21,859
4
0
2008-09-24T16:56:48.767000
2008-09-24T17:00:01.600000
128,350
128,373
PHP: using preg_replace with htmlentities
I'm writing an RSS to JSON parser and as a part of that, I need to use htmlentities() on any tag found inside the description tag. Currently, I'm trying to use preg_replace(), but I'm struggling a little with it. My current (non-working) code looks like: $pattern[0] = "/\ (.*?)\<\/description\>/is"; $replace[0] = ' '.h...
Simple. Use preg_replace_callback: function _handle_match($match) { return ' '. htmlentities($match[1]). ' '; } $pattern = "/\ (.*?)\<\/description\>/is"; $rawFeed = preg_replace_callback($pattern, '_handle_match', $rawFeed); It accepts any callback type, so also methods in classes.
PHP: using preg_replace with htmlentities I'm writing an RSS to JSON parser and as a part of that, I need to use htmlentities() on any tag found inside the description tag. Currently, I'm trying to use preg_replace(), but I'm struggling a little with it. My current (non-working) code looks like: $pattern[0] = "/\ (.*?)...
TITLE: PHP: using preg_replace with htmlentities QUESTION: I'm writing an RSS to JSON parser and as a part of that, I need to use htmlentities() on any tag found inside the description tag. Currently, I'm trying to use preg_replace(), but I'm struggling a little with it. My current (non-working) code looks like: $patt...
[ "php", "regex" ]
3
7
2,717
2
0
2008-09-24T16:57:11.823000
2008-09-24T17:00:36.107000
128,352
128,362
When developing, do you turn off UAC in Vista?
I didn't upgrade to Vista until May or so and one of the things I've always heard developers I know in real life say is "first thing you should do is turn off that UAC crap" Well, I've left it on this whole time for a few reasons. First, just as a failsafe in case I do something idiotic like have a momentary lapse of r...
I think it is necessary to leave UAC on on a test machine, so you can see what a real user would see using your app. However, I turn it off on my development machine since I find it distracting, and I trust myself enough to not need it. (Hopefully your test machine!= your dev machine right?) All this being said, I supp...
When developing, do you turn off UAC in Vista? I didn't upgrade to Vista until May or so and one of the things I've always heard developers I know in real life say is "first thing you should do is turn off that UAC crap" Well, I've left it on this whole time for a few reasons. First, just as a failsafe in case I do som...
TITLE: When developing, do you turn off UAC in Vista? QUESTION: I didn't upgrade to Vista until May or so and one of the things I've always heard developers I know in real life say is "first thing you should do is turn off that UAC crap" Well, I've left it on this whole time for a few reasons. First, just as a failsaf...
[ "windows-vista", "uac" ]
6
12
1,918
23
0
2008-09-24T16:57:49.170000
2008-09-24T16:59:14.440000
128,365
128,394
Count number of occurrences of token in a file
I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using sed, and cut -c, so far I've managed to cut the file down to just the timestamps, such as: 22-Sep-2008 20:00:21 +0000 22-Sep-2008 20:00:22 +0000 22-Sep-2008 20:00:22 +0000 22-Sep-...
I think you're looking for uniq --count -c, --count prefix lines by the number of occurrences
Count number of occurrences of token in a file I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using sed, and cut -c, so far I've managed to cut the file down to just the timestamps, such as: 22-Sep-2008 20:00:21 +0000 22-Sep-2008 20...
TITLE: Count number of occurrences of token in a file QUESTION: I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using sed, and cut -c, so far I've managed to cut the file down to just the timestamps, such as: 22-Sep-2008 20:00:21 +0...
[ "bash", "shell", "grep" ]
10
33
10,364
6
0
2008-09-24T16:59:26.157000
2008-09-24T17:04:23.227000
128,372
130,108
View SVG using Silverlight or Flash
Is there a way to view a SVG from either a file or webpage dynamically using Silver light or flash? Edit: I am currently converting them on the server using inkscape. The only trouble with this is the time it takes to make all 60+ pages of the catalog is a little slow. It take 5 min to make it, and some customers (boss...
Additionally Inkscape has support for exporting SVG images to XAML output. Neither of course is exactly what you are asking for as both "convert" in some manner, but to directly answer -- No, Silverlight does not interpret SVG directly. I'm not sure about Flash though.
View SVG using Silverlight or Flash Is there a way to view a SVG from either a file or webpage dynamically using Silver light or flash? Edit: I am currently converting them on the server using inkscape. The only trouble with this is the time it takes to make all 60+ pages of the catalog is a little slow. It take 5 min ...
TITLE: View SVG using Silverlight or Flash QUESTION: Is there a way to view a SVG from either a file or webpage dynamically using Silver light or flash? Edit: I am currently converting them on the server using inkscape. The only trouble with this is the time it takes to make all 60+ pages of the catalog is a little sl...
[ "flash", "silverlight", "svg" ]
1
2
4,276
5
0
2008-09-24T17:00:20.053000
2008-09-24T21:31:36.643000
128,377
887,426
What is the 'best' way to do distributed transactions across multiple databases using Spring and Hibernate
I have an application - more like a utility - that sits in a corner and updates two different databases periodically. It is a little standalone app that has been built with a Spring Application Context. The context has two Hibernate Session Factories configured in it, in turn using Commons DBCP data sources configured ...
The best way to distribute transactions over more than one database is: Don't. Some people will point you to XA but XA (or Two Phase Commit) is a lie (or marketese). Imagine: After the first phase have told the XA manager that it can send the final commit, the network connection to one of the databases fails. Now what?...
What is the 'best' way to do distributed transactions across multiple databases using Spring and Hibernate I have an application - more like a utility - that sits in a corner and updates two different databases periodically. It is a little standalone app that has been built with a Spring Application Context. The contex...
TITLE: What is the 'best' way to do distributed transactions across multiple databases using Spring and Hibernate QUESTION: I have an application - more like a utility - that sits in a corner and updates two different databases periodically. It is a little standalone app that has been built with a Spring Application C...
[ "java", "hibernate", "spring", "transactions", "xa" ]
37
46
49,515
6
0
2008-09-24T17:01:40.177000
2009-05-20T11:38:48.053000
128,381
128,439
Including many rewrite directives in lighttpd
I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this: url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1") Unfortunately, I just discovered that I can't simply loop through them, because ...
try: url.rewrite-once += ("^/project1(.*)$"=>"project1/router.php?args=$1") to append your new config to the existing variable instead of defining it again.
Including many rewrite directives in lighttpd I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this: url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1") Unfortunately, I just discovered t...
TITLE: Including many rewrite directives in lighttpd QUESTION: I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this: url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1") Unfortunately, I...
[ "lighttpd" ]
3
5
952
1
0
2008-09-24T17:02:11.983000
2008-09-24T17:14:37.167000
128,389
128,413
What are XML namespaces for?
This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associated with a namespace?
They're for allowing multiple markup languages to be combined, without having to worry about conflicts of element and attribute names. For example, look at any bit of XSLT code, and then think what would happen if you didn't use namespaces and were trying to write an XSLT where the output has to contain "template", "fo...
What are XML namespaces for? This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associat...
TITLE: What are XML namespaces for? QUESTION: This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas ...
[ "xml", "xsd", "namespaces", "schema", "xml-namespaces" ]
78
38
22,943
10
0
2008-09-24T17:03:37.550000
2008-09-24T17:08:26.603000
128,412
128,433
SQL query - Select * from view or Select col1, col2, ... colN from view
We are using SQL Server 2005, but this question can be for any RDBMS. Which of the following is more efficient, when selecting all columns from a view? Select * from view or Select col1, col2,..., colN from view
NEVER, EVER USE "SELECT *"!!!! This is the cardinal rule of query design! There are multiple reasons for this. One of which is, that if your table only has three fields on it and you use all three fields in the code that calls the query, there's a great possibility that you will be adding more fields to that table as t...
SQL query - Select * from view or Select col1, col2, ... colN from view We are using SQL Server 2005, but this question can be for any RDBMS. Which of the following is more efficient, when selecting all columns from a view? Select * from view or Select col1, col2,..., colN from view
TITLE: SQL query - Select * from view or Select col1, col2, ... colN from view QUESTION: We are using SQL Server 2005, but this question can be for any RDBMS. Which of the following is more efficient, when selecting all columns from a view? Select * from view or Select col1, col2,..., colN from view ANSWER: NEVER, EV...
[ "sql", "sql-server" ]
12
40
79,753
10
0
2008-09-24T17:08:22.313000
2008-09-24T17:13:18.243000
128,414
128,469
Is DataGrid a necessity in WPF?
I have seen a lot of discussions going on and people asking about DataGrid for WPF and complaining about Microsoft for not having one with their WPF framework till date. We know that WPF is a great UI technology and have the Concept of ItemsControl,DataTemplate, etc,etc to make great UX. Even WPF has got a more closely...
DataGrids are excellent for displaying large amounts of tabular data bound to a backing store. But what happened in the WinForms world was that people often used them for everything that required a multi-element scrolling list. Souped-up third-party DataGrids soon became available that allowed columns and fields to con...
Is DataGrid a necessity in WPF? I have seen a lot of discussions going on and people asking about DataGrid for WPF and complaining about Microsoft for not having one with their WPF framework till date. We know that WPF is a great UI technology and have the Concept of ItemsControl,DataTemplate, etc,etc to make great UX....
TITLE: Is DataGrid a necessity in WPF? QUESTION: I have seen a lot of discussions going on and people asking about DataGrid for WPF and complaining about Microsoft for not having one with their WPF framework till date. We know that WPF is a great UI technology and have the Concept of ItemsControl,DataTemplate, etc,etc...
[ "wpf", "datagrid" ]
24
30
4,871
7
0
2008-09-24T17:08:31.783000
2008-09-24T17:20:00.757000
128,431
129,582
Run Amazon EC2 AMI in Windows
Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC.
If you build your images from scratch you can do it with VMware (or insert your favorite VM software here). Build and install your linux box as you'd like it, then run the AMI packaging/uploading tools in the guest. Then, just keep backup copies of your VM image in sync with the different AMI's you upload. Some caveats...
Run Amazon EC2 AMI in Windows Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC.
TITLE: Run Amazon EC2 AMI in Windows QUESTION: Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC. ANSWER: If you build your images from scratch you can do it with VMware (or insert your favorite VM soft...
[ "amazon-ec2", "amazon-ami" ]
24
14
7,340
3
0
2008-09-24T17:13:00.210000
2008-09-24T20:09:57.617000
128,443
128,539
.NET currency formatter: can I specify the use of banker's rounding?
Does anyone know how I can get a format string to use bankers rounding? I have been using "{0:c}" but that doesn't round the same way that bankers rounding does. The Math.Round() method does bankers rounding. I just need to be able to duplicate how it rounds using a format string. Note: the original question was rather...
Can't you simply call Math.Round() on the string input to get the behavior you want? Instead of: string s = string.Format("{0:c}", 12345.6789); Do: string s = string.Format("{0:c}", Math.Round(12345.6789));
.NET currency formatter: can I specify the use of banker's rounding? Does anyone know how I can get a format string to use bankers rounding? I have been using "{0:c}" but that doesn't round the same way that bankers rounding does. The Math.Round() method does bankers rounding. I just need to be able to duplicate how it...
TITLE: .NET currency formatter: can I specify the use of banker's rounding? QUESTION: Does anyone know how I can get a format string to use bankers rounding? I have been using "{0:c}" but that doesn't round the same way that bankers rounding does. The Math.Round() method does bankers rounding. I just need to be able t...
[ "c#", ".net", "formatting", "bankers-rounding" ]
5
4
2,507
5
0
2008-09-24T17:15:17.367000
2008-09-24T17:31:26
128,445
128,477
Calling 32bit Code from 64bit Process
I have an application that we're trying to migrate to 64bit from 32bit. It's.NET, compiled using the x64 flags. However, we have a large number of DLLs written in FORTRAN 90 compiled for 32bit. The functions in the FORTRAN DLLs are fairly simple: you put data in, you pull data out; no state of any sort. We also don't s...
You'll need to have the 32-bit dll loaded into a separate 32-bit process, and have your 64 bit process communicate with it via interprocess communication. I don't think there is any way a 32-bit dll can be loaded into a 64 bit process otherwise. There is a pretty good article here: Accessing 32-bit DLLs from 64-bit cod...
Calling 32bit Code from 64bit Process I have an application that we're trying to migrate to 64bit from 32bit. It's.NET, compiled using the x64 flags. However, we have a large number of DLLs written in FORTRAN 90 compiled for 32bit. The functions in the FORTRAN DLLs are fairly simple: you put data in, you pull data out;...
TITLE: Calling 32bit Code from 64bit Process QUESTION: I have an application that we're trying to migrate to 64bit from 32bit. It's.NET, compiled using the x64 flags. However, we have a large number of DLLs written in FORTRAN 90 compiled for 32bit. The functions in the FORTRAN DLLs are fairly simple: you put data in, ...
[ ".net", "migration", "x86", "64-bit", "fortran" ]
55
41
69,018
3
0
2008-09-24T17:15:51.530000
2008-09-24T17:21:19.613000
128,450
130,821
Best Practices for reusing code between controllers in Ruby on Rails
I have some controller methods I'd like to share. What is the best practice for doing this in ruby on rails? Should I create an abstract class that my controllers extend, or should I create module and add it in to each controller? Below are the controller methods I want to share: def driving_directions @address_to = pa...
In my opinion, normal OO design principles apply: If the code is really a set of utilities that doesn't need access to object state, I would consider putting it in a module to be called separately. For instance, if the code is all mapping utilities, create a module Maps, and access the methods like: Maps::driving_direc...
Best Practices for reusing code between controllers in Ruby on Rails I have some controller methods I'd like to share. What is the best practice for doing this in ruby on rails? Should I create an abstract class that my controllers extend, or should I create module and add it in to each controller? Below are the contro...
TITLE: Best Practices for reusing code between controllers in Ruby on Rails QUESTION: I have some controller methods I'd like to share. What is the best practice for doing this in ruby on rails? Should I create an abstract class that my controllers extend, or should I create module and add it in to each controller? Be...
[ "ruby-on-rails", "ruby" ]
85
116
27,718
7
0
2008-09-24T17:16:46.550000
2008-09-25T00:35:50.303000
128,456
135,127
Typical Kimball Star-schema Data Warehouse - Model Views Feasible? and How to Code Gen
I have a data warehouse containing typical star schemas, and a whole bunch of code which does stuff like this (obviously a lot bigger, but this is illustrative): SELECT cdim.x,SUM(fact.y) AS y,dim.z FROM fact INNER JOIN conformed_dim AS cdim ON cdim.cdim_dim_id = fact.cdim_dim_id INNER JOIN nonconformed_dim AS dim ON d...
I’ve used this technique on several data warehouses I look after. I have not noticed any performance degradation when running reports based off of the views versus a table direct approach but have never performed a detailed analysis. I created the views using the designer in SQL Server management studio and did not use...
Typical Kimball Star-schema Data Warehouse - Model Views Feasible? and How to Code Gen I have a data warehouse containing typical star schemas, and a whole bunch of code which does stuff like this (obviously a lot bigger, but this is illustrative): SELECT cdim.x,SUM(fact.y) AS y,dim.z FROM fact INNER JOIN conformed_dim...
TITLE: Typical Kimball Star-schema Data Warehouse - Model Views Feasible? and How to Code Gen QUESTION: I have a data warehouse containing typical star schemas, and a whole bunch of code which does stuff like this (obviously a lot bigger, but this is illustrative): SELECT cdim.x,SUM(fact.y) AS y,dim.z FROM fact INNER ...
[ "sql", "sql-server", "t-sql", "code-generation", "data-warehouse" ]
3
2
2,887
3
0
2008-09-24T17:17:54.020000
2008-09-25T18:36:48.910000
128,463
174,725
Use clipboard from VBScript
I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid using anything that isn't available on a clean Windows XP system. Edit: In answer to the questions about what this is for. We wanted to encourage us...
Microsoft doesn't give a way for VBScript to directly access the clipboard. If you do a search for 'clipboard' on this site you'll see: Although Visual Basic for Applications supports the Screen, Printer, App, Debug, Err, and Clipboard objects, VBScript supports only the Err object. Therefore, VBScript does not allow y...
Use clipboard from VBScript I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid using anything that isn't available on a clean Windows XP system. Edit: In answer to the questions about what this is fo...
TITLE: Use clipboard from VBScript QUESTION: I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid using anything that isn't available on a clean Windows XP system. Edit: In answer to the questions abo...
[ "vbscript", "windows-xp", "clipboard" ]
23
5
65,990
15
0
2008-09-24T17:19:08.823000
2008-10-06T15:19:53.413000
128,466
128,496
What's the best way to upgrade from Django 0.96 to 1.0?
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
Although this depends on what you're doing, most applications should be able to just upgrade and then fix everything that breaks. In my experience, the main things that I've had to fix after an upgrade are Changes to some of the funky stuff with models, such as the syntax for following foreign keys. A small set of temp...
What's the best way to upgrade from Django 0.96 to 1.0? Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
TITLE: What's the best way to upgrade from Django 0.96 to 1.0? QUESTION: Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can? ANSWER: Although this depends on what you're doing, most applications should be able to just upgrade and then fi...
[ "python", "django" ]
8
7
911
5
0
2008-09-24T17:19:38.743000
2008-09-24T17:26:05.920000
128,470
133,704
How do I write a working IThumbnailProvider for Windows Vista
I have written a thumbnail provider following the interfaces specified on MSDN. However, I have been unable to figure out how to register it in a way that Vista actually calls into it. Has anyone gotten a thumbnail provider working for Vista? Sample code or links would be especially helpful.
The documented way to register your IThumbnailProvider is to create a registry entry at HKCR\.ext\ShellEx\{E357FCCD-A995-4576-B01F-234630154E96} and set the (Default) string value to the GUID of your IThumbnailProvider. Your assembly will need to be registered first. If using.NET, that means you will need to use the Re...
How do I write a working IThumbnailProvider for Windows Vista I have written a thumbnail provider following the interfaces specified on MSDN. However, I have been unable to figure out how to register it in a way that Vista actually calls into it. Has anyone gotten a thumbnail provider working for Vista? Sample code or ...
TITLE: How do I write a working IThumbnailProvider for Windows Vista QUESTION: I have written a thumbnail provider following the interfaces specified on MSDN. However, I have been unable to figure out how to register it in a way that Vista actually calls into it. Has anyone gotten a thumbnail provider working for Vist...
[ "com", "windows-vista", "thumbnails" ]
10
3
3,417
1
0
2008-09-24T17:20:04.890000
2008-09-25T14:30:08.923000
128,478
128,577
Should import statements always be at the top of a module?
PEP 8 states: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. However if the class/method/function that I am importing is only used in rare cases, surely it is more efficient to do the import when it is needed? Isn't this: class Some...
Module importing is quite fast, but not instant. This means that: Putting the imports at the top of the module is fine, because it's a trivial cost that's only paid once. Putting the imports within a function will cause calls to that function to take longer. So if you care about efficiency, put the imports at the top. ...
Should import statements always be at the top of a module? PEP 8 states: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. However if the class/method/function that I am importing is only used in rare cases, surely it is more efficient...
TITLE: Should import statements always be at the top of a module? QUESTION: PEP 8 states: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. However if the class/method/function that I am importing is only used in rare cases, surely it...
[ "python", "optimization", "pep8" ]
546
385
185,398
22
0
2008-09-24T17:21:47.757000
2008-09-24T17:38:00.760000
128,502
129,051
Ruby error "Superclass mismatch for for class Cookie" from cgi.rb
I've just updated my ruby installation on my gentoo server to ruby 1.8.6 patchlevel 287 and have started getting an error on one of my eRuby apps. The error given in the apache error_log file is: [error] mod_ruby: /usr/lib/ruby/1.8/cgi.rb:774: superclass mismatch for class Cookie (TypeError) The strange thing is that i...
That error shows up when you redeclare a class that’s already been declared, most likely because you’re loading two different copies of cgi.rb. See a similar issue in Rails.
Ruby error "Superclass mismatch for for class Cookie" from cgi.rb I've just updated my ruby installation on my gentoo server to ruby 1.8.6 patchlevel 287 and have started getting an error on one of my eRuby apps. The error given in the apache error_log file is: [error] mod_ruby: /usr/lib/ruby/1.8/cgi.rb:774: superclass...
TITLE: Ruby error "Superclass mismatch for for class Cookie" from cgi.rb QUESTION: I've just updated my ruby installation on my gentoo server to ruby 1.8.6 patchlevel 287 and have started getting an error on one of my eRuby apps. The error given in the apache error_log file is: [error] mod_ruby: /usr/lib/ruby/1.8/cgi....
[ "ruby", "eruby" ]
4
2
5,295
2
0
2008-09-24T17:26:51.537000
2008-09-24T18:48:40.840000
128,512
128,552
Compile-time error for NotSupportedException in subclass function
If I have a subclass that has yet to implement a function provided by the base class, I can override that function and have it throw a NotSupportedException. Is there a way to generate a compile-time error for this to avoid only hitting this at runtime? Update: I can't make the base class abstract.
[Obsolete("This still needs implementing", true/false)] true if you don't want the build to succeed, false if you just want a warning Slightly hackish... but it does the job of warning at compile time.
Compile-time error for NotSupportedException in subclass function If I have a subclass that has yet to implement a function provided by the base class, I can override that function and have it throw a NotSupportedException. Is there a way to generate a compile-time error for this to avoid only hitting this at runtime? ...
TITLE: Compile-time error for NotSupportedException in subclass function QUESTION: If I have a subclass that has yet to implement a function provided by the base class, I can override that function and have it throw a NotSupportedException. Is there a way to generate a compile-time error for this to avoid only hitting...
[ "c#", "exception", "inheritance" ]
1
1
165
3
0
2008-09-24T17:28:32.060000
2008-09-24T17:33:26.167000
128,513
128,589
Modify config file based on build constants
I have an application dependent on some internal web services, and so we want our development and staging configurations to point to the development and staging servers for the web services. Right now, this means manually editing my app.config file to point to the appropriate URLs. This is not only a hassle, but prone ...
We used a program called XmlPreprocessor from SourceForge to handle this. It allows you to create parameters in your configuration files and different value files to populate them from. Given the following files: app.config... $importantSettingValue$... qavalues.xml... QAvalue... prodvalues.xml... PRODvalue... A comman...
Modify config file based on build constants I have an application dependent on some internal web services, and so we want our development and staging configurations to point to the development and staging servers for the web services. Right now, this means manually editing my app.config file to point to the appropriate...
TITLE: Modify config file based on build constants QUESTION: I have an application dependent on some internal web services, and so we want our development and staging configurations to point to the development and staging servers for the web services. Right now, this means manually editing my app.config file to point ...
[ "c#", ".net", "configuration-files" ]
2
3
740
1
0
2008-09-24T17:28:41.233000
2008-09-24T17:39:59.273000
128,517
153,262
Any business examples of using Markov chains?
What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the like... Edit: Thanks to all who gave examples, I upvoted each on...
There is a class of optimization methods based on Markov Chain Monte Carlo (MCMC) methods. These have been applied to a wide variety of practical problems, for example signal & image processing applications to data segmentation and classification. Speech & image recognition, time series analysis, lots of similar exampl...
Any business examples of using Markov chains? What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the like... Edit: Than...
TITLE: Any business examples of using Markov chains? QUESTION: What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the ...
[ "artificial-intelligence", "markov-chains" ]
18
6
7,874
14
0
2008-09-24T17:29:41.840000
2008-09-30T14:23:16.797000
128,527
129,333
Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad?
We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure out why the connections are being dropped in the first place?
There is usually a configuration option on the pool to enable a validation query to be executed on borrow. If the validation query executes successfully, the pool will return that connection. If the query does not execute successfully, the pool will create a new connection. The JBoss Wiki documents the various attribut...
Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad? We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure out why the connect...
TITLE: Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad? QUESTION: We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure o...
[ "oracle", "jboss", "connection-pooling", "reconnect" ]
32
28
65,140
6
0
2008-09-24T17:30:40.247000
2008-09-24T19:30:08.323000
128,558
128,597
Is there a way to Categorize my custom controls in the toolbox?
I have built a number of asp.net servercontrols into a class library, & I would like them to be grouped a certain way when the other members of my team reference my dll. Is that possible? How?
There's a blog here that discusses how to add controls to the Visual Studio 2005 toolbox - including creating tabs to group the controls. I made a version of this that works in a Custom Action, if you want more details let me know.
Is there a way to Categorize my custom controls in the toolbox? I have built a number of asp.net servercontrols into a class library, & I would like them to be grouped a certain way when the other members of my team reference my dll. Is that possible? How?
TITLE: Is there a way to Categorize my custom controls in the toolbox? QUESTION: I have built a number of asp.net servercontrols into a class library, & I would like them to be grouped a certain way when the other members of my team reference my dll. Is that possible? How? ANSWER: There's a blog here that discusses h...
[ "c#", "asp.net", "custom-server-controls" ]
0
0
137
1
0
2008-09-24T17:34:27.273000
2008-09-24T17:41:16.070000
128,560
128,564
When do I use the PHP constant "PHP_EOL"?
When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?
Yes, PHP_EOL is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Unix issues. Note that PHP_EOL represents the endline character for the current system. For instance, it will not find a Windows endline when executed on a unix-like system.
When do I use the PHP constant "PHP_EOL"? When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?
TITLE: When do I use the PHP constant "PHP_EOL"? QUESTION: When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues? ANSWER: Yes, PHP_EOL is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Unix ...
[ "php", "eol" ]
432
421
499,134
19
0
2008-09-24T17:34:39.067000
2008-09-24T17:35:53.433000
128,561
138,468
Registering a custom win32 window class from c#
I have a new application written in WPF that needs to support an old API that allows it to receive a message that has been posted to a hidden window. Typically another application uses FindWindow to identify the hidden window using the name of its custom window class. 1) I assume to implement a custom window class I ne...
For the record I finally got this to work. Turned out the difficulties I had were down to string marshalling problems. I had to be more precise in my importing of win32 functions. Below is the code that will create a custom window class in c# - useful for supporting old APIs you might have that rely on custom window cl...
Registering a custom win32 window class from c# I have a new application written in WPF that needs to support an old API that allows it to receive a message that has been posted to a hidden window. Typically another application uses FindWindow to identify the hidden window using the name of its custom window class. 1) ...
TITLE: Registering a custom win32 window class from c# QUESTION: I have a new application written in WPF that needs to support an old API that allows it to receive a message that has been posted to a hidden window. Typically another application uses FindWindow to identify the hidden window using the name of its custom...
[ "c#", "windows", "winapi", "interop" ]
16
40
21,872
4
0
2008-09-24T17:35:00.253000
2008-09-26T09:30:44.033000
128,579
128,645
How do I define my own errno values?
When developing a module (device driver, middleware, etc...) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail. In VxWorks, The errno mechanism seems to be a good way to do this. Is it possible to define my own errno values?
In the context of VxWorks errno is defined as two 16-bit: The upper 16-bit identifies the "module" where the error occured. The lower 16-bit represent the particular error for that module. The official vxWorks module values (for errno) are located in the../h/vwModNum.h file. They are currently using a few hundred numbe...
How do I define my own errno values? When developing a module (device driver, middleware, etc...) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail. In VxWorks, The errno mechanism seems to be a good way to do this. Is it possible to define my own errno valu...
TITLE: How do I define my own errno values? QUESTION: When developing a module (device driver, middleware, etc...) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail. In VxWorks, The errno mechanism seems to be a good way to do this. Is it possible to define...
[ "embedded", "vxworks" ]
0
2
1,106
2
0
2008-09-24T17:38:06.063000
2008-09-24T17:48:52.637000
128,580
128,598
Parsing XML with namespaces using jQuery $().find
I'm trying to get the contents of a XML document element, but the element has a colon in it's name. This line works for every element but the ones with a colon in the name: $(this).find("geo:lat").text(); I assume that the colon needs escaping. How do I fix this?
Use a backslash, which itself should be escaped so JavaScript doesn't eat it: $(this).find("geo\\:lat").text();
Parsing XML with namespaces using jQuery $().find I'm trying to get the contents of a XML document element, but the element has a colon in it's name. This line works for every element but the ones with a colon in the name: $(this).find("geo:lat").text(); I assume that the colon needs escaping. How do I fix this?
TITLE: Parsing XML with namespaces using jQuery $().find QUESTION: I'm trying to get the contents of a XML document element, but the element has a colon in it's name. This line works for every element but the ones with a colon in the name: $(this).find("geo:lat").text(); I assume that the colon needs escaping. How do ...
[ "javascript", "jquery", "xml", "namespaces" ]
21
32
30,071
3
0
2008-09-24T17:38:36.467000
2008-09-24T17:41:19.940000
128,584
128,724
Recursive descent parsing - from LL(1) up
The following simple "calculator expression" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1)::= + | - |:= * /:= | | ( ):= \d+:= [a-zA-Z_]\w+ Because it is always enough to see the next token in order to know the rule to pick. However, suppose that I add the foll...
THe problem with:= | = is that when you "see" you can't tell if it's the beginning of an assignement (second rule) or it's a " ". You will only know when you'll read the next token. AFAIK ANTLR is LL(*) (and is also able to generate rat-pack parsers if I'm not mistaken) so it will probably handle this grammare consider...
Recursive descent parsing - from LL(1) up The following simple "calculator expression" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1)::= + | - |:= * /:= | | ( ):= \d+:= [a-zA-Z_]\w+ Because it is always enough to see the next token in order to know the rule to ...
TITLE: Recursive descent parsing - from LL(1) up QUESTION: The following simple "calculator expression" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1)::= + | - |:= * /:= | | ( ):= \d+:= [a-zA-Z_]\w+ Because it is always enough to see the next token in order to...
[ "parsing", "compilation", "recursive-descent" ]
9
7
3,935
4
0
2008-09-24T17:39:16.217000
2008-09-24T17:58:02.943000
128,586
128,937
How do you incentivize good code?
Are there any methods/systems that you have in place to incentivize your development team members to write "good" code and add comments to their code? I recognize that "good" is a subjective term and it relates to an earlier question about measuring the maintainability of code as one measurement of good code.
While most people respond that code reviews are a good way to ensure high quality code, and rightfully so, they don't seem to me to be a direct incentive to getting there. However, coming up with a positive incentive for good code is difficult because the concept of good code has large areas that fall in the realm of o...
How do you incentivize good code? Are there any methods/systems that you have in place to incentivize your development team members to write "good" code and add comments to their code? I recognize that "good" is a subjective term and it relates to an earlier question about measuring the maintainability of code as one m...
TITLE: How do you incentivize good code? QUESTION: Are there any methods/systems that you have in place to incentivize your development team members to write "good" code and add comments to their code? I recognize that "good" is a subjective term and it relates to an earlier question about measuring the maintainabilit...
[ "sdlc" ]
5
6
1,188
15
0
2008-09-24T17:39:23.423000
2008-09-24T18:31:06.030000
128,618
128,683
File-size format provider
Is there any easy way to create a class that uses IFormatProvider that writes out a user-friendly file-size? public static string GetFileSizeString(string filePath) { FileInfo info = new FileInfo(@"c:\windows\notepad.exe"); long size = info.Length; string sizeString = size.ToString(FileSizeFormatProvider); // This is w...
I use this one, I get it from the web public class FileSizeFormatProvider: IFormatProvider, ICustomFormatter { public object GetFormat(Type formatType) { if (formatType == typeof(ICustomFormatter)) return this; return null; } private const string fileSizeFormat = "fs"; private const Decimal OneKiloByte = 1024M; privat...
File-size format provider Is there any easy way to create a class that uses IFormatProvider that writes out a user-friendly file-size? public static string GetFileSizeString(string filePath) { FileInfo info = new FileInfo(@"c:\windows\notepad.exe"); long size = info.Length; string sizeString = size.ToString(FileSizeFor...
TITLE: File-size format provider QUESTION: Is there any easy way to create a class that uses IFormatProvider that writes out a user-friendly file-size? public static string GetFileSizeString(string filePath) { FileInfo info = new FileInfo(@"c:\windows\notepad.exe"); long size = info.Length; string sizeString = size.To...
[ "c#", "formatting", "filesize" ]
72
111
49,162
12
0
2008-09-24T17:44:34.957000
2008-09-24T17:52:47.370000
128,623
131,595
Disable all table constraints in Oracle
How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables.
It is better to avoid writing out temporary spool files. Use a PL/SQL block. You can run this from SQL*Plus or put this thing into a package or procedure. The join to USER_TABLES is there to avoid view constraints. It's unlikely that you really want to disable all constraints (including NOT NULL, primary keys, etc). Yo...
Disable all table constraints in Oracle How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables.
TITLE: Disable all table constraints in Oracle QUESTION: How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables. ANSWER: It is better to avoid writing out temporary spool files. Use a PL/SQL block. You can run this from SQL*Pl...
[ "sql", "oracle" ]
100
157
250,722
11
0
2008-09-24T17:45:09.573000
2008-09-25T05:26:55.737000
128,625
128,720
Stand-alone text editor with Visual Studio editor functionality
Is anyone aware of any text editors with Visual Studio editor functionality? Specifically, I'm looking for the following features: CTRL+C anywhere on the line, no text selected -> the whole line is copied CTRL+X or SHIFT+DEL anywhere on the line, no text selected -> the whole line cut Thanks!
Komodo Edit does the two things you specified. I use it all the time as a secondary editor, for various scripting and other programming tasks. Tons of features, free, open source.
Stand-alone text editor with Visual Studio editor functionality Is anyone aware of any text editors with Visual Studio editor functionality? Specifically, I'm looking for the following features: CTRL+C anywhere on the line, no text selected -> the whole line is copied CTRL+X or SHIFT+DEL anywhere on the line, no text s...
TITLE: Stand-alone text editor with Visual Studio editor functionality QUESTION: Is anyone aware of any text editors with Visual Studio editor functionality? Specifically, I'm looking for the following features: CTRL+C anywhere on the line, no text selected -> the whole line is copied CTRL+X or SHIFT+DEL anywhere on t...
[ "editor", "text-editor" ]
5
5
3,671
7
0
2008-09-24T17:45:43.410000
2008-09-24T17:57:38.123000
128,636
128,754
.Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary -- Speed, memory, and when to use each?
.NET has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and VB books talk about them to a certain extent, but they never really go into any real detail. What's the difference between Array, ArrayList, List, H...
Off the top of my head: Array * - represents an old-school memory array - kind of like a alias for a normal type[] array. Can enumerate. Can't grow automatically. I would assume very fast insert and retrival speed. ArrayList - automatically growing array. Adds more overhead. Can enum., probably slower than a normal arr...
.Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary -- Speed, memory, and when to use each? .NET has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and VB books talk abo...
TITLE: .Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary -- Speed, memory, and when to use each? QUESTION: .NET has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and...
[ "c#", ".net", "vb.net", "arrays", "data-structures" ]
223
167
172,448
12
0
2008-09-24T17:47:27.897000
2008-09-24T18:00:25.870000
128,658
128,797
Menu control CSS breaks when inside UpdatePanel
I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this?
The problem is here: StaticSelectedStyle-CssClass="staticSubMenuItemSelected" StaticHoverStyle-CssClass="staticSubMenuItemSelected" If you have a different CssClass set for Selected and Hover, the problem is fixed. Create a "Hover" css class and change the above to: StaticSelectedStyle-CssClass="staticSubMenuItemSelect...
Menu control CSS breaks when inside UpdatePanel I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this?
TITLE: Menu control CSS breaks when inside UpdatePanel QUESTION: I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this? ANSWER: The problem is here: Stat...
[ "c#", "asp.net", "asp.net-ajax" ]
2
3
2,841
1
0
2008-09-24T17:50:23.897000
2008-09-24T18:06:45.307000
128,660
136,158
How can I make Ruby's SOAP::RPC::Driver work with self signed certificates?
How can I prevent this exception when making a soap call to a server that is using a self signed certificate? require "rubygems" gem "httpclient", "2.1.2" require 'http-access2' require 'soap/rpc/driver' client = SOAP::RPC::Driver.new( url, 'http://removed' ) client.options[ 'protocol.http.ssl_config.verify_mode' ] = O...
Try: client.options["protocol.http.ssl_config.verify_mode"] = nil
How can I make Ruby's SOAP::RPC::Driver work with self signed certificates? How can I prevent this exception when making a soap call to a server that is using a self signed certificate? require "rubygems" gem "httpclient", "2.1.2" require 'http-access2' require 'soap/rpc/driver' client = SOAP::RPC::Driver.new( url, 'ht...
TITLE: How can I make Ruby's SOAP::RPC::Driver work with self signed certificates? QUESTION: How can I prevent this exception when making a soap call to a server that is using a self signed certificate? require "rubygems" gem "httpclient", "2.1.2" require 'http-access2' require 'soap/rpc/driver' client = SOAP::RPC::Dr...
[ "ruby", "soap", "ssl" ]
3
2
3,078
1
0
2008-09-24T17:50:46.703000
2008-09-25T21:08:44.910000
128,699
130,050
Best java open source toolkit to visualize a GML fragment
I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task?
GeoTools provides a library for reading GML files. They also provide UI components for displaying geospatial formats their library supports.
Best java open source toolkit to visualize a GML fragment I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task?
TITLE: Best java open source toolkit to visualize a GML fragment QUESTION: I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task? ANSWER: GeoTools provides a library for reading GML files. They also provide UI components for displaying geo...
[ "java", "gml" ]
4
1
1,991
2
0
2008-09-24T17:54:33.327000
2008-09-24T21:19:34.020000
128,710
128,761
Best tool for Software System Diagramming
Over the years, I have tried many times to find a good, easy to use, cross platform tool for some basic software system diagramming. The UML tools I have tried seemed to get in my way more than help. So far, the solution I keep returning to is Visio, which is both Windows-only and expensive. Although its far from ideal...
You could try DIA, though it is a bit basic it will keep out of your way when doing pure diagrams. http://www.gnome.org/projects/dia/
Best tool for Software System Diagramming Over the years, I have tried many times to find a good, easy to use, cross platform tool for some basic software system diagramming. The UML tools I have tried seemed to get in my way more than help. So far, the solution I keep returning to is Visio, which is both Windows-only ...
TITLE: Best tool for Software System Diagramming QUESTION: Over the years, I have tried many times to find a good, easy to use, cross platform tool for some basic software system diagramming. The UML tools I have tried seemed to get in my way more than help. So far, the solution I keep returning to is Visio, which is ...
[ "diagramming" ]
15
5
14,269
14
0
2008-09-24T17:56:13.243000
2008-09-24T18:01:22.967000
128,718
142,378
Is there a way to have class variables with setter/getter like virtual variables?
I am embedding Ruby into my C project and want to load several files that define a class inherited from my own parent class. Each inherited class needs to set some variables on initialization and I don't want to have two different variables for Ruby and C. Is there a way to define a class variable that has an own custo...
I'm not sure exactly what you're asking. Of course class variables can have getters and setters (and behind the scenes you can store the value any way you like). Does this snippet help illuminate anything? >> class TestClass >> def self.var >> @@var ||= nil >> end >> def self.var=(value) >> @@var = value >> end >> end ...
Is there a way to have class variables with setter/getter like virtual variables? I am embedding Ruby into my C project and want to load several files that define a class inherited from my own parent class. Each inherited class needs to set some variables on initialization and I don't want to have two different variabl...
TITLE: Is there a way to have class variables with setter/getter like virtual variables? QUESTION: I am embedding Ruby into my C project and want to load several files that define a class inherited from my own parent class. Each inherited class needs to set some variables on initialization and I don't want to have two...
[ "c", "ruby" ]
2
5
1,800
1
0
2008-09-24T17:57:23.367000
2008-09-26T22:35:53.387000
128,789
128,844
Web Services framework versus a custom XML over HTTP protocol?
I am looking for specific guidelines for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP. I am less concerned about performance than I am about maintainability and ease-of-development both for client-side and server-side code. For example, I can develop...
The benefit of WS is typically derived from tooling support to generate the clients, server stubs and descriptors, and pipeline benefits such as security, encryption, and other extensibility. Without the tooling the burden to roll and process WS requests is high, and the value to your outcome is relatively low. IMO if ...
Web Services framework versus a custom XML over HTTP protocol? I am looking for specific guidelines for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP. I am less concerned about performance than I am about maintainability and ease-of-development both f...
TITLE: Web Services framework versus a custom XML over HTTP protocol? QUESTION: I am looking for specific guidelines for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP. I am less concerned about performance than I am about maintainability and ease-of-...
[ "xml", "web-services" ]
1
1
1,366
7
0
2008-09-24T18:05:18.213000
2008-09-24T18:14:21.203000
128,815
128,957
Does Django support multi-value cookies?
I'd like to set a cookie via Django with that has several different values to it, similar to.NET's HttpCookie.Values property. Looking at the documentation, I can't tell if this is possible. It looks like it just takes a string, so is there another way? I've tried passing it an array ( [10, 20, 30] ) and dictionary ( {...
.NETs multi-value cookies work exactly the same way as what you're doing in django using a separator. They've just abstracted that away for you. What you're doing is fine and proper, and I don't think Django has anything specific to 'solve' this problem. I will say that you're doing the right thing, in not using multip...
Does Django support multi-value cookies? I'd like to set a cookie via Django with that has several different values to it, similar to.NET's HttpCookie.Values property. Looking at the documentation, I can't tell if this is possible. It looks like it just takes a string, so is there another way? I've tried passing it an ...
TITLE: Does Django support multi-value cookies? QUESTION: I'd like to set a cookie via Django with that has several different values to it, similar to.NET's HttpCookie.Values property. Looking at the documentation, I can't tell if this is possible. It looks like it just takes a string, so is there another way? I've tr...
[ "python", "django", "cookies" ]
2
7
3,001
4
0
2008-09-24T18:09:14.303000
2008-09-24T18:35:11.277000
128,816
128,925
JavaScript intellisense in Visual Studio 2008
Have you guys and gals got any tips or hacks for making the most out of the JavaScript intellisense options in Visual Studio 2008? Visual Studio shows me the "namespaces" and uses the documentation features ( and ). I have not been able to get the documentation feature to work though. Now, that's all well and good. But...
Javascript Intellisense is definitely flaky as far as recognizing function members. I've had slightly more success using the prototype paradigm, so that's something you could check out. Often times, though, I find it still won't reliably list functions in the Intellisense. Edit: As the original poster suggested in the ...
JavaScript intellisense in Visual Studio 2008 Have you guys and gals got any tips or hacks for making the most out of the JavaScript intellisense options in Visual Studio 2008? Visual Studio shows me the "namespaces" and uses the documentation features ( and ). I have not been able to get the documentation feature to w...
TITLE: JavaScript intellisense in Visual Studio 2008 QUESTION: Have you guys and gals got any tips or hacks for making the most out of the JavaScript intellisense options in Visual Studio 2008? Visual Studio shows me the "namespaces" and uses the documentation features ( and ). I have not been able to get the document...
[ "javascript", "visual-studio-2008" ]
5
4
781
1
0
2008-09-24T18:09:14.787000
2008-09-24T18:29:21.807000
128,818
128,829
Why is try {...} finally {...} good; try {...} catch{} bad?
I have seen people say that it is bad form to use catch with no arguments, especially if that catch doesn't do anything: StreamReader reader=new StreamReader("myfile.txt"); try { int i = 5 / 0; } catch // No args, so it will catch any exception {} reader.Close(); However, this is considered good form: StreamReader read...
The big difference is that try...catch will swallow the exception, hiding the fact that an error occurred. try..finally will run your cleanup code and then the exception will keep going, to be handled by something that knows what to do with it.
Why is try {...} finally {...} good; try {...} catch{} bad? I have seen people say that it is bad form to use catch with no arguments, especially if that catch doesn't do anything: StreamReader reader=new StreamReader("myfile.txt"); try { int i = 5 / 0; } catch // No args, so it will catch any exception {} reader.Close...
TITLE: Why is try {...} finally {...} good; try {...} catch{} bad? QUESTION: I have seen people say that it is bad form to use catch with no arguments, especially if that catch doesn't do anything: StreamReader reader=new StreamReader("myfile.txt"); try { int i = 5 / 0; } catch // No args, so it will catch any excepti...
[ "c#", ".net", "exception", "try-catch", "try-catch-finally" ]
205
370
93,038
20
0
2008-09-24T18:10:23.100000
2008-09-24T18:12:51.533000
128,830
128,869
SQL sp_help_operator
Anyone know what group I need to belong to show up in the sp_help_operator list?
Judging from the docs for sp_help_operator, it looks like you need to explicitly add/remove operators using sp_add_operator and sp_delete_operator. http://msdn.microsoft.com/en-us/library/aa238703(SQL.80).aspx
SQL sp_help_operator Anyone know what group I need to belong to show up in the sp_help_operator list?
TITLE: SQL sp_help_operator QUESTION: Anyone know what group I need to belong to show up in the sp_help_operator list? ANSWER: Judging from the docs for sp_help_operator, it looks like you need to explicitly add/remove operators using sp_add_operator and sp_delete_operator. http://msdn.microsoft.com/en-us/library/aa2...
[ "sql", "sp-help-operator" ]
0
1
726
1
0
2008-09-24T18:13:02.673000
2008-09-24T18:17:31.943000
128,836
128,927
Best Method to Spawn Process from SQL Server Trigger
How would I go about spawning a separate process using a SQL Server 05/08 trigger? Ideally, I would like to spawn the process and have SQL Server not wait on the process to finish execution. I need to pass a couple parameters from the insert that is triggering the process, but the executable would take care of the rest...
a bit of CLR Integration, combined with SQL Service Broker can help you here. http://microsoft.apress.com/feature/70/asynchronous-stored-procedures-in-sql-server-2005
Best Method to Spawn Process from SQL Server Trigger How would I go about spawning a separate process using a SQL Server 05/08 trigger? Ideally, I would like to spawn the process and have SQL Server not wait on the process to finish execution. I need to pass a couple parameters from the insert that is triggering the pr...
TITLE: Best Method to Spawn Process from SQL Server Trigger QUESTION: How would I go about spawning a separate process using a SQL Server 05/08 trigger? Ideally, I would like to spawn the process and have SQL Server not wait on the process to finish execution. I need to pass a couple parameters from the insert that is...
[ "sql-server", "triggers" ]
0
1
1,194
3
0
2008-09-24T18:13:52.467000
2008-09-24T18:29:42.163000
128,853
128,905
How do I run a command in a loop until I see some string in stdout?
I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let me run a command in a loop until I observe some string in stdout, then stop. Ideally, I'd like to capture stdout as well, but if it's going to console, that might be enough. The particular environment in question at the moment is RedH...
In Perl: #!/usr/local/bin/perl -w if (@ARGV!= 2) { print "Usage: watchit.pl \n"; exit(1); } $cmd = $ARGV[0]; $str = $ARGV[1]; while (1) { my $output = `$cmd`; print $output; # or dump to file if desired if ($output =~ /$str/) { exit(0); } } Example: [bash$]./watchit.pl ls stop watchit.pl watchit.pl~ watchit.pl watch...
How do I run a command in a loop until I see some string in stdout? I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let me run a command in a loop until I observe some string in stdout, then stop. Ideally, I'd like to capture stdout as well, but if it's going to console, that might be ...
TITLE: How do I run a command in a loop until I see some string in stdout? QUESTION: I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let me run a command in a loop until I observe some string in stdout, then stop. Ideally, I'd like to capture stdout as well, but if it's going to conso...
[ "linux", "bash", "shell" ]
18
13
21,434
8
0
2008-09-24T18:15:11.327000
2008-09-24T18:26:22
128,857
128,896
Is this a proper way to get a WebProfile?
I have a user reporting that when they use the back button to return to a web page that they come back as a different person. It seems like they may be accessing a different users profile. Here are the important parts of the code: //here's the code on the web page public static WebProfile p = null; protected void Pag...
A static object is shared across all instances of an application so if you alter the value of a static object, that alteration will be reflected across all instances of the application which access that object. Therefore if your web profile is reassigned by another thread (i.e. a second user visiting a page) inbetween ...
Is this a proper way to get a WebProfile? I have a user reporting that when they use the back button to return to a web page that they come back as a different person. It seems like they may be accessing a different users profile. Here are the important parts of the code: //here's the code on the web page public stati...
TITLE: Is this a proper way to get a WebProfile? QUESTION: I have a user reporting that when they use the back button to return to a web page that they come back as a different person. It seems like they may be accessing a different users profile. Here are the important parts of the code: //here's the code on the web ...
[ "c#", "asp.net", "asp.net-ajax" ]
1
1
506
2
0
2008-09-24T18:16:00.950000
2008-09-24T18:24:15.797000
128,888
128,926
How to compute the hashCode() from the object's address?
In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, so good: class Vertex extends Point3f { //... public boolean equals(Objec...
Either use System.identityHashCode() or use an IdentityHashMap.
How to compute the hashCode() from the object's address? In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, so good: class Ver...
TITLE: How to compute the hashCode() from the object's address? QUESTION: In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, ...
[ "java", "hash", "equals", "hashcode" ]
5
10
1,890
7
0
2008-09-24T18:21:58.953000
2008-09-24T18:29:26.190000
128,919
128,956
Extreme Sharding: One SQLite Database Per User
I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability. Instead of using one centralized MySQL/InnoDB database and then partitioning it when that time comes, I've decided to create a separ...
The place where this will fail is if you have to do what's called "shard walking" - which is finding out all the data across a bunch of different users. That particular kind of "query" will have to be done programmatically, asking each of the SQLite databases in turn - and will very likely be the slowest aspect of your...
Extreme Sharding: One SQLite Database Per User I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability. Instead of using one centralized MySQL/InnoDB database and then partitioning it when ...
TITLE: Extreme Sharding: One SQLite Database Per User QUESTION: I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability. Instead of using one centralized MySQL/InnoDB database and then par...
[ "database", "sqlite", "architecture", "scalability", "sharding" ]
44
34
16,367
8
0
2008-09-24T18:28:36.270000
2008-09-24T18:35:01.747000
128,923
128,966
What's the effect of adding 'return false' to a click event listener?
Many times I've seen links like these in HTML pages: Click here! What's the effect of the return false in there? Also, I don't usually see that in buttons. Is this specified anywhere? In some spec in w3.org?
The return value of an event handler determines whether or not the default browser behaviour should take place as well. In the case of clicking on links, this would be following the link, but the difference is most noticeable in form submit handlers, where you can cancel a form submission if the user has made a mistake...
What's the effect of adding 'return false' to a click event listener? Many times I've seen links like these in HTML pages: Click here! What's the effect of the return false in there? Also, I don't usually see that in buttons. Is this specified anywhere? In some spec in w3.org?
TITLE: What's the effect of adding 'return false' to a click event listener? QUESTION: Many times I've seen links like these in HTML pages: Click here! What's the effect of the return false in there? Also, I don't usually see that in buttons. Is this specified anywhere? In some spec in w3.org? ANSWER: The return valu...
[ "javascript", "html" ]
425
359
515,213
15
0
2008-09-24T18:28:54.803000
2008-09-24T18:36:17.873000
128,924
128,971
C# Day from Week picker component
This question is for C# 2.0 Winform. For the moment I use checkboxes to select like this: Monday[x], Thuesday[x]¸... etc. It works fine but is it a better way to get the day of the week? (Can have more than one day picked)
Checkboxes are the standard UI component to use when selection of multiple items is allowed. From UI usability guru Jakob Nielsen's article on Checkboxes vs. Radio Buttons: "Checkboxes are used when there are lists of options and the user may select any number of choices, including zero, one, or several. In other words...
C# Day from Week picker component This question is for C# 2.0 Winform. For the moment I use checkboxes to select like this: Monday[x], Thuesday[x]¸... etc. It works fine but is it a better way to get the day of the week? (Can have more than one day picked)
TITLE: C# Day from Week picker component QUESTION: This question is for C# 2.0 Winform. For the moment I use checkboxes to select like this: Monday[x], Thuesday[x]¸... etc. It works fine but is it a better way to get the day of the week? (Can have more than one day picked) ANSWER: Checkboxes are the standard UI compo...
[ "c#", "winforms" ]
1
3
2,059
4
0
2008-09-24T18:29:16.720000
2008-09-24T18:36:57
128,933
462,545
Perl or Python script to remove user from group
I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from an existing group with a command line script. It appears that the...
Web Link: http://www.ibm.com/developerworks/linux/library/l-roadmap4/ To add members to the group, use the gpasswd command with the -a switch and the user id you wish to add: gpasswd -a userid mygroup Remove users from a group with the same command, but a -d switch rather than -a: gpasswd -d userid mygroup "man gpasswd...
Perl or Python script to remove user from group I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from an existing group...
TITLE: Perl or Python script to remove user from group QUESTION: I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from...
[ "python", "perl", "system-administration", "centos", "redhat" ]
3
2
3,266
4
0
2008-09-24T18:30:36.123000
2009-01-20T18:42:40.460000
128,938
129,161
Cap invoke and sudo
I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command? In other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command line.
Found it - cap invoke COMMAND=" command that requires sudo " SUDO=1
Cap invoke and sudo I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command? In other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command line.
TITLE: Cap invoke and sudo QUESTION: I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command? In other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command line....
[ "ruby-on-rails", "ruby", "capistrano" ]
7
12
3,169
3
0
2008-09-24T18:31:08.963000
2008-09-24T19:03:16.500000
128,949
2,687,348
What good template language is supported in JavaScript?
Templates are a pretty healthy business in established programming languages, but are there any good ones that can be processed in JavaScript? By "template" I mean a document that accepts a data object as input, inserts the data into some kind of serialized markup language, and outputs the markup. Well-known examples a...
You might want to check out Mustache - it's really portable and simple template language with javascript support among other languages.
What good template language is supported in JavaScript? Templates are a pretty healthy business in established programming languages, but are there any good ones that can be processed in JavaScript? By "template" I mean a document that accepts a data object as input, inserts the data into some kind of serialized markup...
TITLE: What good template language is supported in JavaScript? QUESTION: Templates are a pretty healthy business in established programming languages, but are there any good ones that can be processed in JavaScript? By "template" I mean a document that accepts a data object as input, inserts the data into some kind of...
[ "javascript", "templates" ]
19
10
4,303
16
0
2008-09-24T18:33:11.517000
2010-04-21T23:56:00.890000
128,954
128,967
Accessing created DOM elements
I have code to create another "row" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements. Example: I have input element (name_1 below). Then I create another input element (name_2 below), by using the javascript's creat...
You have to create the element AND add it to the DOM using functions such as appendChild. See here for details. My guess is that you called createElement() but never added it to your DOM hierarchy.
Accessing created DOM elements I have code to create another "row" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements. Example: I have input element (name_1 below). Then I create another input element (name_2 below), ...
TITLE: Accessing created DOM elements QUESTION: I have code to create another "row" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements. Example: I have input element (name_1 below). Then I create another input elemen...
[ "javascript", "jquery", "html", "dom" ]
2
2
5,016
5
0
2008-09-24T18:34:09.610000
2008-09-24T18:36:21.710000
128,965
129,410
Is there something wrong with joins that don't use the JOIN keyword in SQL or MySQL?
When I started writing database queries I didn't know the JOIN keyword yet and naturally I just extended what I already knew and wrote queries like this: SELECT a.someRow, b.someRow FROM tableA AS a, tableB AS b WHERE a.ID=b.ID AND b.ID= $someVar Now that I know that this is the same as an INNER JOIN I find all these q...
Filtering joins solely using WHERE can be extremely inefficient in some common scenarios. For example: SELECT * FROM people p, companies c WHERE p.companyID = c.id AND p.firstName = 'Daniel' Most databases will execute this query quite literally, first taking the Cartesian product of the people and companies tables and...
Is there something wrong with joins that don't use the JOIN keyword in SQL or MySQL? When I started writing database queries I didn't know the JOIN keyword yet and naturally I just extended what I already knew and wrote queries like this: SELECT a.someRow, b.someRow FROM tableA AS a, tableB AS b WHERE a.ID=b.ID AND b.I...
TITLE: Is there something wrong with joins that don't use the JOIN keyword in SQL or MySQL? QUESTION: When I started writing database queries I didn't know the JOIN keyword yet and naturally I just extended what I already knew and wrote queries like this: SELECT a.someRow, b.someRow FROM tableA AS a, tableB AS b WHERE...
[ "sql", "mysql", "join" ]
46
41
18,722
11
0
2008-09-24T18:36:12.320000
2008-09-24T19:43:40.067000
128,990
129,003
Absolute URL from base + relative URL in C#
I have a base URL: http://my.server.com/folder/directory/sample And a relative one:../../other/path How to get the absolute URL from this? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the Uri class or something similar. It's for a standard a C# app, not an ASP...
var baseUri = new Uri("http://my.server.com/folder/directory/sample"); var absoluteUri = new Uri(baseUri,"../../other/path"); OR Uri uri; if ( Uri.TryCreate("http://base/","../relative", out uri) ) doSomething(uri);
Absolute URL from base + relative URL in C# I have a base URL: http://my.server.com/folder/directory/sample And a relative one:../../other/path How to get the absolute URL from this? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the Uri class or something simil...
TITLE: Absolute URL from base + relative URL in C# QUESTION: I have a base URL: http://my.server.com/folder/directory/sample And a relative one:../../other/path How to get the absolute URL from this? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the Uri class ...
[ "c#", ".net", "url", "path" ]
28
50
17,836
2
0
2008-09-24T18:39:51.283000
2008-09-24T18:41:13.337000
128,998
129,102
Visual studio relative reference path
I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here I set in my project the reference path for all the needed folder, but if a developper checkout ...
I'm not sure which Visual Studio language you use, but if it's C++, then then file paths are stored in the.vcproj project file which should also be under version control. (NOTE: the.sln solution file does NOT store path settings) If you are careful to use relative, rather than absolute paths, it should be easily sharab...
Visual studio relative reference path I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here I set in my project the reference path for all the needed...
TITLE: Visual studio relative reference path QUESTION: I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here I set in my project the reference path ...
[ "visual-studio" ]
6
3
12,282
2
0
2008-09-24T18:40:41.030000
2008-09-24T18:55:09.233000
129,019
129,025
Does System.Windows.Forms have a non-static messagebox?
I would like something that I can use as follows var msg = new NonStaticMessageBox(); if(msg.Show("MyMessage", "MyCaption", MessageBoxButtons.OkCancel) == DialogResult.Ok) {....} But specifically non-static (I need to pass a reference to it around) does anyone know if/where such an object exists?
Such an object does not exist in the.net framework. You'll need to roll your own.
Does System.Windows.Forms have a non-static messagebox? I would like something that I can use as follows var msg = new NonStaticMessageBox(); if(msg.Show("MyMessage", "MyCaption", MessageBoxButtons.OkCancel) == DialogResult.Ok) {....} But specifically non-static (I need to pass a reference to it around) does anyone kno...
TITLE: Does System.Windows.Forms have a non-static messagebox? QUESTION: I would like something that I can use as follows var msg = new NonStaticMessageBox(); if(msg.Show("MyMessage", "MyCaption", MessageBoxButtons.OkCancel) == DialogResult.Ok) {....} But specifically non-static (I need to pass a reference to it aroun...
[ ".net", "winforms" ]
1
2
496
6
0
2008-09-24T18:43:13.787000
2008-09-24T18:45:03.407000
129,023
131,354
.NET Integer vs Int16?
I have a questionable coding practice. When I need to iterate through a small list of items whose count limit is under 32000, I use Int16 for my i variable type instead of Integer. I do this because I assume using the Int16 is more efficient than a full blown Integer. Am I wrong? Is there no effective performance diffe...
According to the below reference, the runtime optimizes performance of Int32 and recommends them for counters and other frequently accessed operations. From the book: MCTS Self-Paced Training Kit (Exam 70-536): Microsoft®.NET Framework 2.0—Application Development Foundation Chapter 1: "Framework Fundamentals" Lesson 1:...
.NET Integer vs Int16? I have a questionable coding practice. When I need to iterate through a small list of items whose count limit is under 32000, I use Int16 for my i variable type instead of Integer. I do this because I assume using the Int16 is more efficient than a full blown Integer. Am I wrong? Is there no effe...
TITLE: .NET Integer vs Int16? QUESTION: I have a questionable coding practice. When I need to iterate through a small list of items whose count limit is under 32000, I use Int16 for my i variable type instead of Integer. I do this because I assume using the Int16 is more efficient than a full blown Integer. Am I wrong...
[ "c#", ".net", "vb.net", "variables", "types" ]
53
55
25,845
10
0
2008-09-24T18:44:51.393000
2008-09-25T03:36:40.383000
129,034
129,084
looking for Java GUI components / ideas for syntax highlighting
I'm not committed to any particular GUI tookit or anything - just needs to be Java based. I want to do simple syntax highlighting ( XML and XQuery ) inside editable text areas. My only candidate so far is Swing's JTextPane, as it supports seems to support the styling of text, but I have no idea how to implement it in t...
JSyntaxPane handles XML and can be extended http://code.google.com/p/jsyntaxpane/wiki/Using Or, it should be possible to extract the NetBeans editor, but that would probably be more work... [edit] btw, I got the XML info from here... it doesn't seem to mention it on the google code pages...
looking for Java GUI components / ideas for syntax highlighting I'm not committed to any particular GUI tookit or anything - just needs to be Java based. I want to do simple syntax highlighting ( XML and XQuery ) inside editable text areas. My only candidate so far is Swing's JTextPane, as it supports seems to support ...
TITLE: looking for Java GUI components / ideas for syntax highlighting QUESTION: I'm not committed to any particular GUI tookit or anything - just needs to be Java based. I want to do simple syntax highlighting ( XML and XQuery ) inside editable text areas. My only candidate so far is Swing's JTextPane, as it supports...
[ "java", "xml", "user-interface", "syntax-highlighting", "xquery" ]
5
4
1,827
3
0
2008-09-24T18:46:43.480000
2008-09-24T18:52:27.897000
129,036
129,204
Unit testing code with a file system dependency
I am writing a component that, given a ZIP file, needs to: Unzip the file. Find a specific dll among the unzipped files. Load that dll through reflection and invoke a method on it. I'd like to unit test this component. I'm tempted to write code that deals directly with the file system: void DoIt() { Zip.Unzip(theZipFil...
There's really nothing wrong with this, it's just a question of whether you call it a unit test or an integration test. You just have to make sure that if you do interact with the file system, there are no unintended side effects. Specifically, make sure that you clean up after youself -- delete any temporary files you...
Unit testing code with a file system dependency I am writing a component that, given a ZIP file, needs to: Unzip the file. Find a specific dll among the unzipped files. Load that dll through reflection and invoke a method on it. I'd like to unit test this component. I'm tempted to write code that deals directly with th...
TITLE: Unit testing code with a file system dependency QUESTION: I am writing a component that, given a ZIP file, needs to: Unzip the file. Find a specific dll among the unzipped files. Load that dll through reflection and invoke a method on it. I'd like to unit test this component. I'm tempted to write code that deal...
[ "unit-testing", "dependency-injection", "dependencies" ]
161
56
61,388
11
0
2008-09-24T18:46:56.943000
2008-09-24T19:09:31.710000
129,043
129,132
Can I specify redirects and pipes in variables?
I have a bash script that creates a Subversion patch file for the current directory. I want to modify it to zip the produced file, if -z is given as an argument to the script. Here's the relevant part: zipped='' zipcommand='>' if [ "$1" = "-z" ] then zipped='zipped ' filename="${filename}.zip" zipcommand='| zip >' fi ...
I would do something like this (use bash -c or eval): zipped='' zipcommand='>' if [ "$1" = "-z" ] then zipped='zipped ' filename="${filename}.zip" zipcommand='| zip -@' fi echo "Creating ${zipped}patch file $filename..." eval "svn diff $zipcommand $filename" # this also works: # bash -c "svn diff $zipcommand $filena...
Can I specify redirects and pipes in variables? I have a bash script that creates a Subversion patch file for the current directory. I want to modify it to zip the produced file, if -z is given as an argument to the script. Here's the relevant part: zipped='' zipcommand='>' if [ "$1" = "-z" ] then zipped='zipped ' fil...
TITLE: Can I specify redirects and pipes in variables? QUESTION: I have a bash script that creates a Subversion patch file for the current directory. I want to modify it to zip the produced file, if -z is given as an argument to the script. Here's the relevant part: zipped='' zipcommand='>' if [ "$1" = "-z" ] then zi...
[ "bash" ]
4
5
1,203
4
0
2008-09-24T18:47:47.050000
2008-09-24T18:59:16.960000
129,046
3,526,027
Disable and later enable all table indexes in Oracle
How would I disable and later enable all indexes in a given schema/database in Oracle? Note: This is to make sqlldr run faster.
Here's making the indexes unusable without the file: DECLARE CURSOR usr_idxs IS select * from user_indexes; cur_idx usr_idxs% ROWTYPE; v_sql VARCHAR2(1024); BEGIN OPEN usr_idxs; LOOP FETCH usr_idxs INTO cur_idx; EXIT WHEN NOT usr_idxs%FOUND; v_sql:= 'ALTER INDEX ' || cur_idx.index_name || ' UNUSABLE'; EXECUTE IMMEDIA...
Disable and later enable all table indexes in Oracle How would I disable and later enable all indexes in a given schema/database in Oracle? Note: This is to make sqlldr run faster.
TITLE: Disable and later enable all table indexes in Oracle QUESTION: How would I disable and later enable all indexes in a given schema/database in Oracle? Note: This is to make sqlldr run faster. ANSWER: Here's making the indexes unusable without the file: DECLARE CURSOR usr_idxs IS select * from user_indexes; cur_...
[ "sql", "oracle", "sql-loader" ]
21
20
142,908
8
0
2008-09-24T18:48:01.777000
2010-08-19T20:40:36.493000
129,052
129,653
Find Processor Type from compact .net 1.0
My application is targeted for Compact.Net 1.0 framework. The application has to check and download any updates available from a web-site. I am thinking of providing the updates as CAB files. Since the CAB files are processor type specific, I want to download the CAB file based on the Processor Type. What is the API fo...
There's nothing available directly from within the managed libraries. You'll need to use P/Invoke to call into the native Coredll.dll and use a method called GetSystemInfo. pinvoke.net is an excellent resource for using P/Invokes for both mobile and desktop development. The pertinent entry for you is: http://www.pinvok...
Find Processor Type from compact .net 1.0 My application is targeted for Compact.Net 1.0 framework. The application has to check and download any updates available from a web-site. I am thinking of providing the updates as CAB files. Since the CAB files are processor type specific, I want to download the CAB file based...
TITLE: Find Processor Type from compact .net 1.0 QUESTION: My application is targeted for Compact.Net 1.0 framework. The application has to check and download any updates available from a web-site. I am thinking of providing the updates as CAB files. Since the CAB files are processor type specific, I want to download ...
[ "c#", "windows-mobile", "compact-framework" ]
0
2
735
1
0
2008-09-24T18:48:42.260000
2008-09-24T20:18:10.110000
129,071
132,797
A reliable HTTP library for .Net 2.0
.Net's implementation of HTTP is... problematic. Beyond some issues in compliance with HTTP/1.0, what's bugging me right now is that HttpWebResponse.GetResponse() with ReadTimeout and Timeout set to 5000 blocks for about 20 seconds before failing (the problem is it should fail after 5 seconds, but it actually takes 20 ...
According to Microsoft, what could be hanging is possibly the DNS resolution, which may take up to 15 seconds. Solution - do the DNS resolving on your own (Dns.BeginGetHostByName).
A reliable HTTP library for .Net 2.0 .Net's implementation of HTTP is... problematic. Beyond some issues in compliance with HTTP/1.0, what's bugging me right now is that HttpWebResponse.GetResponse() with ReadTimeout and Timeout set to 5000 blocks for about 20 seconds before failing (the problem is it should fail after...
TITLE: A reliable HTTP library for .Net 2.0 QUESTION: .Net's implementation of HTTP is... problematic. Beyond some issues in compliance with HTTP/1.0, what's bugging me right now is that HttpWebResponse.GetResponse() with ReadTimeout and Timeout set to 5000 blocks for about 20 seconds before failing (the problem is it...
[ ".net", "http", "timeout" ]
5
2
526
3
0
2008-09-24T18:51:12.470000
2008-09-25T11:49:14.927000
129,072
129,109
Is it possible to compile a Rails app to a Java VM JAR file?
Essentially the only thing I can deploy to my deployment machine is a JAR file. I can't install JRuby, nor can I install Glassfish or Tomcat. Is it possible to package up a Rails application (including Rails, vendored, of course) to a JAR file such that I can do c:\my_server> java rails_app.jar and have it run WEBRick ...
I'd recommend that you checkout Jetty. The process for Embedding Jetty is surprisingly easy, and it should be possible to give it your servlets from your current jar file. I haven't used Ruby/Rails, though, so I'm not sure if there are any complications there. Is it normally possible to embed all of your rails template...
Is it possible to compile a Rails app to a Java VM JAR file? Essentially the only thing I can deploy to my deployment machine is a JAR file. I can't install JRuby, nor can I install Glassfish or Tomcat. Is it possible to package up a Rails application (including Rails, vendored, of course) to a JAR file such that I can...
TITLE: Is it possible to compile a Rails app to a Java VM JAR file? QUESTION: Essentially the only thing I can deploy to my deployment machine is a JAR file. I can't install JRuby, nor can I install Glassfish or Tomcat. Is it possible to package up a Rails application (including Rails, vendored, of course) to a JAR fi...
[ "java", "ruby-on-rails", "ruby", "jruby" ]
12
6
2,890
6
0
2008-09-24T18:51:12.893000
2008-09-24T18:56:10.400000
129,073
4,750,629
What is the best pattern/solution to implement 'workflow (a process) for product development'?
Present: The product development is done in Visual Studio at the moment using.Net technologies, so it's important to stay in the same set of tools. Roles apart from developers are using spreadsheets, docs and diagramming tools, photoshop to do their work. Future: We want to build a workflow (a sequential process with r...
I think there is a market for this product as I could not find anything close. There are disparate tools and products but no unified IDE like experience available and needs to be built on our own. VS Isolated Shell 2010 is the starting point and platform on which this can be built. Needs several man months and may be y...
What is the best pattern/solution to implement 'workflow (a process) for product development'? Present: The product development is done in Visual Studio at the moment using.Net technologies, so it's important to stay in the same set of tools. Roles apart from developers are using spreadsheets, docs and diagramming tool...
TITLE: What is the best pattern/solution to implement 'workflow (a process) for product development'? QUESTION: Present: The product development is done in Visual Studio at the moment using.Net technologies, so it's important to stay in the same set of tools. Roles apart from developers are using spreadsheets, docs an...
[ "visual-studio", "vsx", "extensibility", "devtools" ]
1
0
357
2
0
2008-09-24T18:51:15.560000
2011-01-20T17:48:00.120000
129,077
129,152
NULL values inside NOT IN clause
This issue came up when I got different records counts for what I thought were identical queries one using a not in where constraint and the other a left join. The table in the not in constraint had one null value (bad data) which caused that query to return a count of 0 records. I sort of understand why but I could us...
Query A is the same as: select 'true' where 3 = 1 or 3 = 2 or 3 = 3 or 3 = null Since 3 = 3 is true, you get a result. Query B is the same as: select 'true' where 3 <> 1 and 3 <> 2 and 3 <> null When ansi_nulls is on, 3 <> null is UNKNOWN, so the predicate evaluates to UNKNOWN, and you don't get any rows. When ansi_nul...
NULL values inside NOT IN clause This issue came up when I got different records counts for what I thought were identical queries one using a not in where constraint and the other a left join. The table in the not in constraint had one null value (bad data) which caused that query to return a count of 0 records. I sort...
TITLE: NULL values inside NOT IN clause QUESTION: This issue came up when I got different records counts for what I thought were identical queries one using a not in where constraint and the other a left join. The table in the not in constraint had one null value (bad data) which caused that query to return a count of...
[ "sql", "sql-server", "t-sql", "null", "notin" ]
323
341
349,352
12
0
2008-09-24T18:51:32.237000
2008-09-24T19:01:50.323000
129,086
130,150
Sql Server 2000 - How can I find out what stored procedures are running currently?
I'd like to know what stored procedures are currently running to diagnose some performance problems. How can I find that out?
Very useful script for analyzing locks and deadlocks: http://www.sommarskog.se/sqlutil/aba_lockinfo.html It shows procedure or trigger and current statement.
Sql Server 2000 - How can I find out what stored procedures are running currently? I'd like to know what stored procedures are currently running to diagnose some performance problems. How can I find that out?
TITLE: Sql Server 2000 - How can I find out what stored procedures are running currently? QUESTION: I'd like to know what stored procedures are currently running to diagnose some performance problems. How can I find that out? ANSWER: Very useful script for analyzing locks and deadlocks: http://www.sommarskog.se/sqlut...
[ "sql-server" ]
6
4
17,853
5
0
2008-09-24T18:52:46.570000
2008-09-24T21:41:32.203000
129,088
129,385
What is the meaning of Powershell's Copy-Item's -container argument?
I am writing a script for MS PowerShell. This script uses the Copy-Item command. One of the optional arguments to this command is " -container ". The documentation for the argument states that specifying this argument "Preserves container objects during the copy operation." This is all well and good, for I would be the...
The container the documentation is talking about is the folder structure. If you are doing a recursive copy and want to preserve the folder structure, you would use the -container switch. (Note: by default the -container switch is set to true, so you really would not need to specify it. If you wanted to turn it off you...
What is the meaning of Powershell's Copy-Item's -container argument? I am writing a script for MS PowerShell. This script uses the Copy-Item command. One of the optional arguments to this command is " -container ". The documentation for the argument states that specifying this argument "Preserves container objects duri...
TITLE: What is the meaning of Powershell's Copy-Item's -container argument? QUESTION: I am writing a script for MS PowerShell. This script uses the Copy-Item command. One of the optional arguments to this command is " -container ". The documentation for the argument states that specifying this argument "Preserves cont...
[ "powershell", "copy-item" ]
47
37
29,666
2
0
2008-09-24T18:53:15.710000
2008-09-24T19:38:18.163000
129,094
130,064
Find OS type from .Net CF 1.0
What is the API for getting the OS type? Windows CE or Windows mobile? Environment.OSVersion just gives the CE version. It does not provide information if 'Windows Mobile' is installed on the device.
See these blog articles on Platform detection: Platform Detection I Platform Detection II
Find OS type from .Net CF 1.0 What is the API for getting the OS type? Windows CE or Windows mobile? Environment.OSVersion just gives the CE version. It does not provide information if 'Windows Mobile' is installed on the device.
TITLE: Find OS type from .Net CF 1.0 QUESTION: What is the API for getting the OS type? Windows CE or Windows mobile? Environment.OSVersion just gives the CE version. It does not provide information if 'Windows Mobile' is installed on the device. ANSWER: See these blog articles on Platform detection: Platform Detecti...
[ "c#", "windows-mobile", "compact-framework" ]
1
1
656
1
0
2008-09-24T18:53:55.693000
2008-09-24T21:22:45.603000
129,120
129,429
When should I use Debug.Assert()?
I've been a professional software engineer for about a year now, having graduated with a CS degree. I've known about assertions for a while in C++ and C, but had no idea they existed in C# and.NET at all until recently. Our production code contains no asserts whatsoever and my question is this... Should I begin using A...
In Debugging Microsoft.NET 2.0 Applications John Robbins has a big section on assertions. His main points are: Assert liberally. You can never have too many assertions. Assertions don't replace exceptions. Exceptions cover the things your code demands; assertions cover the things it assumes. A well-written assertion ca...
When should I use Debug.Assert()? I've been a professional software engineer for about a year now, having graduated with a CS degree. I've known about assertions for a while in C++ and C, but had no idea they existed in C# and.NET at all until recently. Our production code contains no asserts whatsoever and my question...
TITLE: When should I use Debug.Assert()? QUESTION: I've been a professional software engineer for about a year now, having graduated with a CS degree. I've known about assertions for a while in C++ and C, but had no idea they existed in C# and.NET at all until recently. Our production code contains no asserts whatsoev...
[ "testing", "exception", "language-agnostic", "assertion", "defensive-programming" ]
266
274
76,560
20
0
2008-09-24T18:57:38.493000
2008-09-24T19:47:21.260000
129,133
129,818
How do I view the SQL that is generated by nHibernate?
How do I view the SQL that is generated by nHibernate? version 1.2
You can put something like this in your app.config/web.config file: in the configSections node: in the configuration node: And don't forget to call log4net.Config.XmlConfigurator.Configure(); at the startup of your application, or to put [assembly: log4net.Config.XmlConfigurator(Watch=true)] in the assemblyinfo.cs In t...
How do I view the SQL that is generated by nHibernate? How do I view the SQL that is generated by nHibernate? version 1.2
TITLE: How do I view the SQL that is generated by nHibernate? QUESTION: How do I view the SQL that is generated by nHibernate? version 1.2 ANSWER: You can put something like this in your app.config/web.config file: in the configSections node: in the configuration node: And don't forget to call log4net.Config.XmlConfi...
[ "nhibernate" ]
43
44
43,372
10
0
2008-09-24T18:59:17.553000
2008-09-24T20:38:28.580000