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
119,788
119,811
How to compare files with same names in two different directories using a shell script
Before moving on to use SVN, I used to manage my project by simply keeping a /develop/ directory and editing and testing files there, then moving them to the /main/ directory. When I decided to move to SVN, I needed to be sure that the directories were indeed in sync. So, what is a good way to write a shell script [ ba...
The diff command has a -r option to recursively compare directories: diff -r /develop /main
How to compare files with same names in two different directories using a shell script Before moving on to use SVN, I used to manage my project by simply keeping a /develop/ directory and editing and testing files there, then moving them to the /main/ directory. When I decided to move to SVN, I needed to be sure that t...
TITLE: How to compare files with same names in two different directories using a shell script QUESTION: Before moving on to use SVN, I used to manage my project by simply keeping a /develop/ directory and editing and testing files there, then moving them to the /main/ directory. When I decided to move to SVN, I needed...
[ "bash", "shell", "diff" ]
22
37
44,047
6
0
2008-09-23T08:15:57.967000
2008-09-23T08:21:57.610000
119,802
120,291
Using **kwargs with SimpleXMLRPCServer in python
I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_instance(service) server.serve_forever() I then have a ServiceRemote cla...
You can't do this with plain xmlrpc since it has no notion of keyword arguments. However, you can superimpose this as a protocol on top of xmlrpc that would always pass a list as first argument, and a dictionary as a second, and then provide the proper support code so this becomes transparent for your usage, example be...
Using **kwargs with SimpleXMLRPCServer in python I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_instance(service) serve...
TITLE: Using **kwargs with SimpleXMLRPCServer in python QUESTION: I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_insta...
[ "python", "simplexmlrpcserver", "xmlrpclib" ]
15
16
6,779
5
0
2008-09-23T08:19:44.587000
2008-09-23T10:47:37.040000
119,815
120,341
Transform .HBM model to annotated pojos
We have our domain model declared in rusty old hbm files, we wish to move to POJOs annotated with the javax.persistence.* annotations. Has anyone had experience doing so? Are there tools that we could employ?
You could use hbm2java ant task from hibernate-tools.jar. This is a tool known as Hibernate Tool. hbm2java will generate JPA annotated POJOS from hbm files. See http://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html
Transform .HBM model to annotated pojos We have our domain model declared in rusty old hbm files, we wish to move to POJOs annotated with the javax.persistence.* annotations. Has anyone had experience doing so? Are there tools that we could employ?
TITLE: Transform .HBM model to annotated pojos QUESTION: We have our domain model declared in rusty old hbm files, we wish to move to POJOs annotated with the javax.persistence.* annotations. Has anyone had experience doing so? Are there tools that we could employ? ANSWER: You could use hbm2java ant task from hiberna...
[ "java", "hibernate", "domain-driven-design", "hbm", "mda" ]
1
3
468
1
0
2008-09-23T08:23:29.323000
2008-09-23T11:04:37.220000
119,818
119,907
Dynamic Client Script
I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id is know only at the se...
Here is a thought: As indicated by Anonymous you can generate javascript, if you are in ASP.NET you have some help with the RegisterClientScriptBlock() method. MSDN on Injecting Client Side Script Also you could write, or generate, a javascript function that takes in a checkbox as a parameter and add an onClick attribu...
Dynamic Client Script I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id ...
TITLE: Dynamic Client Script QUESTION: I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at desig...
[ "javascript", "scripting", "server-side-scripting" ]
0
1
275
4
0
2008-09-23T08:23:49.523000
2008-09-23T08:45:26.943000
119,826
119,852
GUI apps in javascript without a browser?
I would like to use javascript to develop general-purpose GUI applications. Initially these are to run on Windows, but I would like them to ultimately be cross-platform. Is there a way to do this without having to make the application run in a browser?
Check out Adobe AIR. From Wikipedia: Adobe AIR is a cross-platform runtime environment for building rich Internet applications using Adobe Flash, Adobe Flex, HTML, or Ajax, that can be deployed as a desktop application. Also check out Mozilla Prism (in beta).
GUI apps in javascript without a browser? I would like to use javascript to develop general-purpose GUI applications. Initially these are to run on Windows, but I would like them to ultimately be cross-platform. Is there a way to do this without having to make the application run in a browser?
TITLE: GUI apps in javascript without a browser? QUESTION: I would like to use javascript to develop general-purpose GUI applications. Initially these are to run on Windows, but I would like them to ultimately be cross-platform. Is there a way to do this without having to make the application run in a browser? ANSWER...
[ "javascript", "user-interface" ]
11
6
10,372
10
0
2008-09-23T08:26:08.940000
2008-09-23T08:31:48.647000
119,832
198,117
How to default the working directory for JUnit launch configurations in Eclipse?
Our Java code (not the test code) reads files from the current directory, which means the working directory needs to be set properly whenever we run the code. When launching a JUnit test from within Eclipse, a launch configuration automatically gets created. The problem is, that the working directory in that launch con...
As far as I can tell, there's no way of changing the default working directory for future JUnit launch configurations in Eclipse 3.4. This issue has also been reported as a bug in the Eclipse bug database. However, it is possible in IDEA. There's the Edit Defaults button for setting all kinds of defaults for each launc...
How to default the working directory for JUnit launch configurations in Eclipse? Our Java code (not the test code) reads files from the current directory, which means the working directory needs to be set properly whenever we run the code. When launching a JUnit test from within Eclipse, a launch configuration automati...
TITLE: How to default the working directory for JUnit launch configurations in Eclipse? QUESTION: Our Java code (not the test code) reads files from the current directory, which means the working directory needs to be set properly whenever we run the code. When launching a JUnit test from within Eclipse, a launch conf...
[ "java", "eclipse", "junit", "eclipse-3.4" ]
23
10
25,941
5
0
2008-09-23T08:26:32.170000
2008-10-13T16:07:41.227000
119,838
120,003
How to learn Java Webservices
Please suggest some good resources to start writing Java Web services.
The standard way in Java to write a web service is to use Apache Axis. If you are generating a web service client, then you need the WSDL (.xsd,.wsdl, etc) of the foreign web service, and then you can use wsdl2java (or preferably, the ANT task provided by axis-ant) to simply generate the code to do the communications a...
How to learn Java Webservices Please suggest some good resources to start writing Java Web services.
TITLE: How to learn Java Webservices QUESTION: Please suggest some good resources to start writing Java Web services. ANSWER: The standard way in Java to write a web service is to use Apache Axis. If you are generating a web service client, then you need the WSDL (.xsd,.wsdl, etc) of the foreign web service, and then...
[ "java", "web-services" ]
12
4
13,190
7
0
2008-09-23T08:28:28.920000
2008-09-23T09:13:59.887000
119,855
119,982
Which Design Pattern is best for Iterative development?
Is there such a thing as having the most prefered design pattern for building applications in TDD or the iterative mode?
I think the question could be rewritten so it makes more sense in these words: "Which architectural patterns and strategies are useful in order to achieve flexibility when using a Test-Driven and incremental development strategy?" My answer would be: patterns that help you decouple your clases and components, like: Inv...
Which Design Pattern is best for Iterative development? Is there such a thing as having the most prefered design pattern for building applications in TDD or the iterative mode?
TITLE: Which Design Pattern is best for Iterative development? QUESTION: Is there such a thing as having the most prefered design pattern for building applications in TDD or the iterative mode? ANSWER: I think the question could be rewritten so it makes more sense in these words: "Which architectural patterns and str...
[ "oop", "design-patterns" ]
3
7
760
5
0
2008-09-23T08:32:49.783000
2008-09-23T09:07:24.303000
119,857
119,864
How do you read an image in Java when Toolkit.getDefaultToolkit() throws an AWTError?
I am reading image files in Java using java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit. How else can you create a java.awt.Image object from an image file?
I read images using ImageIO. Image i = ImageIO.read(InputStream in); The javadoc will offer more info as well.
How do you read an image in Java when Toolkit.getDefaultToolkit() throws an AWTError? I am reading image files in Java using java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit. How else can you...
TITLE: How do you read an image in Java when Toolkit.getDefaultToolkit() throws an AWTError? QUESTION: I am reading image files in Java using java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit...
[ "java", "image", "awt" ]
6
6
7,151
3
0
2008-09-23T08:33:24.960000
2008-09-23T08:35:32.163000
119,860
119,883
Shortcut to switch between markup and code
Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup?
The following is a macro taken from a comment by Lozza on https://blog.codinghorror.com/visual-studio-net-2003-and-2005-keyboard-shortcuts/. You just need to bind it to a shortcut of your choice: Sub SwitchToMarkup() Dim FileName If (DTE.ActiveWindow.Caption().EndsWith(".cs")) Then ' swith from.aspx.cs to.aspx FileNam...
Shortcut to switch between markup and code Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup?
TITLE: Shortcut to switch between markup and code QUESTION: Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup? ANSWER: The following is a macro taken from a comment by Lozz...
[ "visual-studio-2008", "keyboard-shortcuts" ]
3
4
972
2
0
2008-09-23T08:34:51.090000
2008-09-23T08:40:44.820000
119,867
119,889
How to improve the program coding
I am a C# developer. Still learning. I had not learn all the features of C# 2.0 and now the new version of c# is being released. how do we cope up with this.what is the best option to cope up with the latest programming skills.
As Steve M said: Read. But don't stop there. You also have to write. First: Write Code. Try out the stuff you read about. Look at open source software and how things are done by others. Try those new techniques out. Second: Write text. Write a blog post or whatever on how to do something. You had a problem and you solv...
How to improve the program coding I am a C# developer. Still learning. I had not learn all the features of C# 2.0 and now the new version of c# is being released. how do we cope up with this.what is the best option to cope up with the latest programming skills.
TITLE: How to improve the program coding QUESTION: I am a C# developer. Still learning. I had not learn all the features of C# 2.0 and now the new version of c# is being released. how do we cope up with this.what is the best option to cope up with the latest programming skills. ANSWER: As Steve M said: Read. But don'...
[ "c#" ]
2
4
1,880
9
0
2008-09-23T08:37:06.887000
2008-09-23T08:41:57.530000
119,887
119,908
Performance improvements moving from g++/gcc 3.2.3 to 4.2.4
We have been looking at g++ versions 3.2.3 and 4.2.4. With 4.2.4, the performance improvements on some of our code base is significant. I've tried searching the gcc buzilla database to find hints as to what bugs may have had such a dramatic improvement but I didn't find any individual bug that stood out as being a cand...
In my experience, 3.4 is where the performance basically peaked; 4.2 is actually slower than 3.4 on my project, with 4.3 being the first to roughly equal 3.4's performance. 4.4 is slightly faster than 3.4. There are a specific few cases I've found where older versions of gcc did some unbelievably retarded things in cod...
Performance improvements moving from g++/gcc 3.2.3 to 4.2.4 We have been looking at g++ versions 3.2.3 and 4.2.4. With 4.2.4, the performance improvements on some of our code base is significant. I've tried searching the gcc buzilla database to find hints as to what bugs may have had such a dramatic improvement but I d...
TITLE: Performance improvements moving from g++/gcc 3.2.3 to 4.2.4 QUESTION: We have been looking at g++ versions 3.2.3 and 4.2.4. With 4.2.4, the performance improvements on some of our code base is significant. I've tried searching the gcc buzilla database to find hints as to what bugs may have had such a dramatic i...
[ "gcc", "g++" ]
3
3
1,693
3
0
2008-09-23T08:41:28.373000
2008-09-23T08:45:40.143000
119,896
119,904
Duplicate result
I am writing a query in SQL server2005. This is returning me a duplicate rows in the result. Can i eliminate this duplication with a particular column as the key?
You can eliminate complete duplicate rows using the DISTINCT keyword. If there is some key column that is a duplicate but the rest of the columns are not, then you would have to use aggregate functions and a GROUP BY clause to explain to SQL Server what data you do want returned.
Duplicate result I am writing a query in SQL server2005. This is returning me a duplicate rows in the result. Can i eliminate this duplication with a particular column as the key?
TITLE: Duplicate result QUESTION: I am writing a query in SQL server2005. This is returning me a duplicate rows in the result. Can i eliminate this duplication with a particular column as the key? ANSWER: You can eliminate complete duplicate rows using the DISTINCT keyword. If there is some key column that is a dupli...
[ "sql", "sql-server" ]
1
9
651
6
0
2008-09-23T08:43:49.040000
2008-09-23T08:44:59.613000
119,927
120,286
Different framerate for loaded SWF file in Flex?
Using The loader class of Adobe Flex, I load an external SWF file. However, the loaded SWF file has a different frameRate than my application. Is it possible to have both the parent app and the loaded child app playing at different framerates? If so, how?
It's not possible. Flash Player or Adobe AIR only uses a single frame rate for all loaded SWF files at any one time, and this frame rate is determined by the nominal frame rate of the main SWF file There are two ways around this, change the framerate of the main swf to match the loaded one (this can be done during runt...
Different framerate for loaded SWF file in Flex? Using The loader class of Adobe Flex, I load an external SWF file. However, the loaded SWF file has a different frameRate than my application. Is it possible to have both the parent app and the loaded child app playing at different framerates? If so, how?
TITLE: Different framerate for loaded SWF file in Flex? QUESTION: Using The loader class of Adobe Flex, I load an external SWF file. However, the loaded SWF file has a different frameRate than my application. Is it possible to have both the parent app and the loaded child app playing at different framerates? If so, ho...
[ "apache-flex" ]
0
5
3,287
2
0
2008-09-23T08:51:58.503000
2008-09-23T10:46:41.677000
119,929
137,713
Storing SAS data (including table structure) in a single flat file
I need to convert SAS data tables into flat files (or "ASCII files" as they were called once, as opposed to binary files). And only one flat file for each original SAS table. The challenging thing is that I want the flat file to contain some structural information of the original SAS table also, specifically: Variable/...
I'm not aware of any easy solutions. Possibly: Use PROC EXPORT to produce CSV file with the data in it. Use PROC DATASETS with ODS to produce a dataset with the names, types, etc. Produce another CSV file for this dataset. Now you've got your ASCII description of the table (spread over two CSV files). Reversing the pro...
Storing SAS data (including table structure) in a single flat file I need to convert SAS data tables into flat files (or "ASCII files" as they were called once, as opposed to binary files). And only one flat file for each original SAS table. The challenging thing is that I want the flat file to contain some structural ...
TITLE: Storing SAS data (including table structure) in a single flat file QUESTION: I need to convert SAS data tables into flat files (or "ASCII files" as they were called once, as opposed to binary files). And only one flat file for each original SAS table. The challenging thing is that I want the flat file to contai...
[ "sas", "flat-file", "table-structure" ]
2
4
4,544
5
0
2008-09-23T08:52:05.697000
2008-09-26T04:01:24.480000
119,941
119,983
Dynamically create variables inside function
I want to create variables inside a function from a dictionary. Let's say I have a dictionary, bar: bar = { 'a': 1, 'b': 2, 'c': 3 } That goes to: def foo(): a = 1 b = 2 c = 3 I want to make new variables with the variable names as bar 's keys ( a, b, c ), then set the values of the variables to the value of the corres...
Your question is not clear. If you want to "set" said variables when foo is not running, no, you can't. There is no frame object yet to "set" the local variables in. If you want to do that in the function body, you shouldn't (check the python documentation for locals()). However, you could do a foo.__dict__.update(bar)...
Dynamically create variables inside function I want to create variables inside a function from a dictionary. Let's say I have a dictionary, bar: bar = { 'a': 1, 'b': 2, 'c': 3 } That goes to: def foo(): a = 1 b = 2 c = 3 I want to make new variables with the variable names as bar 's keys ( a, b, c ), then set the value...
TITLE: Dynamically create variables inside function QUESTION: I want to create variables inside a function from a dictionary. Let's say I have a dictionary, bar: bar = { 'a': 1, 'b': 2, 'c': 3 } That goes to: def foo(): a = 1 b = 2 c = 3 I want to make new variables with the variable names as bar 's keys ( a, b, c ), ...
[ "python" ]
2
3
1,469
4
0
2008-09-23T08:55:24.877000
2008-09-23T09:08:06.093000
119,960
119,990
How to export fonts and colors from VS2008 to VS2005?
I have been forced to work in Visual Studio 2005 and would like to export my fonts and colors from Visual Studio 2008. However, VS2005 complains about wrong export document version. Is there any good way to do this besides manually changing each color and font?
I think there's a tag in the exported file called "applicationIdentity" that is set to a value of "9.0" by 2008, change it to "8.0" and the file should import. I don't recall it causing any problems from settings that are 2k8 specific, but take a backup of your settings first! UPDATE: Just looked in an export file and ...
How to export fonts and colors from VS2008 to VS2005? I have been forced to work in Visual Studio 2005 and would like to export my fonts and colors from Visual Studio 2008. However, VS2005 complains about wrong export document version. Is there any good way to do this besides manually changing each color and font?
TITLE: How to export fonts and colors from VS2008 to VS2005? QUESTION: I have been forced to work in Visual Studio 2005 and would like to export my fonts and colors from Visual Studio 2008. However, VS2005 complains about wrong export document version. Is there any good way to do this besides manually changing each co...
[ "visual-studio" ]
1
1
375
1
0
2008-09-23T09:00:48.187000
2008-09-23T09:09:42.410000
119,961
122,357
Set tag's size attribute through css?
Normally you can do this: blah blah blah And it would render as a selectionbox where all three options are visible (without dropping down) I'm looking for a way to set this size attribute from css.
There ins't an option for setting the size, but if you do set the size some browsers will let you set the width/height properties to whatever you want via CSS. Some = Firefox, Chrome, Safari, Opera. Not much works in IE though (no surprise) You could though, if you wanted, use CSS expressions in IE, to check if the siz...
Set tag's size attribute through css? Normally you can do this: blah blah blah And it would render as a selectionbox where all three options are visible (without dropping down) I'm looking for a way to set this size attribute from css.
TITLE: Set tag's size attribute through css? QUESTION: Normally you can do this: blah blah blah And it would render as a selectionbox where all three options are visible (without dropping down) I'm looking for a way to set this size attribute from css. ANSWER: There ins't an option for setting the size, but if you do...
[ "html", "css", "html-select" ]
19
8
48,260
7
0
2008-09-23T09:01:06.767000
2008-09-23T17:09:38.870000
119,980
119,992
Detect via javascript whether Silverlight is installed
Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser? I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silverlight control which is just shown if the Silverlight ...
Include Silverlight.js (from Silverlight SDK) Silverlight.isInstalled("4.0") Resource: http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx
Detect via javascript whether Silverlight is installed Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser? I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silv...
TITLE: Detect via javascript whether Silverlight is installed QUESTION: Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser? I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an ima...
[ "javascript", "silverlight" ]
10
11
12,748
5
0
2008-09-23T09:07:08.360000
2008-09-23T09:10:53.967000
119,994
120,376
Should an index be optimised after incremental indexes in Lucene?
We run full re-indexes every 7 days (i.e. creating the index from scratch) on our Lucene index and incremental indexes every 2 hours or so. Our index has around 700,000 documents and a full index takes around 17 hours (which isn't a problem). When we do incremental indexes, we only index content that has changed in the...
Mat, since you seem to have a good idea how long your current process takes, I suggest that you remove the optimize() and measure the impact. Do many of the documents change in those 2 hour windows? If only a small fraction (50,000/700,000 is about 7%) are incrementally re-indexed, then I don't think you are getting mu...
Should an index be optimised after incremental indexes in Lucene? We run full re-indexes every 7 days (i.e. creating the index from scratch) on our Lucene index and incremental indexes every 2 hours or so. Our index has around 700,000 documents and a full index takes around 17 hours (which isn't a problem). When we do ...
TITLE: Should an index be optimised after incremental indexes in Lucene? QUESTION: We run full re-indexes every 7 days (i.e. creating the index from scratch) on our Lucene index and incremental indexes every 2 hours or so. Our index has around 700,000 documents and a full index takes around 17 hours (which isn't a pro...
[ "optimization", "lucene" ]
16
17
13,369
3
0
2008-09-23T09:11:16.727000
2008-09-23T11:16:40.450000
119,999
120,234
How to setup a shared ccache
How can I setup a shared ccache without falling into a permissions problem? I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository.
The easiest solution: create a new group (e.g. "devel"), and make all developers members of it. Give read/write permissions to that group on the directory hierarchy where the cache is maintained. The developers will also need to fix their umask.
How to setup a shared ccache How can I setup a shared ccache without falling into a permissions problem? I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository.
TITLE: How to setup a shared ccache QUESTION: How can I setup a shared ccache without falling into a permissions problem? I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository. ANSWER: The easiest solution: create a new group (e...
[ "c++", "c", "compiler-construction", "build-process" ]
11
3
9,395
5
0
2008-09-23T09:12:30.373000
2008-09-23T10:28:12.937000
120,000
120,025
How can you get more information about processes when Linux runs out of memory?
I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious place to get more info about oom-killer? E.g. detailed info about processes at the time...
You can check the messages log file to see which process got killed and some related information. As for the reasons:... the ideal candidate for liquidation is a recently started, non privileged process which together with it's children uses lots of memory, has been nice'd, and does no raw I/O. Something like a nohup'd...
How can you get more information about processes when Linux runs out of memory? I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious place t...
TITLE: How can you get more information about processes when Linux runs out of memory? QUESTION: I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good n...
[ "linux", "memory-leaks" ]
1
2
1,092
3
0
2008-09-23T09:12:38.783000
2008-09-23T09:21:13.973000
120,007
120,665
Multiple Session Factories under Spring/Hibernate
I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go to that DB until they log out. I want to hot swap the session facto...
If all the databases are identical, then I can suggest using a single SessionFactory and providing your own implementations for the DataSource and Cache that are actually "tenant-aware". (Implementing these is fairly trivial: just maintain a map of tenant id -> real cache/real datasource and then delegate all calls to ...
Multiple Session Factories under Spring/Hibernate I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go to that DB until ...
TITLE: Multiple Session Factories under Spring/Hibernate QUESTION: I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go...
[ "hibernate", "spring", "sessionfactory" ]
8
2
13,577
5
0
2008-09-23T09:15:26.203000
2008-09-23T12:29:42.240000
120,016
120,072
Retrieving CDATA contents from XML using PHP and simplexml
I have the following XML structure: Dit college leert studenten hoe ze een onderzoek kunn$ <item id="5453116633894965" view="12000" title="0x|Onderwijsvorm" engtitle="0x|Method of instruction"><![CDATA[instructiecollege Opdrachten/werkstuk Wayne C. Booth, Gregory G. Colomb, Joseph M. Wi$ <item id="5960589172957031" vie...
When you load the XML file, you'll need to handle the CDATA.. This example works: xpath("//item[@title='0x|Beschrijving']"); var_dump($description);?> Here's the output: array(1) { [0]=> object(SimpleXMLElement)#2 (2) { ["@attributes"]=> array(4) { ["id"]=> string(15) "787900813228567" ["view"]=> string(5) "12000" ["ti...
Retrieving CDATA contents from XML using PHP and simplexml I have the following XML structure: Dit college leert studenten hoe ze een onderzoek kunn$ <item id="5453116633894965" view="12000" title="0x|Onderwijsvorm" engtitle="0x|Method of instruction"><![CDATA[instructiecollege Opdrachten/werkstuk Wayne C. Booth, Grego...
TITLE: Retrieving CDATA contents from XML using PHP and simplexml QUESTION: I have the following XML structure: Dit college leert studenten hoe ze een onderzoek kunn$ <item id="5453116633894965" view="12000" title="0x|Onderwijsvorm" engtitle="0x|Method of instruction"><![CDATA[instructiecollege Opdrachten/werkstuk Way...
[ "php", "xpath", "simplexml" ]
6
15
7,545
4
0
2008-09-23T09:18:11.843000
2008-09-23T09:41:17.293000
120,022
120,030
Tool to monitor HTTP, TCP, etc. Web Service traffic
What's the best tool that you use to monitor Web Service, SOAP, WCF, etc. traffic that's coming and going on the wire? I have seen some tools that made with Java but they seem to be a little crappy. What I want is a tool that sits in the middle as a proxy and does port redirection (which should have configurable listen...
For Windows HTTP, you can't beat Fiddler. You can use it as a reverse proxy for port-forwarding on a web server. It doesn't necessarily need IE, either. It can use other clients.
Tool to monitor HTTP, TCP, etc. Web Service traffic What's the best tool that you use to monitor Web Service, SOAP, WCF, etc. traffic that's coming and going on the wire? I have seen some tools that made with Java but they seem to be a little crappy. What I want is a tool that sits in the middle as a proxy and does por...
TITLE: Tool to monitor HTTP, TCP, etc. Web Service traffic QUESTION: What's the best tool that you use to monitor Web Service, SOAP, WCF, etc. traffic that's coming and going on the wire? I have seen some tools that made with Java but they seem to be a little crappy. What I want is a tool that sits in the middle as a ...
[ "web-services", "http", "tcp", "monitoring" ]
44
35
138,681
11
0
2008-09-23T09:20:39.450000
2008-09-23T09:23:23.313000
120,033
120,084
Any workarounds for non-static member array initialization?
In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not using arrays? [Anything that can be initialized using only the i...
One possible workaround is to avoid the compiler calling the OtherClass constructor at all, and to call it on your own using placement new to initialize it whichever way you need. Example: class Foo { private: char inst[3*sizeof(OtherClass)]; // Array size fixed. OtherClass has no default ctor. // use Inst to access, ...
Any workarounds for non-static member array initialization? In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not usin...
TITLE: Any workarounds for non-static member array initialization? QUESTION: In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this a...
[ "c++" ]
14
4
7,621
7
0
2008-09-23T09:23:51.283000
2008-09-23T09:43:00.223000
120,059
120,257
Releasing a database build consistently via isql
I am releasing a database build to SQL Server 2000 via a batch file using isql. The batch file is used so multiple files are released consistently to different SQL Servers (development, test, live). The SQL Server uses ANSI code page 1252 (from sp_helpsort) but isql is an OEM client using code page 437. This means that...
isql is obsolete. It isn't included in SQL Server 2005 or later, because it uses the DB-Library connections, which are also obsolete. For the reasons why, and the effects this has, see Connecting Early Version Clients to SQL Server 2000. osql uses ODBC connections to connect to SQL Server. For completeness, this has be...
Releasing a database build consistently via isql I am releasing a database build to SQL Server 2000 via a batch file using isql. The batch file is used so multiple files are released consistently to different SQL Servers (development, test, live). The SQL Server uses ANSI code page 1252 (from sp_helpsort) but isql is a...
TITLE: Releasing a database build consistently via isql QUESTION: I am releasing a database build to SQL Server 2000 via a batch file using isql. The batch file is used so multiple files are released consistently to different SQL Servers (development, test, live). The SQL Server uses ANSI code page 1252 (from sp_helps...
[ "sql-server" ]
0
2
314
2
0
2008-09-23T09:37:10.847000
2008-09-23T10:36:54.743000
120,061
120,118
Fetch a Wikipedia article with Python
I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedia Foundation: Request: GET http://en.wikipedia.org/w/index.php?titl...
You need to use the urllib2 that superseedes urllib in the python std library in order to change the user agent. Straight from the examples import urllib2 opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] infile = opener.open('http://en.wikipedia.org/w/index.php?title=Albert_Einstein&p...
Fetch a Wikipedia article with Python I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedia Foundation: Request: GET ht...
TITLE: Fetch a Wikipedia article with Python QUESTION: I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedia Foundatio...
[ "python", "urllib2", "user-agent", "wikipedia", "http-status-code-403" ]
40
51
27,661
10
0
2008-09-23T09:37:21.983000
2008-09-23T09:50:39.893000
120,065
120,340
Mnesia table replication/sharing
Assume that we have N erlang nodes, running same application. I want to share an mnesia table T1 with all N nodes, which I see no problem. However, I want to share another mnesia table T2 with pairs of nodes. I mean the contents of T2 will be identical and replicated to/with only sharing pair. In another words, I want ...
One table is always one table, no matter how many nodes you share it with. If you want pairs of nodes sharing a table, you would have to create a unique table for each pair of nodes. You can use the same settings (records etc) for all those tables though, so there shouldn't be so much more work to get it done.
Mnesia table replication/sharing Assume that we have N erlang nodes, running same application. I want to share an mnesia table T1 with all N nodes, which I see no problem. However, I want to share another mnesia table T2 with pairs of nodes. I mean the contents of T2 will be identical and replicated to/with only sharin...
TITLE: Mnesia table replication/sharing QUESTION: Assume that we have N erlang nodes, running same application. I want to share an mnesia table T1 with all N nodes, which I see no problem. However, I want to share another mnesia table T2 with pairs of nodes. I mean the contents of T2 will be identical and replicated t...
[ "erlang", "mnesia" ]
2
5
1,478
2
0
2008-09-23T09:39:49.543000
2008-09-23T11:03:46.957000
120,066
120,156
Doing readback from Direct3D textures and surfaces
I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to system memory? In short I'm looking for concise descri...
The most involved part is reading from some surface that is in video memory ("default pool"). This is most often render targets. Let's get the easy parts first: reading from a texture is the same as reading from 0-level surface of that texture. See below. the same for subset of a texture. reading from a surface that is...
Doing readback from Direct3D textures and surfaces I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to sys...
TITLE: Doing readback from Direct3D textures and surfaces QUESTION: I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the e...
[ "directx", "textures", "gpgpu", "geometry-surface" ]
15
30
19,253
1
0
2008-09-23T09:40:10.837000
2008-09-23T10:01:40.863000
120,071
120,207
How can I find the first occurrence of a pattern in a string from some starting position?
I have a string of arbitrary length, and starting at position p0, I need to find the first occurrence of one of three 3-letter patterns. Assume the string contain only letters. I need to find the count of triplets starting at position p0 and jumping forward in triplets until the first occurrence of either 'aaa' or 'bbb...
Moritz says this might be faster than a regex. Even if it's a little slower, it's easier to understand at 5 am.:) #0123456789.123456789.123456789. my $string = "alsdhfaaasccclaaaagalkfgblkgbklfs"; my $pos = 9; my $length = 3; my $regex = qr/^(aaa|bbb|ccc)/; while( $pos < length $string ) { print "Checking $pos\n"; if...
How can I find the first occurrence of a pattern in a string from some starting position? I have a string of arbitrary length, and starting at position p0, I need to find the first occurrence of one of three 3-letter patterns. Assume the string contain only letters. I need to find the count of triplets starting at posi...
TITLE: How can I find the first occurrence of a pattern in a string from some starting position? QUESTION: I have a string of arbitrary length, and starting at position p0, I need to find the first occurrence of one of three 3-letter patterns. Assume the string contain only letters. I need to find the count of triplet...
[ "regex", "perl", "string", "search" ]
6
12
6,712
5
0
2008-09-23T09:41:07.263000
2008-09-23T10:19:50.853000
120,075
120,246
Problem with Asp.Net RequireFieldValidator and Javascript WYSIWYG
I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-side RFV ErrorMessage "Required", but if I submit a second time, it goes through. Am I...
I think the reason for this behavior is that validation code runs earlier than the code that updates underlying TextBox from value of WYSIWYG. So the first time you get the error, then the field is updated and the second time you don't get it. Try removing all the content the second time and I bet you wont get validati...
Problem with Asp.Net RequireFieldValidator and Javascript WYSIWYG I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-side RFV ErrorMessag...
TITLE: Problem with Asp.Net RequireFieldValidator and Javascript WYSIWYG QUESTION: I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-si...
[ "asp.net", "javascript", "validation", "wysiwyg" ]
1
3
444
2
0
2008-09-23T09:41:54
2008-09-23T10:34:25.340000
120,083
120,821
How do I alter the precision of a decimal column in Microsoft SQL Server?
Is there a way to alter the precision of an existing decimal column in Microsoft SQL Server?
ALTER TABLE Testing ALTER COLUMN TestDec decimal(16,1) Just put decimal(precision, scale), replacing the precision and scale with your desired values. I haven't done any testing with this with data in the table, but if you alter the precision, you would be subject to losing data if the new precision is lower.
How do I alter the precision of a decimal column in Microsoft SQL Server? Is there a way to alter the precision of an existing decimal column in Microsoft SQL Server?
TITLE: How do I alter the precision of a decimal column in Microsoft SQL Server? QUESTION: Is there a way to alter the precision of an existing decimal column in Microsoft SQL Server? ANSWER: ALTER TABLE Testing ALTER COLUMN TestDec decimal(16,1) Just put decimal(precision, scale), replacing the precision and scale w...
[ "sql-server" ]
115
202
222,011
5
0
2008-09-23T09:42:56.587000
2008-09-23T12:58:38.413000
120,102
120,231
Stored Procedure Syntax
My stored procedure is called as below from an SQL instegartion package within SQL Server 2005 EXEC? = Validation.PopulateFaultsFileDetails?, 0 Though i'm not sure what the? means
When this SQL statment is called, both question marks (?) will be replaced. The first will be replaced by a variable which will receive the return value of the stored procedure. The second will be replaced by a value which will be passed into the stored procedure. The code to use this statement will look something like...
Stored Procedure Syntax My stored procedure is called as below from an SQL instegartion package within SQL Server 2005 EXEC? = Validation.PopulateFaultsFileDetails?, 0 Though i'm not sure what the? means
TITLE: Stored Procedure Syntax QUESTION: My stored procedure is called as below from an SQL instegartion package within SQL Server 2005 EXEC? = Validation.PopulateFaultsFileDetails?, 0 Though i'm not sure what the? means ANSWER: When this SQL statment is called, both question marks (?) will be replaced. The first wil...
[ "sql-server", "sql-server-2005", "stored-procedures" ]
1
1
3,355
3
0
2008-09-23T09:46:30.683000
2008-09-23T10:27:51.380000
120,107
120,157
Guidelines for email newsletter service
I'm implementing a email newsletter sender service using.NET and Windows Server technologies. Are there comprehensive guidelines which could help avoiding emails being trapped by spam filters and other mechanisms? They should cover all aspects of (legal) bulk mail sending: SMTP configuration, DNS, HTML content, images,...
Although I don't have a definitive answer, I think this is a very important question. Here are few tidbits I know about it Choose a clean hosting/smtp server. IP addresses of spamming SMTP servers are often black-listed by other ISPs. Send a simple introductory email to every subscriber, asking them to add your sender ...
Guidelines for email newsletter service I'm implementing a email newsletter sender service using.NET and Windows Server technologies. Are there comprehensive guidelines which could help avoiding emails being trapped by spam filters and other mechanisms? They should cover all aspects of (legal) bulk mail sending: SMTP c...
TITLE: Guidelines for email newsletter service QUESTION: I'm implementing a email newsletter sender service using.NET and Windows Server technologies. Are there comprehensive guidelines which could help avoiding emails being trapped by spam filters and other mechanisms? They should cover all aspects of (legal) bulk ma...
[ "email", "smtp", "email-spam" ]
5
4
1,363
2
0
2008-09-23T09:48:46.950000
2008-09-23T10:01:44.030000
120,114
120,500
Retrieve catalog, metadata or schema information from MS Access database when connecting with PHP
I am using following PHP code to connect to MS Access database: $odb_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";"; $odb_conn->open($connstr); How can I retrieve database catalog/metadata from the mdb file? FOUND THE SOLUTION $rs_meta = $odb_conn->OpenSche...
You will find information on ADO here: http://msdn.microsoft.com/en-us/library/ms675532(VS.85).aspx http://www.w3schools.com/ado/default.asp The connection object has an OpenSchema method to get database schema information. I don't know how to use MS Acces DB with PHP and how your new COM() object works, but I think it...
Retrieve catalog, metadata or schema information from MS Access database when connecting with PHP I am using following PHP code to connect to MS Access database: $odb_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";"; $odb_conn->open($connstr); How can I retri...
TITLE: Retrieve catalog, metadata or schema information from MS Access database when connecting with PHP QUESTION: I am using following PHP code to connect to MS Access database: $odb_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";"; $odb_conn->open($connstr...
[ "php", "database", "ms-access" ]
1
2
2,020
2
0
2008-09-23T09:49:53.920000
2008-09-23T11:50:30.337000
120,116
120,153
Encryption libraries?
I have been tasked with implementing a PKI library in C# for a company project, and have been unable to find a good implementation of it. There appear to be multiple libraries, and many broken links pointing to MSDN libraries that have been removed. I've seen people using Crypt32.dll, people building their own librarie...
Well, you did not mention that the built-in class doesn't cover your need, so how about System.Security.Cryptography.RSACryptoServiceProvider? It has a large set qualified ways to asymmetrically encrypt/decrypt streams. There are several tutorial/guides to take you along the way: Public Key RSA Encryption in C#.NET - C...
Encryption libraries? I have been tasked with implementing a PKI library in C# for a company project, and have been unable to find a good implementation of it. There appear to be multiple libraries, and many broken links pointing to MSDN libraries that have been removed. I've seen people using Crypt32.dll, people build...
TITLE: Encryption libraries? QUESTION: I have been tasked with implementing a PKI library in C# for a company project, and have been unable to find a good implementation of it. There appear to be multiple libraries, and many broken links pointing to MSDN libraries that have been removed. I've seen people using Crypt32...
[ "c#", "encryption", "pki" ]
7
12
6,351
2
0
2008-09-23T09:50:10.347000
2008-09-23T10:01:11.817000
120,131
120,146
Combination of more than one crypto algorithm
I'm considering the following: I have some data stream which I'd like to protect as secure as possible -- does it make any sense to apply let's say AES with some IV, then Blowfish with some IV and finally again AES with some IV? The encryption / decryption process will be hidden (even protected against debugging) so it...
I'm not sure about this specific combination, but it's generally a bad idea to mix things like this unless that specific combination has been extensively researched. It's possible the mathematical transformations would actually counteract one another and the end result would be easier to hack. A single pass of either A...
Combination of more than one crypto algorithm I'm considering the following: I have some data stream which I'd like to protect as secure as possible -- does it make any sense to apply let's say AES with some IV, then Blowfish with some IV and finally again AES with some IV? The encryption / decryption process will be h...
TITLE: Combination of more than one crypto algorithm QUESTION: I'm considering the following: I have some data stream which I'd like to protect as secure as possible -- does it make any sense to apply let's say AES with some IV, then Blowfish with some IV and finally again AES with some IV? The encryption / decryption...
[ "security", "cryptography" ]
4
11
2,160
14
0
2008-09-23T09:54:01.757000
2008-09-23T09:58:51.323000
120,139
120,144
Failover & Disaster Recovery
What's the difference between failover and disaster recovery?
Failover: When one machine fails, another machine (usually in the same location) takes over and resumes service Disaster recovery: When Godzilla destroys your data center, you do have alternative locations to keep providing your service and protocols/means for the other location to know how to keep delivering the servi...
Failover & Disaster Recovery What's the difference between failover and disaster recovery?
TITLE: Failover & Disaster Recovery QUESTION: What's the difference between failover and disaster recovery? ANSWER: Failover: When one machine fails, another machine (usually in the same location) takes over and resumes service Disaster recovery: When Godzilla destroys your data center, you do have alternative locati...
[ "failover", "high-availability", "disaster-recovery" ]
15
26
15,532
3
0
2008-09-23T09:56:07.057000
2008-09-23T09:57:57.270000
120,149
120,178
User Monitoring in Rails
We have an app with an extensive admin section. We got a little trigger happy with features (as you do) and are looking for some quick and easy way to monitor "who uses what". Ideally a simple gem that will allow us to track controller/actions on a per user basis to build up a picture of the features that are used and ...
I don't know that there's a popular gem or plugin for this; in the past, I've implemented this sort of auditing as a before_filter in ApplicationController: from memory: class ApplicationController < ActionController::Base before_filter:audit_events #... protected def audit_events local_params = params.clone controlle...
User Monitoring in Rails We have an app with an extensive admin section. We got a little trigger happy with features (as you do) and are looking for some quick and easy way to monitor "who uses what". Ideally a simple gem that will allow us to track controller/actions on a per user basis to build up a picture of the fe...
TITLE: User Monitoring in Rails QUESTION: We have an app with an extensive admin section. We got a little trigger happy with features (as you do) and are looking for some quick and easy way to monitor "who uses what". Ideally a simple gem that will allow us to track controller/actions on a per user basis to build up a...
[ "ruby-on-rails", "ruby", "rubygems" ]
9
10
1,073
1
0
2008-09-23T09:59:49.277000
2008-09-23T10:11:23.790000
120,170
121,358
Save drop-down history in a Firefox Toolbar
I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile. Is there any tutorial on how to sort this out?
Since it's taking quite a bit to get an answer I went and investigate it myself. Here is what I've got now. Not all is clear to me but it works. Let's assume you have a like this, on your.xul: You now have to add some other attributes to enable history. This gives you the minimum to enable a history on that textbox. Fo...
Save drop-down history in a Firefox Toolbar I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile. Is there any tutorial on how to sort this out?
TITLE: Save drop-down history in a Firefox Toolbar QUESTION: I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile. Is there any tutorial on how to sort this out? ANSWER: Since it's taking...
[ "firefox", "xul", "toolbar" ]
0
1
1,745
3
0
2008-09-23T10:06:39.917000
2008-09-23T14:31:27.643000
120,180
121,456
How to do query auto-completion/suggestions in Lucene?
I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to using Solr in the near future, and Solr is obviously just wrapping around ...
Based on @Alexandre Victoor's answer, I wrote a little class based on the Lucene Spellchecker in the contrib package (and using the LuceneDictionary included in it) that does exactly what I want. This allows re-indexing from a single source index with a single field, and provides suggestions for terms. Results are sort...
How to do query auto-completion/suggestions in Lucene? I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to using Solr in the n...
TITLE: How to do query auto-completion/suggestions in Lucene? QUESTION: I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to u...
[ "java", "autocomplete", "lucene" ]
52
38
56,681
5
0
2008-09-23T10:12:10.560000
2008-09-23T14:41:51.317000
120,189
120,204
XSS Blacklist - Is anyone aware of a reasonable one?
As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS. Preferably a set of Regular Expressions. I'm aware of plenty of cheat shee...
I realise this may not be a direct answer to your question, but ASP.NET developers in a similar situation may find this useful: Microsoft Anti-Cross Site Scripting Library V1.5 This library differs from most encoding libraries in that it uses the "principle of inclusions" technique to provide protection against XSS att...
XSS Blacklist - Is anyone aware of a reasonable one? As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS. Preferably a set of R...
TITLE: XSS Blacklist - Is anyone aware of a reasonable one? QUESTION: As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS. Pre...
[ "javascript", "html", "security", "xss" ]
2
3
3,738
6
0
2008-09-23T10:14:11.677000
2008-09-23T10:19:25.267000
120,191
122,913
What are the steps needed to create and publish a rubygem of your own?
So you've created a ruby library. How do you create and publish your rubygem? And what common pitfalls and gotchas are there pertaining to creating and publishing rubygems?
There are several tools to help you build your own gems. hoe and newgem are the best-known, and have a lot of good qualities. However, hoe adds itself as a dependency to your gem, and newgem has become a very large tool, one that I find unwieldy when I want to create and deploy a gem quickly. My favorite tool is Mr Bon...
What are the steps needed to create and publish a rubygem of your own? So you've created a ruby library. How do you create and publish your rubygem? And what common pitfalls and gotchas are there pertaining to creating and publishing rubygems?
TITLE: What are the steps needed to create and publish a rubygem of your own? QUESTION: So you've created a ruby library. How do you create and publish your rubygem? And what common pitfalls and gotchas are there pertaining to creating and publishing rubygems? ANSWER: There are several tools to help you build your ow...
[ "ruby", "rubygems" ]
16
6
1,367
6
0
2008-09-23T10:15:03.780000
2008-09-23T18:40:05.237000
120,201
120,317
Updating server-side progress on Rails application
I want to upload and then process a file in a Ruby on Rails app. The file upload is usually quite short, but the server-side processing can take some time (more than 20 seconds) so I want to give the user some indicator - something better than a meaningless 'processing...' screen. I'm trying to use the following code i...
periodically_call_remote() updates a div. It won't call your JavaScript function. I'm no JavaScript guru, but to solve your problem, you should do your own xmlhttp call. If I were you, I'd use prototype's AJAX request http://www.prototypejs.org/api/ajax/request and use JavaScript's settimeout or setinterval to do the p...
Updating server-side progress on Rails application I want to upload and then process a file in a Ruby on Rails app. The file upload is usually quite short, but the server-side processing can take some time (more than 20 seconds) so I want to give the user some indicator - something better than a meaningless 'processing...
TITLE: Updating server-side progress on Rails application QUESTION: I want to upload and then process a file in a Ruby on Rails app. The file upload is usually quite short, but the server-side processing can take some time (more than 20 seconds) so I want to give the user some indicator - something better than a meani...
[ "javascript", "ruby-on-rails", "ajax", "xmlhttprequest" ]
4
3
1,965
2
0
2008-09-23T10:18:34.710000
2008-09-23T10:56:20.360000
120,206
120,223
What is the best replacement for Windows' rand_s in Linux/POSIX?
The problem is not about randomness itself (we have rand), but in cryptographically secure PRNG. What can be used on Linux, or ideally POSIX? Does NSS have something useful? Clarification: I know about /dev/random, but it may run out of entropy pool. And I'm not sure whether /dev/urandom is guaranteed to be cryptograph...
Use /dev/random (requires user input, eg mouse movements) or /dev/urandom. The latter has an entropy pool and doesn't require any user input unless the pool is empty. You can read from the pool like this: char buf[100]; FILE *fp; if (fp = fopen("/dev/urandom", "r")) { fread(&buf, sizeof(char), 100, fp); fclose(fp); } O...
What is the best replacement for Windows' rand_s in Linux/POSIX? The problem is not about randomness itself (we have rand), but in cryptographically secure PRNG. What can be used on Linux, or ideally POSIX? Does NSS have something useful? Clarification: I know about /dev/random, but it may run out of entropy pool. And ...
TITLE: What is the best replacement for Windows' rand_s in Linux/POSIX? QUESTION: The problem is not about randomness itself (we have rand), but in cryptographically secure PRNG. What can be used on Linux, or ideally POSIX? Does NSS have something useful? Clarification: I know about /dev/random, but it may run out of ...
[ "linux", "security", "random", "cryptography" ]
3
5
1,820
3
0
2008-09-23T10:19:43.490000
2008-09-23T10:26:24.907000
120,212
120,530
Virtual Machine Benchmarks
I am using VMware Server 1.0.7 on Windows XP SP3 at the moment to test software in virtual machines. I have also tried Microsoft Virtual PC (do not remeber the version, could be 2004 or 2007) and VMware was way faster at the time. I have heard of Parallels and VirtualBox but I did not have the time to try them out. Any...
From my experience of Parallels and VMware (on the PC and more extensively on the Mac) the difference between any 2 competing versions of the software is usually quite small and often 'reversed' in the next releases. I never found Parallels to be much faster (or slower) than VMware - it often would be a case of the sta...
Virtual Machine Benchmarks I am using VMware Server 1.0.7 on Windows XP SP3 at the moment to test software in virtual machines. I have also tried Microsoft Virtual PC (do not remeber the version, could be 2004 or 2007) and VMware was way faster at the time. I have heard of Parallels and VirtualBox but I did not have th...
TITLE: Virtual Machine Benchmarks QUESTION: I am using VMware Server 1.0.7 on Windows XP SP3 at the moment to test software in virtual machines. I have also tried Microsoft Virtual PC (do not remeber the version, could be 2004 or 2007) and VMware was way faster at the time. I have heard of Parallels and VirtualBox but...
[ "virtualization", "benchmarking" ]
2
1
2,304
3
0
2008-09-23T10:22:07.557000
2008-09-23T11:59:50.457000
120,240
120,255
Is there an alternative to the SQL Profiler for SQL Server 2000
I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message "In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.". It seems that only members of the sysadmin role can run traces on the server (someth...
Your hands are kind of tied without profiler. You can, however, start with tuning your existing queries using Query Analyzer or any query tool and examining the execution plans. With QA, you can use the Show Execution Plan option. From other tools you can use the SET STATISTICS PROFILE ON / OFF
Is there an alternative to the SQL Profiler for SQL Server 2000 I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message "In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.". It seems that only m...
TITLE: Is there an alternative to the SQL Profiler for SQL Server 2000 QUESTION: I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message "In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.". It...
[ "sql-server", "sql-server-profiler" ]
2
1
3,281
3
0
2008-09-23T10:32:10.557000
2008-09-23T10:36:22.827000
120,262
120,280
What's the best way to detect if a given Javascript object is a DOM Element?
Say for instance I was writing a function that was designed to accept multiple argument types: var overloaded = function (arg) { if (is_dom_element(arg)) { // Code for DOM Element argument... } }; What's the best way to implement is_dom_element so that it works in a cross-browser, fairly accurate way?
jQuery checks the nodeType property. So you would have: var overloaded = function (arg) { if (arg.nodeType) { // Code for DOM Element argument... } }; Although this would detect all DOM objects, not just elements. If you want elements alone, that would be: var overloaded = function (arg) { if (arg.nodeType && arg.nodeT...
What's the best way to detect if a given Javascript object is a DOM Element? Say for instance I was writing a function that was designed to accept multiple argument types: var overloaded = function (arg) { if (is_dom_element(arg)) { // Code for DOM Element argument... } }; What's the best way to implement is_dom_elemen...
TITLE: What's the best way to detect if a given Javascript object is a DOM Element? QUESTION: Say for instance I was writing a function that was designed to accept multiple argument types: var overloaded = function (arg) { if (is_dom_element(arg)) { // Code for DOM Element argument... } }; What's the best way to imple...
[ "javascript", "dom", "cross-browser" ]
12
20
4,456
3
0
2008-09-23T10:38:05.020000
2008-09-23T10:44:25.490000
120,283
120,379
How can I measure distance and create a bounding box based on two latitude+longitude points in Java?
I am wanting to find the distance between two different points. This I know can be accomplished with the great circle distance. http://www.meridianworlddata.com/Distance-calculation.asp Once done, with a point and distance I would like to find the point that distance north, and that distance east in order to create a b...
We've had some success using OpenMap to plot a lot of positional data. There's a LatLonPoint class that has some basic functionality, including distance.
How can I measure distance and create a bounding box based on two latitude+longitude points in Java? I am wanting to find the distance between two different points. This I know can be accomplished with the great circle distance. http://www.meridianworlddata.com/Distance-calculation.asp Once done, with a point and dista...
TITLE: How can I measure distance and create a bounding box based on two latitude+longitude points in Java? QUESTION: I am wanting to find the distance between two different points. This I know can be accomplished with the great circle distance. http://www.meridianworlddata.com/Distance-calculation.asp Once done, with...
[ "java", "geocoding", "latitude-longitude" ]
76
21
97,005
12
0
2008-09-23T10:45:35.987000
2008-09-23T11:16:52.430000
120,296
120,362
Used Ctrl-Alt-F6 in Linux, and can't get my screen back
This is obviously a stupid question. I am coding in Eclipse both on Mac and Linux, but I mixed up and used the Mac shortcut to window tabbing ( Ctrl - Cmd - F6 ), but I was using the Linux on uni and screen went black. I've done this before, but this time I can't get back to my desktop. Ctrl - Alt F1 - F6 gives me diff...
X is probably still running on F7, your display driver (or something else) is just misbehaving. You might be able to trick it into coming back on by going to F7 and blindly opening a terminal and playing with xset ($ xset dpms force on ). Or you can ctrl - alt - backspace to kill X and GDM should restart it. Try seeing...
Used Ctrl-Alt-F6 in Linux, and can't get my screen back This is obviously a stupid question. I am coding in Eclipse both on Mac and Linux, but I mixed up and used the Mac shortcut to window tabbing ( Ctrl - Cmd - F6 ), but I was using the Linux on uni and screen went black. I've done this before, but this time I can't ...
TITLE: Used Ctrl-Alt-F6 in Linux, and can't get my screen back QUESTION: This is obviously a stupid question. I am coding in Eclipse both on Mac and Linux, but I mixed up and used the Mac shortcut to window tabbing ( Ctrl - Cmd - F6 ), but I was using the Linux on uni and screen went black. I've done this before, but ...
[ "linux", "console" ]
23
13
39,952
11
0
2008-09-23T10:49:31.453000
2008-09-23T11:12:27.013000
120,334
125,879
How to sort an array of UTF-8 strings?
I currentyl have no clue on how to sort an array which contains UTF-8 encoded strings in PHP. The array comes from a LDAP server so sorting via a database (would be no problem) is no solution. The following does not work on my windows development machine (although I'd think that this should be at least a possible solut...
Eventually this problem cannot be solved in a simple way without using recoded strings (UTF-8 → Windows-1252 or ISO-8859-1) as suggested by ΤΖΩΤΖΙΟΥ due to an obvious PHP bug as discovered by Huppie. To summarize the problem, I created the following code snippet which clearly demonstrates that the problem is the strcol...
How to sort an array of UTF-8 strings? I currentyl have no clue on how to sort an array which contains UTF-8 encoded strings in PHP. The array comes from a LDAP server so sorting via a database (would be no problem) is no solution. The following does not work on my windows development machine (although I'd think that t...
TITLE: How to sort an array of UTF-8 strings? QUESTION: I currentyl have no clue on how to sort an array which contains UTF-8 encoded strings in PHP. The array comes from a LDAP server so sorting via a database (would be no problem) is no solution. The following does not work on my windows development machine (althoug...
[ "php", "arrays", "sorting", "utf-8" ]
27
6
34,584
8
0
2008-09-23T11:01:24.527000
2008-09-24T07:42:28.867000
120,335
120,347
How do I get maven to "stamp" a build number into a properties file
I would like to be able to, as part of a maven build, set the build number (doesn't matter exactly what) in a properties file/class (so I can show it in a UI). Any ideas?
We used the Build Number Plugin now available from Codehaus. It can generate a sequential build number or allows you to use the time stamp.
How do I get maven to "stamp" a build number into a properties file I would like to be able to, as part of a maven build, set the build number (doesn't matter exactly what) in a properties file/class (so I can show it in a UI). Any ideas?
TITLE: How do I get maven to "stamp" a build number into a properties file QUESTION: I would like to be able to, as part of a maven build, set the build number (doesn't matter exactly what) in a properties file/class (so I can show it in a UI). Any ideas? ANSWER: We used the Build Number Plugin now available from Cod...
[ "maven-2" ]
10
7
4,291
3
0
2008-09-23T11:01:31.640000
2008-09-23T11:05:32.613000
120,351
120,405
Performance Profiling Tips Netbeans for client applications
Do you have any tips for effective profiling using Netbeans? The profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out of it. Normally I set it to profile either all my classes (starting with xxx....
The JavaOne lab exercises are available online for free, you should be able to get some good tips there. http://developers.sun.com/learning/javaoneonline/j1labs2008.jsp?track=1&yr=2008
Performance Profiling Tips Netbeans for client applications Do you have any tips for effective profiling using Netbeans? The profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out of it. Normally I...
TITLE: Performance Profiling Tips Netbeans for client applications QUESTION: Do you have any tips for effective profiling using Netbeans? The profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out...
[ "java", "netbeans", "profiling" ]
2
2
322
2
0
2008-09-23T11:06:30.943000
2008-09-23T11:26:12.957000
120,380
120,401
Irretrievably destroying data in Java
Is there anyway in Java to delete data (e.g., a variable value, object) and be sure it can't be recovered from memory? Does assigning null to a variable in Java delete the value from memory? Any ideas? Answers applicable to other languages are also acceptable.
Due to the wonders virtual memory, it is nearly impossible to delete something from memory in a completely irretrievable manner. Your best bet is to zero out the value fields; however: This does not mean that an old (unzeroed) copy of the object won't be left on an unused swap page, which could persist across reboots. ...
Irretrievably destroying data in Java Is there anyway in Java to delete data (e.g., a variable value, object) and be sure it can't be recovered from memory? Does assigning null to a variable in Java delete the value from memory? Any ideas? Answers applicable to other languages are also acceptable.
TITLE: Irretrievably destroying data in Java QUESTION: Is there anyway in Java to delete data (e.g., a variable value, object) and be sure it can't be recovered from memory? Does assigning null to a variable in Java delete the value from memory? Any ideas? Answers applicable to other languages are also acceptable. AN...
[ "java", "security" ]
11
19
2,722
10
0
2008-09-23T11:17:11.730000
2008-09-23T11:26:00.973000
120,383
274,817
How to save file using Eclipse Monkey?
I've recently started working with Aptana and Eclipse Monkey. What I want to do now is to create a script that saves a file then uploads it to a FTP. Problem is that Eclipse Monkey is VERY poorly documented and Google returned only unrelated results. I've made it upload the file, but I need the script to save the file ...
Check this out, it has the solution for your problem: http://forums.aptana.com/viewtopic.php?t=5216 Edit; to be more specific; You need to add the following line into the meta-data piece at the top, so the script knows the reference 'editors': * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclips...
How to save file using Eclipse Monkey? I've recently started working with Aptana and Eclipse Monkey. What I want to do now is to create a script that saves a file then uploads it to a FTP. Problem is that Eclipse Monkey is VERY poorly documented and Google returned only unrelated results. I've made it upload the file, ...
TITLE: How to save file using Eclipse Monkey? QUESTION: I've recently started working with Aptana and Eclipse Monkey. What I want to do now is to create a script that saves a file then uploads it to a FTP. Problem is that Eclipse Monkey is VERY poorly documented and Google returned only unrelated results. I've made it...
[ "eclipse", "scripting", "ide" ]
2
1
716
1
0
2008-09-23T11:18:23.707000
2008-11-08T15:19:26.047000
120,396
120,431
How to price a corporate web app?
I am putting together a proposal for a large multinational company for our licenced solution. Problem is I've never put together something this big before and so I don't know what is acceptable. Ignoring hosting or support (or even the functionality of the app) for the moment and just concentrating the licence - do you...
With big deals it's usually discounted on each unit of whatever you're selling so that you can scale with their volume. Probably makes sense to have a base price plus a per user license that scales with their usage. Another rule of thumb is that when you have a large purchase to get approved your sales cycle will be fa...
How to price a corporate web app? I am putting together a proposal for a large multinational company for our licenced solution. Problem is I've never put together something this big before and so I don't know what is acceptable. Ignoring hosting or support (or even the functionality of the app) for the moment and just ...
TITLE: How to price a corporate web app? QUESTION: I am putting together a proposal for a large multinational company for our licenced solution. Problem is I've never put together something this big before and so I don't know what is acceptable. Ignoring hosting or support (or even the functionality of the app) for th...
[ "web-applications" ]
4
5
908
2
0
2008-09-23T11:25:13.287000
2008-09-23T11:31:36.373000
120,402
203,439
Fax barcode recognition software to integrate in a c# application
My application is preparing a cover-sheet for submitting documents by fax. I identify the batch by printing a Code39 on it. The incoming faxes are received as tif files and my small c# service is polling for new faxes and calling a decoding function. Currently I use a Win32 dll to recognize the barcode ( QSbar39 ) and ...
BarBara is an open source barcode recognition library. It certainly isn't perfect, but I have gotten it to work (if I remember it needed some twiddling to get it to compile in VS2008) pretty well.
Fax barcode recognition software to integrate in a c# application My application is preparing a cover-sheet for submitting documents by fax. I identify the batch by printing a Code39 on it. The incoming faxes are received as tif files and my small c# service is polling for new faxes and calling a decoding function. Cur...
TITLE: Fax barcode recognition software to integrate in a c# application QUESTION: My application is preparing a cover-sheet for submitting documents by fax. I identify the batch by printing a Code39 on it. The incoming faxes are received as tif files and my small c# service is polling for new faxes and calling a deco...
[ "c#", ".net", "barcode" ]
1
3
1,550
3
0
2008-09-23T11:26:02.410000
2008-10-15T01:28:35.587000
120,404
120,434
Problem accessing file from different thread in Asp.net
I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows: Upload file Record and save info regarding file to database Import data from file into database Redirect to different page When run sequentially like this, everything works fine. However, since the files being i...
Try Response.Redirect(url, false), else the 'Response' will be ended just after that call.
Problem accessing file from different thread in Asp.net I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows: Upload file Record and save info regarding file to database Import data from file into database Redirect to different page When run sequentially like this,...
TITLE: Problem accessing file from different thread in Asp.net QUESTION: I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows: Upload file Record and save info regarding file to database Import data from file into database Redirect to different page When run seque...
[ "c#", "asp.net", "multithreading", "file" ]
0
1
1,094
1
0
2008-09-23T11:26:12.860000
2008-09-23T11:31:46.903000
120,420
120,428
Image icon beside the site URL
I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself?
These icons are called favicons Most web browsers support http://mysite.com/favicon.ico but the proper way to do it is to include an icon meta tag in the head profile. […] Source from the W3C itself. Your best bet is to probably do both with the same icon image.
Image icon beside the site URL I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself?
TITLE: Image icon beside the site URL QUESTION: I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself? ANSWER: These icons are called favico...
[ "web-applications", "favicon" ]
21
51
34,046
9
0
2008-09-23T11:30:14.707000
2008-09-23T11:31:13.583000
120,422
120,993
How do I iterate over a set of records in RPG(LE) with embedded SQL?
How do I iterate over a set of records in RPG(LE) with embedded SQL?
Usually I'll create a cursor and fetch each record. //*********************************************************************** // Main - Main Processing Routine begsr Main; exsr BldSqlStmt; if OpenSqlCursor() = SQL_SUCCESS; dow FetchNextRow() = SQL_SUCCESS; exsr ProcessRow; enddo; if sqlStt = SQL_NO_MORE_ROWS; Close...
How do I iterate over a set of records in RPG(LE) with embedded SQL? How do I iterate over a set of records in RPG(LE) with embedded SQL?
TITLE: How do I iterate over a set of records in RPG(LE) with embedded SQL? QUESTION: How do I iterate over a set of records in RPG(LE) with embedded SQL? ANSWER: Usually I'll create a cursor and fetch each record. //*********************************************************************** // Main - Main Processing Rou...
[ "sql", "ibm-midrange", "db2-400", "rpgle" ]
7
13
1,726
2
0
2008-09-23T11:30:18.407000
2008-09-23T13:29:34.920000
120,438
120,487
What's the difference between "Layers" and "Tiers"?
What's the difference between "Layers" and "Tiers"?
Logical layers are merely a way of organizing your code. Typical layers include Presentation, Business and Data – the same as the traditional 3-tier model. But when we’re talking about layers, we’re only talking about logical organization of code. In no way is it implied that these layers might run on different compute...
What's the difference between "Layers" and "Tiers"? What's the difference between "Layers" and "Tiers"?
TITLE: What's the difference between "Layers" and "Tiers"? QUESTION: What's the difference between "Layers" and "Tiers"? ANSWER: Logical layers are merely a way of organizing your code. Typical layers include Presentation, Business and Data – the same as the traditional 3-tier model. But when we’re talking about laye...
[ "architecture" ]
258
304
157,973
14
0
2008-09-23T11:32:12.770000
2008-09-23T11:44:42.880000
120,460
3,943,469
What is the most convincing way to require formalized unit testing?
This certainly presupposes that unit testing is a good thing. Our projects have some level of unit testing, but it's inconsistent at best. What are the most convincing ways that you have used or have had used with you to convince everyone that formalized unit testing is a good thing and that making it required is reall...
So, two years after I asked this question, I find that one unexpected answer was that by moving to a new SDLC was what was needed. Five years ago, we established our first formal SDLC. It improved our situation, but left out some important things, such as automation. We are now in the process of establishing a new SDLC...
What is the most convincing way to require formalized unit testing? This certainly presupposes that unit testing is a good thing. Our projects have some level of unit testing, but it's inconsistent at best. What are the most convincing ways that you have used or have had used with you to convince everyone that formaliz...
TITLE: What is the most convincing way to require formalized unit testing? QUESTION: This certainly presupposes that unit testing is a good thing. Our projects have some level of unit testing, but it's inconsistent at best. What are the most convincing ways that you have used or have had used with you to convince ever...
[ "unit-testing", "software-quality" ]
9
0
546
14
0
2008-09-23T11:37:27.063000
2010-10-15T15:02:01.960000
120,467
120,494
Use of Migrations in Ruby on Rails
I would like to confirm that the following analysis is correct: I am building a web app in RoR. I have a data structure for my postgres db designed (around 70 tables; this design may need changes and additions during development to reflect Rails ways of doing things. EG, I designed some user and role tables - but if it...
Proposition 1 is false in at least two situations - you can use plugins like foreign_key_migrations to do the following: def self.up create_table:users do |t| t.column:department_id,:integer,:references =>:departments end end which creates the appropriate foreign key constraint in your DB. Of course, you might have oth...
Use of Migrations in Ruby on Rails I would like to confirm that the following analysis is correct: I am building a web app in RoR. I have a data structure for my postgres db designed (around 70 tables; this design may need changes and additions during development to reflect Rails ways of doing things. EG, I designed so...
TITLE: Use of Migrations in Ruby on Rails QUESTION: I would like to confirm that the following analysis is correct: I am building a web app in RoR. I have a data structure for my postgres db designed (around 70 tables; this design may need changes and additions during development to reflect Rails ways of doing things....
[ "ruby-on-rails", "ruby" ]
2
10
2,666
4
0
2008-09-23T11:38:50.663000
2008-09-23T11:49:18.470000
120,470
132,250
NHibernate nvarchar/ntext truncation problem
I'm using nhibernate to store some user settings for an app in a SQL Server Compact Edition table. This is an excerpt the mapping file: Name is a regular string/nvarchar(50), and Value is set as ntext in the DB I'm trying to write a large amount of xml to the "Value" property. I get an exception every time: @p1: String...
Okay, with many thanks to Artur in this thread, here's the solution: Inherit from the SqlServerCeDriver with a new one, and override the InitializeParamter method: using System.Data; using System.Data.SqlServerCe; using NHibernate.Driver; using NHibernate.SqlTypes; namespace MySqlServerCeDriverNamespace { /// /// Over...
NHibernate nvarchar/ntext truncation problem I'm using nhibernate to store some user settings for an app in a SQL Server Compact Edition table. This is an excerpt the mapping file: Name is a regular string/nvarchar(50), and Value is set as ntext in the DB I'm trying to write a large amount of xml to the "Value" propert...
TITLE: NHibernate nvarchar/ntext truncation problem QUESTION: I'm using nhibernate to store some user settings for an app in a SQL Server Compact Edition table. This is an excerpt the mapping file: Name is a regular string/nvarchar(50), and Value is set as ntext in the DB I'm trying to write a large amount of xml to t...
[ "nhibernate", "sql-server-ce", "truncate", "ntext" ]
4
6
6,649
7
0
2008-09-23T11:39:01.223000
2008-09-25T09:04:22.873000
120,484
120,509
How do you deploy your common SharePoint library
We have a class library where we keep a lot of the stuff that we often use when doing sharepoint development. How would you go around deploying this? Right now our best bet is to have it in a separate solution, and deploy that so that the assembly is deployed to GAC. That way we ensure that the assembly is deployed to ...
The GAC is usually your best choice. Like ensuring you deploy to all applications, it's also easier in terms of security.
How do you deploy your common SharePoint library We have a class library where we keep a lot of the stuff that we often use when doing sharepoint development. How would you go around deploying this? Right now our best bet is to have it in a separate solution, and deploy that so that the assembly is deployed to GAC. Tha...
TITLE: How do you deploy your common SharePoint library QUESTION: We have a class library where we keep a lot of the stuff that we often use when doing sharepoint development. How would you go around deploying this? Right now our best bet is to have it in a separate solution, and deploy that so that the assembly is de...
[ "sharepoint" ]
3
2
951
6
0
2008-09-23T11:43:18.500000
2008-09-23T11:52:59.287000
120,497
241,160
How to work around the [1] IE bug while saving an excel file from a Web server?
I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet (usually [1]). This creates a big problem with downloading Excel spreadsheets as square brackets are not a valid filename character inside Excel worksheet name. That problem is IE specific, others browsers are kee...
I've got it working using VBA provided by this cool guy (think of him fondly). It renames the file and then reattaches the pivots. http://php.kennedydatasolutions.com/blog/2008/02/05/internet-explorer-breaks-excel-pivot-tables/
How to work around the [1] IE bug while saving an excel file from a Web server? I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet (usually [1]). This creates a big problem with downloading Excel spreadsheets as square brackets are not a valid filename character i...
TITLE: How to work around the [1] IE bug while saving an excel file from a Web server? QUESTION: I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet (usually [1]). This creates a big problem with downloading Excel spreadsheets as square brackets are not a valid fi...
[ "excel", "download", "vba" ]
5
3
9,753
10
0
2008-09-23T11:49:56.080000
2008-10-27T19:38:09.853000
120,503
120,756
delphi "Invalid use of keyword" in TQuery
I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db: select * from Journal where Journal.where = "RainPump" I've tried both Journal."Where" and Journal.[Where] to no avail. I've also tried: select Journal.[Where] as "Location" with the same result. Journal.db is a file ...
You can insert the resultset into a new table with "values" (specifying no column names) where you have given your own column names in the new table and then do a select from that table, Using a TQuery, something like: Query1.sql.clear; query1,sql.add('Insert into newtable values (select * from Journal);'); query1.sql....
delphi "Invalid use of keyword" in TQuery I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db: select * from Journal where Journal.where = "RainPump" I've tried both Journal."Where" and Journal.[Where] to no avail. I've also tried: select Journal.[Where] as "Location" w...
TITLE: delphi "Invalid use of keyword" in TQuery QUESTION: I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db: select * from Journal where Journal.where = "RainPump" I've tried both Journal."Where" and Journal.[Where] to no avail. I've also tried: select Journal.[Wher...
[ "delphi", "bde", "tquery" ]
4
2
7,126
8
0
2008-09-23T11:50:49.260000
2008-09-23T12:44:49.897000
120,504
121,161
Optimising a SELECT query that runs slow on Oracle which runs quickly on SQL Server
I'm trying to run the following SQL statement in Oracle, and it takes ages to run: SELECT orderID FROM tasks WHERE orderID NOT IN (SELECT DISTINCT orderID FROM tasks WHERE engineer1 IS NOT NULL AND engineer2 IS NOT NULL) If I run just the sub-part that is in the IN clause, that runs very quickly in Oracle, i.e. SELECT ...
Often this type of problem goes away if you analyze the tables involved (so Oracle has a better idea of the distribution of the data) ANALYZE TABLE tasks COMPUTE STATISTICS;
Optimising a SELECT query that runs slow on Oracle which runs quickly on SQL Server I'm trying to run the following SQL statement in Oracle, and it takes ages to run: SELECT orderID FROM tasks WHERE orderID NOT IN (SELECT DISTINCT orderID FROM tasks WHERE engineer1 IS NOT NULL AND engineer2 IS NOT NULL) If I run just t...
TITLE: Optimising a SELECT query that runs slow on Oracle which runs quickly on SQL Server QUESTION: I'm trying to run the following SQL statement in Oracle, and it takes ages to run: SELECT orderID FROM tasks WHERE orderID NOT IN (SELECT DISTINCT orderID FROM tasks WHERE engineer1 IS NOT NULL AND engineer2 IS NOT NUL...
[ "sql", "sql-server", "oracle", "optimization" ]
12
10
82,046
18
0
2008-09-23T11:50:55.627000
2008-09-23T13:57:51.500000
120,556
120,594
Why would an application act differently after the VS debugger is attached?
I have a desktop application written in C#. It is trying to manage a socket connection and fails. The same application is successful if it is attached to the Visual Studio debugger. How can it be debugged?
This is a classic example of timing. If it works in the debugger then it means you have to re-factor your code a bit to handle this. Now if you are app is a server socket that receives connections from client and trying to spawn a thread for each of those connections, you might have to consider using select() to manage...
Why would an application act differently after the VS debugger is attached? I have a desktop application written in C#. It is trying to manage a socket connection and fails. The same application is successful if it is attached to the Visual Studio debugger. How can it be debugged?
TITLE: Why would an application act differently after the VS debugger is attached? QUESTION: I have a desktop application written in C#. It is trying to manage a socket connection and fails. The same application is successful if it is attached to the Visual Studio debugger. How can it be debugged? ANSWER: This is a c...
[ "c#", "visual-studio", "sockets", "debugging" ]
2
0
611
7
0
2008-09-23T12:05:16.997000
2008-09-23T12:15:34.227000
120,561
142,002
How can a task wait on multiple vxworks Queues?
We have a vxWorks design which requires one task to process messages from two message queues, Q1 & Q2. We would like to wait on both Queues and whichever gets a message, process the message from the queue. We want to avoid either polling the queues or using a timeout value which could cause the other queue to fill up. ...
If you use named pipes (pipeDevCreate(), write(), read()) instead of message queues, you can use select() to block until there are messages in either pipe. Whenever select() triggers, you process all messages in the high priority pipe. Then you process a single message from the low priority pipe. Then call select again...
How can a task wait on multiple vxworks Queues? We have a vxWorks design which requires one task to process messages from two message queues, Q1 & Q2. We would like to wait on both Queues and whichever gets a message, process the message from the queue. We want to avoid either polling the queues or using a timeout valu...
TITLE: How can a task wait on multiple vxworks Queues? QUESTION: We have a vxWorks design which requires one task to process messages from two message queues, Q1 & Q2. We would like to wait on both Queues and whichever gets a message, process the message from the queue. We want to avoid either polling the queues or us...
[ "embedded", "vxworks" ]
3
3
6,230
2
0
2008-09-23T12:05:48.070000
2008-09-26T21:12:30.950000
120,579
120,864
Expose VSTO functionality to VBA w/o local admin
What would be the best way to expose certain functionality in a Dotnet VSTO Excel add-in to VBA, without requiring the user to be a local administrator (i.e. no COM registration, no HttpListener )? Would it be possible to use Microsoft Message Queues from VBA?
If I may interpret your question as broadly as "How do I expose functionality in a.Net assembly to Excel without COM registration" then an excellent solution is to use Excel's XLL interface. Basically one deploys an xll shim and an associated.Net dll. When the xll is loaded it reflects over the dll and exposes the func...
Expose VSTO functionality to VBA w/o local admin What would be the best way to expose certain functionality in a Dotnet VSTO Excel add-in to VBA, without requiring the user to be a local administrator (i.e. no COM registration, no HttpListener )? Would it be possible to use Microsoft Message Queues from VBA?
TITLE: Expose VSTO functionality to VBA w/o local admin QUESTION: What would be the best way to expose certain functionality in a Dotnet VSTO Excel add-in to VBA, without requiring the user to be a local administrator (i.e. no COM registration, no HttpListener )? Would it be possible to use Microsoft Message Queues fr...
[ ".net", "excel", "vsto", "officedev" ]
2
3
1,310
4
0
2008-09-23T12:11:47.493000
2008-09-23T13:06:30.903000
120,584
341,742
SVG rendering in a Pygame application. Prior to Pygame 2.0, Pygame did not support SVG. Then how did you load it?
In a Pygame application, I would like to render resolution-free GUI widgets described in SVG. How can I achieve this? (I like the OCEMP GUI toolkit, but it seems to be bitmap-dependent for its rendering.)
This is a complete example which combines hints by other people here. It should render a file called test.svg from the current directory. It was tested on Ubuntu 10.10, python-cairo 1.8.8, python-pygame 1.9.1, python-rsvg 2.30.0. #!/usr/bin/python import array import math import cairo import pygame import rsvg WIDTH...
SVG rendering in a Pygame application. Prior to Pygame 2.0, Pygame did not support SVG. Then how did you load it? In a Pygame application, I would like to render resolution-free GUI widgets described in SVG. How can I achieve this? (I like the OCEMP GUI toolkit, but it seems to be bitmap-dependent for its rendering.)
TITLE: SVG rendering in a Pygame application. Prior to Pygame 2.0, Pygame did not support SVG. Then how did you load it? QUESTION: In a Pygame application, I would like to render resolution-free GUI widgets described in SVG. How can I achieve this? (I like the OCEMP GUI toolkit, but it seems to be bitmap-dependent for...
[ "python", "svg", "pygame", "widget", "pygame-surface" ]
29
21
25,977
10
0
2008-09-23T12:13:14.777000
2008-12-04T19:23:54.163000
120,587
655,324
What is the best way to forward a single qmail alias to /dev/null?
I would like to trash the mail received by a single qmail alias. I don't want any mail delivery errors, and I want qmail to be happy about having delivered the mail. How can I do this, preferably without adding another local email account?
Create an alias with only a comment and no delivery instructions, like: echo "# drop all messages on the floor" > ~alias/.qmail-devnull Replace "devnull" with whatever alias name you need of course.
What is the best way to forward a single qmail alias to /dev/null? I would like to trash the mail received by a single qmail alias. I don't want any mail delivery errors, and I want qmail to be happy about having delivered the mail. How can I do this, preferably without adding another local email account?
TITLE: What is the best way to forward a single qmail alias to /dev/null? QUESTION: I would like to trash the mail received by a single qmail alias. I don't want any mail delivery errors, and I want qmail to be happy about having delivered the mail. How can I do this, preferably without adding another local email acco...
[ "unix", "system-administration", "qmail" ]
1
1
2,909
3
0
2008-09-23T12:14:23.743000
2009-03-17T17:46:11.670000
120,588
120,641
Case-insensitive search using Hibernate
I'm using Hibernate for ORM of my Java app to an Oracle database (not that the database vendor matters, we may switch to another database one day), and I want to retrieve objects from the database according to user-provided strings. For example, when searching for people, if the user is looking for people who live in '...
For the simple case you describe, look at Restrictions.ilike(), which does a case-insensitive search. Criteria crit = session.createCriteria(Person.class); crit.add(Restrictions.ilike('town', '%fran%'); List results = crit.list();
Case-insensitive search using Hibernate I'm using Hibernate for ORM of my Java app to an Oracle database (not that the database vendor matters, we may switch to another database one day), and I want to retrieve objects from the database according to user-provided strings. For example, when searching for people, if the ...
TITLE: Case-insensitive search using Hibernate QUESTION: I'm using Hibernate for ORM of my Java app to an Oracle database (not that the database vendor matters, we may switch to another database one day), and I want to retrieve objects from the database according to user-provided strings. For example, when searching f...
[ "sql", "hibernate", "select", "case-sensitive" ]
49
72
89,660
10
0
2008-09-23T12:14:35.147000
2008-09-23T12:26:16.180000
120,596
120,651
Auto-updating Bags in NHibernate
I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects, we use NHibernate bags, which map to List objects in our application. Sometimes we have issues with needing to refresh the objects through NHibernate when we update anything to do with the lists in the database. Above is a sample of the ...
Have you tried NHibernate cascades, such as save-update? You are able to tell NHibernate to automatically traverse an entity's associations, and act according to the cascade option. For instance, adding an unsaved entity to a collection with save-update cascade will cause it to be saved along with its parent object, wi...
Auto-updating Bags in NHibernate I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects, we use NHibernate bags, which map to List objects in our application. Sometimes we have issues with needing to refresh the objects through NHibernate when we update anything to do with the lists in the da...
TITLE: Auto-updating Bags in NHibernate QUESTION: I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects, we use NHibernate bags, which map to List objects in our application. Sometimes we have issues with needing to refresh the objects through NHibernate when we update anything to do with t...
[ "asp.net", "database", "nhibernate" ]
2
4
3,679
1
0
2008-09-23T12:16:05.580000
2008-09-23T12:27:47.893000
120,607
120,632
Classic asp include
I am trying to separate some asp logic out into a separate page. For now, I am trying to call a simple function. Here is the simple index page that I am using Calling a webservice from classic ASP <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then %> <% doStuff() End If %> ID: Here is aspfunctions.asp sub do...
aspfunctions.asp should be inside tags so the asp is "executed", e.g. aspfunctions.asp file: <% sub doStuff() Response.Write("In Do Stuff") end sub %> Otherwise the asp in aspfunctions.asp is just seen as plain-text, so as far as the server is concerned, doStuff has never been defined.
Classic asp include I am trying to separate some asp logic out into a separate page. For now, I am trying to call a simple function. Here is the simple index page that I am using Calling a webservice from classic ASP <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then %> <% doStuff() End If %> ID: Here is asp...
TITLE: Classic asp include QUESTION: I am trying to separate some asp logic out into a separate page. For now, I am trying to call a simple function. Here is the simple index page that I am using Calling a webservice from classic ASP <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then %> <% doStuff() End If ...
[ "asp-classic", "vbscript", "externalizing" ]
2
6
12,333
5
0
2008-09-23T12:19:11.610000
2008-09-23T12:24:41.240000
120,616
120,746
How to display the total of a level as the value of its last child in MDX
I have an MDX query which lists a measure for all 'Week' and 'Day' levels in the OLAP database. For example SELECT { HIERARCHIZE( {[Business Time].[Week].members, [Business Time].[Date].members} ) } ON ROWS, { [Measures].[Quantity] } ON COLUMNS FROM [Sales] Where the measure is displayed for a Week though, instead of s...
Add a new calculated measures onto the start of your MDX that shows the last day's value only if it is being shown at a week level, otherwise leave it unaltered: WITH MEMBER [Measures].[Blah] AS 'IIF( [Business Time].currentMember.level.name = "Week", ([Business Time].currentMember.lastChild, [Measures].[Quantity]), ([...
How to display the total of a level as the value of its last child in MDX I have an MDX query which lists a measure for all 'Week' and 'Day' levels in the OLAP database. For example SELECT { HIERARCHIZE( {[Business Time].[Week].members, [Business Time].[Date].members} ) } ON ROWS, { [Measures].[Quantity] } ON COLUMNS F...
TITLE: How to display the total of a level as the value of its last child in MDX QUESTION: I have an MDX query which lists a measure for all 'Week' and 'Day' levels in the OLAP database. For example SELECT { HIERARCHIZE( {[Business Time].[Week].members, [Business Time].[Date].members} ) } ON ROWS, { [Measures].[Quanti...
[ "olap", "mdx" ]
1
1
3,319
1
0
2008-09-23T12:21:10.890000
2008-09-23T12:42:33.147000
120,618
121,077
Logging in J2ME
What logging solutions exist for j2me? I'm specifically interested in easily excluding logging for "release" version, to have a smaller package & memory footprint.
If you are using preprocessing and obfuscation with Proguard, then you can have a simple logging class. public class Log { public static void debug(final String message) { //#if!release.build System.out.println(message); //#endif } } Or do logging where ever you need to. Now, if release.build property is set to true, t...
Logging in J2ME What logging solutions exist for j2me? I'm specifically interested in easily excluding logging for "release" version, to have a smaller package & memory footprint.
TITLE: Logging in J2ME QUESTION: What logging solutions exist for j2me? I'm specifically interested in easily excluding logging for "release" version, to have a smaller package & memory footprint. ANSWER: If you are using preprocessing and obfuscation with Proguard, then you can have a simple logging class. public cl...
[ "logging", "java-me", "mobile", "mobile-phones" ]
17
13
8,148
8
0
2008-09-23T12:21:17.440000
2008-09-23T13:42:26.107000
120,621
4,664,780
Dark color scheme for Eclipse
Is Eclipse at all theme-able? I would like to install a dark color scheme for it, since I much prefer white text on dark background than the other way around.
As posted to a few related questions already, I'm working on a plugin for easy, cross-editor color theme management: http://marketplace.eclipse.org/content/eclipse-color-theme It is still work in progress, but already supports many editors and a few dark color themes.
Dark color scheme for Eclipse Is Eclipse at all theme-able? I would like to install a dark color scheme for it, since I much prefer white text on dark background than the other way around.
TITLE: Dark color scheme for Eclipse QUESTION: Is Eclipse at all theme-able? I would like to install a dark color scheme for it, since I much prefer white text on dark background than the other way around. ANSWER: As posted to a few related questions already, I'm working on a plugin for easy, cross-editor color theme...
[ "eclipse" ]
425
288
307,471
19
0
2008-09-23T12:21:44.163000
2011-01-12T02:17:25.253000
120,625
121,534
One or more files do not match the primary file of the database (error 5173)
I got this error when I checked out my database from source control. It might sounds weird to check in the sql server database, but this was what I have done because this is just a personal project. Anyone knows how to fix this?
Here's my finding. As mentioned by other posters, you really don't want to check database files into and out of the source control. But if you absolutely need to, and you have done check in the database files and you are encountering the same error that I encountered, here is a workaround: First, detach the database, t...
One or more files do not match the primary file of the database (error 5173) I got this error when I checked out my database from source control. It might sounds weird to check in the sql server database, but this was what I have done because this is just a personal project. Anyone knows how to fix this?
TITLE: One or more files do not match the primary file of the database (error 5173) QUESTION: I got this error when I checked out my database from source control. It might sounds weird to check in the sql server database, but this was what I have done because this is just a personal project. Anyone knows how to fix th...
[ "c#", "sql-server" ]
1
5
14,327
4
0
2008-09-23T12:22:42.367000
2008-09-23T14:53:51.007000
120,627
120,663
Is there a way to redefine malloc at link time on Windows?
I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error: MSVCRT.lib(MSVCR80.dll): error LNK2005: _malloc already defined in test.lib(test.obj) This works perfectly on any Unix, and it works on Windows with most functions, but not ...
There is really good discussion of how hard this is here: http://benjamin.smedbergs.us/blog/2008-01-10/patching-the-windows-crt/ Apparently, you need to patch the CRT Edit: actually, a MS employee gave the technique in the discussion. You need to move your malloc to a lib, and then link it before the CRT "he also menti...
Is there a way to redefine malloc at link time on Windows? I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error: MSVCRT.lib(MSVCR80.dll): error LNK2005: _malloc already defined in test.lib(test.obj) This works perfectly on any ...
TITLE: Is there a way to redefine malloc at link time on Windows? QUESTION: I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error: MSVCRT.lib(MSVCR80.dll): error LNK2005: _malloc already defined in test.lib(test.obj) This works...
[ "c", "windows" ]
10
16
4,995
4
0
2008-09-23T12:22:50.900000
2008-09-23T12:29:04.817000
120,636
120,675
Best practice regarding number of threads in GUI applications
In the past I've worked with a number of programmers who have worked exclusively writing GUI applications. And I've been given the impression that they have almost universally minimised the use of multiple threads in their applications. In some cases they seem to have gone to extreme lengths to ensure that they use a s...
I've seen the same thing. Ideally you should perform any operation that is going to take longer then a few hundred ms in a background thread. Anything sorter than 100ms and a human probably wont notice the difference. A lot of GUI programmers I've worked with in the past are scared of threads because they are "hard". I...
Best practice regarding number of threads in GUI applications In the past I've worked with a number of programmers who have worked exclusively writing GUI applications. And I've been given the impression that they have almost universally minimised the use of multiple threads in their applications. In some cases they se...
TITLE: Best practice regarding number of threads in GUI applications QUESTION: In the past I've worked with a number of programmers who have worked exclusively writing GUI applications. And I've been given the impression that they have almost universally minimised the use of multiple threads in their applications. In ...
[ "user-interface", "language-agnostic" ]
5
4
2,530
9
0
2008-09-23T12:25:25.590000
2008-09-23T12:31:57.557000
120,648
120,679
Is Assert.Fail() considered bad practice?
I use Assert.Fail a lot when doing TDD. I'm usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where the name of the test method indicates what I want to implement as sort of a todo-list. To make sure I don't forget I put an Assert.Fail() in the...
For this scenario, rather than calling Assert.Fail, I do the following (in C# / NUnit) [Test] public void MyClassDoesSomething() { throw new NotImplementedException(); } It is more explicit than an Assert.Fail. There seems to be general agreement that it is preferable to use more explicit assertions than Assert.Fail()....
Is Assert.Fail() considered bad practice? I use Assert.Fail a lot when doing TDD. I'm usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where the name of the test method indicates what I want to implement as sort of a todo-list. To make sure I ...
TITLE: Is Assert.Fail() considered bad practice? QUESTION: I use Assert.Fail a lot when doing TDD. I'm usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where the name of the test method indicates what I want to implement as sort of a todo-lis...
[ "unit-testing", "xunit.net" ]
77
55
113,066
14
0
2008-09-23T12:27:16.990000
2008-09-23T12:32:30.690000
120,656
120,701
Directory-tree listing in Python
How do I get a list of all files (and directories) in a given directory in Python?
This is a way to traverse every file and directory in a directory tree: import os for dirname, dirnames, filenames in os.walk('.'): # print path to all subdirectories first. for subdirname in dirnames: print(os.path.join(dirname, subdirname)) # print path to all filenames. for filename in filenames: print(os.path.joi...
Directory-tree listing in Python How do I get a list of all files (and directories) in a given directory in Python?
TITLE: Directory-tree listing in Python QUESTION: How do I get a list of all files (and directories) in a given directory in Python? ANSWER: This is a way to traverse every file and directory in a directory tree: import os for dirname, dirnames, filenames in os.walk('.'): # print path to all subdirectories first. fo...
[ "python", "file", "directory", "subdirectory", "directory-tree" ]
612
637
712,309
21
0
2008-09-23T12:28:19.920000
2008-09-23T12:35:46.097000
120,657
120,706
Python subprocess issue with ampersands
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted qu...
Make sure you are using lists and no shell expansion: subprocess.Popen(['command', 'argument1', 'argument2'], shell=False)
Python subprocess issue with ampersands I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains am...
TITLE: Python subprocess issue with ampersands QUESTION: I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a comman...
[ "python", "windows", "subprocess", "command-line-arguments" ]
6
7
6,891
5
0
2008-09-23T12:28:39.717000
2008-09-23T12:36:19.823000
120,662
120,729
"Could not find the main class. Program will exit"
I'm trying to run SQuirreL SQL. I've downloaded it and installed it, but when I try to run it I get this error message: Java Virtual Machine Launcher. Could not find the main class. Program will exit. I get the gist of this, but I have not idea how to fix it. Any help? more info: I'm on Windows XP pro. I have java 1.6 ...
Is Java installed on your computer? Is the path to its bin directory set properly (in other words if you type 'java' from the command line do you get back a list of instructions or do you get something like "java is not recognized as a.....")? You could try try running squirrel-sql.jar from the command line (from the s...
"Could not find the main class. Program will exit" I'm trying to run SQuirreL SQL. I've downloaded it and installed it, but when I try to run it I get this error message: Java Virtual Machine Launcher. Could not find the main class. Program will exit. I get the gist of this, but I have not idea how to fix it. Any help...
TITLE: "Could not find the main class. Program will exit" QUESTION: I'm trying to run SQuirreL SQL. I've downloaded it and installed it, but when I try to run it I get this error message: Java Virtual Machine Launcher. Could not find the main class. Program will exit. I get the gist of this, but I have not idea how t...
[ "java", "squirrel-sql" ]
21
20
210,964
10
0
2008-09-23T12:28:54.990000
2008-09-23T12:39:20.207000
120,669
121,037
Will Subclipse 1.4.4 work with Subversion 1.3.2
Will Subclipse 1.4.4 work safely with Subversion 1.3.2? I am confused because its changelog says NOTE: As of Subclipse 1.3.0, the minimum Subversion JavaHL requirement is 1.5.0.
Subclipse requires Subversion 1.5.x on the client. A Subversion 1.5.x client can talk to any 1.x server, all the way back to 1.0.0.
Will Subclipse 1.4.4 work with Subversion 1.3.2 Will Subclipse 1.4.4 work safely with Subversion 1.3.2? I am confused because its changelog says NOTE: As of Subclipse 1.3.0, the minimum Subversion JavaHL requirement is 1.5.0.
TITLE: Will Subclipse 1.4.4 work with Subversion 1.3.2 QUESTION: Will Subclipse 1.4.4 work safely with Subversion 1.3.2? I am confused because its changelog says NOTE: As of Subclipse 1.3.0, the minimum Subversion JavaHL requirement is 1.5.0. ANSWER: Subclipse requires Subversion 1.5.x on the client. A Subversion 1.5...
[ "svn", "subclipse" ]
1
1
626
3
0
2008-09-23T12:30:50.727000
2008-09-23T13:36:09.757000
120,702
122,338
Recursive overloading semantics in the Scala REPL - JVM languages
Using Scala's command line REPL: def foo(x: Int): Unit = {} def foo(x: String): Unit = {println(foo(2))} gives error: type mismatch; found: Int(2) required: String It seems that you can't define overloaded recursive methods in the REPL. I thought this was a bug in the Scala REPL and filed it, but it was almost instantl...
The issue is due to the fact that the interpreter most often has to replace existing elements with a given name, rather than overload them. For example, I will often be running through experimenting with something, often creating a method called test: def test(x: Int) = x + x A little later on, let's say that I'm runni...
Recursive overloading semantics in the Scala REPL - JVM languages Using Scala's command line REPL: def foo(x: Int): Unit = {} def foo(x: String): Unit = {println(foo(2))} gives error: type mismatch; found: Int(2) required: String It seems that you can't define overloaded recursive methods in the REPL. I thought this wa...
TITLE: Recursive overloading semantics in the Scala REPL - JVM languages QUESTION: Using Scala's command line REPL: def foo(x: Int): Unit = {} def foo(x: String): Unit = {println(foo(2))} gives error: type mismatch; found: Int(2) required: String It seems that you can't define overloaded recursive methods in the REPL....
[ "scala", "recursion", "jvm", "jvm-languages" ]
8
11
789
4
0
2008-09-23T12:35:48.840000
2008-09-23T17:06:52.137000
120,704
120,738
Getting started with AJAX with ASP.NET 3.5, what do I need on the server
I have the.net framework 3.5 on my development machine and also am using the AJAX toolkit in my code. In order to publish this code to a server for my users, do I need anything on the server in order for my AJAX code to operate correctly?
You need only the.NET framework 3.5. If you publish your project, the AJAX Toolkit used will be also copied over. If you only reference the AJAX Toolkit via file, not via project, then be sure you set the dll to "Copy always" in the properties window.
Getting started with AJAX with ASP.NET 3.5, what do I need on the server I have the.net framework 3.5 on my development machine and also am using the AJAX toolkit in my code. In order to publish this code to a server for my users, do I need anything on the server in order for my AJAX code to operate correctly?
TITLE: Getting started with AJAX with ASP.NET 3.5, what do I need on the server QUESTION: I have the.net framework 3.5 on my development machine and also am using the AJAX toolkit in my code. In order to publish this code to a server for my users, do I need anything on the server in order for my AJAX code to operate c...
[ "asp.net", "asp.net-ajax" ]
4
3
684
3
0
2008-09-23T12:36:09.980000
2008-09-23T12:40:59.907000
120,715
120,816
Setting up F# in Visual Studio 2005
Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008. ie: 'F# projects' under projects, etc.
Unfortunately the CTP release of F# doesn't support VS 2005. Two options: Use 1.9.4.19, the most recent pre-CTP release Download the free VS2008 shell and use that instead (I haven't tried it, but apparently it works )
Setting up F# in Visual Studio 2005 Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008. ie: 'F# projects' under projects, etc.
TITLE: Setting up F# in Visual Studio 2005 QUESTION: Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008. ie: 'F# projects' under projects, etc. ANSWER: Unfortunately the CTP release of F# doesn't support VS 2005. Two options: Use 1.9.4.19, the most recent ...
[ "visual-studio-2005", "f#", "functional-programming" ]
5
3
1,839
2
0
2008-09-23T12:37:17.730000
2008-09-23T12:57:42.597000
120,751
1,385,217
Supporting URLs like /similar-to-:product in Ruby on Rails?
I have been trying to use routes.rb for creating a URL /similar-to-:product (where product is dynamic) for my website. The issue is that routes.rb readily supports URLs like /:product-similar but doesn't support the former because it requires:product to be preceded with a separator ('/' is a separator but '-' isn't). T...
In fact you can add - as a separator, then use route globbing. map.similar_product '/similar-to-*product',:controller => 'products',:action => 'similar' then, in ProductsController#similar @product = Product.find_by_slug params[:product].join('-') Though refactoring does seem nicer, since with this approach you'll need...
Supporting URLs like /similar-to-:product in Ruby on Rails? I have been trying to use routes.rb for creating a URL /similar-to-:product (where product is dynamic) for my website. The issue is that routes.rb readily supports URLs like /:product-similar but doesn't support the former because it requires:product to be pre...
TITLE: Supporting URLs like /similar-to-:product in Ruby on Rails? QUESTION: I have been trying to use routes.rb for creating a URL /similar-to-:product (where product is dynamic) for my website. The issue is that routes.rb readily supports URLs like /:product-similar but doesn't support the former because it requires...
[ "ruby-on-rails", "seo", "friendly-url" ]
3
1
354
4
0
2008-09-23T12:43:42.147000
2009-09-06T08:34:46.537000
120,763
120,776
Using the literal '@' with a string variable
I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command? Instead of this: string filePath = @"C:\somepath\file.txt"; I want to do this: string filePath = @helper.getFil...
I don't think you have to worry about it if you already have the value. The @ operator is for when you're specifying the string (like in your first code snippet). What are you attempting to do with the path string that isn't working?
Using the literal '@' with a string variable I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command? Instead of this: string filePath = @"C:\somepath\file.txt"; I want...
TITLE: Using the literal '@' with a string variable QUESTION: I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command? Instead of this: string filePath = @"C:\somepath...
[ "c#", "string" ]
7
14
26,748
6
0
2008-09-23T12:45:48.943000
2008-09-23T12:49:22.663000
120,766
120,894
How to change CSS class of a HTML page element using ASP.NET?
I have several elements with different id's on ASP.NET page: and can change their class using JavaScript like this: li1.className="class2" But is there a way to change element class using ASP.NET? It could be something like: WebControl control = (WebControl)FindControl("li1"); control.CssClass="class2"; But FindControl...
The FindControl method searches for server controls. That is, it looks for controls with the attribute "runat" set to "server", as in: System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(" "); ClientScript.RegisterStartupScript(this.GetType(), "MyScript", sb.ToString());
How to change CSS class of a HTML page element using ASP.NET? I have several elements with different id's on ASP.NET page: and can change their class using JavaScript like this: li1.className="class2" But is there a way to change element class using ASP.NET? It could be something like: WebControl control = (WebControl)...
TITLE: How to change CSS class of a HTML page element using ASP.NET? QUESTION: I have several elements with different id's on ASP.NET page: and can change their class using JavaScript like this: li1.className="class2" But is there a way to change element class using ASP.NET? It could be something like: WebControl cont...
[ "asp.net", "css", "dynamic-css" ]
18
5
61,009
8
0
2008-09-23T12:46:32.340000
2008-09-23T13:13:09.423000
120,781
770,240
What should an Application Controller do?
I am a bit confused in what the application controller should do? Because I see the functionality will also exists in your MVP pattern to make the decisions which form should be shown when a button is clicked? Are there any good examples for Windows Forms that uses the application controller pattern? There is a differe...
I recently wrote an article on creating and using an ApplicationController in a C# Winforms project, to decouple the workflow and presenters from the forms directly. It may help: Decoupling Workflow And Forms With An Application Controller edit: Archive.org has got a more readable copy of the article at this time.
What should an Application Controller do? I am a bit confused in what the application controller should do? Because I see the functionality will also exists in your MVP pattern to make the decisions which form should be shown when a button is clicked? Are there any good examples for Windows Forms that uses the applicat...
TITLE: What should an Application Controller do? QUESTION: I am a bit confused in what the application controller should do? Because I see the functionality will also exists in your MVP pattern to make the decisions which form should be shown when a button is clicked? Are there any good examples for Windows Forms that...
[ "winforms", "design-patterns" ]
10
12
12,759
3
0
2008-09-23T12:49:46.763000
2009-04-20T21:44:12.297000
120,783
121,642
How do I implement IEqualityComparer on an immutable generic Pair struct?
Currently I have this (edited after reading advice): struct Pair: IEqualityComparer > { readonly private T _first; readonly private K _second; public Pair(T first, K second) { _first = first; _second = second; } public T First { get { return _first; } } public K Second { get { return _second; } } #region IEqualityC...
It looks like you need IEquatable instead: internal struct Pair: IEquatable > { private readonly T _first; private readonly K _second; public Pair(T first, K second) { _first = first; _second = second; } public T First { get { return _first; } } public K Second { get { return _second; } } public bool Equals(Pair ob...
How do I implement IEqualityComparer on an immutable generic Pair struct? Currently I have this (edited after reading advice): struct Pair: IEqualityComparer > { readonly private T _first; readonly private K _second; public Pair(T first, K second) { _first = first; _second = second; } public T First { get { return _...
TITLE: How do I implement IEqualityComparer on an immutable generic Pair struct? QUESTION: Currently I have this (edited after reading advice): struct Pair: IEqualityComparer > { readonly private T _first; readonly private K _second; public Pair(T first, K second) { _first = first; _second = second; } public T Firs...
[ "c#", "generics", "struct" ]
3
2
4,073
7
0
2008-09-23T12:50:01.490000
2008-09-23T15:14:47.803000
120,791
120,856
What are the pros and cons of Web Services and RMI in a Java-only environment?
When developing distributed applications, all written in Java by the same company, would you choose Web Services or RMI? What are the pros and cons in terms of performance, loose coupling, ease of use,...? Would anyone choose WS? Can you build a service-oriented architecture with RMI?
I'd try to think about it this way: Are you going for independent services running beneath each other, and those services may be accessed by non-java applications some time in the future? Then go for web services. Do you just want to spread parts of an application (mind the singular) over several servers? Then go for R...
What are the pros and cons of Web Services and RMI in a Java-only environment? When developing distributed applications, all written in Java by the same company, would you choose Web Services or RMI? What are the pros and cons in terms of performance, loose coupling, ease of use,...? Would anyone choose WS? Can you bui...
TITLE: What are the pros and cons of Web Services and RMI in a Java-only environment? QUESTION: When developing distributed applications, all written in Java by the same company, would you choose Web Services or RMI? What are the pros and cons in terms of performance, loose coupling, ease of use,...? Would anyone choo...
[ "java", "web-services", "remoting", "rmi" ]
11
9
5,036
5
0
2008-09-23T12:52:04.137000
2008-09-23T13:04:56.417000
120,797
120,802
How do I set the proxy to be used by the JVM
Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How can I set my JVM to use the proxy?
From the Java documentation ( not the javadoc API): http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html Set the JVM flags http.proxyHost and http.proxyPort when starting your JVM on the command line. This is usually done in a shell script (in Unix) or bat file (in Windows). Here's the example wit...
How do I set the proxy to be used by the JVM Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How can I set my JVM to use the proxy?
TITLE: How do I set the proxy to be used by the JVM QUESTION: Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How can I set my JVM to use the proxy? ANSWER: From the Java documentation...
[ "java", "proxy", "jvm" ]
371
404
859,226
21
0
2008-09-23T12:53:25.913000
2008-09-23T12:54:23.010000
120,803
120,849
Learning FreeBSD
What is the average time that it would take a complete novice, whose background is mostly Windows XP, to go through the FreeBSD handbook and get sufficient mastery to setup a server from the ground up?
It's impossible to say. Not only is it highly dependent upon what sort of person you are, but it also depends on what exactly you are doing and how you define "sufficient mastery". Being able to get Apache operational is a simple matter of following step-by-step tutorials, you could do that in a matter of hours. Being ...
Learning FreeBSD What is the average time that it would take a complete novice, whose background is mostly Windows XP, to go through the FreeBSD handbook and get sufficient mastery to setup a server from the ground up?
TITLE: Learning FreeBSD QUESTION: What is the average time that it would take a complete novice, whose background is mostly Windows XP, to go through the FreeBSD handbook and get sufficient mastery to setup a server from the ground up? ANSWER: It's impossible to say. Not only is it highly dependent upon what sort of ...
[ "windows-xp", "freebsd" ]
3
10
1,479
8
0
2008-09-23T12:54:28.250000
2008-09-23T13:03:43.423000
120,804
121,302
Difference between Array.slice and Array().slice
I am going through John Resig's excellent Advanced javascript tutorial and I do not thoroughly understand what's the difference between the following calls: (please note that 'arguments' is a builtin javascript word and is not exactly an array hence the hacking with the Array.slice instead of simply calling arguments.s...
Not quite. Watch what happens when you call String.substring.call("foo", 1) and String().substring.call("foo", 2): >>> String.substring.call("foo", 1) "1" >>> String().substring.call("foo", 1) "oo" Array.slice is neither properly referencing the slice function attached to the Array prototype nor the slice function att...
Difference between Array.slice and Array().slice I am going through John Resig's excellent Advanced javascript tutorial and I do not thoroughly understand what's the difference between the following calls: (please note that 'arguments' is a builtin javascript word and is not exactly an array hence the hacking with the ...
TITLE: Difference between Array.slice and Array().slice QUESTION: I am going through John Resig's excellent Advanced javascript tutorial and I do not thoroughly understand what's the difference between the following calls: (please note that 'arguments' is a builtin javascript word and is not exactly an array hence the...
[ "javascript", "arrays" ]
27
39
15,346
6
0
2008-09-23T12:54:41.823000
2008-09-23T14:22:51.487000