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
21,560
21,967
How to enable multisampling for a wxWidgets OpenGL program?
Multisampling is a way of applying full screen anti-aliasing (FSAA) in 3D applications. I need to use multisampling in my OpenGL program, which is currently embedded in a wxWidgets GUI. Is there a way to do this? Please respond only if you know the detailed steps to achieve this. I'm aware of enabling multisampling usi...
I finally got Multisampling working with my wxWidgets OpenGL program. It's a bit messy right now, but here's how: wxWidgets doesn't have Multisampling support in their stable releases right now (latest version at this time is 2.8.8 ). But, it's available as a patch and also through their daily snapshot. (The latter is ...
How to enable multisampling for a wxWidgets OpenGL program? Multisampling is a way of applying full screen anti-aliasing (FSAA) in 3D applications. I need to use multisampling in my OpenGL program, which is currently embedded in a wxWidgets GUI. Is there a way to do this? Please respond only if you know the detailed st...
TITLE: How to enable multisampling for a wxWidgets OpenGL program? QUESTION: Multisampling is a way of applying full screen anti-aliasing (FSAA) in 3D applications. I need to use multisampling in my OpenGL program, which is currently embedded in a wxWidgets GUI. Is there a way to do this? Please respond only if you kn...
[ "opengl", "wxwidgets", "multisampling" ]
3
4
3,804
1
0
2008-08-22T01:16:26.817000
2008-08-22T09:13:56.527000
21,564
21,620
Is there a Unix utility to prepend timestamps to stdin?
I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like: cat somefile.txt | prepend-timestamp (Before you answer sed, I trie...
Could try using awk: | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }' You may need to make sure that produces line buffered output, i.e. it flushes its output stream after each line; the timestamp awk adds will be the time that the end of the line appeared on its input pipe. If awk shows errors, then try ...
Is there a Unix utility to prepend timestamps to stdin? I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like: cat somefil...
TITLE: Is there a Unix utility to prepend timestamps to stdin? QUESTION: I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something...
[ "unix", "shell", "awk" ]
186
195
78,927
19
0
2008-08-22T01:24:34.817000
2008-08-22T01:53:25.837000
21,574
21,621
What is the difference between Ruby 1.8 and Ruby 1.9
I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?
Sam Ruby has a cool slideshow that outline the differences. In the interest of bringing this information inline for easier reference, and in case the link goes dead in the abstract future, here's an overview of Sam's slides. The slideshow is less overwhelming to review, but having it all laid out in a list like this is...
What is the difference between Ruby 1.8 and Ruby 1.9 I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?
TITLE: What is the difference between Ruby 1.8 and Ruby 1.9 QUESTION: I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different? ANSWER: Sam Ruby has a cool slideshow that outline...
[ "ruby", "ruby-1.9", "ruby-1.8" ]
103
169
42,465
4
0
2008-08-22T01:32:54.937000
2008-08-22T01:53:44.310000
21,583
21,603
Unit-Testing Databases
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be: stateless independent from each other repeatable with the same results i.e. no persisting cha...
There's no real way to unit test a database other than asserting that the tables exist, contain the expected columns, and have the appropriate constraints. But that's usually not really worth doing. You don't typically unit test the database. You usually involve the database in integration tests. You typically use your...
Unit-Testing Databases This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be: stateless independent from each other repeatable with the same results...
TITLE: Unit-Testing Databases QUESTION: This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be: stateless independent from each other repeatable wit...
[ "database", "unit-testing", "transactions", "xtunit" ]
32
26
8,495
9
0
2008-08-22T01:35:33.773000
2008-08-22T01:43:32.523000
21,589
66,513
Is it possible to share a transaction between a .Net application and a COM+ object?
I did some tests a while ago and never figured out how to make this work. The ingredients: COM+ transactional object (developed in VB6).Net web application (with transaction) in IIS that... makes a call to the COM+ component updates a row in a SQL database Testing: Run the.Net application and force an exception. Result...
Because VB and.NET will use different SQL connections (and there is no way to make ADO and ADO.NET share the same connection), your only possibility is to enlist the DTC (Distributed Transaction Coordinator). The DTC will coordinates the two independent transactions so they commit or are rolled-back together. From.NET,...
Is it possible to share a transaction between a .Net application and a COM+ object? I did some tests a while ago and never figured out how to make this work. The ingredients: COM+ transactional object (developed in VB6).Net web application (with transaction) in IIS that... makes a call to the COM+ component updates a r...
TITLE: Is it possible to share a transaction between a .Net application and a COM+ object? QUESTION: I did some tests a while ago and never figured out how to make this work. The ingredients: COM+ transactional object (developed in VB6).Net web application (with transaction) in IIS that... makes a call to the COM+ com...
[ ".net", "database", "transactions", "com+" ]
4
2
1,462
2
0
2008-08-22T01:39:05.920000
2008-09-15T20:17:25.580000
21,635
21,726
Pushing out MSI files
I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We have already standardized on InstallAnywher...
If your clients are using SMS then you're in the clear... SMS supports EXE. You enter a command line when creating 'Programs' and clients are probably already calling msiexec to launch the MSI. Also I'm pretty sure SMS predates the MSI file format:) However if they're using Active Directory / Group Policy Objects.. the...
Pushing out MSI files I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We have already standard...
TITLE: Pushing out MSI files QUESTION: I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We hav...
[ "deployment", "installation", "windows-installer" ]
3
4
1,084
3
0
2008-08-22T02:13:38.363000
2008-08-22T03:32:01.077000
21,640
22,361
.NET - Get protocol, host, and port
Is there a simple way in.NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL: http://www.mywebsite.com:80/pages/page1.aspx I need to return: http://www.mywebsite.com:80 I know I can use Request.Url.AbsoluteUri to get the complete URL, and I know I can use Request.Url.Author...
The following (C#) code should do the trick Uri uri = new Uri("http://www.mywebsite.com:80/pages/page1.aspx"); string requested = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;
.NET - Get protocol, host, and port Is there a simple way in.NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL: http://www.mywebsite.com:80/pages/page1.aspx I need to return: http://www.mywebsite.com:80 I know I can use Request.Url.AbsoluteUri to get the complete URL, and...
TITLE: .NET - Get protocol, host, and port QUESTION: Is there a simple way in.NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL: http://www.mywebsite.com:80/pages/page1.aspx I need to return: http://www.mywebsite.com:80 I know I can use Request.Url.AbsoluteUri to get the...
[ ".net", "asp.net", "url", "uri", "authority" ]
281
191
200,299
11
0
2008-08-22T02:18:28.307000
2008-08-22T13:35:39.863000
21,647
21,656
Reading from text file until EOF repeats last line
The following C++ code uses a ifstream object to read integers from a text file (which has one number per line) until it hits EOF. Why does it read the integer on the last line twice? How to fix this? Code: #include #include using namespace std; int main() { ifstream iFile("input.txt"); // input.txt has integers, one ...
Just follow closely the chain of events. Grab 10 Grab 20 Grab 30 Grab EOF Look at the second-to-last iteration. You grabbed 30, then carried on to check for EOF. You haven't reached EOF because the EOF mark hasn't been read yet ("binarically" speaking, its conceptual location is just after the 30 line). Therefore you c...
Reading from text file until EOF repeats last line The following C++ code uses a ifstream object to read integers from a text file (which has one number per line) until it hits EOF. Why does it read the integer on the last line twice? How to fix this? Code: #include #include using namespace std; int main() { ifstream ...
TITLE: Reading from text file until EOF repeats last line QUESTION: The following C++ code uses a ifstream object to read integers from a text file (which has one number per line) until it hits EOF. Why does it read the integer on the last line twice? How to fix this? Code: #include #include using namespace std; int ...
[ "c++", "iostream", "fstream" ]
132
135
376,118
7
0
2008-08-22T02:21:07.440000
2008-08-22T02:50:56.403000
21,651
24,919
Adobe AIR: Handling JSON objects from server
I have a script that retrieves objects from a remote server through an Ajax call. The server returns objects in JSON notation.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
You can find a JSON parser written in JavaScript here ( source code here ). You can also use the as3corelib JSON parser from JavaScript, there's a description of how to access ActionScript libraries from JavaScript here.
Adobe AIR: Handling JSON objects from server I have a script that retrieves objects from a remote server through an Ajax call. The server returns objects in JSON notation.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
TITLE: Adobe AIR: Handling JSON objects from server QUESTION: I have a script that retrieves objects from a remote server through an Ajax call. The server returns objects in JSON notation.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
[ "javascript", "ajax", "json", "air" ]
8
7
4,988
5
0
2008-08-22T02:26:26.117000
2008-08-24T08:11:29.673000
21,652
138,532
Do you write exceptions for specific issues or general exceptions?
I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException { /*... logic that could throw a MailException */ } MailException could be thrown for a number of reasons, problems with th...
I usually start with a general exception and subclass it as needed. I always can catch the general exception (and with it all subclassed exceptions) if needed, but also the specific. An example from the Java-API is IOException, that has subclasses like FileNotFoundException or EOFException (and much more). This way you...
Do you write exceptions for specific issues or general exceptions? I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException { /*... logic that could throw a MailException */ } Mail...
TITLE: Do you write exceptions for specific issues or general exceptions? QUESTION: I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException { /*... logic that could throw a MailE...
[ "c#", "java", "exception" ]
10
8
1,378
11
0
2008-08-22T02:47:44.333000
2008-09-26T09:55:04.287000
21,669
21,702
Complexity of Regex substitution
I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution? Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).
From a purely theoretical stance: The implementation I am familiar with would be to build a Deterministic Finite Automaton to recognize the regex. This is done in O(2^m), m being the size of the regex, using a standard algorithm. Once this is built, running a string through it is linear in the length of the string - O(...
Complexity of Regex substitution I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution? Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).
TITLE: Complexity of Regex substitution QUESTION: I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution? Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed). ANSWER: From a purely theoretical stance: The im...
[ "regex", "complexity-theory" ]
14
15
9,424
8
0
2008-08-22T03:02:34.550000
2008-08-22T03:15:13.690000
21,697
22,043
How Do You Communicate Service Layer Messages/Errors to Higher Layers Using MVP?
I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns. So with MVP, the Presenter handles events raised by the View. Here's some code that I have in place to deal with the creation of users: ...
That sounds just right to me. Exceptions are preferable as they can be thrown up to the top of the service layer from anywhere inside the service layer, no matter how deeply nested inside the service method implementation it is. This keeps the service code clean as you know the calling presenter will always get notific...
How Do You Communicate Service Layer Messages/Errors to Higher Layers Using MVP? I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns. So with MVP, the Presenter handles events raised by the...
TITLE: How Do You Communicate Service Layer Messages/Errors to Higher Layers Using MVP? QUESTION: I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns. So with MVP, the Presenter handles ev...
[ "c#", "asp.net", "exception", "mvp", "n-tier-architecture" ]
18
16
6,021
3
0
2008-08-22T03:12:59.517000
2008-08-22T10:33:43.903000
21,715
21,786
List<BusinessObject> or BusinessObjectCollection?
Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable IE: public class CollectionBase: IEnumerable and then would derive their Business Object collections from that. public class BusinessObjectCollection: CollectionBase Now with the g...
I am generally in the camp of just using a List directly, unless for some reason I need to encapsulate the data structure and provide a limited subset of its functionality. This is mainly because if I don't have a specific need for encapsulation then doing it is just a waste of time. However, with the aggregate initial...
List<BusinessObject> or BusinessObjectCollection? Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable IE: public class CollectionBase: IEnumerable and then would derive their Business Object collections from that. public class Busin...
TITLE: List<BusinessObject> or BusinessObjectCollection? QUESTION: Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable IE: public class CollectionBase: IEnumerable and then would derive their Business Object collections from that. ...
[ "c#", ".net", "generics", "collections", "class-design" ]
46
50
4,891
18
0
2008-08-22T03:25:09.487000
2008-08-22T04:46:28.433000
21,725
30,699
Favorite (G)Vim plugins/scripts?
What are your favorite (G)Vim plugins/scripts?
Nerdtree The NERD tree allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also allows you to perform simple filesystem operations. The tree can be toggled easily with:NERDTreeToggle whic...
Favorite (G)Vim plugins/scripts? What are your favorite (G)Vim plugins/scripts?
TITLE: Favorite (G)Vim plugins/scripts? QUESTION: What are your favorite (G)Vim plugins/scripts? ANSWER: Nerdtree The NERD tree allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also ...
[ "vim", "editor" ]
165
97
56,653
38
0
2008-08-22T03:31:48.940000
2008-08-27T17:40:51.730000
21,738
201,513
Problems running Swing application with IDEA 8M1
Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a pop-up that says the usual "This process is no lo...
I have actually experienced problems from using the JDK 6u10 beta myself and had to downgrade to JDK 6u7 for the time being. This solved some of my problems with among other things swing. Also, i have been running IJ8M1 since the 'release' and I am very satisfied with it, especially if you regard the "beta" tag. It fee...
Problems running Swing application with IDEA 8M1 Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a ...
TITLE: Problems running Swing application with IDEA 8M1 QUESTION: Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and W...
[ "java", "swing", "ide", "jvm", "intellij-idea" ]
1
1
394
3
0
2008-08-22T03:43:41.690000
2008-10-14T14:57:36.673000
21,749
21,978
Multiple form Delphi applications and dialogs
I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window. If I open a modal dialog from one of the separate forms, the main form is broug...
I'd use this code... (Basically what Lars said) dialog:= TDialogForm.Create( parentForm ); dialog.PopupParent:= parentForm; dialog.PopupMode:= pmExplicit; dialog.ShowModal();
Multiple form Delphi applications and dialogs I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window. If I open a modal dialog from one...
TITLE: Multiple form Delphi applications and dialogs QUESTION: I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window. If I open a mod...
[ "delphi", "delphi-7" ]
4
5
7,644
5
0
2008-08-22T03:51:42.980000
2008-08-22T09:28:14.480000
21,753
22,073
How to use BITS to download from a UNC path?
What is the best way to distribute files to users in remote offices, using BITS with a UNC path or BITS with HTTP? I have a VB.NET project which currently downloads from a HTTP path, but there is added complexity involved (e.g. having a web server). Or is there a better way to do this? Low bandwith usage is more import...
Maybe consider not using BITS at all and use the old favourite Robocopy. Robocopy is a standalone command-line executable which is part of the Windows Server 2003 ResKit tools and now standard on Vista/2008. Robocopy has the /IPG:ms (Inter-Packet Gap) switch to "dribble" the download, which is designed specifically to ...
How to use BITS to download from a UNC path? What is the best way to distribute files to users in remote offices, using BITS with a UNC path or BITS with HTTP? I have a VB.NET project which currently downloads from a HTTP path, but there is added complexity involved (e.g. having a web server). Or is there a better way ...
TITLE: How to use BITS to download from a UNC path? QUESTION: What is the best way to distribute files to users in remote offices, using BITS with a UNC path or BITS with HTTP? I have a VB.NET project which currently downloads from a HTTP path, but there is added complexity involved (e.g. having a web server). Or is t...
[ "vb.net", "bit" ]
0
1
707
1
0
2008-08-22T03:58:10.530000
2008-08-22T11:11:08.743000
21,766
21,818
Open source rules engine with decent interface for writing rules
I'm trying to locate an open source business rules engine that has a decent interface for building the rules. OR at least one that works well on the.Net platform and has been updated sometime in the past 12 months. Thanks,
NxBRE is one option. http://sourceforge.net/projects/nxbre/#item3rd-5
Open source rules engine with decent interface for writing rules I'm trying to locate an open source business rules engine that has a decent interface for building the rules. OR at least one that works well on the.Net platform and has been updated sometime in the past 12 months. Thanks,
TITLE: Open source rules engine with decent interface for writing rules QUESTION: I'm trying to locate an open source business rules engine that has a decent interface for building the rules. OR at least one that works well on the.Net platform and has been updated sometime in the past 12 months. Thanks, ANSWER: NxBRE...
[ ".net", "rule-engine" ]
12
8
8,563
5
0
2008-08-22T04:20:07.280000
2008-08-22T05:18:12.397000
21,817
22,497
Why can't I declare static methods in an interface?
The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface? public interface ITest { public static String test(); } The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the interface method ITest.test(); only public & abstra...
There are a few issues at play here. The first is the issue of declaring a static method without defining it. This is the difference between public interface Foo { public static int bar(); } and public interface Foo { public static int bar() {... } } The first is impossible for the reasons that Espo mentions: you don't...
Why can't I declare static methods in an interface? The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface? public interface ITest { public static String test(); } The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the...
TITLE: Why can't I declare static methods in an interface? QUESTION: The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface? public interface ITest { public static String test(); } The code above gives me the following error (in Eclipse, at least): "Illega...
[ "java", "interface", "methods", "static" ]
154
86
107,804
14
0
2008-08-22T05:16:43.837000
2008-08-22T14:29:02.467000
21,830
26,398
PostgreSQL: GIN or GiST indexes?
From what information I could find, they both solve the same problems - more esoteric operations like array containment and intersection (&&, @>, <@, etc). However I would be interested in advice about when to use one or the other (or neither possibly). The PostgreSQL documentation has some information about this: GIN ...
First of all, do you need to use them for text search indexing? GIN and GiST are index specialized for some data types. If you need to index simple char or integer values then the normal B-Tree index is the best. Anyway, PostgreSQL documentation has a chapter on GIST and one on GIN, where you can find more info. And, l...
PostgreSQL: GIN or GiST indexes? From what information I could find, they both solve the same problems - more esoteric operations like array containment and intersection (&&, @>, <@, etc). However I would be interested in advice about when to use one or the other (or neither possibly). The PostgreSQL documentation has ...
TITLE: PostgreSQL: GIN or GiST indexes? QUESTION: From what information I could find, they both solve the same problems - more esoteric operations like array containment and intersection (&&, @>, <@, etc). However I would be interested in advice about when to use one or the other (or neither possibly). The PostgreSQL ...
[ "postgresql", "indexing", "gwt-gin", "gist-index" ]
39
18
20,002
1
0
2008-08-22T05:22:39.610000
2008-08-25T17:00:24.947000
21,848
21,932
Switch branch names in git
There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a ...
In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master: git branch -m master crap_work git branch -m previous_master master
Switch branch names in git There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this wor...
TITLE: Switch branch names in git QUESTION: There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Pr...
[ "git", "branch" ]
108
148
48,458
5
0
2008-08-22T05:39:54.843000
2008-08-22T07:33:28.983000
21,870
984,076
System.Web.Caching vs. Enterprise Library Caching Block
For a.NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block. What do you use? Why? System.Web.Caching Is this safe to use outside of web apps? I've seen mixed information, but I think the...
These are the items that I consider for the topic of Caching: MemCached Win32 Velocity.net Cache Enterprise Library Caching Application Block MemCached Win32: Up until recently I have used MemCached Win32. This is a akin to a web farm (many servers serving the same content for high availability) but it is a cache farm....
System.Web.Caching vs. Enterprise Library Caching Block For a.NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block. What do you use? Why? System.Web.Caching Is this safe to use outside o...
TITLE: System.Web.Caching vs. Enterprise Library Caching Block QUESTION: For a.NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block. What do you use? Why? System.Web.Caching Is this saf...
[ "caching", ".net-2.0", "memcached", "enterprise-library" ]
29
18
13,489
4
0
2008-08-22T06:07:29.487000
2009-06-11T22:21:21.470000
21,877
21,887
Dynamically Rendering asp:Image from BLOB entry in ASP.NET
What I want to achieve is this. I want to give the user the ability to upload an image file, store the image in BLOB in SQL Server, and then use this image as a logo in other pages of the site. I have done this by using Response.Clear(); Response.ContentType = "image/pjpeg"; Response.BinaryWrite(imageConents); Response...
Add a 'Generic Handler' to your web project, name it something like Image.ashx. Implement it like this: public class ImageHandler: IHttpHandler { public void ProcessRequest(HttpContext context) { using(Image image = GetImage(context.Request.QueryString["ID"])) { context.Response.ContentType = "image/jpeg"; image.Save(...
Dynamically Rendering asp:Image from BLOB entry in ASP.NET What I want to achieve is this. I want to give the user the ability to upload an image file, store the image in BLOB in SQL Server, and then use this image as a logo in other pages of the site. I have done this by using Response.Clear(); Response.ContentType = ...
TITLE: Dynamically Rendering asp:Image from BLOB entry in ASP.NET QUESTION: What I want to achieve is this. I want to give the user the ability to upload an image file, store the image in BLOB in SQL Server, and then use this image as a logo in other pages of the site. I have done this by using Response.Clear(); Respo...
[ "asp.net" ]
13
18
32,129
6
0
2008-08-22T06:14:06.600000
2008-08-22T06:25:31.317000
21,879
21,962
Where can I find a "Math topic dependency tree" to assist my self-guided refresher on the subject?
I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are here if you're interested in helping out). My biggest stumbling block so far has been math - how can I learn about algorithms and asy...
Here's how my school did it: base: algebra trigonometry analytic geometry track 1 track 2 track 3 calc 1 linear algebra statistics calc 2 discrete math 1 calc 3 (multivariable) discrete math 2 differential equations The base courses were a prerequisite for everything, the tracks were independent and taken in order. So...
Where can I find a "Math topic dependency tree" to assist my self-guided refresher on the subject? I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are here if you're interested in helpi...
TITLE: Where can I find a "Math topic dependency tree" to assist my self-guided refresher on the subject? QUESTION: I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are here if you're i...
[ "math" ]
12
6
5,130
5
0
2008-08-22T06:15:39.717000
2008-08-22T09:07:14.673000
21,912
21,921
IntelliSense for XElement objects with XML schema
Reading an article called "Increase LINQ Query Performance" in July's MSDN magazine, the author states that using an Imports in VB providing a path to schema in the current project will turn IntelliSense on for XElement. In the code provided, he uses statements like xelement.@name to retreive attributes values and so o...
This post claims to have a link to a video that shows how to use VB9's XML Literals in C#. However, it only really discusses them and from what I can gather, you cannot use them in C#. http://blogs.msdn.com/bethmassi/archive/2008/07/03/teched-panel-vb-xml-literals-for-c-developers.aspx
IntelliSense for XElement objects with XML schema Reading an article called "Increase LINQ Query Performance" in July's MSDN magazine, the author states that using an Imports in VB providing a path to schema in the current project will turn IntelliSense on for XElement. In the code provided, he uses statements like xel...
TITLE: IntelliSense for XElement objects with XML schema QUESTION: Reading an article called "Increase LINQ Query Performance" in July's MSDN magazine, the author states that using an Imports in VB providing a path to schema in the current project will turn IntelliSense on for XElement. In the code provided, he uses s...
[ "c#", "linq", "xsd", "linq-to-xml", "vb.net-to-c#" ]
2
4
1,649
1
0
2008-08-22T07:07:17.643000
2008-08-22T07:14:46.360000
21,934
21,964
Why Java and Python garbage collection methods are different?
Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed. But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time. Why does Java choose this strategy and what is the benefit from this? Is this better t...
There are drawbacks of using reference counting. One of the most mentioned is circular references: Suppose A references B, B references C and C references B. If A were to drop its reference to B, both B and C will still have a reference count of 1 and won't be deleted with traditional reference counting. CPython (refer...
Why Java and Python garbage collection methods are different? Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed. But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time. Why does Java choose thi...
TITLE: Why Java and Python garbage collection methods are different? QUESTION: Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed. But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time. Why do...
[ "java", "python", "garbage-collection" ]
66
54
22,254
9
0
2008-08-22T07:35:26.703000
2008-08-22T09:10:06.943000
21,938
21,950
Is it really that bad to catch a general exception?
Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.
Obviously this is one of those questions where the only real answer is "it depends." The main thing it depends on is where your are catching the exception. In general libraries should be more conservative with catching exceptions whereas at the top level of your program (e.g. in your main method or in the top of the ac...
Is it really that bad to catch a general exception? Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.
TITLE: Is it really that bad to catch a general exception? QUESTION: Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please. ANSWER: Obviously this is o...
[ "exception" ]
76
119
65,949
16
0
2008-08-22T07:41:13.223000
2008-08-22T08:53:55.470000
21,956
22,256
How do I compare two arrays of DataRow objects in PowerShell?
I have two arrays of System.Data.DataRow objects which I want to compare. The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted. How do I do this in PowerShell?
I wrote a script to do this a little while back. The script (Compare-QueryResults.ps1) is available here and you will also need my Run-SQLQuery script (available here ) or you can replace that with a script or function of your own. Basically, what the script does is take the results of each of your queries and break th...
How do I compare two arrays of DataRow objects in PowerShell? I have two arrays of System.Data.DataRow objects which I want to compare. The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted. How do I do this in Po...
TITLE: How do I compare two arrays of DataRow objects in PowerShell? QUESTION: I have two arrays of System.Data.DataRow objects which I want to compare. The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted. How ...
[ "arrays", "powershell", "comparison" ]
4
4
5,298
3
0
2008-08-22T09:00:26.250000
2008-08-22T12:53:16.767000
21,965
21,991
Programmatically encrypting a config-file in .NET
Could somebody please do a rundown of how to programmatically encrypt a config-file in.NET, preferably in C#. What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it. This for both settings and connection-strings. Also if anyone coul...
To summarize the answers and what I've found so far, here are some good links to answer this question: Encrypting Configuration Information in ASP.NET 2.0 Applications - 4GuysFromRolla.com How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI - MSDN Please feel free to complement with other links, maybe som...
Programmatically encrypting a config-file in .NET Could somebody please do a rundown of how to programmatically encrypt a config-file in.NET, preferably in C#. What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it. This for both se...
TITLE: Programmatically encrypting a config-file in .NET QUESTION: Could somebody please do a rundown of how to programmatically encrypt a config-file in.NET, preferably in C#. What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it...
[ "c#", ".net", "configuration", "encryption", "configuration-files" ]
19
14
16,999
5
0
2008-08-22T09:12:54.830000
2008-08-22T09:46:35.780000
21,987
23,285
FlashWindowEx FLASHW_STOP still keeps taskbar colored
I am developing an application that controls an Machine. When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashing. There's one little annoyance using the FlashWindowE...
Behaviour is the same when a window finishes flashing for as long as it's supposed to: the taskbar button stays coloured. I don't think this is a bug. If you think about it, when you use FLASHW_STOP, the flashing does in fact stop, but the point of the flashing is to get the user's attention. The button stays coloured ...
FlashWindowEx FLASHW_STOP still keeps taskbar colored I am developing an application that controls an Machine. When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashin...
TITLE: FlashWindowEx FLASHW_STOP still keeps taskbar colored QUESTION: I am developing an application that controls an Machine. When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray s...
[ "c#", "winapi", "pinvoke" ]
7
7
3,864
5
0
2008-08-22T09:42:41.047000
2008-08-22T19:33:47.320000
21,992
22,005
XmlHttpRequest return values
I'm looking for (arguably) the correct way to return data from a XmlHttpRequest. Options I see are: Plain HTML. Let the request format the data and return it in a usable format. Advantage: easy to consume by the calling page. Disadvantage: Very rigid, stuck with a fixed layout. XML. Let the request return XML, format i...
If you're looking for a quick solution that should work with most available frameworks, I'd go for JSON. It's easy to start with and works. If you're trying to build a larger application that you're going to extend (in terms of size or maybe your own API for 3rd party extensions) I'd go for XML. You could write a proxy...
XmlHttpRequest return values I'm looking for (arguably) the correct way to return data from a XmlHttpRequest. Options I see are: Plain HTML. Let the request format the data and return it in a usable format. Advantage: easy to consume by the calling page. Disadvantage: Very rigid, stuck with a fixed layout. XML. Let the...
TITLE: XmlHttpRequest return values QUESTION: I'm looking for (arguably) the correct way to return data from a XmlHttpRequest. Options I see are: Plain HTML. Let the request format the data and return it in a usable format. Advantage: easy to consume by the calling page. Disadvantage: Very rigid, stuck with a fixed la...
[ "javascript", "ajax" ]
3
2
2,004
5
0
2008-08-22T09:47:15.997000
2008-08-22T09:59:15.437000
21,999
22,793
WPF Anti aliasing workaround
Anti aliasing cannot be turned off in WPF. But I want to remove the blurred look of WPF fonts when they are small. One possibility would be to use a.net 2.0 component. This looks like it would lose the transparency capability and Blend support. Never tried it though. Anyone has a solution for this? Any drawbacks from i...
Have you tried putting a WindowsFormsHost control on a WPF window/control? That will allow WPF to render a WinForms control. UPDATE November 2012: This question and answer is 4 years old. Text rendering has since improved in WPF. Please don't put WinForms controls in WPF apps; that was a hackish way to fix font renderi...
WPF Anti aliasing workaround Anti aliasing cannot be turned off in WPF. But I want to remove the blurred look of WPF fonts when they are small. One possibility would be to use a.net 2.0 component. This looks like it would lose the transparency capability and Blend support. Never tried it though. Anyone has a solution f...
TITLE: WPF Anti aliasing workaround QUESTION: Anti aliasing cannot be turned off in WPF. But I want to remove the blurred look of WPF fonts when they are small. One possibility would be to use a.net 2.0 component. This looks like it would lose the transparency capability and Blend support. Never tried it though. Anyon...
[ ".net", "wpf" ]
10
3
13,374
6
0
2008-08-22T09:54:43.793000
2008-08-22T16:28:35.890000
22,000
22,025
Table cells larger than they are meant to be
I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me;) I have made the latest version live so you can see exactly where the ...
I think you need to use display: block on your images. When images are inline there's a little extra space for the line spacing.
Table cells larger than they are meant to be I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me;) I have made the latest v...
TITLE: Table cells larger than they are meant to be QUESTION: I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me;) I have...
[ "html", "css" ]
15
35
9,607
4
0
2008-08-22T09:55:34.057000
2008-08-22T10:14:24.387000
22,011
22,044
Switching to ORMs
I'm toying with the idea of phasing in an ORM into an application I support. The app is not very structured with no unit tests. So any change will be risky. I'm obviously concerned that I've got a good enough reason to change. The idea is that there will be less boiler plate code for data access and there for greater p...
I would strongly recommend getting a copy of Michael Feather's book Working Effectively With Legacy Code (by "Legacy Code" Feathers means any system that isn't adequately covered by unit tests). It is full of good ideas which should help you with your refactoring and phasing in of best practices. Sure, you could phase ...
Switching to ORMs I'm toying with the idea of phasing in an ORM into an application I support. The app is not very structured with no unit tests. So any change will be risky. I'm obviously concerned that I've got a good enough reason to change. The idea is that there will be less boiler plate code for data access and t...
TITLE: Switching to ORMs QUESTION: I'm toying with the idea of phasing in an ORM into an application I support. The app is not very structured with no unit tests. So any change will be risky. I'm obviously concerned that I've got a good enough reason to change. The idea is that there will be less boiler plate code for...
[ "language-agnostic", "orm" ]
2
3
362
7
0
2008-08-22T10:05:44.283000
2008-08-22T10:34:57.677000
22,012
22,026
Loading assemblies and its dependencies
My application dynamically loads assemblies at runtime from specific subfolders. These assemblies are compiled with dependencies to other assemblies. The runtime trys to load these from the application directory. But I want to put them into the modules directory. Is there a way to tell the runtime that the dlls are in ...
One nice approach I've used lately is to add an event handler for the AppDomain's AssemblyResolve event. AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler); Then in the event handler method you can load the assembly that was attempted to be...
Loading assemblies and its dependencies My application dynamically loads assemblies at runtime from specific subfolders. These assemblies are compiled with dependencies to other assemblies. The runtime trys to load these from the application directory. But I want to put them into the modules directory. Is there a way t...
TITLE: Loading assemblies and its dependencies QUESTION: My application dynamically loads assemblies at runtime from specific subfolders. These assemblies are compiled with dependencies to other assemblies. The runtime trys to load these from the application directory. But I want to put them into the modules directory...
[ "c#", ".net" ]
22
19
12,993
3
0
2008-08-22T10:06:48.210000
2008-08-22T10:15:01.203000
22,067
938,672
MS Project Gantt chart control usage in C#
Has anybody used the MS Project Gantt chart control in C#? If yes, can you share some resources regarding this?
You could also check Gantt Chart Library for WPF or Windows Forms, they do not require Microsoft Project installed on the client computer, but provide similar UI for project and related Gantt Charts.
MS Project Gantt chart control usage in C# Has anybody used the MS Project Gantt chart control in C#? If yes, can you share some resources regarding this?
TITLE: MS Project Gantt chart control usage in C# QUESTION: Has anybody used the MS Project Gantt chart control in C#? If yes, can you share some resources regarding this? ANSWER: You could also check Gantt Chart Library for WPF or Windows Forms, they do not require Microsoft Project installed on the client computer,...
[ "c#", ".net-2.0", "controls", "ms-project", "gantt-chart" ]
8
5
28,546
5
0
2008-08-22T11:00:27.067000
2009-06-02T09:34:12.080000
22,084
22,112
Controls versus standard HTML
I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the asp: -style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last night when working with Master Pages: my, w...
Personally, I think the standard ASP.NET controls are fine for inhouse stuff - quick and dirty is good in that scenario. But, I once worked with a web developer who was also a designer and he refused to use the ASP.NET controls and only code in HTML and add runat="server" tags when needed. This was more because he want...
Controls versus standard HTML I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the asp: -style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last night when wo...
TITLE: Controls versus standard HTML QUESTION: I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the asp: -style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one ...
[ "c#", "asp.net", "controls" ]
14
14
4,904
11
0
2008-08-22T11:18:07.510000
2008-08-22T11:34:27.003000
22,106
22,113
Difference between `/dev/ttyS0` and `/dev/ttys0`?
In Linux, what is the difference between /dev/ttyS0 and /dev/ttys0? I know that the first is a serial port, but what about the second, with the small s?
see this For a pseudo terminal pair such as ptyp3 and ttyp3, the pty... is the master or controlling terminal and the tty... is the slave. There are only 16 ttyp's: ttyp0-ttypf (f is a hexadecimal digit). To get more pairs, the 3 letters q, r, s may be used instead of p. For example the pair ttys8, ptys8 is a pseudo te...
Difference between `/dev/ttyS0` and `/dev/ttys0`? In Linux, what is the difference between /dev/ttyS0 and /dev/ttys0? I know that the first is a serial port, but what about the second, with the small s?
TITLE: Difference between `/dev/ttyS0` and `/dev/ttys0`? QUESTION: In Linux, what is the difference between /dev/ttyS0 and /dev/ttys0? I know that the first is a serial port, but what about the second, with the small s? ANSWER: see this For a pseudo terminal pair such as ptyp3 and ttyp3, the pty... is the master or c...
[ "linux", "serial-port" ]
2
1
6,512
3
0
2008-08-22T11:29:57.123000
2008-08-22T11:35:06.423000
22,115
22,133
Using Regex to generate Strings rather than match them
I am writing a Java utility that helps me to generate loads of data for performance testing. It would be really cool to be able to specify a regex for Strings so that my generator spits out things that match this. Is something out there already baked that I can use to do this? Or is there a library that gets me most of...
Firstly, with a complex enough regexp, I believe this can be impossible. But you should be able to put something together for simple regexps. If you take a look at the source code of the class java.util.regex.Pattern, you'll see that it uses an internal representation of Node instances. Each of the different pattern co...
Using Regex to generate Strings rather than match them I am writing a Java utility that helps me to generate loads of data for performance testing. It would be really cool to be able to specify a regex for Strings so that my generator spits out things that match this. Is something out there already baked that I can use...
TITLE: Using Regex to generate Strings rather than match them QUESTION: I am writing a Java utility that helps me to generate loads of data for performance testing. It would be really cool to be able to specify a regex for Strings so that my generator spits out things that match this. Is something out there already ba...
[ "java", "regex" ]
135
57
114,362
12
0
2008-08-22T11:35:41.990000
2008-08-22T11:54:06.270000
22,145
22,170
Calculating a cutting list with the least amount of off cut waste
I am working on a project where I produce an aluminium extrusion cutting list. The aluminium extrusions come in lengths of 5m. I have a list of smaller lengths that need to be cut from the 5m lengths of aluminium extrusions. The smaller lengths need to be cut in the order that produces the least amount of off cut waste...
This is a classic, difficult problem to solve efficiently. The algorithm you describe sounds like a Greedy Algorithm. Take a look at this Wikipedia article for more information: The Cutting Stock Problem
Calculating a cutting list with the least amount of off cut waste I am working on a project where I produce an aluminium extrusion cutting list. The aluminium extrusions come in lengths of 5m. I have a list of smaller lengths that need to be cut from the 5m lengths of aluminium extrusions. The smaller lengths need to b...
TITLE: Calculating a cutting list with the least amount of off cut waste QUESTION: I am working on a project where I produce an aluminium extrusion cutting list. The aluminium extrusions come in lengths of 5m. I have a list of smaller lengths that need to be cut from the 5m lengths of aluminium extrusions. The smaller...
[ "algorithm" ]
22
17
42,684
8
0
2008-08-22T11:58:56.943000
2008-08-22T12:10:17.823000
22,149
522,827
Unicode vs UTF-8 confusion in Python / Django?
I stumbled over this passage in the Django tutorial: Django models have a default str () method that calls unicode () and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a normal string, with characters encoded as UTF-8. Now, I'm confused becaus...
what is a "Unicode string" in Python? Does that mean UCS-2? Unicode strings in Python are stored internally either as UCS-2 (fixed-length 16-bit representation, almost the same as UTF-16) or UCS-4/UTF-32 (fixed-length 32-bit representation). It's a compile-time option; on Windows it's always UTF-16 whilst many Linux di...
Unicode vs UTF-8 confusion in Python / Django? I stumbled over this passage in the Django tutorial: Django models have a default str () method that calls unicode () and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a normal string, with charac...
TITLE: Unicode vs UTF-8 confusion in Python / Django? QUESTION: I stumbled over this passage in the Django tutorial: Django models have a default str () method that calls unicode () and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a normal s...
[ "python", "django", "unicode" ]
34
54
14,394
5
0
2008-08-22T12:01:53.490000
2009-02-07T00:54:09.373000
22,156
22,174
What is the difference between HttpHandler and a Web User Control and when to use each one?
I've been using user controls extensively but never use a HttpHandler and was wondering if I am doing something suboptimal or wrong
Expect a better answer (probably before I finish typing this) but as a quick summary. A user control is something that can be added to a page. A HttpHandler can be used instead of a page.
What is the difference between HttpHandler and a Web User Control and when to use each one? I've been using user controls extensively but never use a HttpHandler and was wondering if I am doing something suboptimal or wrong
TITLE: What is the difference between HttpHandler and a Web User Control and when to use each one? QUESTION: I've been using user controls extensively but never use a HttpHandler and was wondering if I am doing something suboptimal or wrong ANSWER: Expect a better answer (probably before I finish typing this) but as ...
[ "asp.net" ]
1
0
698
5
0
2008-08-22T12:03:36.060000
2008-08-22T12:11:39.333000
22,165
22,220
Transactional Design Pattern
I have a need to create a "transactional" process using an external API that does not support COM+ or.NET transactions (Sharepoint to be exact) What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will have to manually undo all of the previous ste...
If your changes are done to the SharePoint object model, you can use the fact that changes are not committed until you call the Update() method of the modified object, such as SPList.Update() or SPWeb.Update(). Otherwise, I would use the Command Design Pattern. Chapter 6 in Head First Design Patterns even has an exampl...
Transactional Design Pattern I have a need to create a "transactional" process using an external API that does not support COM+ or.NET transactions (Sharepoint to be exact) What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will have to manually...
TITLE: Transactional Design Pattern QUESTION: I have a need to create a "transactional" process using an external API that does not support COM+ or.NET transactions (Sharepoint to be exact) What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I wil...
[ "sharepoint", "design-patterns", "transactions" ]
5
3
2,062
6
0
2008-08-22T12:08:40.650000
2008-08-22T12:40:18.250000
22,181
26,103
ADO.NET Mapping From SQLDataReader to Domain Object?
I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "System.IndexOutOfRangeException" exception and wanted ...
Although connection.GetSchema("Tables") does return meta data about the tables in your database, it won't return everything in your sproc if you define any custom columns. For example, if you throw in some random ad-hoc column like *SELECT ProductName,'Testing' As ProductTestName FROM dbo.Products" you won't see 'Produ...
ADO.NET Mapping From SQLDataReader to Domain Object? I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "S...
TITLE: ADO.NET Mapping From SQLDataReader to Domain Object? QUESTION: I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping a...
[ "ado.net" ]
3
1
7,573
8
0
2008-08-22T12:14:37.563000
2008-08-25T14:25:40.497000
22,187
22,285
Erlang-style Concurrency for Other Languages
What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.
Message Passing Interface (MPI) ( http://www-unix.mcs.anl.gov/mpi/ ) is a highly scalable and robust library for parallel programming, geared original towards C but now available in several flavors http://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations. While the library doesn't introduce new syntax, it...
Erlang-style Concurrency for Other Languages What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queuein...
TITLE: Erlang-style Concurrency for Other Languages QUESTION: What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any th...
[ "multithreading", "concurrency", "erlang" ]
21
8
4,306
13
0
2008-08-22T12:19:29.983000
2008-08-22T13:08:51.863000
22,212
27,815
TClientDataSet Aggregates specification aren't added automatically when creating an Aggregate field
I need to create an Aggregate Field in a TClientDataSet, but as said in the docs: Choose OK. The newly defined aggregate field is automatically added to the client dataset and its Aggregates property is automatically updated to include the appropriate aggregate specification. When I add a new aggregate field, the aggre...
I think you may be getting confused between TAggregate and TAggregateField objects, and the Delphi documentation probably isn't helping. AFAICT, TAggregateField objects are automatically 'recalculated' and can be bound to data-aware controls like TDBText, but don't have any OnUpdate event. "TAggregate" objects, on the ...
TClientDataSet Aggregates specification aren't added automatically when creating an Aggregate field I need to create an Aggregate Field in a TClientDataSet, but as said in the docs: Choose OK. The newly defined aggregate field is automatically added to the client dataset and its Aggregates property is automatically upd...
TITLE: TClientDataSet Aggregates specification aren't added automatically when creating an Aggregate field QUESTION: I need to create an Aggregate Field in a TClientDataSet, but as said in the docs: Choose OK. The newly defined aggregate field is automatically added to the client dataset and its Aggregates property is...
[ "delphi" ]
1
4
1,510
2
0
2008-08-22T12:34:44.673000
2008-08-26T11:52:35.960000
22,239
22,262
Why does int main() {} compile?
(I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main(), the compiler complains sa...
3.6.1 Main function.... 2 An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main: int main() { /*... */ } and int ...
Why does int main() {} compile? (I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than m...
TITLE: Why does int main() {} compile? QUESTION: (I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named any...
[ "c++", "return-value", "program-entry-point" ]
37
72
10,527
4
0
2008-08-22T12:49:37.213000
2008-08-22T12:54:54.313000
22,245
22,364
How do I change my workspace in Team Foundation Server 2005 and 2008?
I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked out by somebody else and are not accessible.
I'm going to assume you mean "workspace", not "workstation", as your question doesn't quite make sense to me otherwise. In Visual Studio, go to the Source Control Explorer (View->Other Windows->Source Control Explorer). At the top of the source control explorer window you should have a toolbar with a few buttons. Somew...
How do I change my workspace in Team Foundation Server 2005 and 2008? I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked out by somebody els...
TITLE: How do I change my workspace in Team Foundation Server 2005 and 2008? QUESTION: I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked o...
[ "tfs", "tfs-2005" ]
25
35
46,347
6
0
2008-08-22T12:51:03.043000
2008-08-22T13:36:08.707000
22,309
28,847
ARMV4i (Windows Mobile 6) Native Code disassembler
Does anyone know of a disassembler for ARMV4i executables and DLLs? I've got a plug-in DLL I'm writing with a very rare data abort (<5% of the time) that I have narrowed down to a specific function (via dumpbin and the address output by the data abort ). However, it is a fairly large function and I would like to narrow...
IDA Pro will definitely do ARM disassembly. And they (Datarescue) once arranged me a licence at about 11PM local time, so I like to recommend them... I see from http://www.datarescue.com/idabase/ that there's been some rearrangement of the company, but I guess it's still a good product. Here's the link to the new publi...
ARMV4i (Windows Mobile 6) Native Code disassembler Does anyone know of a disassembler for ARMV4i executables and DLLs? I've got a plug-in DLL I'm writing with a very rare data abort (<5% of the time) that I have narrowed down to a specific function (via dumpbin and the address output by the data abort ). However, it is...
TITLE: ARMV4i (Windows Mobile 6) Native Code disassembler QUESTION: Does anyone know of a disassembler for ARMV4i executables and DLLs? I've got a plug-in DLL I'm writing with a very rare data abort (<5% of the time) that I have narrowed down to a specific function (via dumpbin and the address output by the data abort...
[ "windows-mobile", "arm", "disassembly" ]
2
3
7,207
4
0
2008-08-22T13:17:48.317000
2008-08-26T18:57:33.580000
22,318
429,683
IE Securty Zone Issues
I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. We've had some success by getting the users to cha...
Turned out that the new security settings on the laptops required NTLMv2 which is not well supported by the JCIFS NLTM library. After some research, found out that JCIFS implementation of NTLM is very hacky (as described by the JCIFS devs) and they're removing support in the next major version of JCIFS. We've moved to ...
IE Securty Zone Issues I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. We've had some success by g...
TITLE: IE Securty Zone Issues QUESTION: I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. We've had...
[ "internet-explorer", "ntlm", "intranet", "jcifs", "security-zone" ]
0
0
594
3
0
2008-08-22T13:21:18.807000
2009-01-09T20:49:58.550000
22,319
22,693
How to send out email at a user's local time in .NET / Sql Server?
I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user. Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each user, I'd have to send the email to John ...
You have two options: Store the adjusted time for the mail action into the database for each user. Then just compare server time with stored time. To avoid confusion and portability issues, I would store all times in UTC. So, send mail when SERVER_UTC_TIME() == storedUtcTime. Store the local time for each mail action i...
How to send out email at a user's local time in .NET / Sql Server? I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user. Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an em...
TITLE: How to send out email at a user's local time in .NET / Sql Server? QUESTION: I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user. Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I ...
[ "sql", ".net", "sql-server", "timezone" ]
3
0
967
3
0
2008-08-22T13:22:31.050000
2008-08-22T15:44:23.033000
22,321
160,441
Remoting server auto-discovery. Broadcast or not?
I have a client/server application that communicates with.Net remoting. I need my clients to be able to find the server(s) on the network without requiring client-side configuration. As far as I know, there is no support for discovery in remoting. I am prepared to implement a UDP solution where the clients will be able...
I've looked at both SSDP and UPnP for this type of functionality, but I'd recommend going with a custom UDP multicast solution. Basically, multicast is very similar to a broadcast, but only machines that have joined the multicast group (i.e. requested the broadcast) are contacted. IMHO, SSDP and UPnP and bloated and ov...
Remoting server auto-discovery. Broadcast or not? I have a client/server application that communicates with.Net remoting. I need my clients to be able to find the server(s) on the network without requiring client-side configuration. As far as I know, there is no support for discovery in remoting. I am prepared to imple...
TITLE: Remoting server auto-discovery. Broadcast or not? QUESTION: I have a client/server application that communicates with.Net remoting. I need my clients to be able to find the server(s) on the network without requiring client-side configuration. As far as I know, there is no support for discovery in remoting. I am...
[ ".net", "networking", "remoting", "udp", "broadcast" ]
4
4
4,077
5
0
2008-08-22T13:22:38.867000
2008-10-02T01:01:22.280000
22,322
479,664
How to late bind 32bit/64 bit libs at runtime
I've got a problem similar to,but subtly different from, that described here (Loading assemblies and their dependencies). I have a C++ DLL for 3D rendering that is what we sell to customers. For.NET users we will have a CLR wrapper around it. The C++ DLL can be built in both 32 and 64bit versions, but I think this mean...
I finally have an answer for this that appears to work. Compile both 32 & 64 bit versions - both managed & unmanaged - into separate folders. Then have the.NET app choose at run time which directory to load the assemblies from. The problem with using the ResolveEvent is that it only gets called if assemblies aren't fou...
How to late bind 32bit/64 bit libs at runtime I've got a problem similar to,but subtly different from, that described here (Loading assemblies and their dependencies). I have a C++ DLL for 3D rendering that is what we sell to customers. For.NET users we will have a CLR wrapper around it. The C++ DLL can be built in bot...
TITLE: How to late bind 32bit/64 bit libs at runtime QUESTION: I've got a problem similar to,but subtly different from, that described here (Loading assemblies and their dependencies). I have a C++ DLL for 3D rendering that is what we sell to customers. For.NET users we will have a CLR wrapper around it. The C++ DLL c...
[ "c#", ".net", "64-bit", "clr", "x86-64" ]
18
9
4,339
3
0
2008-08-22T13:23:15.773000
2009-01-26T12:42:19.303000
22,326
27,425
Word Automation: Write RTF text without going through clipboard
I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable. Here is the current code: Clipboard.SetText(strRTFString, TextDataFormat.Rtf) oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0) Is there any way to do the same thing without going through the clipboard....
Put the RTF in a file instead of the clipboard, then insert from the file, e.g. Selection.InsertFile FileName:="myfile.rtf", Range:="", _ ConfirmConversions:=False, Link:=False, Attachment:=False
Word Automation: Write RTF text without going through clipboard I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable. Here is the current code: Clipboard.SetText(strRTFString, TextDataFormat.Rtf) oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0) Is there a...
TITLE: Word Automation: Write RTF text without going through clipboard QUESTION: I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable. Here is the current code: Clipboard.SetText(strRTFString, TextDataFormat.Rtf) oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFo...
[ "vba", "automation", "ms-word" ]
11
14
7,002
2
0
2008-08-22T13:24:24.697000
2008-08-26T04:54:01.520000
22,340
204,036
WCF push to client through firewall?
See also How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Coment or long polling) I need to use push-technology with WCF through client firewalls. This must be a common problem, and I know for a fact it works in theory (see links below), but I have failed to get it wor...
I've found a couple of solutions: ZeroC Ice GPL with a commercial option. Have only tested quickly. Looks more powerful than.NET Remoting and is very actively developed. RemObjects Commercial, active development, supports everything but does not seem to have all the more advanced features that GenuineChannels use. Genu...
WCF push to client through firewall? See also How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Coment or long polling) I need to use push-technology with WCF through client firewalls. This must be a common problem, and I know for a fact it works in theory (see links be...
TITLE: WCF push to client through firewall? QUESTION: See also How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Coment or long polling) I need to use push-technology with WCF through client firewalls. This must be a common problem, and I know for a fact it works in th...
[ ".net", "wcf", "firewall", "push", "duplex" ]
9
5
11,831
6
0
2008-08-22T13:27:53.937000
2008-10-15T08:32:34.547000
22,356
22,397
Cleanest Way to Invoke Cross-Thread Events
I find that the.NET event model is such that I'll often be raising an event on one thread and listening for it on another thread. I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is. Based on the community suggestions, I've used this: // earlier in the code mCoolObjec...
A couple of observations: Don't create simple delegates explicitly in code like that unless you're pre-2.0 so you could use: BeginInvoke(new EventHandler (mCoolObject_CoolEvent), sender, args); Also you don't need to create and populate the object array because the args parameter is a "params" type so you can just pass...
Cleanest Way to Invoke Cross-Thread Events I find that the.NET event model is such that I'll often be raising an event on one thread and listening for it on another thread. I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is. Based on the community suggestions, I've u...
TITLE: Cleanest Way to Invoke Cross-Thread Events QUESTION: I find that the.NET event model is such that I'll often be raising an event on one thread and listening for it on another thread. I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is. Based on the community s...
[ "c#", "multithreading", "events" ]
82
29
124,870
10
0
2008-08-22T13:34:02.583000
2008-08-22T13:45:40.993000
22,379
22,399
Implementing a log watcher
I'm wondering how you can implement a program similar to tail -f in C/C++, a program that watches for and processes new lines added to a log file?
You can use fseek() to clear the eof condition on the stream. Essentially, read to the end of the file, sleep for a while, fseek() (without changing your position) to clear eof, the read to end of file again. wash, rinse, repeat. man fseek(3) for details. Here's what it looks like in perl. perl's seek() is essentially ...
Implementing a log watcher I'm wondering how you can implement a program similar to tail -f in C/C++, a program that watches for and processes new lines added to a log file?
TITLE: Implementing a log watcher QUESTION: I'm wondering how you can implement a program similar to tail -f in C/C++, a program that watches for and processes new lines added to a log file? ANSWER: You can use fseek() to clear the eof condition on the stream. Essentially, read to the end of the file, sleep for a whi...
[ "c++", "c", "file", "io" ]
3
5
970
4
0
2008-08-22T13:40:32.597000
2008-08-22T13:46:16.093000
22,401
22,407
Does PHP have built-in data structures?
I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?
The only native data structure in PHP is array. Fortunately, arrays are quite flexible and can be used as hash tables as well. http://www.php.net/array However, there is SPL which is sort of a clone of C++ STL. http://www.php.net/manual/en/book.spl.php
Does PHP have built-in data structures? I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?
TITLE: Does PHP have built-in data structures? QUESTION: I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in? ANSWER: The only native data structure in PHP is array. Fortunatel...
[ "php", "data-structures" ]
69
62
63,596
10
0
2008-08-22T13:47:43.297000
2008-08-22T13:51:02.447000
22,409
848,533
How do I convert images between CMYK and RGB in ColdFusion (Java)?
I have a need to convert images from CMYK to RGB - not necessarily back again, but hey, if it can be done... With the release of ColdFusion 8, we got the CFImage tag, but it doesn't support this conversion; and nor does Image.cfc, or Alagad's Image Component. However, it should be possible in Java; which we can leverag...
I use the Java ImageIO libraries ( https://jai-imageio.dev.java.net ). They aren't perfect, but can be simple and get the job done. As far as converting from CMYK to RGB, here is the best I have been able to come up with. Download and install the ImageIO JARs and native libraries for your platform. The native libraries...
How do I convert images between CMYK and RGB in ColdFusion (Java)? I have a need to convert images from CMYK to RGB - not necessarily back again, but hey, if it can be done... With the release of ColdFusion 8, we got the CFImage tag, but it doesn't support this conversion; and nor does Image.cfc, or Alagad's Image Comp...
TITLE: How do I convert images between CMYK and RGB in ColdFusion (Java)? QUESTION: I have a need to convert images from CMYK to RGB - not necessarily back again, but hey, if it can be done... With the release of ColdFusion 8, we got the CFImage tag, but it doesn't support this conversion; and nor does Image.cfc, or A...
[ "java", "image", "coldfusion" ]
8
6
12,764
4
0
2008-08-22T13:51:39.263000
2009-05-11T15:01:05.827000
22,417
22,448
SQL Query Help - Scoring Multiple Choice Tests
Say I have a Student table, it's got an int ID. I have a fixed set of 10 multiple choice questions with 5 possible answers. I have a normalized answer table that has the question id, the Student.answer (1-5) and the Student.ID I'm trying to write a single query that will return all scores over a certain pecentage. To t...
If I understand your schema and question correctly, how about something like this: select student_name, score from students join (select student_answers.student_id, count(*) as score from student_answers, answer_key group by student_id where student_answers.question_id = answer_key.question_id and student_answers.answe...
SQL Query Help - Scoring Multiple Choice Tests Say I have a Student table, it's got an int ID. I have a fixed set of 10 multiple choice questions with 5 possible answers. I have a normalized answer table that has the question id, the Student.answer (1-5) and the Student.ID I'm trying to write a single query that will r...
TITLE: SQL Query Help - Scoring Multiple Choice Tests QUESTION: Say I have a Student table, it's got an int ID. I have a fixed set of 10 multiple choice questions with 5 possible answers. I have a normalized answer table that has the question id, the Student.answer (1-5) and the Student.ID I'm trying to write a single...
[ "dynamic-sql" ]
0
2
2,382
6
0
2008-08-22T13:53:46.137000
2008-08-22T14:11:58.577000
22,431
22,745
Search strategies in ORMs
I am looking for information on handling search in different ORMs. Currently I am redeveloping some old application in PHP and one of requirements is: make everything or almost everything searchable, so user just types "punkrock live" and the app finds videos clips, music tracks, reviews, upcoming events or even user c...
I have recently integrated the Compass search engine into a Java EE 5 application. It is based on Lucene Java and supports different ORM frameworks as well as other types of models like XML or no real model at all;) In the case of an object model managed by an ORM framework you can annotate your classes with special an...
Search strategies in ORMs I am looking for information on handling search in different ORMs. Currently I am redeveloping some old application in PHP and one of requirements is: make everything or almost everything searchable, so user just types "punkrock live" and the app finds videos clips, music tracks, reviews, upco...
TITLE: Search strategies in ORMs QUESTION: I am looking for information on handling search in different ORMs. Currently I am redeveloping some old application in PHP and one of requirements is: make everything or almost everything searchable, so user just types "punkrock live" and the app finds videos clips, music tra...
[ "search", "orm", "doctrine", "propel" ]
1
2
306
2
0
2008-08-22T14:05:05.410000
2008-08-22T16:05:16.197000
22,444
22,449
My regex is matching too much. How do I make it stop?
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Proj...
Make.* non-greedy by adding '? ' after it: Project name:\s+(.*?)\s+J[0-9]{7}:
My regex is matching too much. How do I make it stop? I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully I'm trying to extract pieces from it using reg...
TITLE: My regex is matching too much. How do I make it stop? QUESTION: I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully I'm trying to extract pieces...
[ "regex" ]
121
184
82,133
4
0
2008-08-22T14:10:40.170000
2008-08-22T14:12:01.243000
22,459
22,473
memset() causing data abort
I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset(). The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act. I'm using the following code: char *msg = (char*)malloc(sizeof(char)*2048); c...
malloc can return NULL if no memory is available. You're not checking for that.
memset() causing data abort I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset(). The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act. I'm using the following code: char *msg = (char*)...
TITLE: memset() causing data abort QUESTION: I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset(). The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act. I'm using the following code: c...
[ "c++", "c", "memory", "windows-mobile" ]
4
21
5,359
10
0
2008-08-22T14:17:01.747000
2008-08-22T14:21:43.030000
22,465
158,640
I'm looking for a Windows hosting provider that supports custom os images (like AMZN EC2)
I've come to love Amazon's EC2 service and I'm looking for something similar that supports the ability to save a running Windows server image and start new instances from it. I contacted GoGrid (the feature is planned in future) and Mosso (no joy) Anyone know of any hosting/cloud providers that can dothis?
I have just received a message from Amazon to the effect that that they will be supporting Windows Server on EC2 this fall. Wahaay!!
I'm looking for a Windows hosting provider that supports custom os images (like AMZN EC2) I've come to love Amazon's EC2 service and I'm looking for something similar that supports the ability to save a running Windows server image and start new instances from it. I contacted GoGrid (the feature is planned in future) a...
TITLE: I'm looking for a Windows hosting provider that supports custom os images (like AMZN EC2) QUESTION: I've come to love Amazon's EC2 service and I'm looking for something similar that supports the ability to save a running Windows server image and start new instances from it. I contacted GoGrid (the feature is pl...
[ "hosting", "windows-server-2003", "amazon-ec2", "virtual", "cloud" ]
1
4
426
5
0
2008-08-22T14:19:13.223000
2008-10-01T17:00:05.913000
22,466
22,613
jQuery AJAX vs. UpdatePanel
We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel is sending the whole page back to the serve...
Don't move to UpdatePanels. After coming from jQuery, the drop in performance would be untenable. Especially on a page as complex as yours sounds. If you have 2,000 lines of JavaScript code, the solution is to refactor that code. If you put 2,000 lines of C# code in one file, it would be difficult to maintain too. That...
jQuery AJAX vs. UpdatePanel We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel is sending the ...
TITLE: jQuery AJAX vs. UpdatePanel QUESTION: We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePan...
[ "javascript", "jquery", "asp.net", "ajax", "updatepanel" ]
24
41
13,362
4
0
2008-08-22T14:19:49.570000
2008-08-22T15:09:44.770000
22,469
27,771
What's a good machine for iPhone development?
I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared more towards the average consumer than the professional. Is an iMac...
Any modern Mac will be fine. I work on a two year old MacBook (2GHz) with 2Gb of memory and its perfectly usable. The biggest constraint I find it screen real-estate. I am way more productive on my 22" external screen. Go big if you get an iMac or consider adding an external monitor to the base model.
What's a good machine for iPhone development? I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared more towards the aver...
TITLE: What's a good machine for iPhone development? QUESTION: I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared mor...
[ "ios", "macos" ]
48
28
38,472
19
0
2008-08-22T14:20:35.730000
2008-08-26T11:19:43.853000
22,474
22,476
How do I display records containing specific information in SQl
How do I select all records that contain "LCS" within the title column in sql.
SELECT * FROM TABLE WHERE TABLE.TITLE LIKE '%LCS%'; % is the wild card matcher.
How do I display records containing specific information in SQl How do I select all records that contain "LCS" within the title column in sql.
TITLE: How do I display records containing specific information in SQl QUESTION: How do I select all records that contain "LCS" within the title column in sql. ANSWER: SELECT * FROM TABLE WHERE TABLE.TITLE LIKE '%LCS%'; % is the wild card matcher.
[ "sql", "sql-server" ]
2
2
361
3
0
2008-08-22T14:21:47.460000
2008-08-22T14:22:40.563000
22,500
22,547
What are the major differences between ANSI C and K&R C?
The Wikipedia article on ANSI C says: One of the aims of the ANSI C standardization process was to produce a superset of K&R C (the first published standard), incorporating many of the unofficial features subsequently introduced. However, the standards committee also included several new features, such as function prot...
There may be some confusion here about what "K&R C" is. The term refers to the language as documented in the first edition of "The C Programming Language." Roughly speaking: the input language of the Bell Labs C compiler circa 1978. Kernighan and Ritchie were involved in the ANSI standardization process. The "ANSI C" d...
What are the major differences between ANSI C and K&R C? The Wikipedia article on ANSI C says: One of the aims of the ANSI C standardization process was to produce a superset of K&R C (the first published standard), incorporating many of the unofficial features subsequently introduced. However, the standards committee ...
TITLE: What are the major differences between ANSI C and K&R C? QUESTION: The Wikipedia article on ANSI C says: One of the aims of the ANSI C standardization process was to produce a superset of K&R C (the first published standard), incorporating many of the unofficial features subsequently introduced. However, the st...
[ "c", "kr-c", "c89" ]
48
33
44,439
11
0
2008-08-22T14:29:27.410000
2008-08-22T14:48:18.003000
22,509
22,585
Why is ASP.NET gzip compression corrupting CSS?
I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seems to be corrupting the external CSS file that the pages use, but inter...
Is it only CSS files that get corrupted? Do JS files (or any other static text files) come through ok? Also can you duplicate the behavior if you browse directly to the CSS file? I've only enabled compression on Windows 2003 server's IIS using this approach: IIS → Web Sites → Properties → Service tab, check both boxes ...
Why is ASP.NET gzip compression corrupting CSS? I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seems to be corrupting the...
TITLE: Why is ASP.NET gzip compression corrupting CSS? QUESTION: I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seems to...
[ "asp.net", "compression", "gzip" ]
10
5
3,653
2
0
2008-08-22T14:33:00.973000
2008-08-22T14:57:38.433000
22,519
49,821
How do I secure a folder used to let users upload files?
I have a folder in my web server used for the users to upload photos using an ASP page. Is it safe enough to give IUSR write permissions to the folder? Must I secure something else? I am afraid of hackers bypassing the ASP page and uploading content directly to the folder. I'm using ASP classic and IIS6 on Windows 2003...
also, I would recommend not to let the users upload into a folder that's accessible from the web. Even the best MIME type detection may fail and you absolutely don't want users to upload, say, an executable disguised as a jpeg in a case where your MIME sniffing fails, but the one in IIS works correctly. In the PHP worl...
How do I secure a folder used to let users upload files? I have a folder in my web server used for the users to upload photos using an ASP page. Is it safe enough to give IUSR write permissions to the folder? Must I secure something else? I am afraid of hackers bypassing the ASP page and uploading content directly to t...
TITLE: How do I secure a folder used to let users upload files? QUESTION: I have a folder in my web server used for the users to upload photos using an ASP page. Is it safe enough to give IUSR write permissions to the folder? Must I secure something else? I am afraid of hackers bypassing the ASP page and uploading con...
[ "security", "iis", "asp-classic", "iis-6", "windows-server-2003" ]
4
3
5,567
4
0
2008-08-22T14:38:15.110000
2008-09-08T14:35:25.053000
22,524
23,004
Execute shortcuts like programs
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe, you can type s and it will launch the program. In PowerShell, typing s gives: The term 's' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. If you type s.lnk or SomeProgram, it ru...
On my Vista system typing S won't launch a lnk file unless I have the environment variable PATHEXT set with.lnk in the list. When I do. S will work in cmd.exe and I have to do.\S in powershell.
Execute shortcuts like programs Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe, you can type s and it will launch the program. In PowerShell, typing s gives: The term 's' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. If you ...
TITLE: Execute shortcuts like programs QUESTION: Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe, you can type s and it will launch the program. In PowerShell, typing s gives: The term 's' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and ...
[ "powershell" ]
17
9
37,681
6
0
2008-08-22T14:39:14.033000
2008-08-22T17:42:52.500000
22,528
22,587
PHP includes vs OOP
I would like to have a reference for the pros and cons of using include files vs objects(classes) when developing PHP applications. I know I would benefit from having one place to go for this answer...I have a few opinions of my own but I look forward to hearing others. A Simple Example: Certain pages on my site are on...
These are not really opposite choices. You will have to include the checking code anyway. I read your question as procedural programming vs. OO programming. Writing a few lines of code, or a function, and including it in your page header was how things were done in PHP3 or PHP4. It's simple, it works (that's how we did...
PHP includes vs OOP I would like to have a reference for the pros and cons of using include files vs objects(classes) when developing PHP applications. I know I would benefit from having one place to go for this answer...I have a few opinions of my own but I look forward to hearing others. A Simple Example: Certain pag...
TITLE: PHP includes vs OOP QUESTION: I would like to have a reference for the pros and cons of using include files vs objects(classes) when developing PHP applications. I know I would benefit from having one place to go for this answer...I have a few opinions of my own but I look forward to hearing others. A Simple Ex...
[ "php", "coding-style" ]
11
13
3,237
6
0
2008-08-22T14:41:20.597000
2008-08-22T14:57:46.547000
22,552
22,572
Passing a commented, multi-line (freespace) regex to preg_match
I have a regex that is going to end up being a bit long and it'd make it much easier to read to have it across multiple lines. I tried this but it just barfs. preg_match( '^J[0-9]{7}:\s+ (.*?) #Extract the Transaction Start Date msg \s+J[0-9]{7}:\s+Project\sname:\s+ (.*?) #Extract the Project Name \s+J[0-9]{7}:\s+Job\s...
You can use the extended syntax: preg_match("/ test /x", $foo, $bar);
Passing a commented, multi-line (freespace) regex to preg_match I have a regex that is going to end up being a bit long and it'd make it much easier to read to have it across multiple lines. I tried this but it just barfs. preg_match( '^J[0-9]{7}:\s+ (.*?) #Extract the Transaction Start Date msg \s+J[0-9]{7}:\s+Project...
TITLE: Passing a commented, multi-line (freespace) regex to preg_match QUESTION: I have a regex that is going to end up being a bit long and it'd make it much easier to read to have it across multiple lines. I tried this but it just barfs. preg_match( '^J[0-9]{7}:\s+ (.*?) #Extract the Transaction Start Date msg \s+J[...
[ "php", "regex" ]
2
5
1,033
5
0
2008-08-22T14:49:36.037000
2008-08-22T14:54:20.267000
22,566
22,573
How do I read in the contents of a directory in Perl?
How do I get Perl to read the contents of a given directory into an array? Backticks can do it, but is there some method using 'scandir' or a similar term?
opendir(D, "/path/to/directory") || die "Can't open directory: $!\n"; while (my $f = readdir(D)) { print "\$f = $f\n"; } closedir(D); EDIT: Oh, sorry, missed the "into an array" part: my $d = shift; opendir(D, "$d") || die "Can't open directory $d: $!\n"; my @list = readdir(D); closedir(D); foreach my $f (@list) { pr...
How do I read in the contents of a directory in Perl? How do I get Perl to read the contents of a given directory into an array? Backticks can do it, but is there some method using 'scandir' or a similar term?
TITLE: How do I read in the contents of a directory in Perl? QUESTION: How do I get Perl to read the contents of a given directory into an array? Backticks can do it, but is there some method using 'scandir' or a similar term? ANSWER: opendir(D, "/path/to/directory") || die "Can't open directory: $!\n"; while (my $f ...
[ "perl", "file-io", "filesystems" ]
39
58
64,625
9
0
2008-08-22T14:53:21.970000
2008-08-22T14:54:22.857000
22,570
22,592
What's a good way to check if two datetimes are on the same calendar day in TSQL?
Here is the issue I am having: I have a large query that needs to compare datetimes in the where clause to see if two dates are on the same day. My current solution, which sucks, is to send the datetimes into a UDF to convert them to midnight of the same day, and then check those dates for equality. When it comes to th...
This is much more concise: where datediff(day, date1, date2) = 0
What's a good way to check if two datetimes are on the same calendar day in TSQL? Here is the issue I am having: I have a large query that needs to compare datetimes in the where clause to see if two dates are on the same day. My current solution, which sucks, is to send the datetimes into a UDF to convert them to midn...
TITLE: What's a good way to check if two datetimes are on the same calendar day in TSQL? QUESTION: Here is the issue I am having: I have a large query that needs to compare datetimes in the where clause to see if two dates are on the same day. My current solution, which sucks, is to send the datetimes into a UDF to co...
[ "sql", "sql-server", "t-sql", "datetime", "user-defined-functions" ]
37
87
64,745
8
0
2008-08-22T14:53:47.710000
2008-08-22T15:02:46.300000
22,590
22,653
How do I cluster an upload folder with ASP.Net?
We have a situation where users are allowed to upload content, and then separately make some changes, then submit a form based on those changes. This works fine in a single-server, non-failover environment, however we would like some sort of solution for sharing the files between servers that supports failover. Has any...
At a former job we had a cluster of web servers with an F5 load balancer in front of them. We had a very similar problem in that our applications allowed users to upload content which might include photo's and such. These were legacy applications and we did not want to edit them to use a database and a SAN solution was...
How do I cluster an upload folder with ASP.Net? We have a situation where users are allowed to upload content, and then separately make some changes, then submit a form based on those changes. This works fine in a single-server, non-failover environment, however we would like some sort of solution for sharing the files...
TITLE: How do I cluster an upload folder with ASP.Net? QUESTION: We have a situation where users are allowed to upload content, and then separately make some changes, then submit a form based on those changes. This works fine in a single-server, non-failover environment, however we would like some sort of solution for...
[ "asp.net", "iis-6", "windows-server-2003", "cluster-computing", "failover" ]
5
1
755
4
0
2008-08-22T15:02:06.630000
2008-08-22T15:20:19.673000
22,598
22,627
ASP.NET Tutorials
can you recommend some good ASP.NET tutorials or a good book? Should I jump right to ASP.NET MVC/html/javascript or learn web forms first? Thanks
A great book if you're just beginning is Matthew MacDonald's Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional. Once you're done with that a great reference (also by MacDonald) is Pro ASP.NET 3.5 in C# 2008. One of my favorite sources of information online is 4GuysFromRolla.
ASP.NET Tutorials can you recommend some good ASP.NET tutorials or a good book? Should I jump right to ASP.NET MVC/html/javascript or learn web forms first? Thanks
TITLE: ASP.NET Tutorials QUESTION: can you recommend some good ASP.NET tutorials or a good book? Should I jump right to ASP.NET MVC/html/javascript or learn web forms first? Thanks ANSWER: A great book if you're just beginning is Matthew MacDonald's Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional. Once ...
[ "asp.net", "asp.net-mvc" ]
2
2
700
5
0
2008-08-22T15:06:36.883000
2008-08-22T15:13:13.577000
22,607
22,666
Install Leopard inside VMWare
I’m thinking about trying some development for the iPhone, is it possible to install Leopard inside VMWare? I already have a pretty high spec PC with a comfy setup that I’d like to use, or do I need to buy a real Mac?
It is legal to run Mac OS X Server in a virtual machine on Apple hardware. All other forms of Mac OS X virtualization are currently forbidden.
Install Leopard inside VMWare I’m thinking about trying some development for the iPhone, is it possible to install Leopard inside VMWare? I already have a pretty high spec PC with a comfy setup that I’d like to use, or do I need to buy a real Mac?
TITLE: Install Leopard inside VMWare QUESTION: I’m thinking about trying some development for the iPhone, is it possible to install Leopard inside VMWare? I already have a pretty high spec PC with a comfy setup that I’d like to use, or do I need to buy a real Mac? ANSWER: It is legal to run Mac OS X Server in a virtu...
[ "iphone", "macos", "virtualization" ]
10
12
2,698
6
0
2008-08-22T15:08:50.840000
2008-08-22T15:29:14.223000
22,617
22,624
Format numbers to strings in Python
I need to find out how to format numbers as strings. My code is here: return str(hours)+":"+str(minutes)+":"+str(seconds)+" "+ampm Hours and minutes are integers, and seconds is a float. the str() function will convert all of these numbers to the tenths (0.1) place. So instead of my string outputting "5:30:59.07 pm", i...
Starting with Python 3.6, formatting in Python can be done using formatted string literals or f-strings: hours, minutes, seconds = 6, 56, 33 f'{hours:02}:{minutes:02}:{seconds:02} {"pm" if hours > 12 else "am"}' or the str.format function starting with 2.7: "{:02}:{:02}:{:02} {}".format(hours, minutes, seconds, "pm" if...
Format numbers to strings in Python I need to find out how to format numbers as strings. My code is here: return str(hours)+":"+str(minutes)+":"+str(seconds)+" "+ampm Hours and minutes are integers, and seconds is a float. the str() function will convert all of these numbers to the tenths (0.1) place. So instead of my ...
TITLE: Format numbers to strings in Python QUESTION: I need to find out how to format numbers as strings. My code is here: return str(hours)+":"+str(minutes)+":"+str(seconds)+" "+ampm Hours and minutes are integers, and seconds is a float. the str() function will convert all of these numbers to the tenths (0.1) place....
[ "python", "string-formatting" ]
129
156
407,135
9
0
2008-08-22T15:10:46.360000
2008-08-22T15:12:41.613000
22,623
22,628
Best practices for catching and re-throwing .NET exceptions
What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a difference between the following code blocks in the way they handle this? try { //some code } catch (Exception ex) { throw ex; }...
The way to preserve the stack trace is through the use of the throw; This is valid as well try { // something that bombs here } catch (Exception ex) { throw; } throw ex; is basically like throwing an exception from that point, so the stack trace would only go to where you are issuing the throw ex; statement. Mike is al...
Best practices for catching and re-throwing .NET exceptions What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a difference between the following code blocks in the way they handle ...
TITLE: Best practices for catching and re-throwing .NET exceptions QUESTION: What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a difference between the following code blocks in th...
[ "c#", ".net", "exception", "rethrow" ]
310
279
194,304
11
0
2008-08-22T15:12:15.340000
2008-08-22T15:13:25.197000
22,674
22,731
What are the main differences between programming for Windows XP and for Vista?
From a desktop application developer point of view, is there any difference between developing for Windows XP and developing for Windows Vista?
User Interface Looking at the Windows Vista User Experience Guidelines you can see that they have changed many UI elements, which you should be aware of. Some major things to take note of: Larger icons New font (Which affects some custom UI constistency) New dialog box features ( task dialogs ) Altered common dialogs (...
What are the main differences between programming for Windows XP and for Vista? From a desktop application developer point of view, is there any difference between developing for Windows XP and developing for Windows Vista?
TITLE: What are the main differences between programming for Windows XP and for Vista? QUESTION: From a desktop application developer point of view, is there any difference between developing for Windows XP and developing for Windows Vista? ANSWER: User Interface Looking at the Windows Vista User Experience Guideline...
[ "windows-vista", "windows-xp" ]
11
20
2,104
4
0
2008-08-22T15:33:39.097000
2008-08-22T16:02:49.137000
22,676
22,682
How to download a file over HTTP?
I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes. The text processing that creates/updates the XML file is written in Python. However, I use wget inside a Windows.bat file to download the actual MP3 file. I would...
Use urllib.request.urlopen(): import urllib.request with urllib.request.urlopen('http://www.example.com/') as f: html = f.read().decode('utf-8') This is the most basic way to use the library, minus any error handling. You can also do more complex stuff such as changing headers. On Python 2, the method is in urllib2: im...
How to download a file over HTTP? I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes. The text processing that creates/updates the XML file is written in Python. However, I use wget inside a Windows.bat file to dow...
TITLE: How to download a file over HTTP? QUESTION: I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes. The text processing that creates/updates the XML file is written in Python. However, I use wget inside a Windo...
[ "python", "http", "urllib" ]
1,155
564
1,575,698
31
0
2008-08-22T15:34:13.760000
2008-08-22T15:38:22.330000
22,687
22,702
Alternative SSH Application to Plink
I have recently started having problems with TortoiseCVS, or more specifically with plink, the SSH application that comes with it. The IP address it tries to connect to can not be changed and is stuck with the old CVS repository's IP. Downloading plink from it's home site and calling from the command line still has thi...
For what it's worth, plink is just a command-line version of putty written by the same guy. I think jsight probably has the right idea.
Alternative SSH Application to Plink I have recently started having problems with TortoiseCVS, or more specifically with plink, the SSH application that comes with it. The IP address it tries to connect to can not be changed and is stuck with the old CVS repository's IP. Downloading plink from it's home site and callin...
TITLE: Alternative SSH Application to Plink QUESTION: I have recently started having problems with TortoiseCVS, or more specifically with plink, the SSH application that comes with it. The IP address it tries to connect to can not be changed and is stuck with the old CVS repository's IP. Downloading plink from it's ho...
[ "ssh", "cvs", "tortoisecvs", "plink" ]
1
0
11,034
9
0
2008-08-22T15:41:08.157000
2008-08-22T15:48:25.707000
22,694
250,676
Use of 3rd party libraries/components in production
When using 3rd party libraries/components in production projects, are you rigorous about using only released versions of said libraries? When do you consider using a pre-release or beta version of a library (in dev? in production, under certain circumstances)? If you come across a bug or shortcoming of the library and ...
I am a big fan of not coding something when someone else has a version that I could not code in a reasonable amount of time or would require me to become an expert on something that wouldn't matter in the long run. There are several open source components and libraries I have used in our production environment such as ...
Use of 3rd party libraries/components in production When using 3rd party libraries/components in production projects, are you rigorous about using only released versions of said libraries? When do you consider using a pre-release or beta version of a library (in dev? in production, under certain circumstances)? If you ...
TITLE: Use of 3rd party libraries/components in production QUESTION: When using 3rd party libraries/components in production projects, are you rigorous about using only released versions of said libraries? When do you consider using a pre-release or beta version of a library (in dev? in production, under certain circu...
[ "dependency-management" ]
4
2
601
5
0
2008-08-22T15:44:28.603000
2008-10-30T15:44:51.790000
22,697
23,048
What's the best mock framework for Java?
What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework?
I've had good success using Mockito. When I tried learning about JMock and EasyMock, I found the learning curve to be a bit steep (though maybe that's just me). I like Mockito because of its simple and clean syntax that I was able to grasp pretty quickly. The minimal syntax is designed to support the common cases very ...
What's the best mock framework for Java? What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework?
TITLE: What's the best mock framework for Java? QUESTION: What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework? ANSWER: I've had good success using Mockito. When I tried learning about JMock and EasyMock, I found the learning curve to be a bit steep (though ma...
[ "java", "unit-testing", "mocking" ]
347
314
221,088
14
0
2008-08-22T15:45:11.423000
2008-08-22T18:02:30.267000
22,704
22,722
What strategies have you employed to improve web application performance?
Any personal experience in overcoming web application performance hurdles? Any recommended strategies for improving the performance of a data-driven web application? My development team works on a web application (JSP reports, HTML, JavaScript) that uses an Oracle database (PL/SQL). The key functionality the applicatio...
While my answer may not contain any concrete steps to help this is always where I start. First thing I would do is try to throw away all of your assumptions about what the trouble is and take steps to install metrics everywhere you can. Let the metrics guide you rather than your intuition. I've chased many, many, many ...
What strategies have you employed to improve web application performance? Any personal experience in overcoming web application performance hurdles? Any recommended strategies for improving the performance of a data-driven web application? My development team works on a web application (JSP reports, HTML, JavaScript) t...
TITLE: What strategies have you employed to improve web application performance? QUESTION: Any personal experience in overcoming web application performance hurdles? Any recommended strategies for improving the performance of a data-driven web application? My development team works on a web application (JSP reports, H...
[ "performance", "oracle", "web-applications" ]
2
6
593
6
0
2008-08-22T15:48:44.490000
2008-08-22T15:58:41.987000
22,708
22,715
How do I find the Excel column name that corresponds to a given integer?
How would you determine the column name (e.g. "AQ" or "BH") of the nth column in Excel? Edit: A language-agnostic algorithm to determine this is the main goal here.
I once wrote this function to perform that exact task: public static string Column(int column) { column--; if (column >= 0 && column < 26) return ((char)('A' + column)).ToString(); else if (column > 25) return Column(column / 26) + Column(column % 26 + 1); else throw new Exception("Invalid Column #" + (column + 1).ToSt...
How do I find the Excel column name that corresponds to a given integer? How would you determine the column name (e.g. "AQ" or "BH") of the nth column in Excel? Edit: A language-agnostic algorithm to determine this is the main goal here.
TITLE: How do I find the Excel column name that corresponds to a given integer? QUESTION: How would you determine the column name (e.g. "AQ" or "BH") of the nth column in Excel? Edit: A language-agnostic algorithm to determine this is the main goal here. ANSWER: I once wrote this function to perform that exact task: ...
[ "algorithm", "excel", "language-agnostic" ]
34
45
60,656
20
0
2008-08-22T15:49:53.380000
2008-08-22T15:53:47.503000
22,720
22,803
Configure a Java Socket to fail-fast on disconnect?
I have a listening port on my server that I'm connecting to using a Java class and the Socket interface, i.e. Socket mySocket = new Socket(host,port); I then grab an OutputStream, decorate with a PrintWriter in autoflush mode and I'm laughing - except if the listening port closes. Then I get tcp4 0 0 *.9999 *.* LISTEN ...
Set a short timeout? Does isOutputShutdown() not get you what you want? You could always build a SocketWatcher class that spins up in its own Thread and repeatedly tries to write empty strings to the Socket until that raises a SocketClosedException.
Configure a Java Socket to fail-fast on disconnect? I have a listening port on my server that I'm connecting to using a Java class and the Socket interface, i.e. Socket mySocket = new Socket(host,port); I then grab an OutputStream, decorate with a PrintWriter in autoflush mode and I'm laughing - except if the listening...
TITLE: Configure a Java Socket to fail-fast on disconnect? QUESTION: I have a listening port on my server that I'm connecting to using a Java class and the Socket interface, i.e. Socket mySocket = new Socket(host,port); I then grab an OutputStream, decorate with a PrintWriter in autoflush mode and I'm laughing - excep...
[ "java", "exception", "sockets", "networking" ]
4
1
3,062
3
0
2008-08-22T15:58:13.077000
2008-08-22T16:33:13.820000
22,732
22,770
How do I pass multiple string parameters to a PowerShell script?
I am trying to do some string concatenation/formatting, but it's putting all the parameters into the first placeholder. Code function CreateAppPoolScript([string]$AppPoolName, [string]$AppPoolUser, [string]$AppPoolPass) { # Command to create an IIS application pool $AppPoolScript = "cscript adsutil.vbs CREATE ""w3svc/A...
Lose the parentheses and commas. Calling your function as: $s = CreateAppPoolScript "name" "user" "pass" gives: cscript adsutil.vbs CREATE "w3svc/AppPools/name" IIsApplicationPool cscript adsutil.vbs SET "w3svc/AppPools/name/WamUserName" "user" cscript adsutil.vbs SET "w3svc/AppPools/name/WamUserPass" "pass" cscript ad...
How do I pass multiple string parameters to a PowerShell script? I am trying to do some string concatenation/formatting, but it's putting all the parameters into the first placeholder. Code function CreateAppPoolScript([string]$AppPoolName, [string]$AppPoolUser, [string]$AppPoolPass) { # Command to create an IIS applic...
TITLE: How do I pass multiple string parameters to a PowerShell script? QUESTION: I am trying to do some string concatenation/formatting, but it's putting all the parameters into the first placeholder. Code function CreateAppPoolScript([string]$AppPoolName, [string]$AppPoolUser, [string]$AppPoolPass) { # Command to cr...
[ "string", "powershell", "parameters", "arguments" ]
35
52
79,354
3
0
2008-08-22T16:03:00.227000
2008-08-22T16:15:03.320000
22,764
1,434,830
How does Ruby 1.9 handle character cases in source code?
In Ruby 1.8 and earlier, Foo is a constant (a Class, a Module, or another constant). Whereas foo is a variable. The key difference is as follows: module Foo bar = 7 BAZ = 8 end Foo::BAZ # => 8 Foo::bar # NoMethodError: undefined method 'bar' for Foo:Module That's all well and good, but Ruby 1.9 allows UTF-8 source co...
I can't get IRB to accept UTF-8 characters, so I used a test script ( /tmp/utf_test.rb ). "λ" works fine as a variable name: # encoding: UTF-8 λ = 'foo' puts λ # from the command line: > ruby -KU /tmp/utf_test.rb foo "λ" also works fine as a method name: # encoding: UTF-8 Kernel.class_eval do alias_method:λ,:lambda en...
How does Ruby 1.9 handle character cases in source code? In Ruby 1.8 and earlier, Foo is a constant (a Class, a Module, or another constant). Whereas foo is a variable. The key difference is as follows: module Foo bar = 7 BAZ = 8 end Foo::BAZ # => 8 Foo::bar # NoMethodError: undefined method 'bar' for Foo:Module That...
TITLE: How does Ruby 1.9 handle character cases in source code? QUESTION: In Ruby 1.8 and earlier, Foo is a constant (a Class, a Module, or another constant). Whereas foo is a variable. The key difference is as follows: module Foo bar = 7 BAZ = 8 end Foo::BAZ # => 8 Foo::bar # NoMethodError: undefined method 'bar' f...
[ "ruby", "encoding", "utf-8" ]
5
0
1,788
5
0
2008-08-22T16:09:50.070000
2009-09-16T18:54:35.850000
22,779
22,800
Is GDI+ actually still a "usable" technology?
I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a.net sense. Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ASP.net¹, I just wonder: Is it actually feasib...
It's still a technology worth using. There are lots of Windows Forms and unmanaged apps around that use GDI+ that either won't be upgraded, or that will be upgraded, but that don't need more advanced rendering capabilities. GDI+ is a good bolt-on solution for older applications, and for new applications written in Wind...
Is GDI+ actually still a "usable" technology? I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a.net sense. Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ...
TITLE: Is GDI+ actually still a "usable" technology? QUESTION: I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a.net sense. Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually...
[ ".net", "gdi+" ]
4
5
1,652
5
0
2008-08-22T16:20:55.287000
2008-08-22T16:32:04.557000
22,792
546,633
Is there an open source SQL Server DB compare tool?
I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another. Is there an open source or free SQL Server DB diff tool out there that generates a convert script?
I think that Open DBiff does a good job. It's simple and I works with SQL Server 2005/2008. But only generate the change script. Nothing more and nothing less.
Is there an open source SQL Server DB compare tool? I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another. Is there an open source or free SQL Server DB diff tool out there that generat...
TITLE: Is there an open source SQL Server DB compare tool? QUESTION: I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another. Is there an open source or free SQL Server DB diff tool out ...
[ "sql-server", "sql-server-2005", "compare" ]
42
17
25,579
12
0
2008-08-22T16:26:31.170000
2009-02-13T16:36:40.773000
22,798
4,788,050
Drag and Drop an Email from MS Outlook to Eclipse RCP
Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard?
Maybe this is a solution for your problem: http://sourceforge.net/projects/javaoutlookdd/ It allows to handle outlook items like File objects during drag&drop.
Drag and Drop an Email from MS Outlook to Eclipse RCP Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard?
TITLE: Drag and Drop an Email from MS Outlook to Eclipse RCP QUESTION: Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard? ANSWER: Maybe this is a solution for your problem: http://sourceforge.net/pr...
[ "java", "eclipse", "ms-office", "integration", "desktop" ]
4
2
3,408
3
0
2008-08-22T16:30:20.117000
2011-01-24T22:39:12.187000
22,801
23,835
The difference between loops
It's about PHP but I've no doubt many of the same comments will apply to other languages. Simply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop? for ($i = 0; $i < 10; $i++) { # code... } foreach ($array as $ind...
For loop and While loops are entry condition loops. They evaluate condition first, so the statement block associated with the loop won't run even once if the condition fails to meet The statements inside this for loop block will run 10 times, the value of $i will be 0 to 9; for ($i = 0; $i < 10; $i++) { # code... } Sam...
The difference between loops It's about PHP but I've no doubt many of the same comments will apply to other languages. Simply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop? for ($i = 0; $i < 10; $i++) { # code....
TITLE: The difference between loops QUESTION: It's about PHP but I've no doubt many of the same comments will apply to other languages. Simply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop? for ($i = 0; $i < 1...
[ "php", "loops" ]
6
11
2,323
11
0
2008-08-22T16:32:33.153000
2008-08-23T01:44:16.553000
22,814
22,819
How to decode viewstate
I need to see the contents of the viewstate of an asp.net page. I looked for a viewstate decoder, found Fridz Onion's ViewState Decoder but it asks for the url of a page to get its viewstate. Since my viewstate is formed after a postback and comes as a result of an operation in an update panel, I cannot provide a url. ...
Use Fiddler and grab the view state in the response and paste it into the bottom left text box then decode.
How to decode viewstate I need to see the contents of the viewstate of an asp.net page. I looked for a viewstate decoder, found Fridz Onion's ViewState Decoder but it asks for the url of a page to get its viewstate. Since my viewstate is formed after a postback and comes as a result of an operation in an update panel, ...
TITLE: How to decode viewstate QUESTION: I need to see the contents of the viewstate of an asp.net page. I looked for a viewstate decoder, found Fridz Onion's ViewState Decoder but it asks for the url of a page to get its viewstate. Since my viewstate is formed after a postback and comes as a result of an operation in...
[ "asp.net", "viewstate" ]
63
40
121,244
11
0
2008-08-22T16:38:49.407000
2008-08-22T16:40:16.457000
22,816
43,112
Libraries for pretty charts in SWT?
I know the following libraries for drawing charts in an SWT/Eclipse RCP application: Eclipse BIRT Chart Engine (Links to an article on how to use it) JFreeChart Which other libraries are there for drawing pretty charts with SWT? Or charts in Java generally? After all, you can always display an image...
I have not used BIRT or JGraph, however I use JFreeChart in my SWT application. I have found the best way to use JFreeChart in SWT is by making a composite an AWT frame and using the AWT functionality for JFreeChart. The way to do this is by creating a composite Composite comp = new Composite(parent, SWT.NONE | SWT.EMB...
Libraries for pretty charts in SWT? I know the following libraries for drawing charts in an SWT/Eclipse RCP application: Eclipse BIRT Chart Engine (Links to an article on how to use it) JFreeChart Which other libraries are there for drawing pretty charts with SWT? Or charts in Java generally? After all, you can always ...
TITLE: Libraries for pretty charts in SWT? QUESTION: I know the following libraries for drawing charts in an SWT/Eclipse RCP application: Eclipse BIRT Chart Engine (Links to an article on how to use it) JFreeChart Which other libraries are there for drawing pretty charts with SWT? Or charts in Java generally? After al...
[ "java", "eclipse", "charts", "swt" ]
18
11
17,099
11
0
2008-08-22T16:39:15.927000
2008-09-04T02:59:33.220000
22,836
22,896
How do I perform a Perl substitution on a string while keeping the original?
In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original? I usually just copy the string to a new variable then bind it to the s/// regex that does the replacement on the new string, but I was wondering if ther...
This is the idiom I've always used to get a modified copy of a string without changing the original: (my $newstring = $oldstring) =~ s/foo/bar/g; In perl 5.14.0 or later, you can use the new /r non-destructive substitution modifier: my $newstring = $oldstring =~ s/foo/bar/gr; NOTE: The above solutions work without g to...
How do I perform a Perl substitution on a string while keeping the original? In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original? I usually just copy the string to a new variable then bind it to the s/// r...
TITLE: How do I perform a Perl substitution on a string while keeping the original? QUESTION: In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original? I usually just copy the string to a new variable then bin...
[ "regex", "perl", "replace" ]
212
300
248,371
8
0
2008-08-22T16:47:55.597000
2008-08-22T17:08:29.197000
22,869
22,966
ASP.NET - Building your own routing system
In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and I'm wondering if/how I might perform somet...
This is going to be a long answer, because I want to make sure you are fully aware of all the ways you can accomplish what you want to do. The routing engine that powers the ASP.NET MVC Framework will work with the traditional ASP.NET Framework. You can take advantage of using the RouteTable and assigning routes, just ...
ASP.NET - Building your own routing system In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and...
TITLE: ASP.NET - Building your own routing system QUESTION: In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling i...
[ "asp.net", "routes", "url-rewriting" ]
2
6
1,563
1
0
2008-08-22T16:58:07.193000
2008-08-22T17:31:20.873000
22,879
22,908
How do you prevent leading zeros from being stripped when importing an excel doc using c#
I'm able to connect to and read an excel file no problem. But when importing data such as zipcodes that have leading zeros, how do you prevent excel from guessing the datatype and in the process stripping out leading zeros?
I believe you have to set the option in your connect string to force textual import rather than auto-detecting it. Provider=Microsoft.ACE.OLEDB.12.0; Data Source=c:\path\to\myfile.xlsx; Extended Properties=\"Excel 12.0 Xml;IMEX=1\"; Your milage may vary depending on the version you have installed. The IMEX=1 extended p...
How do you prevent leading zeros from being stripped when importing an excel doc using c# I'm able to connect to and read an excel file no problem. But when importing data such as zipcodes that have leading zeros, how do you prevent excel from guessing the datatype and in the process stripping out leading zeros?
TITLE: How do you prevent leading zeros from being stripped when importing an excel doc using c# QUESTION: I'm able to connect to and read an excel file no problem. But when importing data such as zipcodes that have leading zeros, how do you prevent excel from guessing the datatype and in the process stripping out lea...
[ "c#", "asp.net", "excel", "ado.net" ]
8
8
7,184
8
0
2008-08-22T17:02:14.483000
2008-08-22T17:10:57.210000
22,880
22,913
What is the best way to prevent session hijacking?
Specifically this is regarding when using a client session cookie to identify a session on the server. Is the best answer to use SSL/HTTPS encryption for the entire web site, and you have the best guarantee that no man in the middle attacks will be able to sniff an existing client session cookie? And perhaps second bes...
Encrypting the session value will have zero effect. The session cookie is already an arbitrary value, encrypting it will just generate another arbitrary value that can be sniffed. The only real solution is HTTPS. If you don't want to do SSL on your whole site (maybe you have performance concerns), you might be able to ...
What is the best way to prevent session hijacking? Specifically this is regarding when using a client session cookie to identify a session on the server. Is the best answer to use SSL/HTTPS encryption for the entire web site, and you have the best guarantee that no man in the middle attacks will be able to sniff an exi...
TITLE: What is the best way to prevent session hijacking? QUESTION: Specifically this is regarding when using a client session cookie to identify a session on the server. Is the best answer to use SSL/HTTPS encryption for the entire web site, and you have the best guarantee that no man in the middle attacks will be ab...
[ "security", "session", "cookies" ]
136
146
157,318
14
0
2008-08-22T17:02:26.763000
2008-08-22T17:11:46.723000