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
116,533
116,586
What browser is best for testing web standards?
When I build a site, I'd like to have at least one browser I can show it off in without any hacks or workarounds, and yet still retain maximum functionality. Knowing that none of the browsers have perfect standards adherence, which one comes closest? Also, are there any standards areas in which a single browser seems t...
Safari using the latest WebKit nightly build. Not that any browser in the world uses this yet (not even Chrome) but if all you're worried about is standards then that's your best bet - it passes Acid3, something no browser on the market can do yet.
What browser is best for testing web standards? When I build a site, I'd like to have at least one browser I can show it off in without any hacks or workarounds, and yet still retain maximum functionality. Knowing that none of the browsers have perfect standards adherence, which one comes closest? Also, are there any s...
TITLE: What browser is best for testing web standards? QUESTION: When I build a site, I'd like to have at least one browser I can show it off in without any hacks or workarounds, and yet still retain maximum functionality. Knowing that none of the browsers have perfect standards adherence, which one comes closest? Als...
[ "html", "css", "xhtml", "web-standards", "browser" ]
6
9
1,489
12
0
2008-09-22T18:15:54.087000
2008-09-22T18:23:26.017000
116,560
116,570
Open an Emacs buffer when a command tries to open an editor in shell-mode
I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set to vim I get the following from svn propedit: $ svn propedit svn:externals. "svn-prop.tmp" ...
You can attach to an Emacs session through emacsclient. First, start the emacs server with M-x server-start or add (server-start) to your.emacs. Then, export VISUAL=emacsclient Edit away. Note: The versions of emacs and emacsclient must agree. If you have multiple versions of Emacs installed, make sure you invoke the v...
Open an Emacs buffer when a command tries to open an editor in shell-mode I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set to vim I get the ...
TITLE: Open an Emacs buffer when a command tries to open an editor in shell-mode QUESTION: I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set...
[ "unix", "shell", "emacs" ]
19
21
5,197
6
0
2008-09-22T18:18:58.993000
2008-09-22T18:21:23.573000
116,574
116,916
java get file size efficiently
While googling, I see that using java.io.File#length() can be slow. FileChannel has a size() method that is available as well. Is there an efficient way in java to get the file size?
Well, I tried to measure it up with the code below: For runs = 1 and iterations = 1 the URL method is fastest most times followed by channel. I run this with some pause fresh about 10 times. So for one time access, using the URL is the fastest way I can think of: LENGTH sum: 10626, per Iteration: 10626.0 CHANNEL sum: ...
java get file size efficiently While googling, I see that using java.io.File#length() can be slow. FileChannel has a size() method that is available as well. Is there an efficient way in java to get the file size?
TITLE: java get file size efficiently QUESTION: While googling, I see that using java.io.File#length() can be slow. FileChannel has a size() method that is available as well. Is there an efficient way in java to get the file size? ANSWER: Well, I tried to measure it up with the code below: For runs = 1 and iterations...
[ "java", "filesize" ]
171
103
223,626
9
0
2008-09-22T18:21:40.423000
2008-09-22T19:21:05.380000
116,576
116,598
Debugging Websites in Internet Explorer
I have a Website that is really slow and "feels" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the Page from within IE. In Firefox, I would use Firebug, Y!Sl...
There is the Internet Explorer Web Developer Toolbar. It isn't as good as Firebug IMHO, but it works. IE8 will ship with one built-in, too.
Debugging Websites in Internet Explorer I have a Website that is really slow and "feels" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the Page from within I...
TITLE: Debugging Websites in Internet Explorer QUESTION: I have a Website that is really slow and "feels" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the ...
[ "internet-explorer", "profiling" ]
6
13
1,996
13
0
2008-09-22T18:21:49.593000
2008-09-22T18:25:05.220000
116,577
118,626
File System Management Tools
Looking for suggestions on file system management tools. We have several terabytes of images, pdfs, excel sheets, etc. We're looking at some sort of software that will help us to manage, archive, etc the images. We don't store all the files information in a database but some are and we were hoping to maybe find an app ...
I have always seen these guys in the trade magazines. http://www.dtsearch.com/ I believe they've been around long before even Google. Not sure if this is what you're looking for.
File System Management Tools Looking for suggestions on file system management tools. We have several terabytes of images, pdfs, excel sheets, etc. We're looking at some sort of software that will help us to manage, archive, etc the images. We don't store all the files information in a database but some are and we were...
TITLE: File System Management Tools QUESTION: Looking for suggestions on file system management tools. We have several terabytes of images, pdfs, excel sheets, etc. We're looking at some sort of software that will help us to manage, archive, etc the images. We don't store all the files information in a database but so...
[ "sql", "database", "file", "system" ]
1
3
625
6
0
2008-09-22T18:21:59.127000
2008-09-23T01:26:44.223000
116,579
120,828
Opening more than one of the same Mac Application at once
I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in. How can I allow a user to open several copies of my App at once? I'm using ...
You've probably already gotten enough code that you don't want to hear this, but you should really not be starting up two instances of the same application. There's a reason that you're finding it so difficult and that's because Apple doesn't want you to do it. The OSX way of doing this is to use the Cocoa Document-bas...
Opening more than one of the same Mac Application at once I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in. How can I allow a...
TITLE: Opening more than one of the same Mac Application at once QUESTION: I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in....
[ "java", "eclipse", "macos" ]
1
4
781
4
0
2008-09-22T18:22:16.723000
2008-09-23T13:00:15.507000
116,587
116,615
Determining the extended interfaces of a Class
I need to determine if a Class object representing an interface extends another interface, ie: package a.b.c.d; public Interface IMyInterface extends a.b.d.c.ISomeOtherInterface{ } according to the spec Class.getSuperClass() will return null for an Interface. If this Class represents either the Object class, an interfa...
Use Class.getInterfaces such as: Class c; // Your class for(Class i: c.getInterfaces()) { // test if i is your interface } Also the following code might be of help, it will give you a set with all super-classes and interfaces of a certain class: public static Set > getInheritance(Class in) { LinkedHashSet > result = ne...
Determining the extended interfaces of a Class I need to determine if a Class object representing an interface extends another interface, ie: package a.b.c.d; public Interface IMyInterface extends a.b.d.c.ISomeOtherInterface{ } according to the spec Class.getSuperClass() will return null for an Interface. If this Class...
TITLE: Determining the extended interfaces of a Class QUESTION: I need to determine if a Class object representing an interface extends another interface, ie: package a.b.c.d; public Interface IMyInterface extends a.b.d.c.ISomeOtherInterface{ } according to the spec Class.getSuperClass() will return null for an Interf...
[ "java", "reflection", "interface" ]
11
16
14,506
5
0
2008-09-22T18:23:27.157000
2008-09-22T18:27:49.033000
116,593
116,595
How Do You Clear The IRB Console?
How do you clear the IRB console screen?
On Mac OS X or Linux you can use Ctrl + L to clear the IRB screen.
How Do You Clear The IRB Console? How do you clear the IRB console screen?
TITLE: How Do You Clear The IRB Console? QUESTION: How do you clear the IRB console screen? ANSWER: On Mac OS X or Linux you can use Ctrl + L to clear the IRB screen.
[ "ruby", "irb" ]
205
287
67,735
21
0
2008-09-22T18:24:20.883000
2008-09-22T18:24:57.810000
116,610
116,737
MySpace DOM?
I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks" include incomplete HTML code ...
This shouldn't be too hard if you whip out Firebug and do a bunch of "Inspect > click on page > edit CSS in Firebug's editor" work to see what you can learn about the structure of the page. Then mock it up to roughly how you want it and note down which elements and which styles need work and figure out how to get that ...
MySpace DOM? I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks" include incomple...
TITLE: MySpace DOM? QUESTION: I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks...
[ "html", "dom", "myspace" ]
2
4
492
4
0
2008-09-22T18:27:00.767000
2008-09-22T18:50:45.157000
116,626
117,053
Why am I getting a "wrong number of arguments (0 for 2)" exception in my Ruby Code?
I'm trying to polish up my Ruby by re writing Kent Beck's xUnit Python example from "Test Driven Development: By Example". I've got quite far but now I get the following error when I run which I don't grok. C:\Documents and Settings\aharmel\My Documents\My Workspace\TDD_Book\TDDBook_xUnit_RubyVersion\lib\main.rb:21:in ...
It's your print statement: puts "test was run? (true expected): #{test.wasRun}" should be puts "test was run? (true expected): #{@test.wasRun}" without the '@' you are calling Kernel#test, which expects 2 variables.
Why am I getting a "wrong number of arguments (0 for 2)" exception in my Ruby Code? I'm trying to polish up my Ruby by re writing Kent Beck's xUnit Python example from "Test Driven Development: By Example". I've got quite far but now I get the following error when I run which I don't grok. C:\Documents and Settings\aha...
TITLE: Why am I getting a "wrong number of arguments (0 for 2)" exception in my Ruby Code? QUESTION: I'm trying to polish up my Ruby by re writing Kent Beck's xUnit Python example from "Test Driven Development: By Example". I've got quite far but now I get the following error when I run which I don't grok. C:\Document...
[ "ruby", "metaprogramming", "xunit" ]
3
11
7,595
2
0
2008-09-22T18:29:26.520000
2008-09-22T19:43:20.960000
116,629
118,107
Drools project idea needed
I was asked to make some drools traning for my teammates. Just to show them how it can be used and how usefull it may be. To do this training I first have to learn Drools, and I figured that the best way to learn it will be small project centered around drools. Any interesting ideas? My idea for this project was to do ...
Actually, we have a drools based project, you could try to mimic that.:-) Suppose you have incoming SMS messages arriving on an HTTP based protocol. An HTTP request contains the Anumber (telephone number of the sender) the Bnumber (telephone number of the recipient) and the text of the message. Your goal is to use droo...
Drools project idea needed I was asked to make some drools traning for my teammates. Just to show them how it can be used and how usefull it may be. To do this training I first have to learn Drools, and I figured that the best way to learn it will be small project centered around drools. Any interesting ideas? My idea ...
TITLE: Drools project idea needed QUESTION: I was asked to make some drools traning for my teammates. Just to show them how it can be used and how usefull it may be. To do this training I first have to learn Drools, and I figured that the best way to learn it will be small project centered around drools. Any interesti...
[ "java", "drools", "webmethods" ]
2
4
1,940
6
0
2008-09-22T18:29:52.180000
2008-09-22T22:56:47.890000
116,630
116,982
Hiding Subreports in SQL Report (RDL)
I have a bunch of reports that are printed out and mailed to clients. At the top of the report is the return address, left aligned. I was asked to add an optional logo to the report. This logo should be left of the return address. (The logo and all other info is stored in the database). So if the logo exists, you SHOUL...
You should be able to set an expression on the subreport's visibility so that it does not show if there isn't a logo. Here is the XML from an RDL I had handy: SubReport =Not Parameters!ShowLogo.Value This tests against a boolean parameter called ShowLogo, but you could just as easily test the value of another parameter...
Hiding Subreports in SQL Report (RDL) I have a bunch of reports that are printed out and mailed to clients. At the top of the report is the return address, left aligned. I was asked to add an optional logo to the report. This logo should be left of the return address. (The logo and all other info is stored in the datab...
TITLE: Hiding Subreports in SQL Report (RDL) QUESTION: I have a bunch of reports that are printed out and mailed to clients. At the top of the report is the return address, left aligned. I was asked to add an optional logo to the report. This logo should be left of the return address. (The logo and all other info is s...
[ "sql", "report", "rdl" ]
1
1
2,144
1
0
2008-09-22T18:29:57.220000
2008-09-22T19:31:46.087000
116,640
170,865
Low Java single process thread limit in Red Hat Linux
I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system is unwilling or unable to create any more. This seems to be specific to...
Updating the kernel to a newer version (2.6.something) with NPTL threading fixed this.
Low Java single process thread limit in Red Hat Linux I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system is unwilling or u...
TITLE: Low Java single process thread limit in Red Hat Linux QUESTION: I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system...
[ "java", "linux", "redhat" ]
8
4
18,690
5
0
2008-09-22T18:32:00.210000
2008-10-04T19:09:56.010000
116,646
116,714
data access object pattern implementation
I would like to implement a data access object pattern in C++, but preferably without using multiple inheritance and/or boost (which my client does not like). Do you have any suggestions?
OTL (otl.sourceforge.net) is an excellent C++ database library. It's a single include file so doesn't have all the complexity associated (rightly or wrongly!) with Boost. In terms of the DAO itself, you have many options. The simplest that hides the database implementation is just to use C++ style interfaces and implem...
data access object pattern implementation I would like to implement a data access object pattern in C++, but preferably without using multiple inheritance and/or boost (which my client does not like). Do you have any suggestions?
TITLE: data access object pattern implementation QUESTION: I would like to implement a data access object pattern in C++, but preferably without using multiple inheritance and/or boost (which my client does not like). Do you have any suggestions? ANSWER: OTL (otl.sourceforge.net) is an excellent C++ database library....
[ "c++", "design-patterns", "oop" ]
5
7
10,369
3
0
2008-09-22T18:33:03.733000
2008-09-22T18:46:36.837000
116,650
116,725
cURL equivalent in JAVA
I am tasked with writing an authentication component for an open source JAVA app. We have an in-house authentication widget that uses https. I have some example php code that accesses the widget which uses cURL to handle the transfer. My question is whether or not there is a port of cURL to JAVA, or better yet, what ba...
Exception handling omitted: HttpURLConnection con = (HttpURLConnection) new URL("https://www.example.com").openConnection(); con.setRequestMethod("POST"); con.getOutputStream().write("LOGIN".getBytes("UTF-8")); con.getInputStream();
cURL equivalent in JAVA I am tasked with writing an authentication component for an open source JAVA app. We have an in-house authentication widget that uses https. I have some example php code that accesses the widget which uses cURL to handle the transfer. My question is whether or not there is a port of cURL to JAVA...
TITLE: cURL equivalent in JAVA QUESTION: I am tasked with writing an authentication component for an open source JAVA app. We have an in-house authentication widget that uses https. I have some example php code that accesses the widget which uses cURL to handle the transfer. My question is whether or not there is a po...
[ "java", "php", "authentication", "curl" ]
43
65
77,139
6
0
2008-09-22T18:34:18.440000
2008-09-22T18:48:05.897000
116,654
116,661
Non-C++ languages for generative programming?
C++ is probably the most popular language for static metaprogramming and Java doesn't support it. Are there any other languages besides C++ that support generative programming (programs that create programs)?
The alternative to template style meta-programming is Macro-style that you see in various Lisp implementations. I would suggest downloading Paul Graham's On Lisp and also taking a look at Clojure if you're interested in a Lisp with macros that runs on the JVM. Macros in Lisp are much more powerful than C/C++ style and ...
Non-C++ languages for generative programming? C++ is probably the most popular language for static metaprogramming and Java doesn't support it. Are there any other languages besides C++ that support generative programming (programs that create programs)?
TITLE: Non-C++ languages for generative programming? QUESTION: C++ is probably the most popular language for static metaprogramming and Java doesn't support it. Are there any other languages besides C++ that support generative programming (programs that create programs)? ANSWER: The alternative to template style meta...
[ "haskell", "lisp", "clojure", "metaprogramming", "boo" ]
24
33
4,025
15
0
2008-09-22T18:34:53.573000
2008-09-22T18:36:56.487000
116,658
116,669
Maximum Number of characters with FCKeditor
Have you determined a maximum number of characters allowed in FCKEditor? I seem to have hit a wall. It will display the text to be edited, but changes don't get posted back to the server - only the original text gets posted back to the server. I am assuming that the changed text is not copied back to the hidden input f...
We haven't - we use it for a web content management system, and have some large pages that it quite happily handles. There may be a limit on your response size buffer, or something line that on your web server....
Maximum Number of characters with FCKeditor Have you determined a maximum number of characters allowed in FCKEditor? I seem to have hit a wall. It will display the text to be edited, but changes don't get posted back to the server - only the original text gets posted back to the server. I am assuming that the changed t...
TITLE: Maximum Number of characters with FCKeditor QUESTION: Have you determined a maximum number of characters allowed in FCKEditor? I seem to have hit a wall. It will display the text to be edited, but changes don't get posted back to the server - only the original text gets posted back to the server. I am assuming ...
[ "javascript", "wysiwyg", "fckeditor" ]
2
3
2,379
1
0
2008-09-22T18:36:27.250000
2008-09-22T18:38:13.080000
116,682
116,998
Firebug 1.2 document.cookie inconsistency with Web Developer
I have a URI here in which a simple document.cookie query through the console is resulting in three cookies being displayed. I verified this with trivial code such as the following as well: var cookies = document.cookie.split(';'); console.log(cookies.length); The variable cookies does indeed come out to the number 3. ...
One reason might be that the other 5 cookies are HTTPONLY: http://msdn.microsoft.com/en-us/library/ms533046.aspx If the HttpOnly attribute is included in the response header, the cookie is still sent when the user browses to a Web site in the valid domain. The cookie cannot be accessed through script in Internet Explor...
Firebug 1.2 document.cookie inconsistency with Web Developer I have a URI here in which a simple document.cookie query through the console is resulting in three cookies being displayed. I verified this with trivial code such as the following as well: var cookies = document.cookie.split(';'); console.log(cookies.length)...
TITLE: Firebug 1.2 document.cookie inconsistency with Web Developer QUESTION: I have a URI here in which a simple document.cookie query through the console is resulting in three cookies being displayed. I verified this with trivial code such as the following as well: var cookies = document.cookie.split(';'); console.l...
[ "javascript", "firebug" ]
1
1
644
2
0
2008-09-22T18:41:12.620000
2008-09-22T19:34:28.687000
116,684
116,739
What algorithm should I use to hash passwords into my database?
Is there anything available that isn't trivially breakable?
This 2008 answer is now dangerously out of date. SHA (all variants) is now trivially breakable, and best practice is now (as of Jan 2013) to use a key-stretching hash (like PBKDF2) or ideally a RAM intensive one (like Bcrypt ) and to add a per-user salt too. Points 2, 3 and 4 are still worth paying attention to. See th...
What algorithm should I use to hash passwords into my database? Is there anything available that isn't trivially breakable?
TITLE: What algorithm should I use to hash passwords into my database? QUESTION: Is there anything available that isn't trivially breakable? ANSWER: This 2008 answer is now dangerously out of date. SHA (all variants) is now trivially breakable, and best practice is now (as of Jan 2013) to use a key-stretching hash (l...
[ "security", "encryption", "passwords", "hash" ]
24
46
30,873
11
0
2008-09-22T18:41:33.713000
2008-09-22T18:51:23.313000
116,687
116,741
Problem Linking "static" Methods in C++
I want to call a few "static" methods of a CPP class defined in a different file but I'm having linking problems. I created a test-case that recreates my problem and the code for it is below. (I'm completely new to C++, I come from a Java background and I'm a little familiar with C.) // CppClass.cpp #include #include s...
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. In Java the process of defining something is usually in one piece. You declare and define at the same time. In C/C++ it's a two-step process. Declaring something tells the compiler "something exists with this type,...
Problem Linking "static" Methods in C++ I want to call a few "static" methods of a CPP class defined in a different file but I'm having linking problems. I created a test-case that recreates my problem and the code for it is below. (I'm completely new to C++, I come from a Java background and I'm a little familiar with...
TITLE: Problem Linking "static" Methods in C++ QUESTION: I want to call a few "static" methods of a CPP class defined in a different file but I'm having linking problems. I created a test-case that recreates my problem and the code for it is below. (I'm completely new to C++, I come from a Java background and I'm a li...
[ "c++", "linker", "g++" ]
7
33
16,850
5
0
2008-09-22T18:41:41.107000
2008-09-22T18:51:39.710000
116,713
117,761
Can ClickOnce deployment be used with windows mobile and compact frameworks?
Can I use the ClickOnce deployment method to deploy and auto update applications targeted for the windows mobile platform (eg smartphone or pocket pc)?
True Click-Once is not supported. You might look at these articles to give you a better feel for what can be done: MSDN Article on Deployment Patterns Alex Feinman's article on self-updating apps You can also package the app into a CAB File that you put on the web for OTA deployment. There are also a couple third-party...
Can ClickOnce deployment be used with windows mobile and compact frameworks? Can I use the ClickOnce deployment method to deploy and auto update applications targeted for the windows mobile platform (eg smartphone or pocket pc)?
TITLE: Can ClickOnce deployment be used with windows mobile and compact frameworks? QUESTION: Can I use the ClickOnce deployment method to deploy and auto update applications targeted for the windows mobile platform (eg smartphone or pocket pc)? ANSWER: True Click-Once is not supported. You might look at these articl...
[ "deployment", "windows-mobile", "compact-framework" ]
7
8
4,557
2
0
2008-09-22T18:46:25.213000
2008-09-22T21:29:19.207000
116,736
1,773,424
What Event to Trigger Javascript Form Field Validation and Formatting?
Let me first say, we validate every field on the server side, so this a question about client-side usability. What is the conventional wisdom on exactly when to validate and format html form input fields using javascript? As an example, we have a phone number field. We allow numbers, spaces, parentheses, and hyphens. W...
By far the best answer so far was not an answer but a comment (see above.) I'm adding it as an answer in case anyone misses it in the comment. See the following article on A List Apart. Inline Validation in Web Forms by Luke Wroblewski
What Event to Trigger Javascript Form Field Validation and Formatting? Let me first say, we validate every field on the server side, so this a question about client-side usability. What is the conventional wisdom on exactly when to validate and format html form input fields using javascript? As an example, we have a ph...
TITLE: What Event to Trigger Javascript Form Field Validation and Formatting? QUESTION: Let me first say, we validate every field on the server side, so this a question about client-side usability. What is the conventional wisdom on exactly when to validate and format html form input fields using javascript? As an exa...
[ "javascript", "validation", "usability" ]
11
1
5,337
9
0
2008-09-22T18:50:24.003000
2009-11-20T21:43:52.977000
116,760
116,795
Oracle: Is there a simple way to say "if null keep the current value" in merge/update statements?
I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible. Say I have a table with the following schema: MyTable Id INTEGER, Col1 VARCHAR2(100), Col2 VARCHAR2(100) I would like to write an sproc with the following PROCEDURE InsertOrUpdateMyTable(p_id in intege...
Using MERGE and COALESCE? Try this link for an example with SET a.Col1 = COALESCE(incoming.Col1, a.Col1),a.Col2 = COALESCE(incoming.Col2, a.Col2)
Oracle: Is there a simple way to say "if null keep the current value" in merge/update statements? I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible. Say I have a table with the following schema: MyTable Id INTEGER, Col1 VARCHAR2(100), Col2 VARCHAR2(100...
TITLE: Oracle: Is there a simple way to say "if null keep the current value" in merge/update statements? QUESTION: I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible. Say I have a table with the following schema: MyTable Id INTEGER, Col1 VARCHAR2(100),...
[ "sql", "oracle" ]
0
2
4,178
2
0
2008-09-22T18:56:10.947000
2008-09-22T19:01:58.717000
116,762
116,844
Best Practices: Storing a workflow state of an item in a database?
I have a question about best practices regarding how one should approach storing complex workflow states for processing tasks in a database. I've been looking online to no avail, so I figured I'd ask the community what they thought was best. This question comes out of the same "BoxItem" example I gave in a prior questi...
If I'm understanding correctly, I would add the BoxItemTasks table (just an enumeration table, right?), then a BoxItemActions table with foreign keys to BoxItems and to BoxItemTasks for what type of task it is. If you want to make it so that a particular task can only be performed once on a particular box item, just ma...
Best Practices: Storing a workflow state of an item in a database? I have a question about best practices regarding how one should approach storing complex workflow states for processing tasks in a database. I've been looking online to no avail, so I figured I'd ask the community what they thought was best. This questi...
TITLE: Best Practices: Storing a workflow state of an item in a database? QUESTION: I have a question about best practices regarding how one should approach storing complex workflow states for processing tasks in a database. I've been looking online to no avail, so I figured I'd ask the community what they thought was...
[ "database", "database-design", "refactoring", "workflow" ]
12
4
10,575
5
0
2008-09-22T18:56:12.430000
2008-09-22T19:09:05.627000
116,775
117,766
What is the best way to sort controls inside of a flowlayout panel?
I am adding custom controls to a FlowLayoutPanel. Each control has a date property. I would like to sort the controls in the flowlayoutpanel based on the date property. I can't presort the controls before I add them because it is possible for the user to add more. My current thought is when the ControlAdded event for t...
I doubt this is the best but is what I have so far: SortedList sl = new SortedList (); foreach (Control i in mainContent.Controls) { if (i.GetType().BaseType == typeof(MyBaseType)) { MyBaseType iTyped = (MyBaseType)i; sl.Add(iTyped.Date, iTyped); } } foreach (MyBaseType j in sl.Values) { j.SendToBack(); }
What is the best way to sort controls inside of a flowlayout panel? I am adding custom controls to a FlowLayoutPanel. Each control has a date property. I would like to sort the controls in the flowlayoutpanel based on the date property. I can't presort the controls before I add them because it is possible for the user ...
TITLE: What is the best way to sort controls inside of a flowlayout panel? QUESTION: I am adding custom controls to a FlowLayoutPanel. Each control has a date property. I would like to sort the controls in the flowlayoutpanel based on the date property. I can't presort the controls before I add them because it is poss...
[ "c#", ".net", "vb.net" ]
1
3
5,875
2
0
2008-09-22T18:58:41.567000
2008-09-22T21:29:35.133000
116,797
117,122
Passing int array as parameter in web user control
I have an int array as a property of a Web User Control. I'd like to set that property inline if possible using the following syntax: This will fail at runtime because it will be expecting an actual int array, but a string is being passed instead. I can make myintarray a string and parse it in the setter, but I was won...
Implement a type converter, here is one, warning: quick&dirty, not for production use, etc: public class IntArrayConverter: System.ComponentModel.TypeConverter { public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string); } public ove...
Passing int array as parameter in web user control I have an int array as a property of a Web User Control. I'd like to set that property inline if possible using the following syntax: This will fail at runtime because it will be expecting an actual int array, but a string is being passed instead. I can make myintarray...
TITLE: Passing int array as parameter in web user control QUESTION: I have an int array as a property of a Web User Control. I'd like to set that property inline if possible using the following syntax: This will fail at runtime because it will be expecting an actual int array, but a string is being passed instead. I c...
[ "asp.net", "web-user-controls" ]
24
20
9,498
11
0
2008-09-22T19:02:36.127000
2008-09-22T19:52:25.260000
116,810
116,863
Scrape multi-frame website
I'm auditing our existing web application, which makes heavy use of HTML frames. I would like to download all of the HTML in each frame, is there a method of doing this with wget or a little bit of scripting?
as an addition to Steve's answer: Span to any host—‘-H’ The ‘-H’ option turns on host spanning, thus allowing Wget's recursive run to visit any host referenced by a link. Unless sufficient recursion-limiting criteria are applied depth, these foreign hosts will typically link to yet more hosts, and so on until Wget ends...
Scrape multi-frame website I'm auditing our existing web application, which makes heavy use of HTML frames. I would like to download all of the HTML in each frame, is there a method of doing this with wget or a little bit of scripting?
TITLE: Scrape multi-frame website QUESTION: I'm auditing our existing web application, which makes heavy use of HTML frames. I would like to download all of the HTML in each frame, is there a method of doing this with wget or a little bit of scripting? ANSWER: as an addition to Steve's answer: Span to any host—‘-H’ T...
[ "html", "wget", "frames" ]
3
6
5,555
3
0
2008-09-22T19:04:38.977000
2008-09-22T19:14:23.493000
116,819
116,864
Regular Expression to exclude set of Keywords
I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords.
^(?:(?!boon\.ini|http).)*$\r?\n? (taken from RegexBuddy 's library) will match any line that does not contain boon.ini and/or http. Is that what you wanted?
Regular Expression to exclude set of Keywords I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords.
TITLE: Regular Expression to exclude set of Keywords QUESTION: I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords. ANSWER: ^(?:(?!boon\.ini|http).)*$\r?\n? (taken from RegexBuddy 's libr...
[ "regex", "regex-negation" ]
53
57
97,989
7
0
2008-09-22T19:05:50.690000
2008-09-22T19:14:24.303000
116,824
116,840
Whats the best way to get total # of records in a mysql table with php?
Whats the most efficient way of selecting total number of records from a large table? Currently, Im simply doing $result = mysql_query("SELECT id FROM table"); $total = mysql_num_rows($result) I was told this was not very efficient or fast, if you have a lot of records in the table.
You were told correctly. mysql can do this count for you which is much more efficient. $result = mysql_query( "select count(id) as num_rows from table" ); $row = mysql_fetch_object( $result ); $total = $row->num_rows;
Whats the best way to get total # of records in a mysql table with php? Whats the most efficient way of selecting total number of records from a large table? Currently, Im simply doing $result = mysql_query("SELECT id FROM table"); $total = mysql_num_rows($result) I was told this was not very efficient or fast, if you ...
TITLE: Whats the best way to get total # of records in a mysql table with php? QUESTION: Whats the most efficient way of selecting total number of records from a large table? Currently, Im simply doing $result = mysql_query("SELECT id FROM table"); $total = mysql_num_rows($result) I was told this was not very efficien...
[ "php", "mysql" ]
9
33
33,593
11
0
2008-09-22T19:06:16.103000
2008-09-22T19:08:40.747000
116,830
116,948
Is there an "anonymous" generic tag in C#, like '?' in Java?
In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this: Foo x; Is there an equivalent construct to this question-mark, in C#?
The short answer is no. There isn't an equivalent feature in C#. A workaround, from C# from a Java developer's perspective by Dare Obasanjo: In certain cases, one may need create a method that can operate on data structures containing any type as opposed to those that contain a specific type (e.g. a method to print all...
Is there an "anonymous" generic tag in C#, like '?' in Java? In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this: Foo x; Is there an equivalent construct to this question-mark, in C#?
TITLE: Is there an "anonymous" generic tag in C#, like '?' in Java? QUESTION: In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this: Foo x; Is there an equivalent construct to this question-mark, in C#? ANSWER: The short answer is no. There isn't an equivalent feature i...
[ "c#", "generics", "syntax" ]
46
40
35,535
6
0
2008-09-22T19:07:11.327000
2008-09-22T19:25:11.657000
116,846
117,313
Is there a way from preventing other ReportViewers on the same webpage from refreshing?
Currently I am working on a web page that has six ReportViewer controls that are using remote processing and that allow for drill-down. When a user clicks on one control the entire page refreshes and the other five reports all refresh as well. Users are currently requesting that the refreshing of the other controls be ...
I have been doing some more research on this issue and it looks like the AsyncRendering property of the ReportViewer control controls the functionality that I'm looking for. When it is set to "false" it prevents the "Report is Being Generated" message from being displayed which is what the users were commenting on. The...
Is there a way from preventing other ReportViewers on the same webpage from refreshing? Currently I am working on a web page that has six ReportViewer controls that are using remote processing and that allow for drill-down. When a user clicks on one control the entire page refreshes and the other five reports all refre...
TITLE: Is there a way from preventing other ReportViewers on the same webpage from refreshing? QUESTION: Currently I am working on a web page that has six ReportViewer controls that are using remote processing and that allow for drill-down. When a user clicks on one control the entire page refreshes and the other five...
[ "asp.net", "reporting-services", "reportviewer" ]
1
1
788
1
0
2008-09-22T19:09:25.783000
2008-09-22T20:15:43.877000
116,854
116,889
Getting started with rails? Must have gems?
I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book. Anyway, my question is a bit more pointed than how do I get started... What are some of the must have gems that everyone uses? I need basic authentication, so I have the rest...
The gems and plugins that I tend to use on most of my projects are: Restful Authentication -- For authentication Will Paginate -- For pagination Attachment Fu -- For image and file attachments RedCloth -- For textile rendering Capistrano -- For deployment
Getting started with rails? Must have gems? I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book. Anyway, my question is a bit more pointed than how do I get started... What are some of the must have gems that everyone uses? I n...
TITLE: Getting started with rails? Must have gems? QUESTION: I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book. Anyway, my question is a bit more pointed than how do I get started... What are some of the must have gems that ...
[ "ruby-on-rails", "ruby", "rubygems" ]
14
11
3,461
10
0
2008-09-22T19:12:11.847000
2008-09-22T19:17:31.270000
116,865
1,981,811
What’s the current state of closures in Java?
Does anybody know, if closures will be in Java 7?
At Devoxx 2008, Mark Reinhold made it clear that closures will not be included in Java 7. Wait! Closures will be included in Java 7. Mark Reinhold announced this reversal at Devoxx 2009. Belay that! Closures ( lambda expressions ) have been deferred until Java 8. Follow Project Lambda (JSR 335) for more information.
What’s the current state of closures in Java? Does anybody know, if closures will be in Java 7?
TITLE: What’s the current state of closures in Java? QUESTION: Does anybody know, if closures will be in Java 7? ANSWER: At Devoxx 2008, Mark Reinhold made it clear that closures will not be included in Java 7. Wait! Closures will be included in Java 7. Mark Reinhold announced this reversal at Devoxx 2009. Belay that...
[ "java", "closures" ]
19
13
2,904
6
0
2008-09-22T19:14:28.407000
2009-12-30T18:56:29.023000
116,869
116,929
Pulling in a dynamic image in a control based on a url using C# and ASP.net
I know this is a dumb question. For some reason my mind is blank on this. Any ideas? Sorry should have been more clear. Using a HtmlGenericControl to pull in link description as well as image. private void InternalCreateChildControls() { if (this.DataItem!= null && this.Relationships.Count > 0) { HtmlGenericControl fie...
I'm assuming you want to generate an image dynamicly based upon an url. What I typically do is a create a very lightweight HTTPHandler to serve the images: using System; using System.Web; namespace Example { public class GetImage: IHttpHandler { public void ProcessRequest(HttpContext context) { if (context.Request.Qu...
Pulling in a dynamic image in a control based on a url using C# and ASP.net I know this is a dumb question. For some reason my mind is blank on this. Any ideas? Sorry should have been more clear. Using a HtmlGenericControl to pull in link description as well as image. private void InternalCreateChildControls() { if (th...
TITLE: Pulling in a dynamic image in a control based on a url using C# and ASP.net QUESTION: I know this is a dumb question. For some reason my mind is blank on this. Any ideas? Sorry should have been more clear. Using a HtmlGenericControl to pull in link description as well as image. private void InternalCreateChildC...
[ "asp.net", "image", "dynamic" ]
0
2
2,169
3
0
2008-09-22T19:14:55.007000
2008-09-22T19:22:29.450000
116,876
117,088
How do you set directory permissions in NSIS?
I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to have...
Use the AccessControl plugin and then add this to the script, where the "logs" directory is in the install directory. AccessControl::GrantOnFile "$INSTDIR\logs" "(BU)" "FullAccess" That gives full access to the folder for all users.
How do you set directory permissions in NSIS? I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify...
TITLE: How do you set directory permissions in NSIS? QUESTION: I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users...
[ "windows", "installation", "permissions", "nsis" ]
39
38
27,283
6
0
2008-09-22T19:15:37.407000
2008-09-22T19:47:19.827000
116,887
117,289
Rails Tests Fail With Sqlite3
I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error: SQLite3::SQLException: cannot rollback - no transaction is active This error is crippling my ability to test my...
Check http://dev.rubyonrails.org/ticket/4403 which shows a workaround. Could that be the problem you are encountering?
Rails Tests Fail With Sqlite3 I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error: SQLite3::SQLException: cannot rollback - no transaction is active This error is c...
TITLE: Rails Tests Fail With Sqlite3 QUESTION: I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error: SQLite3::SQLException: cannot rollback - no transaction is acti...
[ "ruby-on-rails", "ruby" ]
3
1
2,479
4
0
2008-09-22T19:17:19.150000
2008-09-22T20:11:21
116,888
121,432
Like in CASE statement not evaluating as expected
Given this data: CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH' ELSE 'XXX' END AS newField FROM tmpTable The expected resultset is: XXX XXX ...
Check your service pack. After upgrading my SQL 2000 box to SP4 I now get the correct values for your situation. I'm still getting the swapped data that I reported in my earlier post though:( If you do SELECT @@version you should get 8.00.2039. Any version number less than that and you should install SP4.
Like in CASE statement not evaluating as expected Given this data: CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH' ELSE 'XXX' END AS newField...
TITLE: Like in CASE statement not evaluating as expected QUESTION: Given this data: CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH' ELSE 'XX...
[ "sql", "sql-server" ]
1
1
14,194
9
0
2008-09-22T19:17:22.207000
2008-09-23T14:38:48.267000
116,894
117,994
Best practices for manipulating database result sets in Python?
I am writing a simple Python web application that consists of several pages of business data formatted for the iPhone. I'm comfortable programming Python, but I'm not very familiar with Python "idiom," especially regarding classes and objects. Python's object oriented design differs somewhat from other languages I've w...
The empty Record class and the free-floating function that (generally) applies to an individual Record is a hint that you haven't designed your class properly. class Record( object ): """Assuming rtda and pnl must exist.""" def __init__( self ): self.da= 0 self.rt= 0 self.rtda= 0 # or whatever self.pnl= None # self.sin...
Best practices for manipulating database result sets in Python? I am writing a simple Python web application that consists of several pages of business data formatted for the iPhone. I'm comfortable programming Python, but I'm not very familiar with Python "idiom," especially regarding classes and objects. Python's obj...
TITLE: Best practices for manipulating database result sets in Python? QUESTION: I am writing a simple Python web application that consists of several pages of business data formatted for the iPhone. I'm comfortable programming Python, but I'm not very familiar with Python "idiom," especially regarding classes and obj...
[ "python", "database" ]
6
2
3,985
4
0
2008-09-22T19:18:21.440000
2008-09-22T22:23:44.787000
116,896
116,934
Visual Studio: How to break on handled exceptions?
I would like Visual Studio to break when a handled exception happens (i.e. I don't just want to see a "First chance" message, I want to debug the actual exception). e.g. I want the debugger to break at the exception: try { System.IO.File.Delete(someFilename); } catch (Exception) { //we really don't care at runtime if t...
With a solution open, go to the Debug - Windows - Exception Settings ( Ctrl + Alt + E ) menu option. From there you can choose to break on Thrown or User-unhandled exceptions. EDIT: My instance is set up with the C# "profile" perhaps it isn't there for other profiles?
Visual Studio: How to break on handled exceptions? I would like Visual Studio to break when a handled exception happens (i.e. I don't just want to see a "First chance" message, I want to debug the actual exception). e.g. I want the debugger to break at the exception: try { System.IO.File.Delete(someFilename); } catch (...
TITLE: Visual Studio: How to break on handled exceptions? QUESTION: I would like Visual Studio to break when a handled exception happens (i.e. I don't just want to see a "First chance" message, I want to debug the actual exception). e.g. I want the debugger to break at the exception: try { System.IO.File.Delete(someFi...
[ "visual-studio", "exception", "debugging" ]
231
219
187,531
8
0
2008-09-22T19:18:24.483000
2008-09-22T19:23:11.553000
116,905
116,920
What must I do to ensure that a web server (Apache) running on a machine is not accessible to the outside world?
I would like to use my laptop as a web development (PHP, Python, etc.) machine, but I'm hesitant to do this unless I can ensure that it can not be accessed by the outside world. I'm guessing that something more than a firewall is necessary, such as configurations to the Apache configuration files, but I'm not sure what...
You need to configure the server daemon to only bind to localhost using the Listen directive like this: Listen 127.0.0.1 An alternative is to configure access control for the main server like this AllowOverride None Deny from all Allow from 127.0.0.1/255.0.0.0 Remember to put the root directory of your server in the Di...
What must I do to ensure that a web server (Apache) running on a machine is not accessible to the outside world? I would like to use my laptop as a web development (PHP, Python, etc.) machine, but I'm hesitant to do this unless I can ensure that it can not be accessed by the outside world. I'm guessing that something m...
TITLE: What must I do to ensure that a web server (Apache) running on a machine is not accessible to the outside world? QUESTION: I would like to use my laptop as a web development (PHP, Python, etc.) machine, but I'm hesitant to do this unless I can ensure that it can not be accessed by the outside world. I'm guessin...
[ "webserver", "development-environment" ]
1
4
394
7
0
2008-09-22T19:19:54.697000
2008-09-22T19:21:44.990000
116,907
116,971
How to use Decision Tables to help your application
I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that you need one more "else if" statement. But I am not sure how I can impl...
I would highly recommend chapter 18 of Code Complete. You could also check this post What Are Table Driven Methods
How to use Decision Tables to help your application I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that you need one more "...
TITLE: How to use Decision Tables to help your application QUESTION: I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that y...
[ "table-driven" ]
7
1
6,137
5
0
2008-09-22T19:20:11.390000
2008-09-22T19:30:06.920000
116,938
117,123
Trouble running insert queries with varray variables
I'm using SQL*Plus 9.2 on Oracle 10g enterprise. I have created some scripts that do basic inserts using parameters that I pass through the command prompt. It seemed logical that I should be able to run a bunch of inserts in a loop. So I tried the following: --begin DECLARE TYPE va_orgs IS TABLE OF nbr.lien_item.lien...
In your insert statement you have org(i) in single quotes. You shouldn't have that, you are probably inserting the words org(i) as values into the table. So your insert statement should be INSERT INTO nbr.lien_item (lien_item_sid, excel_row, include_in_calcs, indent, header_level, sort_order, unit, lien_item_status, li...
Trouble running insert queries with varray variables I'm using SQL*Plus 9.2 on Oracle 10g enterprise. I have created some scripts that do basic inserts using parameters that I pass through the command prompt. It seemed logical that I should be able to run a bunch of inserts in a loop. So I tried the following: --begin ...
TITLE: Trouble running insert queries with varray variables QUESTION: I'm using SQL*Plus 9.2 on Oracle 10g enterprise. I have created some scripts that do basic inserts using parameters that I pass through the command prompt. It seemed logical that I should be able to run a bunch of inserts in a loop. So I tried the f...
[ "sql", "oracle", "plsql" ]
0
0
256
1
0
2008-09-22T19:23:42.847000
2008-09-22T19:52:29.377000
116,945
122,796
What happens to my app when my Mac goes to sleep?
When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process? I suppose non-windowed processes are simply suspended at an arbitrary point of execution. Is that also true for Cocoa apps, or does the OS wait until control returns to the run loop d...
Your app is interrupted exactly where it is that moment if the CPU is actually currently executing code of your app. Your app constantly gets execution time by the task scheduler, that decides which app gets CPU time, on which core, and for how long. Once the system really goes to sleep, the scheduler simply gives no t...
What happens to my app when my Mac goes to sleep? When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process? I suppose non-windowed processes are simply suspended at an arbitrary point of execution. Is that also true for Cocoa apps, or does t...
TITLE: What happens to my app when my Mac goes to sleep? QUESTION: When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process? I suppose non-windowed processes are simply suspended at an arbitrary point of execution. Is that also true for Coc...
[ "macos", "sleep", "process-management" ]
18
23
8,376
5
0
2008-09-22T19:24:21.973000
2008-09-23T18:24:36.677000
116,947
117,076
What is the semantic web, and why would I want to use it?
Just like it reads.
The simplest and shortest explanation that I have found is: "The Semantic Web is to Machines what the World Wide Web is to Humans". And as to why you would want that: for the same reasons why you let your Machine compute Pi to the quadrillionth digit instead of doing that yourself. So you can focus on interesting probl...
What is the semantic web, and why would I want to use it? Just like it reads.
TITLE: What is the semantic web, and why would I want to use it? QUESTION: Just like it reads. ANSWER: The simplest and shortest explanation that I have found is: "The Semantic Web is to Machines what the World Wide Web is to Humans". And as to why you would want that: for the same reasons why you let your Machine co...
[ "language-agnostic", "semantic-web" ]
1
3
300
3
0
2008-09-22T19:24:32.423000
2008-09-22T19:45:42.233000
116,957
122,082
Which Layout Manager do you use?
What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones.
MiGLayout is the GUI layout manager which is widely used by Java Developers.
Which Layout Manager do you use? What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones.
TITLE: Which Layout Manager do you use? QUESTION: What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones. ANSWER: MiGLayout is the GUI layout manager which is w...
[ "java", "swing", "layout" ]
18
17
5,843
22
0
2008-09-22T19:27:47.893000
2008-09-23T16:22:50.277000
116,963
1,360,090
Are there any online user group meetings?
I must admit that I am incredibly jealous of those developers who happen to live near active user groups (e.g. the ALT.NET guys in Austin). I often read blog posts and listen to podcasts that reference these in-person meetings and find myself wishing that I could sit in and participate as well. But it just isn't realis...
I haven't had a chance to check it out, but the Virtual ALT.NET group sounds promising.
Are there any online user group meetings? I must admit that I am incredibly jealous of those developers who happen to live near active user groups (e.g. the ALT.NET guys in Austin). I often read blog posts and listen to podcasts that reference these in-person meetings and find myself wishing that I could sit in and par...
TITLE: Are there any online user group meetings? QUESTION: I must admit that I am incredibly jealous of those developers who happen to live near active user groups (e.g. the ALT.NET guys in Austin). I often read blog posts and listen to podcasts that reference these in-person meetings and find myself wishing that I co...
[ "usergroups" ]
3
0
117
2
0
2008-09-22T19:29:12.803000
2009-09-01T00:52:55.050000
116,965
117,004
How to show that you understand the requirements of the project
How do you show your clients/employers that you understood their requirements? What do you recommend to use? Use-Case diagrams? Flow-Charts? Data-Flow-Diagrams? Decision Trees? I'm not really asking for a very detailed answer. Just something simple to help me communicate with the person who wrote the requirements and t...
I usually put together a PowerPoint deck fairly early in a project, giving a high-level overview of the project, along with some architectural diagrams (the simpler the better) and screen mockups/wireframes. Then I have a "kick-off" meeting for requirements review, and talk through the business problem and proposed sol...
How to show that you understand the requirements of the project How do you show your clients/employers that you understood their requirements? What do you recommend to use? Use-Case diagrams? Flow-Charts? Data-Flow-Diagrams? Decision Trees? I'm not really asking for a very detailed answer. Just something simple to help...
TITLE: How to show that you understand the requirements of the project QUESTION: How do you show your clients/employers that you understood their requirements? What do you recommend to use? Use-Case diagrams? Flow-Charts? Data-Flow-Diagrams? Decision Trees? I'm not really asking for a very detailed answer. Just someth...
[ "project-management" ]
5
8
5,894
7
0
2008-09-22T19:29:33.067000
2008-09-22T19:35:25.487000
116,967
116,990
IMG SRC tags and JavaScript
Is it possible to call a JavaScript function from the IMG SRC tag to get an image url? Like this: This is using.NET 2.0.
Nope. It's not possible, at least not in all browsers. You can do something like this instead: Your favourite JavaScript framework will provide nicer ways:)
IMG SRC tags and JavaScript Is it possible to call a JavaScript function from the IMG SRC tag to get an image url? Like this: This is using.NET 2.0.
TITLE: IMG SRC tags and JavaScript QUESTION: Is it possible to call a JavaScript function from the IMG SRC tag to get an image url? Like this: This is using.NET 2.0. ANSWER: Nope. It's not possible, at least not in all browsers. You can do something like this instead: Your favourite JavaScript framework will provide ...
[ "javascript", "asp.net", "image" ]
11
20
95,203
14
0
2008-09-22T19:29:37.577000
2008-09-22T19:33:00.033000
116,968
118,167
In SQL Server 2005, can I do a cascade delete without setting the property on my tables?
I have a database full of customer data. It's so big that it's really cumbersome to operate on, and I'd rather just slim it down to 10% of the customers, which is plenty for development. I have an awful lot of tables and I don't want to alter them all with "ON DELETE CASCADE", especially because this is a one-time deal...
Combining your advice and a script I found online, I made a procedure that will produce SQL you can run to perform a cascaded delete regardless of ON DELETE CASCADE. It was probably a big waste of time, but I had a good time writing it. An advantage of doing it this way is, you can put a GO statement between each line,...
In SQL Server 2005, can I do a cascade delete without setting the property on my tables? I have a database full of customer data. It's so big that it's really cumbersome to operate on, and I'd rather just slim it down to 10% of the customers, which is plenty for development. I have an awful lot of tables and I don't wa...
TITLE: In SQL Server 2005, can I do a cascade delete without setting the property on my tables? QUESTION: I have a database full of customer data. It's so big that it's really cumbersome to operate on, and I'd rather just slim it down to 10% of the customers, which is plenty for development. I have an awful lot of tab...
[ "sql-server", "sql-server-2005", "cascade" ]
39
58
43,468
13
0
2008-09-22T19:29:53.473000
2008-09-22T23:10:43.737000
116,978
1,621,768
Can anyone recommend a simple Java web-app framework?
I'm trying to get started on what I'm hoping will be a relatively quick web application in Java, yet most of the frameworks I've tried (Apache Wicket, Liftweb) require so much set-up, configuration, and trying to wrap my head around Maven while getting the whole thing to play nice with Eclipse, that I spent the whole w...
Haven't tried it myself, but I think http://www.playframework.org/ has a lot of potential... coming from php and classic asp, it's the first java web framework that sounds promising to me.... Edit by original question asker - 2011-06-09 Just wanted to provide an update. I went with Play and it was exactly what I asked ...
Can anyone recommend a simple Java web-app framework? I'm trying to get started on what I'm hoping will be a relatively quick web application in Java, yet most of the frameworks I've tried (Apache Wicket, Liftweb) require so much set-up, configuration, and trying to wrap my head around Maven while getting the whole thi...
TITLE: Can anyone recommend a simple Java web-app framework? QUESTION: I'm trying to get started on what I'm hoping will be a relatively quick web application in Java, yet most of the frameworks I've tried (Apache Wicket, Liftweb) require so much set-up, configuration, and trying to wrap my head around Maven while get...
[ "java", "web-frameworks" ]
65
50
183,115
33
0
2008-09-22T19:30:59.677000
2009-10-25T19:15:57.547000
116,988
116,993
Do C# Generics Have a Performance Benefit?
I have a number of data classes representing various entities. Which is better: writing a generic class (say, to print or output XML) using generics and interfaces, or writing a separate class to deal with each data class? Is there a performance benefit or any other benefit (other than it saving me the time of writing ...
There's a significant performance benefit to using generics -- you do away with boxing and unboxing. Compared with developing your own classes, it's a coin toss (with one side of the coin weighted more than the other). Roll your own only if you think you can out-perform the authors of the framework.
Do C# Generics Have a Performance Benefit? I have a number of data classes representing various entities. Which is better: writing a generic class (say, to print or output XML) using generics and interfaces, or writing a separate class to deal with each data class? Is there a performance benefit or any other benefit (o...
TITLE: Do C# Generics Have a Performance Benefit? QUESTION: I have a number of data classes representing various entities. Which is better: writing a generic class (say, to print or output XML) using generics and interfaces, or writing a separate class to deal with each data class? Is there a performance benefit or an...
[ "c#", ".net", "performance", "generics" ]
42
62
23,801
12
0
2008-09-22T19:32:52.637000
2008-09-22T19:33:42.090000
116,992
117,045
Is there an equivalent to the XNA framework for consoles other than XBox360?
It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out.
No, all of the major consoles, except for the Xbox 360, do not have open development environments. There are various homebrew kits you can get, but these aren't sanctioned by the console makers (Nintendo, Sony, and Microsoft), so at best, you'll only be able to give away ROMs of what you make for free. If you try to se...
Is there an equivalent to the XNA framework for consoles other than XBox360? It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out.
TITLE: Is there an equivalent to the XNA framework for consoles other than XBox360? QUESTION: It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out. ANSWER: No, all of the major consoles, except for the Xbox 360, do no...
[ "xna" ]
7
3
1,092
9
0
2008-09-22T19:33:23.650000
2008-09-22T19:41:50.883000
117,006
642,182
Prevent people from pushing a git commit with a different author name?
In git, it is up to each user to specify the correct author in their local git config file. When they push to a centralized bare repository, the commit messages on the repository will have the author names that they used when committing to their own repository. Is there a way enforce that a set of known authors for com...
We use the following to prevent accidental unknown-author commits (for example when doing a fast commit from a customer's server or something). It should be placed in.git/hooks/pre-receive and made executable. #!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess from itertools import islice, izip import sys ...
Prevent people from pushing a git commit with a different author name? In git, it is up to each user to specify the correct author in their local git config file. When they push to a centralized bare repository, the commit messages on the repository will have the author names that they used when committing to their own...
TITLE: Prevent people from pushing a git commit with a different author name? QUESTION: In git, it is up to each user to specify the correct author in their local git config file. When they push to a centralized bare repository, the commit messages on the repository will have the author names that they used when commi...
[ "git" ]
26
10
11,145
6
0
2008-09-22T19:35:43.770000
2009-03-13T11:03:45.127000
117,007
117,217
How best to test the validity of XML from a method?
I have some WCF methods that are used to transmit information from a server application to a website frontend for use in binding. I'm sending the result as an XElement that is a root of an XML tree containing the data I want to bind against. I'd like to create some tests that examine the data and ensure it comes across...
Id say validating xml with a xsd schema is a good idea. How to validate a XElement with the loaded schema: As you see in this example you need to validate the XDocument first to get populate the "post-schema-validation infoset" (There might be a solution to do this without using the Validate method on the XDOcument but...
How best to test the validity of XML from a method? I have some WCF methods that are used to transmit information from a server application to a website frontend for use in binding. I'm sending the result as an XElement that is a root of an XML tree containing the data I want to bind against. I'd like to create some te...
TITLE: How best to test the validity of XML from a method? QUESTION: I have some WCF methods that are used to transmit information from a server application to a website frontend for use in binding. I'm sending the result as an XElement that is a root of an XML tree containing the data I want to bind against. I'd like...
[ "c#", ".net", "xml", "unit-testing", "xsd" ]
5
11
8,450
2
0
2008-09-22T19:35:44.410000
2008-09-22T20:02:58.807000
117,043
180,361
What is the best way for a Java program to monitor system health?
I would like to be able to monitor my major system health indicators from inside our Java-based system. Major points of interest include CPU temperature, motherboard temperature, fan speed, etc. Is there a package available that: Makes this sort of data available to Java? Works on Windows or Linux or both? Is open / fr...
There are MIBs supported by both Windows and Linux that expose the parameters you are looking for via SNMP. Also, most major vendors have special MIBs published for their server hardware. I have implemented SNMP MIBs and monitoring for Java applications using the commercial iReasoning SNMP API and they worked great. Th...
What is the best way for a Java program to monitor system health? I would like to be able to monitor my major system health indicators from inside our Java-based system. Major points of interest include CPU temperature, motherboard temperature, fan speed, etc. Is there a package available that: Makes this sort of data ...
TITLE: What is the best way for a Java program to monitor system health? QUESTION: I would like to be able to monitor my major system health indicators from inside our Java-based system. Major points of interest include CPU temperature, motherboard temperature, fan speed, etc. Is there a package available that: Makes ...
[ "java", "system-monitoring" ]
9
4
13,186
4
0
2008-09-22T19:40:58.827000
2008-10-07T20:51:27.223000
117,055
117,752
Licensing and using the Linux kernel
I would like to write my own OS, and would like to temporarily jump over the complicated task of writing the kernel and come back to it later by using the Linux kernel in the mean time. However, I would like to provide the OS as closed source for now. What license is the Linux kernel under and is it possible to use it ...
You can of course write whatever closed-source OS over the Linux kernel that you like provided you are compatible with the licensing of components you link against. Of course that's likely to include the gnu C library (or some other C library). You may also need some command line utilities which will probably be GPL to...
Licensing and using the Linux kernel I would like to write my own OS, and would like to temporarily jump over the complicated task of writing the kernel and come back to it later by using the Linux kernel in the mean time. However, I would like to provide the OS as closed source for now. What license is the Linux kerne...
TITLE: Licensing and using the Linux kernel QUESTION: I would like to write my own OS, and would like to temporarily jump over the complicated task of writing the kernel and come back to it later by using the Linux kernel in the mean time. However, I would like to provide the OS as closed source for now. What license ...
[ "linux", "licensing", "operating-system", "kernel" ]
4
10
5,714
12
0
2008-09-22T19:43:25.250000
2008-09-22T21:27:33.440000
117,059
117,093
ASP.NET Master Page in separate assembly
I have some ASP.NET Master Pages located in one assembly. I need to use these Master Pages with my WebForm pages located in other assemblies that have a reference to the first assembly. I cannot seem to figure out a way to do this. Is there a nice way that I can do this? If no pretty solution exists I would also like t...
Master Pages are based upon Usercontrols, therefore they cannot be shared across applications. That said, Dan Wahlin has a way around that particular limitation listed on his blog.
ASP.NET Master Page in separate assembly I have some ASP.NET Master Pages located in one assembly. I need to use these Master Pages with my WebForm pages located in other assemblies that have a reference to the first assembly. I cannot seem to figure out a way to do this. Is there a nice way that I can do this? If no p...
TITLE: ASP.NET Master Page in separate assembly QUESTION: I have some ASP.NET Master Pages located in one assembly. I need to use these Master Pages with my WebForm pages located in other assemblies that have a reference to the first assembly. I cannot seem to figure out a way to do this. Is there a nice way that I ca...
[ "asp.net", "master-pages" ]
2
6
2,867
3
0
2008-09-22T19:44:04.733000
2008-09-22T19:48:14.317000
117,083
117,319
Error Message Text - Best Practices
We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista).
In terms of wording your error messages, I recommend referring to the following style guides for Windows applications: Windows user experience guidelines, and specifically the section on error messages here. Microsoft Manual of Style
Error Message Text - Best Practices We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista).
TITLE: Error Message Text - Best Practices QUESTION: We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista). ANSWER: In terms of wording your error messages, I recommend referring to the ...
[ "user-interface", "error-handling", "usability" ]
12
6
9,268
12
0
2008-09-22T19:46:40.110000
2008-09-22T20:17:00.317000
117,101
117,154
What is the best way to generate and print invoices in a .NET application?
I'm working on a billing system for a utility company, and we have the following requirements: Batch-generate and print approximately 1,500 bills per day that we then mail to customers Save the bill in a format that can emailed to the customer and also archived (probably PDF) Built with.NET with MS SQL Server database ...
If you are using a SQL Server backend, Reporting Services should work for you. Otherwise I would recommend a third-party report generator that fits your reporting needs and create an app that uses it to create & export the reports.
What is the best way to generate and print invoices in a .NET application? I'm working on a billing system for a utility company, and we have the following requirements: Batch-generate and print approximately 1,500 bills per day that we then mail to customers Save the bill in a format that can emailed to the customer a...
TITLE: What is the best way to generate and print invoices in a .NET application? QUESTION: I'm working on a billing system for a utility company, and we have the following requirements: Batch-generate and print approximately 1,500 bills per day that we then mail to customers Save the bill in a format that can emailed...
[ ".net", "wpf", "printing" ]
5
3
4,492
8
0
2008-09-22T19:49:36.497000
2008-09-22T19:55:59.307000
117,108
117,177
How to improve performance writing to the database?
We log values and we only log them once in a table. When we add values to the table we have to do a look up everytime to see if it needs to insert the value or just grab the id. We have an index on the table (not on the primary key) but there are about 350,000 rows (so it is taking 10 seconds to do 10 of these values)....
How frequently do you write to the table vs. reading from it. If you have frequent writes and occasional reads, consider just always doing inserts and then handle collapsing the values when doing a select. If you're trying to put everything in one table, consider breaking them out into separate tables to cut down on si...
How to improve performance writing to the database? We log values and we only log them once in a table. When we add values to the table we have to do a look up everytime to see if it needs to insert the value or just grab the id. We have an index on the table (not on the primary key) but there are about 350,000 rows (s...
TITLE: How to improve performance writing to the database? QUESTION: We log values and we only log them once in a table. When we add values to the table we have to do a look up everytime to see if it needs to insert the value or just grab the id. We have an index on the table (not on the primary key) but there are abo...
[ ".net", "sql-server", "database", "performance" ]
1
1
2,287
10
0
2008-09-22T19:50:18.977000
2008-09-22T19:58:25.243000
117,110
117,145
When have we any practical use for hierarchical namespaces in c++?
I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception?
Hierarchical namespaces do have a use in that they allow progressively more refined definitions. Certainly a single provider may produce two classes with the same name. Often the first level is occupied by the company name, the second specifies the product, the third (and possibly more) my provide the domain. There are...
When have we any practical use for hierarchical namespaces in c++? I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception?
TITLE: When have we any practical use for hierarchical namespaces in c++? QUESTION: I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception? ANSWER: Hierarchical namespaces do have a use in that they allow progr...
[ "c++", "namespaces" ]
4
9
1,629
9
0
2008-09-22T19:50:34.263000
2008-09-22T19:55:17.107000
117,127
117,433
What is the scope for imported classes in python?
Please excuse the vague title. If anyone has a suggestion, please let me know! Also please retag with more appropriate tags! The Problem I want to have an instance of an imported class be able to view things in the scope (globals, locals) of the importer. Since I'm not sure of the exact mechanism at work here, I can de...
In this example, you can simply hand over functions as objects to the methods in C1: >>> class C1(object): >>> def eval(self, x): >>> x() >>> >>> def f2(): print "go f2" >>> c = C1() >>> c.eval(f2) go f2 In Python, you can pass functions and classes to other methods and invoke/create them there. If you want to actually...
What is the scope for imported classes in python? Please excuse the vague title. If anyone has a suggestion, please let me know! Also please retag with more appropriate tags! The Problem I want to have an instance of an imported class be able to view things in the scope (globals, locals) of the importer. Since I'm not ...
TITLE: What is the scope for imported classes in python? QUESTION: Please excuse the vague title. If anyone has a suggestion, please let me know! Also please retag with more appropriate tags! The Problem I want to have an instance of an imported class be able to view things in the scope (globals, locals) of the import...
[ "python", "import", "scope", "eval" ]
2
2
1,339
2
0
2008-09-22T19:52:44.960000
2008-09-22T20:32:17.863000
117,135
117,206
Resources that have to be manually cleaned up in C#?
What resources have to be manually cleaned up in C# and what are the consequences of not doing so? For example, say I have the following code: myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); // Use Brush If I don't clean up the brush using the dispose method, I'm assuming the garbage collector free...
Technically anything that inherits from IDisposable should be proactively disposed. You can use the 'using' statement to make things easier. http://msdn.microsoft.com/en-us/library/yh598w02.aspx Sometimes you will see inconsistent use of IDisposable derived objects in documentation sample code as well as code that is g...
Resources that have to be manually cleaned up in C#? What resources have to be manually cleaned up in C# and what are the consequences of not doing so? For example, say I have the following code: myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); // Use Brush If I don't clean up the brush using the di...
TITLE: Resources that have to be manually cleaned up in C#? QUESTION: What resources have to be manually cleaned up in C# and what are the consequences of not doing so? For example, say I have the following code: myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); // Use Brush If I don't clean up the ...
[ "c#", "memory-management", "resources", "garbage-collection" ]
11
1
2,618
14
0
2008-09-22T19:54:04.473000
2008-09-22T20:01:48.387000
117,141
121,245
Ruby and WS-Security
I'm having troubles finding good Ruby libraries that implement WS-Security. I've seen wss4r but have yet to use it (and the documentation is a bit light on it). What libraries do you use for this task, or is there a better alternative?
I don't work with soap much myself, but this ruby extension is on my list of things to try: here. Might want to check it out.
Ruby and WS-Security I'm having troubles finding good Ruby libraries that implement WS-Security. I've seen wss4r but have yet to use it (and the documentation is a bit light on it). What libraries do you use for this task, or is there a better alternative?
TITLE: Ruby and WS-Security QUESTION: I'm having troubles finding good Ruby libraries that implement WS-Security. I've seen wss4r but have yet to use it (and the documentation is a bit light on it). What libraries do you use for this task, or is there a better alternative? ANSWER: I don't work with soap much myself, ...
[ "ruby", "soap", "ws-security" ]
5
1
1,838
1
0
2008-09-22T19:54:55.237000
2008-09-23T14:13:47.577000
117,150
117,221
Can I (re)map Ex commands in vim?
I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing:WQ instead of:wq. (On a German keyboard, you have to press Shift to get the colon:.) Vim will then complain that WQ is Not an editor command. Is there some way to make W and Q editor commands?
Try:command WQ wq:command Wq wq:command W w:command Q q This way you can define your own commands. See:help command for more information.
Can I (re)map Ex commands in vim? I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing:WQ instead of:wq. (On a German keyboard, you have to press Shift to get the colon:.) Vim will then complain that WQ is Not an editor command. Is there some way to make W and Q editor...
TITLE: Can I (re)map Ex commands in vim? QUESTION: I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing:WQ instead of:wq. (On a German keyboard, you have to press Shift to get the colon:.) Vim will then complain that WQ is Not an editor command. Is there some way to m...
[ "vim" ]
75
88
27,469
3
0
2008-09-22T19:55:40.663000
2008-09-22T20:03:38.040000
117,167
117,201
Python and POST data
In PHP I simply write: $bob = $_POST['bob']; How do I do the same in Python? And yes, I do normally check that it exists etc, I'm just stripping it down specifically to the functionality I am after. Edit: I am not using a framework
The simplest method is the 'cgi' module: import cgi data = cgi.FieldStorage() data['bob'] But the context you are executing in (frameworks you're using, WSGI or even (heaven forbid) mod_python) may have different, more efficient or more direct methods of access.
Python and POST data In PHP I simply write: $bob = $_POST['bob']; How do I do the same in Python? And yes, I do normally check that it exists etc, I'm just stripping it down specifically to the functionality I am after. Edit: I am not using a framework
TITLE: Python and POST data QUESTION: In PHP I simply write: $bob = $_POST['bob']; How do I do the same in Python? And yes, I do normally check that it exists etc, I'm just stripping it down specifically to the functionality I am after. Edit: I am not using a framework ANSWER: The simplest method is the 'cgi' module:...
[ "python", "http", "post" ]
5
10
5,652
1
0
2008-09-22T19:57:37.413000
2008-09-22T20:01:12.727000
117,171
117,224
Design by contract using assertions or exceptions?
When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on its responsibilities, right? The two most prominent ways to do these checks are by assert and by exception. assert fails only in debug mode. To make sure it is crucial to (unit) test all se...
Disabling assert in release builds is like saying "I will never have any issues whatsoever in a release build", which is often not the case. So assert shouldn't be disabled in a release build. But you don't want the release build crashing whenever errors occur either, do you? So use exceptions and use them well. Use a ...
Design by contract using assertions or exceptions? When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on its responsibilities, right? The two most prominent ways to do these checks are by assert and by exception. assert fails only in debug mod...
TITLE: Design by contract using assertions or exceptions? QUESTION: When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on its responsibilities, right? The two most prominent ways to do these checks are by assert and by exception. assert fails...
[ "exception", "assert", "design-by-contract" ]
133
39
27,229
14
0
2008-09-22T19:57:57.930000
2008-09-22T20:03:41.533000
117,173
117,888
Try-catch every line of code without individual try-catch blocks
I do not currently have this issue, but you never know, and thought experiments are always fun. Ignoring the obvious problems that you would have to have with your architecture to even be attempting this, let's assume that you had some horribly-written code of someone else's design, and you needed to do a bunch of wide...
It's pretty obvious that you'd write the code in VB.NET, which actually does have On Error Resume Next, and export it in a DLL to C#. Anything else is just being a glutton for punishment.
Try-catch every line of code without individual try-catch blocks I do not currently have this issue, but you never know, and thought experiments are always fun. Ignoring the obvious problems that you would have to have with your architecture to even be attempting this, let's assume that you had some horribly-written co...
TITLE: Try-catch every line of code without individual try-catch blocks QUESTION: I do not currently have this issue, but you never know, and thought experiments are always fun. Ignoring the obvious problems that you would have to have with your architecture to even be attempting this, let's assume that you had some h...
[ "c#", "try-catch", "expression-trees" ]
15
12
21,854
20
0
2008-09-22T19:58:00.567000
2008-09-22T21:54:04.453000
117,189
117,246
Seam/JSF form submit firing button onclick event
I have a search form with a query builder. The builder is activated by a button. Something like this Open Builder The result is HTML that has both a and an in the form. If the user enters a string into the expression field and hits the enter key rather than clicking the submit button, the query builder is displayed whe...
A button in an HTML form is assumed to be used to submit the form. Change button to input type="button" and that should fix it. Alternatively, add type="button" to the button element.
Seam/JSF form submit firing button onclick event I have a search form with a query builder. The builder is activated by a button. Something like this Open Builder The result is HTML that has both a and an in the form. If the user enters a string into the expression field and hits the enter key rather than clicking the ...
TITLE: Seam/JSF form submit firing button onclick event QUESTION: I have a search form with a query builder. The builder is activated by a button. Something like this Open Builder The result is HTML that has both a and an in the form. If the user enters a string into the expression field and hits the enter key rather ...
[ "java", "html", "firefox", "jsf", "seam" ]
3
2
11,763
3
0
2008-09-22T19:59:50.593000
2008-09-22T20:06:00.407000
117,211
117,384
How to update a Tix.ComboBox's text?
I have a Tix.ComboBox with an editable text field. How do I force the variable holding the value for the text to update? Let me give a more concrete explanation. I have a combo box and a button. When I click the button, it pops up a message box with the value of the combo box. Let's say the combo box text field current...
woo! solved it on my own. Use self.combo['selection'] instead of self.combo['value']
How to update a Tix.ComboBox's text? I have a Tix.ComboBox with an editable text field. How do I force the variable holding the value for the text to update? Let me give a more concrete explanation. I have a combo box and a button. When I click the button, it pops up a message box with the value of the combo box. Let's...
TITLE: How to update a Tix.ComboBox's text? QUESTION: I have a Tix.ComboBox with an editable text field. How do I force the variable holding the value for the text to update? Let me give a more concrete explanation. I have a combo box and a button. When I click the button, it pops up a message box with the value of th...
[ "python", "combobox", "tkinter", "tix" ]
2
5
2,786
2
0
2008-09-22T20:02:38.493000
2008-09-22T20:24:50.063000
117,240
117,353
Is it possible to delete subdomain cookies?
If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com.
Cookies are only readable by the domain that created them, so if the cookie was created at metric.foo.com, it will have to be deleted under the same domain as it was created. This includes sub-domains. If you are required to delete a cookie from metric.foo.com, but are currently running a page at www.foo.com, you will ...
Is it possible to delete subdomain cookies? If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com.
TITLE: Is it possible to delete subdomain cookies? QUESTION: If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com. ANSWER: Cookies are...
[ "http", "browser", "cookies" ]
17
21
24,414
2
0
2008-09-22T20:05:08.537000
2008-09-22T20:21:14.737000
117,245
117,267
What's the best way to use SVN to version control a PHP site?
I've always just FTPed files down from sites, edited them and put them back up when creating sites, but feel it's worth learning to do things properly. I've just commited everything to a SVN repo, and have tried sshing into the server and checking out a tagged build, as well as updating that build using switch. All goo...
You don't necessarily need to use SVN to deploy the files to the server. Keep using FTP for that and just use SVN for revision history.
What's the best way to use SVN to version control a PHP site? I've always just FTPed files down from sites, edited them and put them back up when creating sites, but feel it's worth learning to do things properly. I've just commited everything to a SVN repo, and have tried sshing into the server and checking out a tagg...
TITLE: What's the best way to use SVN to version control a PHP site? QUESTION: I've always just FTPed files down from sites, edited them and put them back up when creating sites, but feel it's worth learning to do things properly. I've just commited everything to a SVN repo, and have tried sshing into the server and c...
[ "php", "svn" ]
11
8
3,476
12
0
2008-09-22T20:05:55.507000
2008-09-22T20:08:27
117,248
117,360
Manually inserting data in a table(s) with primary key populated with sequence
I have a number of tables that use the trigger/sequence column to simulate auto_increment on their primary keys which has worked great for some time. In order to speed the time necessary to perform regression testing against software that uses the db, I create control files using some sample data, and added running of ...
You can generate a script to create the sequences with the start values you need (based on their existing values).... SELECT 'CREATE SEQUENCE '||sequence_name||' START WITH '||last_number||';' FROM ALL_SEQUENCES WHERE OWNER = your_schema (If I understand the question correctly)
Manually inserting data in a table(s) with primary key populated with sequence I have a number of tables that use the trigger/sequence column to simulate auto_increment on their primary keys which has worked great for some time. In order to speed the time necessary to perform regression testing against software that us...
TITLE: Manually inserting data in a table(s) with primary key populated with sequence QUESTION: I have a number of tables that use the trigger/sequence column to simulate auto_increment on their primary keys which has worked great for some time. In order to speed the time necessary to perform regression testing agains...
[ "oracle", "sequences" ]
1
1
1,564
3
0
2008-09-22T20:06:08.580000
2008-09-22T20:21:59.807000
117,250
117,264
How do I get a decimal value when using the division operator in Python?
For example, the standard division symbol '/' rounds to zero: >>> 4 / 100 0 However, I want it to return 0.04. What do I use?
There are three options: >>> 4 / float(100) 0.04 >>> 4 / 100.0 0.04 which is the same behavior as the C, C++, Java etc, or >>> from __future__ import division >>> 4 / 100 0.04 You can also activate this behavior by passing the argument -Qnew to the Python interpreter: $ python -Qnew >>> 4 / 100 0.04 The second option w...
How do I get a decimal value when using the division operator in Python? For example, the standard division symbol '/' rounds to zero: >>> 4 / 100 0 However, I want it to return 0.04. What do I use?
TITLE: How do I get a decimal value when using the division operator in Python? QUESTION: For example, the standard division symbol '/' rounds to zero: >>> 4 / 100 0 However, I want it to return 0.04. What do I use? ANSWER: There are three options: >>> 4 / float(100) 0.04 >>> 4 / 100.0 0.04 which is the same behavior...
[ "python", "python-2.7", "math", "syntax", "operators" ]
74
148
196,957
13
0
2008-09-22T20:06:16.723000
2008-09-22T20:08:15.377000
117,293
117,308
Does using const on function parameters have any effect? Why does it not affect the function signature?
For example, imagine a simple mutator that takes a single boolean parameter: void SetValue(const bool b) { my_val_ = b; } Does that const actually have any impact? Personally I opt to use it extensively, including parameters, but in this case I wonder if it makes any difference. I was also surprised to learn that you c...
The reason is that const for the parameter only applies locally within the function, since it is working on a copy of the data. This means the function signature is really the same anyways. It's probably bad style to do this a lot though. I personally tend to not use const except for reference and pointer parameters. F...
Does using const on function parameters have any effect? Why does it not affect the function signature? For example, imagine a simple mutator that takes a single boolean parameter: void SetValue(const bool b) { my_val_ = b; } Does that const actually have any impact? Personally I opt to use it extensively, including pa...
TITLE: Does using const on function parameters have any effect? Why does it not affect the function signature? QUESTION: For example, imagine a simple mutator that takes a single boolean parameter: void SetValue(const bool b) { my_val_ = b; } Does that const actually have any impact? Personally I opt to use it extensi...
[ "c++", "parameters", "constants", "function-declaration", "const-correctness" ]
529
242
395,942
31
0
2008-09-22T20:11:47.177000
2008-09-22T20:15:12.630000
117,317
117,387
Finding common blocks
I have two files (f1 and f2) containing some text (or binary data). How can I quickly find common blocks? e.g. f1: ABC DEF f2: XXABC XEF output: common blocks: length 4: "ABC " in f1@0 and f2@2 length 2: "EF" in f1@5 and f2@8
Wikipedia has some pseudocode for finding the longest common substring between two sequences of data. In your case, you simply extract all common substring from the table that are not prefixes of other common substrings (i.e. maximal common substrings).
Finding common blocks I have two files (f1 and f2) containing some text (or binary data). How can I quickly find common blocks? e.g. f1: ABC DEF f2: XXABC XEF output: common blocks: length 4: "ABC " in f1@0 and f2@2 length 2: "EF" in f1@5 and f2@8
TITLE: Finding common blocks QUESTION: I have two files (f1 and f2) containing some text (or binary data). How can I quickly find common blocks? e.g. f1: ABC DEF f2: XXABC XEF output: common blocks: length 4: "ABC " in f1@0 and f2@2 length 2: "EF" in f1@5 and f2@8 ANSWER: Wikipedia has some pseudocode for finding the...
[ "algorithm" ]
4
1
566
3
0
2008-09-22T20:16:38.600000
2008-09-22T20:25:13.247000
117,318
117,400
ASP.NET and Timers
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) { //Do some work here... }, null, 0, 60000); HttpContext.Current.Application["SomeWorkItem"] = someWork; Could this be dangerous? Caching a timer in the Application to perform some work in the background while your s...
This would generally be a bad idea, as System.Threading.Timer uses threads from the ThreadPool, the same as ASP.Net. If for what ever reason your timer delegate blocks or stops, the timer will simply begin a new Thread after the timeout period, which eats in to the Threads available for ASP.net. If they all begin block...
ASP.NET and Timers Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) { //Do some work here... }, null, 0, 60000); HttpContext.Current.Application["SomeWorkItem"] = someWork; Could this be dangerous? Caching a timer in the Application to perform some work in the back...
TITLE: ASP.NET and Timers QUESTION: Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) { //Do some work here... }, null, 0, 60000); HttpContext.Current.Application["SomeWorkItem"] = someWork; Could this be dangerous? Caching a timer in the Application to perform som...
[ "asp.net", "multithreading", "timer" ]
1
3
1,006
6
0
2008-09-22T20:16:53.717000
2008-09-22T20:26:49.950000
117,337
117,376
Can I unshelve to a different branch in tfs 2008?
Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt)
The Visual Studio Power Tools should let you do this. C:\src\2\Merlin\Main>tfpt unshelve /? tfpt unshelve - Unshelve into workspace with pending changes Allows a shelveset to be unshelved into a workspace with pending changes. Merges content between local and shelved changes. Allows migration of shelved changes from o...
Can I unshelve to a different branch in tfs 2008? Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt)
TITLE: Can I unshelve to a different branch in tfs 2008? QUESTION: Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt) ANSWER: The Visual Studio Power Tools should let you do this. C...
[ "tfs", "branch", "shelve", "unshelve" ]
105
129
25,906
5
0
2008-09-22T20:19:25.943000
2008-09-22T20:24:11.157000
117,347
118,993
What's the difference between SQL Server Management Studio and the Express edition?
I'm using Express currently. What extra features do I get with the full edition?
There are no differences in Management Studio. The differences are in the database engine LIMITATIONS! The engine is the same but it will deny you some features. Import/Export wizard in the express edition can be found at: C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe If you dont have it, dowload it f...
What's the difference between SQL Server Management Studio and the Express edition? I'm using Express currently. What extra features do I get with the full edition?
TITLE: What's the difference between SQL Server Management Studio and the Express edition? QUESTION: I'm using Express currently. What extra features do I get with the full edition? ANSWER: There are no differences in Management Studio. The differences are in the database engine LIMITATIONS! The engine is the same bu...
[ "sql-server", "ssms" ]
41
21
72,322
5
0
2008-09-22T20:20:33.770000
2008-09-23T03:45:46.820000
117,348
117,374
Can you force the serialization of an enum value into an integer?
Possible Duplicate: How do I serialize an enum value as an int? Hi, all! I'm wondering if there's a way to force the serialization of an enum value into its integer value, instead of its string representation. To put you into context: We're using, in a web application that heavily relies on web services, a single basec...
Enums do serialize to ints. But generally, if you don't like the way one of your properties gets serialized to XML, you can just do this: [XmlIgnore] public MyThing MyThing { get; set; } [XmlElement("MyThing")] [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public string MyThingForSerialization { get ...
Can you force the serialization of an enum value into an integer? Possible Duplicate: How do I serialize an enum value as an int? Hi, all! I'm wondering if there's a way to force the serialization of an enum value into its integer value, instead of its string representation. To put you into context: We're using, in a w...
TITLE: Can you force the serialization of an enum value into an integer? QUESTION: Possible Duplicate: How do I serialize an enum value as an int? Hi, all! I'm wondering if there's a way to force the serialization of an enum value into its integer value, instead of its string representation. To put you into context: W...
[ "c#", ".net", "xml-serialization", "attributes" ]
2
6
7,488
2
0
2008-09-22T20:20:39.560000
2008-09-22T20:23:43.407000
117,352
117,435
Optimize y = x*x in Galois field arithmetic
I have this C-code to do multiplications over GF(8): int32_t GaloisMultiply (int32_t a, int32_t b) { int32_t i; int32_t mask = 0x100; int32_t y = 0; for(i=0;i<8;i++) { if(b & mask) { y ^= a; } mask >>= 1; y <<= 1; } if(b & 0x1) { y ^= a; } return(y); } That's more or less the text-book implementation. I wonder if I ...
Table-based? link And when you are limited to x*x, it's a sparse matrix. Here's another good paper (and a library)
Optimize y = x*x in Galois field arithmetic I have this C-code to do multiplications over GF(8): int32_t GaloisMultiply (int32_t a, int32_t b) { int32_t i; int32_t mask = 0x100; int32_t y = 0; for(i=0;i<8;i++) { if(b & mask) { y ^= a; } mask >>= 1; y <<= 1; } if(b & 0x1) { y ^= a; } return(y); } That's more or less ...
TITLE: Optimize y = x*x in Galois field arithmetic QUESTION: I have this C-code to do multiplications over GF(8): int32_t GaloisMultiply (int32_t a, int32_t b) { int32_t i; int32_t mask = 0x100; int32_t y = 0; for(i=0;i<8;i++) { if(b & mask) { y ^= a; } mask >>= 1; y <<= 1; } if(b & 0x1) { y ^= a; } return(y); } Th...
[ "c", "cryptography", "bit-manipulation", "low-level" ]
4
4
1,207
7
0
2008-09-22T20:21:03.193000
2008-09-22T20:32:36.317000
117,355
117,367
What is a solid, elegant, reusable piece of code for determining if an IEnumerable is empty, in .NET?
I'm trying to find the most reusable, yet elegant, piece of code possible for determining if an IEnumerable. In the ideal, this should be a function I can call absolutely any time I need to tell if an IEnumerable is empty. While I have developed an answer for.NET 3.5 that has worked well for me so far, my current thoug...
!enumerable.Any() Will attempt to grab the first element only. To expand on how/why this works, any determines if any of the components of an IEnumerable match a given function, if none is given, then any component will succeed, meaning the function will return true if an element exists in the enumerable.
What is a solid, elegant, reusable piece of code for determining if an IEnumerable is empty, in .NET? I'm trying to find the most reusable, yet elegant, piece of code possible for determining if an IEnumerable. In the ideal, this should be a function I can call absolutely any time I need to tell if an IEnumerable is em...
TITLE: What is a solid, elegant, reusable piece of code for determining if an IEnumerable is empty, in .NET? QUESTION: I'm trying to find the most reusable, yet elegant, piece of code possible for determining if an IEnumerable. In the ideal, this should be a function I can call absolutely any time I need to tell if an...
[ ".net", "collections" ]
9
22
698
5
0
2008-09-22T20:21:28.200000
2008-09-22T20:22:44.797000
117,356
117,404
How to correctly add a <select> to a page with jquery and let the change event work?
I've currently got multiple select's on a page that are added dynamically with ajax calls using jquery. The problem I've had is I could not get the change event to work on the added select unless I use the onchange inside the tag e.g. This works, but I'm wondering if there's a way to get it to be assigned by jquery. I'...
I had a similar problem and found this solution here: When you do something like this: $('p').click( function() { alert('blah'); } ) All the currently existing 'p' elements will have a click handler attached. Now if you go on to add other 'p' elements to the page they will not have the your click handler attached to th...
How to correctly add a <select> to a page with jquery and let the change event work? I've currently got multiple select's on a page that are added dynamically with ajax calls using jquery. The problem I've had is I could not get the change event to work on the added select unless I use the onchange inside the tag e.g. ...
TITLE: How to correctly add a <select> to a page with jquery and let the change event work? QUESTION: I've currently got multiple select's on a page that are added dynamically with ajax calls using jquery. The problem I've had is I could not get the change event to work on the added select unless I use the onchange in...
[ "jquery", "html-select" ]
4
2
5,681
4
0
2008-09-22T20:21:29.870000
2008-09-22T20:27:26.110000
117,361
117,456
How can I bind an event handler to an instance in jQuery?
I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using jQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the event to. In more detail, say I have a "class" as follows: function Car(owner)...
Just use an anonymous function: $("#myButton").click(function() { myCar.drive(); });
How can I bind an event handler to an instance in jQuery? I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using jQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the event to. In more de...
TITLE: How can I bind an event handler to an instance in jQuery? QUESTION: I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using jQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the ev...
[ "javascript", "jquery", "events", "dom" ]
0
3
2,148
2
0
2008-09-22T20:22:10.570000
2008-09-22T20:36:45.340000
117,372
117,428
Can't download file in IE7 but there isn't any issue in Firefox, Chrome, etc..?
I have an script that receives an encrypted url and from that generates a download, the most critic par of the script is this: $MimeType = new MimeType(); $mimetype = $MimeType->getType($filename); $basename = basename($filename); header("Content-type: $mimetype"); header("Content-Disposition: attachment; filename=\"$b...
This site has a problem similar to yours in IE6. To summarize: session_start() by default sends a cache control header including "no-store". Internet Explorer takes this a bit too literally, but doesn't have appropriate error handling for the case, and as a result explodes cryptically when you attempt to save the outpu...
Can't download file in IE7 but there isn't any issue in Firefox, Chrome, etc..? I have an script that receives an encrypted url and from that generates a download, the most critic par of the script is this: $MimeType = new MimeType(); $mimetype = $MimeType->getType($filename); $basename = basename($filename); header("C...
TITLE: Can't download file in IE7 but there isn't any issue in Firefox, Chrome, etc..? QUESTION: I have an script that receives an encrypted url and from that generates a download, the most critic par of the script is this: $MimeType = new MimeType(); $mimetype = $MimeType->getType($filename); $basename = basename($fi...
[ "php", "internet-explorer-7", "download" ]
5
3
6,814
3
0
2008-09-22T20:23:07.603000
2008-09-22T20:30:47.133000
117,379
158,976
ADSI will not connect to IIS from XP Workstation
I'm successfully using VBScript within WScript to remotely read and write IIS configurations from the server. When I attempt to run these same scripts from my desk box they fail, though. Example: Dim vdir Set vdir = GetObject("IIS://servername/w3svc/226/root") Error = "Invalid syntax" The code works perfectly when run ...
Stephbu is correct and that answer was helpful, but it is not sufficient. In order to use ADSI remotely from my XP workstation, I needed to install IIS 5.1. Once that was installed, all my scripts started working. If there is an installation that can make the scripts work without making my computer an IIS server, I am ...
ADSI will not connect to IIS from XP Workstation I'm successfully using VBScript within WScript to remotely read and write IIS configurations from the server. When I attempt to run these same scripts from my desk box they fail, though. Example: Dim vdir Set vdir = GetObject("IIS://servername/w3svc/226/root") Error = "I...
TITLE: ADSI will not connect to IIS from XP Workstation QUESTION: I'm successfully using VBScript within WScript to remotely read and write IIS configurations from the server. When I attempt to run these same scripts from my desk box they fail, though. Example: Dim vdir Set vdir = GetObject("IIS://servername/w3svc/226...
[ "iis", "adsi" ]
0
1
821
2
0
2008-09-22T20:24:21.093000
2008-10-01T18:19:02.027000
117,394
117,411
How do I checkout files under Perforce from within Emacs?
I use Perforce for source control at work and I want to 'open for edit' files that under source control from within Emacs. How can that be done? What do I need to setup in Emacs? Is there a plug in? I also want to perform other p4 operations such as submitting my changes, etc.
Perforce/Emacs Integration http://p4el.sourceforge.net/p4.el.html Once you have p4.el installed and ready to go you can use emacs' built-in help to review p4.el's functions: C-x p? will bring up the list. C-h f p4-xyz provides defun information for p4-xyz. Each Perforce command has a corresponding p4.el command. The vc...
How do I checkout files under Perforce from within Emacs? I use Perforce for source control at work and I want to 'open for edit' files that under source control from within Emacs. How can that be done? What do I need to setup in Emacs? Is there a plug in? I also want to perform other p4 operations such as submitting m...
TITLE: How do I checkout files under Perforce from within Emacs? QUESTION: I use Perforce for source control at work and I want to 'open for edit' files that under source control from within Emacs. How can that be done? What do I need to setup in Emacs? Is there a plug in? I also want to perform other p4 operations su...
[ "version-control", "emacs", "file", "perforce" ]
4
11
1,469
1
0
2008-09-22T20:26:28.873000
2008-09-22T20:28:16.110000
117,407
117,597
Which configuration method do you prefer in .net? Why?
You can use App.config; but it only supports key/value pairs. You can use.Net configuration, configuration sections; but it can be really complex. You can use Xml Serialization/Deserialization by yourself; your classes-your way. You can use some other method; what can they be?... Which of these or other methods (if the...
When key value pairs are not enough I use Configuration Sections as they are not complex to use (unless you need a complex section): Define your custom section: public class CustomSection: ConfigurationSection { [ConfigurationProperty("LastName", IsRequired = true, DefaultValue = "TEST")] public String LastName { get {...
Which configuration method do you prefer in .net? Why? You can use App.config; but it only supports key/value pairs. You can use.Net configuration, configuration sections; but it can be really complex. You can use Xml Serialization/Deserialization by yourself; your classes-your way. You can use some other method; what ...
TITLE: Which configuration method do you prefer in .net? Why? QUESTION: You can use App.config; but it only supports key/value pairs. You can use.Net configuration, configuration sections; but it can be really complex. You can use Xml Serialization/Deserialization by yourself; your classes-your way. You can use some o...
[ ".net", "configuration" ]
18
21
3,623
13
0
2008-09-22T20:27:48.573000
2008-09-22T20:56:53.403000
117,415
117,585
How do I branch an individual file in SVN?
The subversion concept of branching appears to be focused on creating an [un]stable fork of the entire repository on which to do development. Is there a mechanism for creating branches of individual files? For a use case, think of a common header (*.h) file that has multiple platform-specific source (*.c) implementatio...
Sadly, I think the real answer here is that ClearCase handles this situation a lot better than Subversion. With subversion, you have to branch everything, but ClearCase allows a kind of "lazy branch" idea that means only a certain group of files are branched, the rest of them still follow the trunk (or whichever branch...
How do I branch an individual file in SVN? The subversion concept of branching appears to be focused on creating an [un]stable fork of the entire repository on which to do development. Is there a mechanism for creating branches of individual files? For a use case, think of a common header (*.h) file that has multiple p...
TITLE: How do I branch an individual file in SVN? QUESTION: The subversion concept of branching appears to be focused on creating an [un]stable fork of the entire repository on which to do development. Is there a mechanism for creating branches of individual files? For a use case, think of a common header (*.h) file t...
[ "svn", "version-control", "branch" ]
9
3
11,434
8
0
2008-09-22T20:29:13.907000
2008-09-22T20:54:50.193000
117,422
118,029
How can I resolve the drifting clock for my Virtual Machine?
My Virtual Machine's clock drifts pretty significantly. There's documentation out there about dealing with this, but nothing seems to be working very well. Anyone have any suggestions, things that worked well for them,... Supposedly updating regularly via ntp is not a good solution.
vmware have a really good PDF doc on this problem. Basically, the host will slew the ticks delivered to your guests as it can. Don't run NTP or timed or junk like that. Just install vmware-guestd and let the host slew your ticks. If you still lose ticks, then any other solution will have major drift too. If you can, us...
How can I resolve the drifting clock for my Virtual Machine? My Virtual Machine's clock drifts pretty significantly. There's documentation out there about dealing with this, but nothing seems to be working very well. Anyone have any suggestions, things that worked well for them,... Supposedly updating regularly via ntp...
TITLE: How can I resolve the drifting clock for my Virtual Machine? QUESTION: My Virtual Machine's clock drifts pretty significantly. There's documentation out there about dealing with this, but nothing seems to be working very well. Anyone have any suggestions, things that worked well for them,... Supposedly updating...
[ "vmware", "clock", "drift" ]
21
11
45,493
11
0
2008-09-22T20:30:22.670000
2008-09-22T22:33:03.860000
117,426
117,446
Adding version control to an existing project
I am working on a project that has grown to a decent size, and I am the only developer. We currently don't use any version control, but I definitely need to start. I want to use Subversion. What would be the best way to transfer an existing project to it? I have a test server that I use for developing new features, the...
To expand a little on the previous answer... 1) Create a new SVN repository 2) Commit all the code you've worked on so far to it 3) Check all that code OUT again, to create a working copy on your dev machine 4) Work! It's definitely not a hurdle, really.
Adding version control to an existing project I am working on a project that has grown to a decent size, and I am the only developer. We currently don't use any version control, but I definitely need to start. I want to use Subversion. What would be the best way to transfer an existing project to it? I have a test serv...
TITLE: Adding version control to an existing project QUESTION: I am working on a project that has grown to a decent size, and I am the only developer. We currently don't use any version control, but I definitely need to start. I want to use Subversion. What would be the best way to transfer an existing project to it? ...
[ "svn", "version-control" ]
17
16
20,516
22
0
2008-09-22T20:30:37.710000
2008-09-22T20:35:07.637000
117,438
117,619
Getting started using Linq, what do I need?
Basically what the title says. (Forgive me because I am a.NET newb) In my department, we have a server running.net 3.5 and ever since I got into this section I have been using LINQ. However, I am starting a personal project on a different server (obviously), so 2 questions: What do I need to get up and running with LIN...
To get up and running, I would definitely recommend checking out LINQ in Action. Your compiler needs to be.NET 3.5 framework. If you are copying over only compiled code, then you will not need 3.5 on your server, you only need it on your development machine. This can help if your server admin is unwilling to install th...
Getting started using Linq, what do I need? Basically what the title says. (Forgive me because I am a.NET newb) In my department, we have a server running.net 3.5 and ever since I got into this section I have been using LINQ. However, I am starting a personal project on a different server (obviously), so 2 questions: W...
TITLE: Getting started using Linq, what do I need? QUESTION: Basically what the title says. (Forgive me because I am a.NET newb) In my department, we have a server running.net 3.5 and ever since I got into this section I have been using LINQ. However, I am starting a personal project on a different server (obviously),...
[ "c#", ".net", "linq" ]
10
8
2,276
12
0
2008-09-22T20:33:03.803000
2008-09-22T21:00:19.247000
117,455
117,742
Can I use Terracotta to scale a RAM-intensive application?
I'm evaluating Terracotta to help me scale up an application which is currently RAM-bounded. It is a collaborative filter and stores about 2 kilobytes of data per-user. I want to use Amazon's EC2, which means I'm limited to 14GB of RAM, which gives me an effective per-server upper-bound of around 7 million users. I nee...
I'd say the answer is a qualified yes for this. Terracotta does allow you to work with clustered heaps larger than the size of a single JVM although that's not the most common use case. You still need to keep in mind a) the working set size and b) the amount of data traffic. For a), there is some set of data that must ...
Can I use Terracotta to scale a RAM-intensive application? I'm evaluating Terracotta to help me scale up an application which is currently RAM-bounded. It is a collaborative filter and stores about 2 kilobytes of data per-user. I want to use Amazon's EC2, which means I'm limited to 14GB of RAM, which gives me an effect...
TITLE: Can I use Terracotta to scale a RAM-intensive application? QUESTION: I'm evaluating Terracotta to help me scale up an application which is currently RAM-bounded. It is a collaborative filter and stores about 2 kilobytes of data per-user. I want to use Amazon's EC2, which means I'm limited to 14GB of RAM, which ...
[ "java", "scalability", "amazon-ec2", "terracotta" ]
7
4
1,144
1
0
2008-09-22T20:36:31.143000
2008-09-22T21:25:37.423000
117,467
117,498
How do you turn a dynamic site into a static site that can be demo'd from a CD?
I need to find a way to crawl one of our company's web applications and create a static site from it that can be burned to a cd and used by traveling sales people to demo the web site. The back end data store is spread across many, many systems so simply running the site on a VM on the sale person's laptop won't work. ...
wget or curl can both recursively follow links and mirror an entire site, so that might be a good bet. You won't be able to use truly interactive parts of the site, like search engines, or anything that modifies the data, thoguh. Is it possible at all to create dummy backend services that can run from the sales folks' ...
How do you turn a dynamic site into a static site that can be demo'd from a CD? I need to find a way to crawl one of our company's web applications and create a static site from it that can be burned to a cd and used by traveling sales people to demo the web site. The back end data store is spread across many, many sys...
TITLE: How do you turn a dynamic site into a static site that can be demo'd from a CD? QUESTION: I need to find a way to crawl one of our company's web applications and create a static site from it that can be burned to a cd and used by traveling sales people to demo the web site. The back end data store is spread acr...
[ "html", "web-crawler", "static-site" ]
9
3
6,464
5
0
2008-09-22T20:38:09.237000
2008-09-22T20:41:45.890000
117,469
132,871
BAML Decompiler / Viewer
Could anyone recommend a good BAML Decompiler / Viewer besides BAML Viewer plugin for Reflector, which doesn't handle path geometry/data?
You might like to have another look at the BAML addin for reflector as it's been recently updated by Andrew Smith. Have a look at his at blog post you'll note that he has fixed the issue with path data.
BAML Decompiler / Viewer Could anyone recommend a good BAML Decompiler / Viewer besides BAML Viewer plugin for Reflector, which doesn't handle path geometry/data?
TITLE: BAML Decompiler / Viewer QUESTION: Could anyone recommend a good BAML Decompiler / Viewer besides BAML Viewer plugin for Reflector, which doesn't handle path geometry/data? ANSWER: You might like to have another look at the BAML addin for reflector as it's been recently updated by Andrew Smith. Have a look at ...
[ "wpf", "decompiling", "baml" ]
13
12
11,767
4
0
2008-09-22T20:38:26.850000
2008-09-25T12:02:09.920000
117,471
117,681
Filtering out duplicate values at runtime in a sql database - set based
I have a database issue that i currently cannot wrap my head around with an easy solution. In my db I have a table that stores event values.. 0's and 1's with a timestamp. Issue being that it is possible for there to be the same event to occur twice as a business rule. Like below '2008-09-22 16:28:14.133', 0 '2008-09-2...
This uses a SQL Server Common Table Expression, but it can be inlined, with table t with columns dt and cyclestate:;WITH Firsts AS ( SELECT t1.dt,MIN(t2.dt) AS Prevdt FROM t AS t1 INNER JOIN t AS t2 ON t1.dt < t2.dt AND t2.cyclestate <> t1.cyclestate GROUP BY t1.dt ) SELECT MIN(t1.dt) AS dt_start,t2.dt AS dt_end FROM t...
Filtering out duplicate values at runtime in a sql database - set based I have a database issue that i currently cannot wrap my head around with an easy solution. In my db I have a table that stores event values.. 0's and 1's with a timestamp. Issue being that it is possible for there to be the same event to occur twic...
TITLE: Filtering out duplicate values at runtime in a sql database - set based QUESTION: I have a database issue that i currently cannot wrap my head around with an easy solution. In my db I have a table that stores event values.. 0's and 1's with a timestamp. Issue being that it is possible for there to be the same e...
[ "sql", "filtered-lookup" ]
0
0
1,710
4
0
2008-09-22T20:38:33.417000
2008-09-22T21:12:05.677000
117,474
117,842
How to sniff a USB port under Windows?
From time to time, I need to dump USB traffic under Windows, mostly to support hardware under Linux, so my primary goal is to produce dump files for protocol analysis. For USB traffic, it seems that SniffUsb is the clear winner... It works under Windows XP (but not later) and has a much nicer GUI than earlier versions....
Personally, I'd use QEMU or KVM and instrument their USB passthrough code, and then use libusb to prototype the replacement driver in user space (this latter bit I've done before; writing USB device drivers in Python is fun!).
How to sniff a USB port under Windows? From time to time, I need to dump USB traffic under Windows, mostly to support hardware under Linux, so my primary goal is to produce dump files for protocol analysis. For USB traffic, it seems that SniffUsb is the clear winner... It works under Windows XP (but not later) and has ...
TITLE: How to sniff a USB port under Windows? QUESTION: From time to time, I need to dump USB traffic under Windows, mostly to support hardware under Linux, so my primary goal is to produce dump files for protocol analysis. For USB traffic, it seems that SniffUsb is the clear winner... It works under Windows XP (but n...
[ "windows", "usb", "sniffing", "usbserial" ]
53
3
118,889
6
0
2008-09-22T20:39:03.867000
2008-09-22T21:46:12.020000
117,481
117,938
How can I update Perl on Windows without losing modules?
At work I'm using Perl 5.8.0 on Windows. When I first put Perl on, I went to CPAN, downloaded all the sources, made a few changes (in the.MAK file(?) to support threads, or things like that), and did nmake / nmake test / nmake install. Then, bit by bit, I've downloaded individual modules from CPAN and done the nmake da...
As others noted, start by installing the new perl in a separate place. I have several perls installed, each completely separate from all of the others. To do that, you'll have to configure and compile the sources yourself. When you run configure, you'll get a chance to specify the installer. I gave detailed instruction...
How can I update Perl on Windows without losing modules? At work I'm using Perl 5.8.0 on Windows. When I first put Perl on, I went to CPAN, downloaded all the sources, made a few changes (in the.MAK file(?) to support threads, or things like that), and did nmake / nmake test / nmake install. Then, bit by bit, I've down...
TITLE: How can I update Perl on Windows without losing modules? QUESTION: At work I'm using Perl 5.8.0 on Windows. When I first put Perl on, I went to CPAN, downloaded all the sources, made a few changes (in the.MAK file(?) to support threads, or things like that), and did nmake / nmake test / nmake install. Then, bit...
[ "windows", "perl", "upgrade", "perl-module" ]
11
9
16,278
7
0
2008-09-22T20:39:22.930000
2008-09-22T22:11:15.363000
117,484
117,497
SVN Versioning: How to have for each project its own revision scheme?
Just a small SVN "problem" here. I setup my own SVN server Setting up Subversion on Windows Now I made a rep in which all my projects will go. Now, I checked the rep out in a folder called "Projects". Now If I make a project and check it in, that project is revision 1. If I make a second project, and check it in, that ...
You need to create repositories inside your "Projects" folder, and when you do the initial checkout, checkout "???/projects/repo1"... this will keep the working copies separate on your machine, and you will check in/out completely separately of each other.
SVN Versioning: How to have for each project its own revision scheme? Just a small SVN "problem" here. I setup my own SVN server Setting up Subversion on Windows Now I made a rep in which all my projects will go. Now, I checked the rep out in a folder called "Projects". Now If I make a project and check it in, that pro...
TITLE: SVN Versioning: How to have for each project its own revision scheme? QUESTION: Just a small SVN "problem" here. I setup my own SVN server Setting up Subversion on Windows Now I made a rep in which all my projects will go. Now, I checked the rep out in a folder called "Projects". Now If I make a project and che...
[ "svn", "version-control" ]
4
0
1,089
5
0
2008-09-22T20:39:37.500000
2008-09-22T20:41:42.207000
117,492
117,815
Does anyone have a good article or good advice for class naming for n-tier web applications?
I'm used to the layout that LLBLGen gives when it generates objects based on a database structure, which might generate the following class files for a given "User" table in the database: /EntityClasses/UserEntity.vb /CollectionClasses/UserCollection.vb This provides some base functionality for data access. However, wh...
I think what you are looking for is a service layer which would sit on top of the domain objects. You essentially have this with your second option although I might call it UserService or UserTasks. By encapsulating this LockUser process in a single place it will be easy to change later when there might be more steps o...
Does anyone have a good article or good advice for class naming for n-tier web applications? I'm used to the layout that LLBLGen gives when it generates objects based on a database structure, which might generate the following class files for a given "User" table in the database: /EntityClasses/UserEntity.vb /Collectio...
TITLE: Does anyone have a good article or good advice for class naming for n-tier web applications? QUESTION: I'm used to the layout that LLBLGen gives when it generates objects based on a database structure, which might generate the following class files for a given "User" table in the database: /EntityClasses/UserEn...
[ "oop", "naming-conventions" ]
1
1
856
1
0
2008-09-22T20:41:16.827000
2008-09-22T21:39:29.823000