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
138,747
139,860
Debugging with Oracle's utl_smtp
A client of mine uses Oracle 9i's utl_smtp to send mails out notifications to managers when their employees have made travel requests and they woul like quite a few changes made to the mailouts done. We're having a lot of problems getting utl_smtp to talk to any smtp server on our network. We've even tried installing f...
Looks like the HELO is the problem. Please can we check with a simple testcase... set serveroutput on declare lConnection UTL_SMTP.CONNECTION; begin lConnection:= UTL_SMTP.OPEN_CONNECTION(your_smtp_server); DBMS_OUTPUT.PUT_LINE('Opened ok'); UTL_SMTP.HELO(lConnection, your_client_machine_name); DBMS_OUTPUT.PUT_LINE('...
Debugging with Oracle's utl_smtp A client of mine uses Oracle 9i's utl_smtp to send mails out notifications to managers when their employees have made travel requests and they woul like quite a few changes made to the mailouts done. We're having a lot of problems getting utl_smtp to talk to any smtp server on our netwo...
TITLE: Debugging with Oracle's utl_smtp QUESTION: A client of mine uses Oracle 9i's utl_smtp to send mails out notifications to managers when their employees have made travel requests and they woul like quite a few changes made to the mailouts done. We're having a lot of problems getting utl_smtp to talk to any smtp s...
[ "oracle", "email" ]
3
2
7,143
4
0
2008-09-26T11:01:31.600000
2008-09-26T14:25:38.807000
138,761
171,113
Web Applications & Desktop Applications
I am a programmer who writes a lot of code for desktop applications, now started considering cross-platform apps as an issue but at work I write C# apps and I come from C++ and CS background and of course, I wrote several things in QT/C++. But now I am kinda confused about web applications, I have done some work on PHP...
The boundaries between desktop and web applications have really blurred. Whilst once upon a time the nature of developing for the web was totally different to developing for the desktop, nowadays you find the same concepts (such as parallelism which you referred to) cropping up in both. Don't think of developing web ap...
Web Applications & Desktop Applications I am a programmer who writes a lot of code for desktop applications, now started considering cross-platform apps as an issue but at work I write C# apps and I come from C++ and CS background and of course, I wrote several things in QT/C++. But now I am kinda confused about web ap...
TITLE: Web Applications & Desktop Applications QUESTION: I am a programmer who writes a lot of code for desktop applications, now started considering cross-platform apps as an issue but at work I write C# apps and I come from C++ and CS background and of course, I wrote several things in QT/C++. But now I am kinda con...
[ "desktop" ]
2
2
1,635
3
0
2008-09-26T11:05:15.587000
2008-10-04T22:22:07.370000
138,785
138,809
Ruby RegEx problem text.gsub[^\W-], '') fails
I'm trying to learn RegEx in Ruby, based on what I'm reading in " The Rails Way ". But, even this simple example has me stumped. I can't tell if it is a typo or not: text.gsub(/\s/, "-").gsub([^\W-], '').downcase It seems to me that this would replace all spaces with -, then anywhere a string starts with a non letter o...
>> text = "I love spaces" => "I love spaces" >> text.gsub(/\s/, "-").gsub(/[^\W-]/, '').downcase => "--" Missing // Although this makes a little more sense:-) >> text.gsub(/\s/, "-").gsub(/([^\W-])/, '\1').downcase => "i-love-spaces" And this is probably what is meant >> text.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase...
Ruby RegEx problem text.gsub[^\W-], '') fails I'm trying to learn RegEx in Ruby, based on what I'm reading in " The Rails Way ". But, even this simple example has me stumped. I can't tell if it is a typo or not: text.gsub(/\s/, "-").gsub([^\W-], '').downcase It seems to me that this would replace all spaces with -, the...
TITLE: Ruby RegEx problem text.gsub[^\W-], '') fails QUESTION: I'm trying to learn RegEx in Ruby, based on what I'm reading in " The Rails Way ". But, even this simple example has me stumped. I can't tell if it is a typo or not: text.gsub(/\s/, "-").gsub([^\W-], '').downcase It seems to me that this would replace all ...
[ "ruby", "regex" ]
6
9
9,043
5
0
2008-09-26T11:11:16.460000
2008-09-26T11:14:32.660000
138,793
138,922
How do I add a separator to a JComboBox in Java?
I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. In this case I would like to show the most-used-f...
There is a pretty short tutorial with an example that shows how to use a custom ListCellRenderer on java2s http://www.java2s.com/Code/Java/Swing-Components/BlockComboBoxExample.htm Basically it involves inserting a known placeholder in your list model and when you detect the placeholder in the ListCellRenderer you retu...
How do I add a separator to a JComboBox in Java? I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. ...
TITLE: How do I add a separator to a JComboBox in Java? QUESTION: I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control i...
[ "java", "swing", "jcombobox", "jseparator" ]
13
8
11,579
4
0
2008-09-26T11:12:15.803000
2008-09-26T11:41:53.850000
138,819
138,847
batch find file extension
If I am iterating over each file using: @echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code: echo "%t:~-3%" to print but with no success.
The FOR command has several built-in switches that allow you to modify file names. Try the following: @echo off for %%i in (*.*) do echo "%%~xi" For further details, use help for to get a complete list of the modifiers - there are quite a few!
batch find file extension If I am iterating over each file using: @echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code: echo "%t:~-3%" to print but with no success.
TITLE: batch find file extension QUESTION: If I am iterating over each file using: @echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code: echo "%t:~-3%" to print but with no success. ANSWER: The FOR command ...
[ "windows", "batch-file", "dos" ]
18
36
54,323
3
0
2008-09-26T11:15:30.617000
2008-09-26T11:22:49.083000
138,839
138,892
How do you parse an HTML string for image tags to get at the SRC information?
Currently I use.Net WebBrowser.Document.Images() to do this. It requires the Webrowser to load the document. It's messy and takes up resources. According to this question XPath is better than a regex at this. Anyone know how to do this in C#?
If your input string is valid XHTML you can treat is as xml, load it into an xmldocument, and do XPath magic:) But it's not always the case. Otherwise you can try this function, that will return all image links from HtmlSource: public List FetchLinksFromSource(string htmlSource) { List links = new List (); string regex...
How do you parse an HTML string for image tags to get at the SRC information? Currently I use.Net WebBrowser.Document.Images() to do this. It requires the Webrowser to load the document. It's messy and takes up resources. According to this question XPath is better than a regex at this. Anyone know how to do this in C#?
TITLE: How do you parse an HTML string for image tags to get at the SRC information? QUESTION: Currently I use.Net WebBrowser.Document.Images() to do this. It requires the Webrowser to load the document. It's messy and takes up resources. According to this question XPath is better than a regex at this. Anyone know how...
[ "c#", ".net", "html", "regex", "xpath" ]
26
57
44,570
4
0
2008-09-26T11:18:32.900000
2008-09-26T11:32:43.197000
138,851
139,137
How do I test a django database schema?
I want to write tests that can show whether or not the database is in sync with my models.py file. Actually I have already written them, only to find out that django creates a new database each time the tests are run based on the models.py file. Is there any way I can make the models.py test use the existing database s...
What we did was override the default test_runner so that it wouldn't create a new database to test against. This way, it runs the test against whatever our current local database looks like. But be very careful if you use this method because any changes to data you make in your tests will be permanent. I made sure that...
How do I test a django database schema? I want to write tests that can show whether or not the database is in sync with my models.py file. Actually I have already written them, only to find out that django creates a new database each time the tests are run based on the models.py file. Is there any way I can make the mo...
TITLE: How do I test a django database schema? QUESTION: I want to write tests that can show whether or not the database is in sync with my models.py file. Actually I have already written them, only to find out that django creates a new database each time the tests are run based on the models.py file. Is there any way...
[ "python", "django", "unit-testing", "model" ]
6
9
3,602
1
0
2008-09-26T11:23:51.237000
2008-09-26T12:32:46.037000
138,877
152,566
Webservice toolkits in Java that can interface with WCF
We've got some problems with an external company trying in integrate into a WCF service we expose and they are a Java shop. I was wondering if there are more than one toolkit that they can try to solve their issues and would like a list to suggest to them but I'm not familiar with the Java world at all. Essentially the...
Microsoft and Sun worked together to ensure that their latest web services toolkits worked with each other. Sun's java implementation is Metro.
Webservice toolkits in Java that can interface with WCF We've got some problems with an external company trying in integrate into a WCF service we expose and they are a Java shop. I was wondering if there are more than one toolkit that they can try to solve their issues and would like a list to suggest to them but I'm ...
TITLE: Webservice toolkits in Java that can interface with WCF QUESTION: We've got some problems with an external company trying in integrate into a WCF service we expose and they are a Java shop. I was wondering if there are more than one toolkit that they can try to solve their issues and would like a list to sugges...
[ "c#", "java", "wcf", "web-services", "axis" ]
2
1
536
4
0
2008-09-26T11:28:44.750000
2008-09-30T10:51:53.373000
138,884
138,893
When should I use Inline vs. External JavaScript?
I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several HTML pages that need client-side form validation. For this I use a jQuery plugin that I includ...
At the time this answer was originally posted (2008), the rule was simple: All script should be external. Both for maintenance and performance. (Why performance? Because if the code is separate, it can easier be cached by browsers.) JavaScript doesn't belong in the HTML code and if it contains special characters (such ...
When should I use Inline vs. External JavaScript? I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several HTML pages that need client-side form valida...
TITLE: When should I use Inline vs. External JavaScript? QUESTION: I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several HTML pages that need clien...
[ "javascript", "html" ]
133
118
63,439
19
0
2008-09-26T11:31:10.750000
2008-09-26T11:33:08.497000
138,917
139,152
Visual Studio debugger slows down in in-line code
Since I upgraded to Visual Studio 2008 from vs2005, I have found a very annoying behaviour when debugging large projects. If I attempt to step into inline code, the debugger appears to lock up for tens of seconds. Each time that I step inside such a function, there is a similar pause. Has anyone experienced this and is...
I used to get this - I think it's a bug with the 'Autos' debug window: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/eabc58b1-51b2-49ce-b710-15e2bf7e7516/
Visual Studio debugger slows down in in-line code Since I upgraded to Visual Studio 2008 from vs2005, I have found a very annoying behaviour when debugging large projects. If I attempt to step into inline code, the debugger appears to lock up for tens of seconds. Each time that I step inside such a function, there is a...
TITLE: Visual Studio debugger slows down in in-line code QUESTION: Since I upgraded to Visual Studio 2008 from vs2005, I have found a very annoying behaviour when debugging large projects. If I attempt to step into inline code, the debugger appears to lock up for tens of seconds. Each time that I step inside such a fu...
[ "c++", "windows", "visual-studio", "debugging" ]
2
3
1,218
4
0
2008-09-26T11:40:47.753000
2008-09-26T12:34:10.603000
138,928
138,942
How do I fix routing errors from rails in production mode?
If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message Routing Error No route matches "/asdfasdifjasdfkj" with {:method=>:get} Even though I am in production mode. Clearly I don't want any real users to see this, and would prefer a 404 page. A...
To get 404 you need to run server in production environment and use external ip address rather than local/loopback ip address in the url. You can also force controller to consider all your requests as local: def local_request? return false end
How do I fix routing errors from rails in production mode? If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message Routing Error No route matches "/asdfasdifjasdfkj" with {:method=>:get} Even though I am in production mode. Clearly I don't want...
TITLE: How do I fix routing errors from rails in production mode? QUESTION: If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message Routing Error No route matches "/asdfasdifjasdfkj" with {:method=>:get} Even though I am in production mode. Cl...
[ "ruby-on-rails", "routes", "http-status-code-404", "production" ]
5
10
2,284
1
0
2008-09-26T11:43:13.270000
2008-09-26T11:46:55.350000
138,929
138,944
What are the relative merits of CSV, JSON and XML for a REST API?
We're currently planning a new API for an application and debating the various data formats we should use for interchange. There's a fairly intense discussion going on about the relative merits of CSV, JSON and XML. Basically, the crux of the argument is whether we should support CSV at all because of the lack of recur...
CSV is right out. JSON is a more compact object notation than XML, so if you're looking for high volumes it has the advantage. XML has wider market penetration (I love that phrase) and is supported by all programming languages and their core frameworks. JSON is getting there (if not already there). Personally, I like t...
What are the relative merits of CSV, JSON and XML for a REST API? We're currently planning a new API for an application and debating the various data formats we should use for interchange. There's a fairly intense discussion going on about the relative merits of CSV, JSON and XML. Basically, the crux of the argument is...
TITLE: What are the relative merits of CSV, JSON and XML for a REST API? QUESTION: We're currently planning a new API for an application and debating the various data formats we should use for interchange. There's a fairly intense discussion going on about the relative merits of CSV, JSON and XML. Basically, the crux ...
[ "xml", "json", "api", "rest", "csv" ]
24
20
26,722
6
0
2008-09-26T11:43:30.820000
2008-09-26T11:47:05.023000
138,932
138,951
How do I obtain CPU cycle count in Win32?
In Win32, is there any way to get a unique cpu cycle count or something similar that would be uniform for multiple processes/languages/systems/etc. I'm creating some log files, but have to produce multiple logfiles because we're hosting the.NET runtime, and I'd like to avoid calling from one to the other to log. As suc...
You can use the RDTSC CPU instruction (assuming x86). This instruction gives the CPU cycle counter, but be aware that it will increase very quickly to its maximum value, and then reset to 0. As the Wikipedia article mentions, you might be better off using the QueryPerformanceCounter function.
How do I obtain CPU cycle count in Win32? In Win32, is there any way to get a unique cpu cycle count or something similar that would be uniform for multiple processes/languages/systems/etc. I'm creating some log files, but have to produce multiple logfiles because we're hosting the.NET runtime, and I'd like to avoid ca...
TITLE: How do I obtain CPU cycle count in Win32? QUESTION: In Win32, is there any way to get a unique cpu cycle count or something similar that would be uniform for multiple processes/languages/systems/etc. I'm creating some log files, but have to produce multiple logfiles because we're hosting the.NET runtime, and I'...
[ "winapi", "timer", "cpu-cycles" ]
7
9
10,755
5
0
2008-09-26T11:44:26.887000
2008-09-26T11:48:39.480000
138,948
138,950
How to get UTF-8 working in Java webapps?
I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases. My setup is the following: Development environment: Windows XP Production environment: Debian Database used: MySQL 5.x Users mainly use Firefo...
Answering myself as the FAQ of this site encourages it. This works for me: Mostly characters äåö are not a problematic as the default character set used by browsers and tomcat/java for webapps is latin1 ie. ISO-8859-1 which "understands" those characters. To get UTF-8 working under Java+Tomcat+Linux/Windows+Mysql requi...
How to get UTF-8 working in Java webapps? I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases. My setup is the following: Development environment: Windows XP Production environment: Debian Databa...
TITLE: How to get UTF-8 working in Java webapps? QUESTION: I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases. My setup is the following: Development environment: Windows XP Production environm...
[ "java", "mysql", "tomcat", "encoding", "utf-8" ]
375
564
235,928
14
0
2008-09-26T11:48:09.763000
2008-09-26T11:48:24.787000
138,952
139,733
Is there an implementation for Delphi:TClientDataSet in C++ for MVS?
I want to migrate from Embarcadero Delphi to Visual Studio, but without a TClientDataset class it is very difficult. This class represents an in-memory dataset. I can't find any class like TClientDataset. Can anyone help me find something like this please?
Visual studio has DataSet and DataTable classes which are very close to what a TClientDataSet is in Delphi. See http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx
Is there an implementation for Delphi:TClientDataSet in C++ for MVS? I want to migrate from Embarcadero Delphi to Visual Studio, but without a TClientDataset class it is very difficult. This class represents an in-memory dataset. I can't find any class like TClientDataset. Can anyone help me find something like this pl...
TITLE: Is there an implementation for Delphi:TClientDataSet in C++ for MVS? QUESTION: I want to migrate from Embarcadero Delphi to Visual Studio, but without a TClientDataset class it is very difficult. This class represents an in-memory dataset. I can't find any class like TClientDataset. Can anyone help me find some...
[ "c++", "delphi", "tclientdataset" ]
2
1
719
2
0
2008-09-26T11:48:53.833000
2008-09-26T14:08:03.717000
138,953
138,957
.htm or .html extension - which one is correct and what is different?
When I save a file with an.htm or.html extension, which one is correct and what is different?
Neither is wrong, it's a matter of preference. Traditionally, MS software uses htm by default, and *nix prefers html. As oded pointed out below, the.htm tradition was carried over from win 3.xx, where file extensions were limited to three characters.
.htm or .html extension - which one is correct and what is different? When I save a file with an.htm or.html extension, which one is correct and what is different?
TITLE: .htm or .html extension - which one is correct and what is different? QUESTION: When I save a file with an.htm or.html extension, which one is correct and what is different? ANSWER: Neither is wrong, it's a matter of preference. Traditionally, MS software uses htm by default, and *nix prefers html. As oded poi...
[ "html", "naming-conventions", "filenames" ]
62
76
31,204
10
0
2008-09-26T11:49:56.297000
2008-09-26T11:50:55.433000
138,979
139,135
What free screen design tools are available
I am looking for a free tool to quickly create a screen design in a workshop with a customer (for a web application). The focus of the tool should be on a functional definition of screens and not on the design of them. Do you have any suggestions for an appropriate tool?
I've found mockupscreens to be pretty good. The designs look exactly like works in progress and keeps clients from getting distracted
What free screen design tools are available I am looking for a free tool to quickly create a screen design in a workshop with a customer (for a web application). The focus of the tool should be on a functional definition of screens and not on the design of them. Do you have any suggestions for an appropriate tool?
TITLE: What free screen design tools are available QUESTION: I am looking for a free tool to quickly create a screen design in a workshop with a customer (for a web application). The focus of the tool should be on a functional definition of screens and not on the design of them. Do you have any suggestions for an appr...
[ "screen" ]
11
4
30,459
7
0
2008-09-26T11:57:13.797000
2008-09-26T12:32:26.257000
138,981
138,995
How to test if a file is a directory in a batch script?
Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this: if(-d $var) { print "it's a directory\n" }
You can do it like so: IF EXIST %VAR%\NUL ECHO It's a directory However, this only works for directories without spaces in their names. When you add quotes round the variable to handle the spaces it will stop working. To handle directories with spaces, convert the filename to short 8.3 format as follows: FOR %%i IN (%V...
How to test if a file is a directory in a batch script? Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this: if(-d $var) { print "it's a directory\n" }
TITLE: How to test if a file is a directory in a batch script? QUESTION: Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this: if(-d $var) { print "it's a directory\n" } ANSWER: You can do it like so: IF EXIST %VAR%\NUL ECHO It's a directory However, this on...
[ "windows", "batch-file", "cmd" ]
93
61
152,424
23
0
2008-09-26T11:57:24.937000
2008-09-26T12:01:33.553000
138,994
139,008
Is there a performance difference between inc(i) and i := i + 1 in Delphi?
I have a procedure with a lot of i:= i +1; in it and I think inc(i); looks a lot better. Is there a performance difference or does the function call just get inlined by the compiler? I know this probably doesn't matter at all to my app, I'm just curious. EDIT: I did some gauging of the performance and found the differe...
Modern compilers optimize the code. inc(i) and i:= i+1; are pretty much the same. Use whichever you prefer. Edit: As Jim McKeeth corrected: with Overflow Checking there is a difference. Inc does not do a range checking.
Is there a performance difference between inc(i) and i := i + 1 in Delphi? I have a procedure with a lot of i:= i +1; in it and I think inc(i); looks a lot better. Is there a performance difference or does the function call just get inlined by the compiler? I know this probably doesn't matter at all to my app, I'm just...
TITLE: Is there a performance difference between inc(i) and i := i + 1 in Delphi? QUESTION: I have a procedure with a lot of i:= i +1; in it and I think inc(i); looks a lot better. Is there a performance difference or does the function call just get inlined by the compiler? I know this probably doesn't matter at all t...
[ "performance", "delphi" ]
14
7
4,035
6
0
2008-09-26T12:01:27.280000
2008-09-26T12:06:38.643000
139,005
139,056
PyQt - QScrollBar
Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks.
It will come down to you using the QScrollArea, it is a widget that implements showing something that is larger than the available space. You will not need to use QScrollBar directly. I don't have a PyQt example but there is a C++ example in the QT distribution it is called the "Image Viewer". The object hierarchy will...
PyQt - QScrollBar Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks.
TITLE: PyQt - QScrollBar QUESTION: Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks. ANSWER: It will come down to you using the QScrollArea, it is a widget that implements showing something that is larger than the available space. You will not need to use QScrollBar directly. I don't...
[ "python", "pyqt" ]
0
1
3,189
3
0
2008-09-26T12:05:29.377000
2008-09-26T12:18:12.950000
139,012
139,054
Tweak the brightness/gamma of the whole scene in OpenGL
Does anyone know how I can achieve the following effect in OpenGL: Change the brightness of the rendered scene Or implementing a Gamma setting in OpenGL I have tried by changing the ambient parameter of the light and the type of light (directional and omnidirectional) but the result was not uniform. TIA. Thanks for you...
On win32 you can use SetDeviceGammaRamp to adjust the overall brightness / gamma. However, this affects the entire display so it's not a good idea unless your app is fullscreen. The portable alternative is to either draw the entire scene brighter or dimmer (which is a hassle), or to slap a fullscreen alpha-blended quad...
Tweak the brightness/gamma of the whole scene in OpenGL Does anyone know how I can achieve the following effect in OpenGL: Change the brightness of the rendered scene Or implementing a Gamma setting in OpenGL I have tried by changing the ambient parameter of the light and the type of light (directional and omnidirectio...
TITLE: Tweak the brightness/gamma of the whole scene in OpenGL QUESTION: Does anyone know how I can achieve the following effect in OpenGL: Change the brightness of the rendered scene Or implementing a Gamma setting in OpenGL I have tried by changing the ambient parameter of the light and the type of light (directiona...
[ "opengl", "3d", "gamma" ]
3
3
8,671
2
0
2008-09-26T12:07:01.403000
2008-09-26T12:18:08.537000
139,015
139,077
How can I do a full-text search of PDF files from Perl?
I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string. To date I have been using this: my @search_results = `grep -i -l \"$string\" *.pdf`; where $string is the text to look for. However this fails for most pdf's because the file format is ...
The PerlMonks thread here talks about this problem. It seems that for your situation, it might be simplest to get pdftotext (the command line tool), then you can do something like: my @search_results = `pdftotext myfile.pdf - | grep -i -l \"$string\"`;
How can I do a full-text search of PDF files from Perl? I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string. To date I have been using this: my @search_results = `grep -i -l \"$string\" *.pdf`; where $string is the text to look for. Howev...
TITLE: How can I do a full-text search of PDF files from Perl? QUESTION: I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string. To date I have been using this: my @search_results = `grep -i -l \"$string\" *.pdf`; where $string is the text ...
[ "perl", "pdf", "full-text-search" ]
9
10
7,207
6
0
2008-09-26T12:07:59.513000
2008-09-26T12:21:51.023000
139,025
139,035
How to program a full-screen mode in Java?
I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?
Try the Full-Screen Exclusive Mode API. It was introduced in the JDK in release 1.4. Some of the features include: Full-Screen Exclusive Mode - allows you to suspend the windowing system so that drawing can be done directly to the screen. Display Mode - composed of the size (width and height of the monitor, in pixels),...
How to program a full-screen mode in Java? I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?
TITLE: How to program a full-screen mode in Java? QUESTION: I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this? ANSWER: Try the Full-Screen Exclusive Mode API. It was introduced in t...
[ "java", "graphics", "fullscreen" ]
13
22
23,129
5
0
2008-09-26T12:10:47.010000
2008-09-26T12:13:39.110000
139,034
139,072
Manager classes
In a recent project I have nearly completed we used an architecture that as its top layer of interaction from the web/services layers uses XXXManager classes. For example, there is a windows services that runs on a scheduled basis that imports data from several diverse data sources into our system. Within this service ...
Managers are a commonly overused naming strategy for services that handle the workflow or complex tasks for a given set of entities. However, if it gets the job done, then it is not necessarily a bad thing. The important question I would have is what is going on underneath the managers? IF they are simply coordinated t...
Manager classes In a recent project I have nearly completed we used an architecture that as its top layer of interaction from the web/services layers uses XXXManager classes. For example, there is a windows services that runs on a scheduled basis that imports data from several diverse data sources into our system. With...
TITLE: Manager classes QUESTION: In a recent project I have nearly completed we used an architecture that as its top layer of interaction from the web/services layers uses XXXManager classes. For example, there is a windows services that runs on a scheduled basis that imports data from several diverse data sources int...
[ "architecture" ]
3
7
1,973
2
0
2008-09-26T12:13:38.907000
2008-09-26T12:20:45.020000
139,046
139,500
Easiest way to decrypt PGP-encrypted files from VBA (MS Access)
I need to write code that picks up PGP-encrypted files from an FTP location and processes them. The files will be encrypted with my public key (not that I have one yet). Obviously, I need a PGP library that I can use from within Microsoft Access. Can you recommend one that is easy to use? I'm looking for something that...
A command line solution is good. If your database is an internal application, not to be redistributed, I can recommend Gnu Privacy Guard. This command-line based tool will allow you to do anything that you need to with regard to the OpenPGP standard. Within Access, you can use the Shell() command in a Macro like this: ...
Easiest way to decrypt PGP-encrypted files from VBA (MS Access) I need to write code that picks up PGP-encrypted files from an FTP location and processes them. The files will be encrypted with my public key (not that I have one yet). Obviously, I need a PGP library that I can use from within Microsoft Access. Can you r...
TITLE: Easiest way to decrypt PGP-encrypted files from VBA (MS Access) QUESTION: I need to write code that picks up PGP-encrypted files from an FTP location and processes them. The files will be encrypted with my public key (not that I have one yet). Obviously, I need a PGP library that I can use from within Microsoft...
[ "security", "ms-access", "encryption", "pgp" ]
3
5
15,777
7
0
2008-09-26T12:15:14.317000
2008-09-26T13:27:45.843000
139,053
140,075
Securing an assembly so that it can't be used by a third party
I have written an assembly I don't want other people to be able to use. My assembly is signed with a strong name key file, but how do I secure the code so that only my other assemblies signed with the same key can call the members in this assembly?
There are a few options, none very effective as they merely will make things a tiny bit difficult, but would not prevent a committed user to work around any restriction: On every one of your entry points, you can call Assembly.GetCallingAssembly() and compare the result with a list of assemblies that are allowed to cal...
Securing an assembly so that it can't be used by a third party I have written an assembly I don't want other people to be able to use. My assembly is signed with a strong name key file, but how do I secure the code so that only my other assemblies signed with the same key can call the members in this assembly?
TITLE: Securing an assembly so that it can't be used by a third party QUESTION: I have written an assembly I don't want other people to be able to use. My assembly is signed with a strong name key file, but how do I secure the code so that only my other assemblies signed with the same key can call the members in this ...
[ ".net", "security" ]
5
12
811
6
0
2008-09-26T12:17:59.067000
2008-09-26T15:04:27.047000
139,055
143,379
Subversive connectors not working with newest Ganymede update
I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede could not handle it; now it can't handle even the dev one). Any ideas how to ma...
I had a similar problem right after the update. It turned out that I had been getting the connectors (the base connector and both the SVNKit and JavaHL connectors) from the Polarion site that had "ganymede" in the URL. Instead, I should have been using the general URL. Checking my current configuration, you should be u...
Subversive connectors not working with newest Ganymede update I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede could not handle ...
TITLE: Subversive connectors not working with newest Ganymede update QUESTION: I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede...
[ "eclipse", "svn", "eclipse-3.4", "subversive", "ganymede" ]
5
10
3,989
2
0
2008-09-26T12:18:09.440000
2008-09-27T10:33:50.603000
139,088
144,142
JFrame.setDefaultLookAndFeelDecorated(true);
when i use setDefaultLookAndFeelDecorated(true) method in Java why is the Frame appear FullScreen when i maximize the Frame? and how can i disaple the FullScreen mode in this method?
Setting setDefaultLookAndFeelDecorated to true causes the decorations to be handled by the look and feel; this means that a System look-and-feel on both Windows and Mac (I have no Linux at hand now) retains the borders you would expect them of a native window, e.g. staying clear of the taskbar in Windows. When using th...
JFrame.setDefaultLookAndFeelDecorated(true); when i use setDefaultLookAndFeelDecorated(true) method in Java why is the Frame appear FullScreen when i maximize the Frame? and how can i disaple the FullScreen mode in this method?
TITLE: JFrame.setDefaultLookAndFeelDecorated(true); QUESTION: when i use setDefaultLookAndFeelDecorated(true) method in Java why is the Frame appear FullScreen when i maximize the Frame? and how can i disaple the FullScreen mode in this method? ANSWER: Setting setDefaultLookAndFeelDecorated to true causes the decorat...
[ "java", "user-interface", "swing" ]
5
4
17,489
2
0
2008-09-26T12:24:53.933000
2008-09-27T17:56:05.267000
139,131
139,174
web-inf and jsp page directives
i have a number of jsp files under web-inf folder. Inside my web.xml i specify an errorppage for 404 amd 403 and java.lang.exception. Do i need to include a page directive for each of my jsp's or will they automatically get forwarded to the exception handling page because they are under web-inf? If this is true does th...
You just need to have whatever errorpage you would like to use in your app available with all the other jsps. So in the following example you would just need to have the error pages in the root of the context path(where all of the other jsps are). Anytime the webapp receives a 404 or 403 error it will try to display on...
web-inf and jsp page directives i have a number of jsp files under web-inf folder. Inside my web.xml i specify an errorppage for 404 amd 403 and java.lang.exception. Do i need to include a page directive for each of my jsp's or will they automatically get forwarded to the exception handling page because they are under ...
TITLE: web-inf and jsp page directives QUESTION: i have a number of jsp files under web-inf folder. Inside my web.xml i specify an errorppage for 404 amd 403 and java.lang.exception. Do i need to include a page directive for each of my jsp's or will they automatically get forwarded to the exception handling page becau...
[ "jsp", "web-inf", "page-directives" ]
2
1
1,647
2
0
2008-09-26T12:31:57.613000
2008-09-26T12:37:57.693000
139,150
259,249
Experiences with OpenLaszlo?
In a related question, I asked about Web Development. I came across something called OpenLaszlo yesterday and thought it looked interesting for doing some website development. The site has a bunch of good information on it and they've got some nice tutorials and such, but being a total novice (as far as web development...
I worked on a website for about a year in which the entire UI was developed in Laszlo. I've also developed AJAX applications using JS frameworks such as JQuery, Prototype and Scriptaculous. In my experience, the total effort required is considerably less when using Laszlo, and the class-based object model helps to keep...
Experiences with OpenLaszlo? In a related question, I asked about Web Development. I came across something called OpenLaszlo yesterday and thought it looked interesting for doing some website development. The site has a bunch of good information on it and they've got some nice tutorials and such, but being a total novi...
TITLE: Experiences with OpenLaszlo? QUESTION: In a related question, I asked about Web Development. I came across something called OpenLaszlo yesterday and thought it looked interesting for doing some website development. The site has a bunch of good information on it and they've got some nice tutorials and such, but ...
[ "openlaszlo" ]
8
6
1,324
4
0
2008-09-26T12:34:05.957000
2008-11-03T16:51:02.493000
139,157
142,801
What is the best way to prevent highlighting of text when clicking on its containing div in javascript?
I am building a menu in HTML/CSS/JS and I need a way to prevent the text in the menu from being highlighted when double-clicked on. I need a way to pass the id's of several divs into a function and have highlighting turned off within them. So when the user accidentally (or on purpose) double clicks on the menu, the men...
In (Mozilla, Firefox, Camino, Safari, Google Chrome) you can use this: div.noSelect { -moz-user-select: none; /* mozilla browsers */ -khtml-user-select: none; /* webkit browsers */ } For IE there is no CSS option, but you can capture the ondragstart event, and return false; Update Browser support for this property has ...
What is the best way to prevent highlighting of text when clicking on its containing div in javascript? I am building a menu in HTML/CSS/JS and I need a way to prevent the text in the menu from being highlighted when double-clicked on. I need a way to pass the id's of several divs into a function and have highlighting ...
TITLE: What is the best way to prevent highlighting of text when clicking on its containing div in javascript? QUESTION: I am building a menu in HTML/CSS/JS and I need a way to prevent the text in the menu from being highlighted when double-clicked on. I need a way to pass the id's of several divs into a function and ...
[ "javascript", "html", "css" ]
15
25
15,944
4
0
2008-09-26T12:35:12.800000
2008-09-27T02:42:35.713000
139,180
139,198
How to list all functions in a module?
I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the help function on each one. In Ruby I can do something like ClassName.methods to get a list of all the methods available on that class. Is there something similar in Python?...
Use the inspect module: from inspect import getmembers, isfunction from somemodule import foo print(getmembers(foo, isfunction)) Also see the pydoc module, the help() function in the interactive interpreter and the pydoc command-line tool which generates the documentation you are after. You can just give them the clas...
How to list all functions in a module? I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the help function on each one. In Ruby I can do something like ClassName.methods to get a list of all the methods available on that class...
TITLE: How to list all functions in a module? QUESTION: I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the help function on each one. In Ruby I can do something like ClassName.methods to get a list of all the methods avail...
[ "python", "reflection", "module", "inspect" ]
591
290
1,053,132
20
0
2008-09-26T12:38:52.417000
2008-09-26T12:41:04.690000
139,199
139,810
Can I protect against SQL injection by escaping single-quote and surrounding user input with single-quotes?
I realize that parameterized SQL queries is the optimal way to sanitize user input when building queries that contain user input, but I'm wondering what is wrong with taking user input and escaping any single quotes and surrounding the whole string with single quotes. Here's the code: sSanitizedInput = "'" & Replace(sI...
First of all, it's just bad practice. Input validation is always necessary, but it's also always iffy. Worse yet, blacklist validation is always problematic, it's much better to explicitly and strictly define what values/formats you accept. Admittedly, this is not always possible - but to some extent it must always be ...
Can I protect against SQL injection by escaping single-quote and surrounding user input with single-quotes? I realize that parameterized SQL queries is the optimal way to sanitize user input when building queries that contain user input, but I'm wondering what is wrong with taking user input and escaping any single quo...
TITLE: Can I protect against SQL injection by escaping single-quote and surrounding user input with single-quotes? QUESTION: I realize that parameterized SQL queries is the optimal way to sanitize user input when building queries that contain user input, but I'm wondering what is wrong with taking user input and escap...
[ "sql", "security", "sql-server-2000", "sql-injection", "sanitization" ]
156
91
93,131
19
0
2008-09-26T12:41:25.720000
2008-09-26T14:18:45.813000
139,207
139,308
Repeater, ListView, DataList, DataGrid, GridView ... Which to choose?
So many different controls to choose from! What are best practices for determining which control to use for displaying data in ASP.NET?
It's really about what you trying to achieve Gridview - Limited in design, works like an html table. More in built functionality like edit/update, page, sort. Lots of overhead. DataGrid - Old version of the Gridview. A gridview is a super datagrid. Datalist - more customisable version of the Gridview. Also has some ove...
Repeater, ListView, DataList, DataGrid, GridView ... Which to choose? So many different controls to choose from! What are best practices for determining which control to use for displaying data in ASP.NET?
TITLE: Repeater, ListView, DataList, DataGrid, GridView ... Which to choose? QUESTION: So many different controls to choose from! What are best practices for determining which control to use for displaying data in ASP.NET? ANSWER: It's really about what you trying to achieve Gridview - Limited in design, works like a...
[ "asp.net", "user-interface" ]
112
150
73,587
5
0
2008-09-26T12:43:51.267000
2008-09-26T12:55:21.410000
139,209
139,652
Do you databind your object fields to your form controls?
Or do you populate your form controls manually by a method? Is either considered a best practice?
Generally, if data binding business or DAL objects is possible, I would use it. The old axiom holds true: The most error-free and reliable line of code is often the one you didn't have to write. (Bear in mind, however, that you need to know exactly how that data binding occurs, what its overhead is, and you have to be ...
Do you databind your object fields to your form controls? Or do you populate your form controls manually by a method? Is either considered a best practice?
TITLE: Do you databind your object fields to your form controls? QUESTION: Or do you populate your form controls manually by a method? Is either considered a best practice? ANSWER: Generally, if data binding business or DAL objects is possible, I would use it. The old axiom holds true: The most error-free and reliabl...
[ "winforms", "oop", "data-binding" ]
2
1
310
3
0
2008-09-26T12:44:27.957000
2008-09-26T13:57:18.237000
139,212
145,610
Adding Cookie to ZSI Posts
I've added cookie support to SOAPpy by overriding HTTPTransport. I need functionality beyond that of SOAPpy, so I was planning on moving to ZSI, but I can't figure out how to put the Cookies on the ZSI posts made to the service. Without these cookies, the server will think it is an unauthorized request and it will fail...
If you read the _Binding class in client.py of ZSI you can see that it has a variable cookies, which is an instance of Cookie.SimpleCookie. Following the ZSI example and the Cookie example that is how it should work: b = Binding(url='/cgi-bin/simple-test', tracefile=fp) b.cookies['foo'] = 'bar'
Adding Cookie to ZSI Posts I've added cookie support to SOAPpy by overriding HTTPTransport. I need functionality beyond that of SOAPpy, so I was planning on moving to ZSI, but I can't figure out how to put the Cookies on the ZSI posts made to the service. Without these cookies, the server will think it is an unauthoriz...
TITLE: Adding Cookie to ZSI Posts QUESTION: I've added cookie support to SOAPpy by overriding HTTPTransport. I need functionality beyond that of SOAPpy, so I was planning on moving to ZSI, but I can't figure out how to put the Cookies on the ZSI posts made to the service. Without these cookies, the server will think i...
[ "python", "web-services", "cookies", "soappy", "zsi" ]
2
1
535
2
0
2008-09-26T12:45:01.203000
2008-09-28T10:15:27.800000
139,228
139,362
What do you do with a developer who does not test his code?
One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result. Besides getting rid of the developer, how can I solve this problem? EDIT I have talked to him about it number of times and even given him written warning
If you systematically perform code reviews before allowing a developer to commit the code, well, your problem is mostly solved. But this doesn't seem to be your case, so this is what I recommend: Talk to the developer. Discuss the consequences for others in the team. Most developers want to be recognized by their peer,...
What do you do with a developer who does not test his code? One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result. Besides getting rid of the developer, how can I solve this problem? EDIT I have talked to him about it n...
TITLE: What do you do with a developer who does not test his code? QUESTION: One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result. Besides getting rid of the developer, how can I solve this problem? EDIT I have talked...
[ "testing", "project-management", "software-quality" ]
27
34
7,230
49
0
2008-09-26T12:46:49.653000
2008-09-26T13:03:31.330000
139,245
169,730
Relative path in t sql?
How to get the relative path in t sql? Take for example a.sql file is located in the folder D:\temp, I want to get path of the file hello.txt in the folder D:\temp\App_Data. How to use the relative path reference? Let's say I am executing the sql file inside the SQL server management studio.
The server is executing the t-sql. It doesn't know where the client loaded the file from. You'll have to have the path embedded within the script. DECLARE @RelDir varchar(1000) SET @RelDir = 'D:\temp\'... Perhaps you can programmatically place the path into the SET command within the.sql script file, or perhaps you can...
Relative path in t sql? How to get the relative path in t sql? Take for example a.sql file is located in the folder D:\temp, I want to get path of the file hello.txt in the folder D:\temp\App_Data. How to use the relative path reference? Let's say I am executing the sql file inside the SQL server management studio.
TITLE: Relative path in t sql? QUESTION: How to get the relative path in t sql? Take for example a.sql file is located in the folder D:\temp, I want to get path of the file hello.txt in the folder D:\temp\App_Data. How to use the relative path reference? Let's say I am executing the sql file inside the SQL server mana...
[ "sql-server", "t-sql" ]
11
5
21,620
7
0
2008-09-26T12:49:18.320000
2008-10-04T04:23:35.830000
139,260
139,372
Writing XML files using XmlTextWriter with ISO-8859-1 encoding
I'm having a problem writing Norwegian characters into an XML file using C#. I have a string variable containing some Norwegian text (with letters like æøå). I'm writing the XML using an XmlTextWriter, writing the contents to a MemoryStream like this: MemoryStream stream = new MemoryStream(); XmlTextWriter xmlTextWrite...
Why are you writing the XML first to a MemoryStream and then writing that to the actual file stream? That's pretty inefficient. If you write directly to the FileStream it should work. If you still want to do the double write, for whatever reason, do one of two things. Either Make sure that the StreamReader and StreamWr...
Writing XML files using XmlTextWriter with ISO-8859-1 encoding I'm having a problem writing Norwegian characters into an XML file using C#. I have a string variable containing some Norwegian text (with letters like æøå). I'm writing the XML using an XmlTextWriter, writing the contents to a MemoryStream like this: Memor...
TITLE: Writing XML files using XmlTextWriter with ISO-8859-1 encoding QUESTION: I'm having a problem writing Norwegian characters into an XML file using C#. I have a string variable containing some Norwegian text (with letters like æøå). I'm writing the XML using an XmlTextWriter, writing the contents to a MemoryStrea...
[ "c#", ".net", "xml", "encoding", "iso-8859-1" ]
18
13
46,896
6
0
2008-09-26T12:50:46.587000
2008-09-26T13:05:52.307000
139,261
139,289
How to create a file with a given size in Linux?
For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux?
For small files: dd if=/dev/zero of=upload_test bs=file_size count=1 Where file_size is the size of your test file in bytes. For big files: dd if=/dev/zero of=upload_test bs=1M count=size_in_megabytes
How to create a file with a given size in Linux? For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux?
TITLE: How to create a file with a given size in Linux? QUESTION: For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux? ANSWER: For small files: dd if=/dev/zero of=upload_test bs=file_size count=1 Where file_size is t...
[ "linux", "command-line" ]
213
249
234,909
14
0
2008-09-26T12:50:48.660000
2008-09-26T12:53:11.010000
139,288
139,349
Get the time of tomorrow xx:xx
what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them! Okami
I take the brute force approach // make it now Calendar dateCal = Calendar.getInstance(); // make it tomorrow dateCal.add(Calendar.DAY_OF_YEAR, 1); // Now set it to the time you want dateCal.set(Calendar.HOUR_OF_DAY, hours); dateCal.set(Calendar.MINUTE, minutes); dateCal.set(Calendar.SECOND, seconds); dateCal.set(Calen...
Get the time of tomorrow xx:xx what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them! Okami
TITLE: Get the time of tomorrow xx:xx QUESTION: what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them! Okami ANSWER: I take the brute force appr...
[ "java", "date" ]
5
14
3,211
4
0
2008-09-26T12:53:08.937000
2008-09-26T13:01:20.773000
139,325
139,377
Setting all values in a std::map
How to set all the values in a std::map to the same value, without using a loop iterating over each value?
Using a loop is by far the simplest method. In fact, it’s a one-liner: [C++17] for (auto& [_, v]: mymap) v = value; Unfortunately C++ algorithm support for associative containers isn’t great pre-C++20. As a consequence, we can’t directly use std::fill. To use them anyway (pre-C++20), we need to write adapters — in the ...
Setting all values in a std::map How to set all the values in a std::map to the same value, without using a loop iterating over each value?
TITLE: Setting all values in a std::map QUESTION: How to set all the values in a std::map to the same value, without using a loop iterating over each value? ANSWER: Using a loop is by far the simplest method. In fact, it’s a one-liner: [C++17] for (auto& [_, v]: mymap) v = value; Unfortunately C++ algorithm support f...
[ "c++", "stl" ]
10
20
19,398
3
0
2008-09-26T12:57:40.033000
2008-09-26T13:06:21.853000
139,358
157,659
Inno Setup: Capture control events in wizard page
In a user defined wizard page, is there a way to capture change or focus events of the controls? I want to provide an immediate feedback on user input in some dropdowns (e.g. a message box)
Took me some time to work it out, but after being pointed in the right direction by Otherside, I finally got it (works for version 5.2): [Code] var MyCustomPage: TWizardPage; procedure MyEditField_OnChange(Sender: TObject); begin MsgBox('TEST', mbError, MB_OK); end; function MyCustomPage_Create(PreviousPageId: Integ...
Inno Setup: Capture control events in wizard page In a user defined wizard page, is there a way to capture change or focus events of the controls? I want to provide an immediate feedback on user input in some dropdowns (e.g. a message box)
TITLE: Inno Setup: Capture control events in wizard page QUESTION: In a user defined wizard page, is there a way to capture change or focus events of the controls? I want to provide an immediate feedback on user input in some dropdowns (e.g. a message box) ANSWER: Took me some time to work it out, but after being poi...
[ "inno-setup" ]
2
4
3,312
2
0
2008-09-26T13:02:58.927000
2008-10-01T13:44:34.387000
139,365
139,888
Handling TDD interface changes
I've begun to use TDD. As mentioned in an earlier question the biggest difficulty is handling interface changes. How do you reduce the impact on your test cases as requirements change?
Changing an interface requires updating code that uses that interface. Test code isn't any different from non-test code in this respect. It's unavoidable that tests for that interface will need to change. Often when an interface changes you find that "too many" tests break, i.e. tests for largely unrelated functionalit...
Handling TDD interface changes I've begun to use TDD. As mentioned in an earlier question the biggest difficulty is handling interface changes. How do you reduce the impact on your test cases as requirements change?
TITLE: Handling TDD interface changes QUESTION: I've begun to use TDD. As mentioned in an earlier question the biggest difficulty is handling interface changes. How do you reduce the impact on your test cases as requirements change? ANSWER: Changing an interface requires updating code that uses that interface. Test c...
[ "unit-testing", "tdd" ]
6
9
996
9
0
2008-09-26T13:03:37.147000
2008-09-26T14:30:15.583000
139,368
139,392
how is MalformedURLException thrown in Java
I mean, how does Java decide which protocols are available? I run some code from inside Eclipse, and it works just fine. Then I run the same code from outside Eclipse, and I get "unknown protocol" MalformedURLException. Probably it has to do with the code base, or something? Any hints would be helpful. Thanks!
The work of resolving the protocol is done by the URLStreamHandler, which are stored in URL.handlers by protocol in lowercase. The handler, in turn, is created by the URLStreamHandlerFactory at URL.factory. Maybe eclipse is monkeying with that? Some of the URL constructors take stream handlers and you can set the facto...
how is MalformedURLException thrown in Java I mean, how does Java decide which protocols are available? I run some code from inside Eclipse, and it works just fine. Then I run the same code from outside Eclipse, and I get "unknown protocol" MalformedURLException. Probably it has to do with the code base, or something? ...
TITLE: how is MalformedURLException thrown in Java QUESTION: I mean, how does Java decide which protocols are available? I run some code from inside Eclipse, and it works just fine. Then I run the same code from outside Eclipse, and I get "unknown protocol" MalformedURLException. Probably it has to do with the code ba...
[ "java", "protocols", "malformedurlexception" ]
2
1
2,001
3
0
2008-09-26T13:04:53.697000
2008-09-26T13:08:25.780000
139,373
139,799
#defines in linker scripts
For an embedded system I need to place a few data structures at fixed addresses, so that a separate control CPU can access them at a known location. I'm using linker scripts for the embedded target to accomplish this, plus #defines of those same addresses for the control CPU. It bothers me that these address constants ...
This isn't quite the solution you are looking for but one option is to utilize the build system to configure these values. Create a config.h.in and a target.ld.in which acts as templates and have the build system produce a config.h with the correct define and a target.ld with the correct address for the target you are ...
#defines in linker scripts For an embedded system I need to place a few data structures at fixed addresses, so that a separate control CPU can access them at a known location. I'm using linker scripts for the embedded target to accomplish this, plus #defines of those same addresses for the control CPU. It bothers me th...
TITLE: #defines in linker scripts QUESTION: For an embedded system I need to place a few data structures at fixed addresses, so that a separate control CPU can access them at a known location. I'm using linker scripts for the embedded target to accomplish this, plus #defines of those same addresses for the control CPU...
[ "linux", "linker" ]
1
5
2,870
2
0
2008-09-26T13:06:12.367000
2008-09-26T14:17:17.643000
139,384
139,567
Recommend an Open Source .NET Statistics Library
I need to calculate averages, standard deviations, medians etc for a bunch of numerical data. Is there a good open source.NET library I can use? I have found NMath but it is not free and may be overkill for my needs.
I found this on the CodeProject website. It looks like a good C# class for handling most of the basic statistical functions. http://www.codeproject.com/KB/cs/csstatistics.aspx
Recommend an Open Source .NET Statistics Library I need to calculate averages, standard deviations, medians etc for a bunch of numerical data. Is there a good open source.NET library I can use? I have found NMath but it is not free and may be overkill for my needs.
TITLE: Recommend an Open Source .NET Statistics Library QUESTION: I need to calculate averages, standard deviations, medians etc for a bunch of numerical data. Is there a good open source.NET library I can use? I have found NMath but it is not free and may be overkill for my needs. ANSWER: I found this on the CodePro...
[ ".net", "math", "open-source", "statistics" ]
25
7
22,496
8
0
2008-09-26T13:06:54.020000
2008-09-26T13:41:30.350000
139,389
298,099
Should I use Qt Jambi in Java?
Is it a good idea for me to use Qt Jambi in Java as a toolkit? I see that Qt Jambi is hard to learn, and Swing is easier than Qt Jambi, but I think that Qt Jambi is more powerful.
Two years ago, I started a Java Desktop Application and used Swing as a GUI framweork. Up to that point, I had experience with C++/MFC ( shudder ) and C++/Qt ( very nice ). After trying to get along with Swing for a while (including reading lots of tutorials and even a book) I came to the following conclusion: Swing is...
Should I use Qt Jambi in Java? Is it a good idea for me to use Qt Jambi in Java as a toolkit? I see that Qt Jambi is hard to learn, and Swing is easier than Qt Jambi, but I think that Qt Jambi is more powerful.
TITLE: Should I use Qt Jambi in Java? QUESTION: Is it a good idea for me to use Qt Jambi in Java as a toolkit? I see that Qt Jambi is hard to learn, and Swing is easier than Qt Jambi, but I think that Qt Jambi is more powerful. ANSWER: Two years ago, I started a Java Desktop Application and used Swing as a GUI framw...
[ "java", "user-interface", "qt", "qt-jambi" ]
13
15
5,336
3
0
2008-09-26T13:08:01.083000
2008-11-18T07:57:09.017000
139,406
139,586
What is the best solution? Using WF StateMachine to follow user states on a web application
I was looking at WF and was wondering if it would be best to use the StateMachine workflow to follow a users state. i.e. user is anonymous, user is known but not authenticated, user is known and authenticated. would this be a good way to go about solving this regular issue?
No, I think that it is completely inappropriate. Please see these questions for more info: What are your experiences with Windows Workflow Foundation? When to use Windows Workflow Foundation?
What is the best solution? Using WF StateMachine to follow user states on a web application I was looking at WF and was wondering if it would be best to use the StateMachine workflow to follow a users state. i.e. user is anonymous, user is known but not authenticated, user is known and authenticated. would this be a go...
TITLE: What is the best solution? Using WF StateMachine to follow user states on a web application QUESTION: I was looking at WF and was wondering if it would be best to use the StateMachine workflow to follow a users state. i.e. user is anonymous, user is known but not authenticated, user is known and authenticated. ...
[ ".net", "asp.net", "workflow-foundation", "state-machine" ]
1
3
524
3
0
2008-09-26T13:10:33.713000
2008-09-26T13:45:39.823000
139,409
139,456
Log Post Parameters sent to a website
Something I have always been interested in out of curiosity, is there a tool or utility that will allow me so log post parameters sent to a website? Not a personal website, any site on the web. Reason for this, is that I want to be able to develop a.NET application without having to add the overhead of creating a WebBr...
Check out Fiddler ( http://www.fiddler2.com/fiddler2/ ) - it's quite good debugging proxy, which allows for deep inspection and modification of the traffic between your browser and the websites.
Log Post Parameters sent to a website Something I have always been interested in out of curiosity, is there a tool or utility that will allow me so log post parameters sent to a website? Not a personal website, any site on the web. Reason for this, is that I want to be able to develop a.NET application without having t...
TITLE: Log Post Parameters sent to a website QUESTION: Something I have always been interested in out of curiosity, is there a tool or utility that will allow me so log post parameters sent to a website? Not a personal website, any site on the web. Reason for this, is that I want to be able to develop a.NET applicatio...
[ "http", "utilities" ]
1
3
1,000
1
0
2008-09-26T13:10:49.283000
2008-09-26T13:19:31.213000
139,411
139,448
Is a Gantt Chart larger than a single page ever useful?
I've worked on a few projects managed through the use of a Gantt chart. Some of these have has a massive number of tasks and the project manager spends all their time wrestling with MS Project instead of making good choices. I can see the point if there are a number of separate teams working towards something (e.g. leg...
Micromanaging software development projects using MS Project is one of the more stupid things someone can do, especially in an agile environment. Too many things that take 1/10th or 10x the time that you predicted, too many things that overrun, and too many project planning meetings eating up useful work time. In addit...
Is a Gantt Chart larger than a single page ever useful? I've worked on a few projects managed through the use of a Gantt chart. Some of these have has a massive number of tasks and the project manager spends all their time wrestling with MS Project instead of making good choices. I can see the point if there are a numb...
TITLE: Is a Gantt Chart larger than a single page ever useful? QUESTION: I've worked on a few projects managed through the use of a Gantt chart. Some of these have has a massive number of tasks and the project manager spends all their time wrestling with MS Project instead of making good choices. I can see the point i...
[ "project-management", "gantt-chart" ]
1
8
3,443
13
0
2008-09-26T13:10:56.710000
2008-09-26T13:17:56.897000
139,427
139,453
Which Coding convention to follow for PHP?
Should I stick with Sun's Java code conventions for PHP code?
For PHP, i'd suggest to follow Zends suggestions As you might know, Zend is the most widely used framework!
Which Coding convention to follow for PHP? Should I stick with Sun's Java code conventions for PHP code?
TITLE: Which Coding convention to follow for PHP? QUESTION: Should I stick with Sun's Java code conventions for PHP code? ANSWER: For PHP, i'd suggest to follow Zends suggestions As you might know, Zend is the most widely used framework!
[ "php", "coding-style" ]
29
41
26,423
9
0
2008-09-26T13:13:23.007000
2008-09-26T13:18:31.777000
139,466
139,470
Is PHP international?
Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have said - is it straight forward. Because some languages like Java make it extremely easy. Perhaps localisation in PHP isn't as easy as Java???
Yes on both counts. Read this guide on building Chinese websites in PHP.
Is PHP international? Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have said - is it straight forward. Because some languages like Java make it extremely easy. Perhaps localisation in PHP isn't as easy as Java???
TITLE: Is PHP international? QUESTION: Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have said - is it straight forward. Because some languages like Java make it extremely easy. Perhaps localisation in PHP isn't as easy as Java??? ANSWER: Yes on both counts. Read this guide on build...
[ "php", "localization" ]
1
3
251
3
0
2008-09-26T13:21:25.827000
2008-09-26T13:22:40.003000
139,479
139,506
How universally is C99 supported?
How universally is the C99 standard supported in today's compilers? I understand that not even GCC fully supports it. Is this right? Which features of C99 are supported more than others, i.e. which can I use to be quite sure that most compilers will understand me?
If you want to write portable C code, then I'd suggest you to write in C89 (old ANSI C standard). This standard is supported by most compilers. The Intel C Compiler has very good C99 support and it produces fast binaries. (Thanks 0x69!) MSVC supports some new features and Microsoft plan to broaden support in future ver...
How universally is C99 supported? How universally is the C99 standard supported in today's compilers? I understand that not even GCC fully supports it. Is this right? Which features of C99 are supported more than others, i.e. which can I use to be quite sure that most compilers will understand me?
TITLE: How universally is C99 supported? QUESTION: How universally is the C99 standard supported in today's compilers? I understand that not even GCC fully supports it. Is this right? Which features of C99 are supported more than others, i.e. which can I use to be quite sure that most compilers will understand me? AN...
[ "c", "c99", "standards-compliance" ]
47
29
11,414
7
0
2008-09-26T13:23:19.410000
2008-09-26T13:28:20.457000
139,482
139,549
What are some good methods to hinder screen scrapers from grabbing specific pieces of content off my site?
Pretty sure this question counts as blasphemy to most web 2.0 proponents, but I do think there are times when you could possibly not want pieces of your site being easily ripped off into someone else's arbitrary web aggregator. At least enough so they'd need to be arsed to do it by hand if they really wanted it. My ide...
I've seen a TV guide decrypt using javascript on the client side. It wouldn't stop a determined scraper but would stop most casual scripting. All the textual TV entries are similar ps10825('4VUknMERbnt0OAP3klgpmjs....abd26') where ps10825 is simply a function that calls their decrypt function with a key of ps10825. Obv...
What are some good methods to hinder screen scrapers from grabbing specific pieces of content off my site? Pretty sure this question counts as blasphemy to most web 2.0 proponents, but I do think there are times when you could possibly not want pieces of your site being easily ripped off into someone else's arbitrary w...
TITLE: What are some good methods to hinder screen scrapers from grabbing specific pieces of content off my site? QUESTION: Pretty sure this question counts as blasphemy to most web 2.0 proponents, but I do think there are times when you could possibly not want pieces of your site being easily ripped off into someone ...
[ "screen-scraping" ]
3
3
955
9
0
2008-09-26T13:23:27.567000
2008-09-26T13:37:41.183000
139,483
139,577
Websphere 6.1 - Configuring Security
When i try to configure security through the admin console of Websphere it just hangs. Its at the last step of the below 4 steps Specify extent of protection Select user repository Configure user repository Summary Here are the extracts from my console [26/09/08 13:50:56:539 IST] 0000001f ServletWrappe I SRVE0242I: [is...
It sounds to me like your LDAP server is not responding in a timely manor. The fact that you have a hung thread rather than a network error indicates to me that you are successfully communicating to LDAP. If you are attaching this to the Active Directory backed LDAP, it could be overtaxed. We have used ADAM servers in ...
Websphere 6.1 - Configuring Security When i try to configure security through the admin console of Websphere it just hangs. Its at the last step of the below 4 steps Specify extent of protection Select user repository Configure user repository Summary Here are the extracts from my console [26/09/08 13:50:56:539 IST] 00...
TITLE: Websphere 6.1 - Configuring Security QUESTION: When i try to configure security through the admin console of Websphere it just hangs. Its at the last step of the below 4 steps Specify extent of protection Select user repository Configure user repository Summary Here are the extracts from my console [26/09/08 13...
[ "security", "websphere", "websphere-6.1" ]
0
2
2,980
1
0
2008-09-26T13:23:42.170000
2008-09-26T13:44:09.047000
139,487
139,494
ASP.NET Themes samples/starter kits
I was wondering if there was somewhere I could get some starter kit / theme sample for ASP.NET. I am not a designer, but I need to build a prototype for a project, and if I do it myself it'll certainly be awful Do you know where I could find that (ASP.NET specific)?
Check http://asp.net. There are quite a few starter kits and sample projects there. ( http://www.asp.net/community/projects/ )
ASP.NET Themes samples/starter kits I was wondering if there was somewhere I could get some starter kit / theme sample for ASP.NET. I am not a designer, but I need to build a prototype for a project, and if I do it myself it'll certainly be awful Do you know where I could find that (ASP.NET specific)?
TITLE: ASP.NET Themes samples/starter kits QUESTION: I was wondering if there was somewhere I could get some starter kit / theme sample for ASP.NET. I am not a designer, but I need to build a prototype for a project, and if I do it myself it'll certainly be awful Do you know where I could find that (ASP.NET specific)?...
[ "asp.net", "themes", "sample", "starter-kits" ]
2
2
12,456
5
0
2008-09-26T13:24:40.327000
2008-09-26T13:26:13.240000
139,513
139,625
How to code the partial extensions that Linq to SQL autogenerates?
I made a class from Linq to SQL Clasees with VS 2008 SP1 Framework 3.5 SP1, in this case I extended the partial partial void UpdateMyTable(MyTable instance){ // Business logic // Validation rules, etc. } My problem is when I execute db.SubmitChanges(), it executes UpdateMyTable and makes the validations but it doesn't ...
if you provide this method, you must perform the update in the method. http://msdn.microsoft.com/en-us/library/bb882671.aspx If you implement the Insert, Update and Delete methods in your partial class, the LINQ to SQL runtime will call them instead of its own default methods when SubmitChanges is called. Try MiTabla.O...
How to code the partial extensions that Linq to SQL autogenerates? I made a class from Linq to SQL Clasees with VS 2008 SP1 Framework 3.5 SP1, in this case I extended the partial partial void UpdateMyTable(MyTable instance){ // Business logic // Validation rules, etc. } My problem is when I execute db.SubmitChanges(), ...
TITLE: How to code the partial extensions that Linq to SQL autogenerates? QUESTION: I made a class from Linq to SQL Clasees with VS 2008 SP1 Framework 3.5 SP1, in this case I extended the partial partial void UpdateMyTable(MyTable instance){ // Business logic // Validation rules, etc. } My problem is when I execute db...
[ "linq", "linq-to-sql", "partial-methods" ]
4
3
879
2
0
2008-09-26T13:29:44.620000
2008-09-26T13:53:01.040000
139,521
139,544
User or account or person or what?
Here on Stack Overflow, you're a "user." On 43things.com you're a "person." On other sites, you're an "account." And then some web apps skip the usage of this kind of signifier, and it's just http://webapp.com/yourusername Do you think that these signifiers imply anything at all? Do you prefer one over the other? In bu...
This semantic is contextual. In a community site, you are often a 'member', on a paid service you have an 'account'. 'User' is the generic default. You should choose a moniker that best describes what is the role of the 'user' in your application.
User or account or person or what? Here on Stack Overflow, you're a "user." On 43things.com you're a "person." On other sites, you're an "account." And then some web apps skip the usage of this kind of signifier, and it's just http://webapp.com/yourusername Do you think that these signifiers imply anything at all? Do y...
TITLE: User or account or person or what? QUESTION: Here on Stack Overflow, you're a "user." On 43things.com you're a "person." On other sites, you're an "account." And then some web apps skip the usage of this kind of signifier, and it's just http://webapp.com/yourusername Do you think that these signifiers imply any...
[ "user-management" ]
0
4
597
8
0
2008-09-26T13:31:36.097000
2008-09-26T13:35:46.337000
139,525
192,038
How to programmatically run an Xpand workflow on a model in a second workbench?
I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I set the model file using the absolute path of the IFile I have, e.g. with: String dslFile = file.ge...
I found help at the openArchitectureWare forum. Basically using properties.put("modelFile", file.getLocation().makeAbsolute().toOSString()); works, but you need to specify looking it up via URI in the workflow you are calling:
How to programmatically run an Xpand workflow on a model in a second workbench? I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I set the model file ...
TITLE: How to programmatically run an Xpand workflow on a model in a second workbench? QUESTION: I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I s...
[ "java", "eclipse", "xtext", "xpand", "oaw" ]
1
0
3,884
3
0
2008-09-26T13:32:10.073000
2008-10-10T16:00:24.160000
139,534
141,969
Classloader issues - How to determine which library versions (jar-files) are loaded
I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify (or monitor) whether your application has access to all the appropriate jar-files, or loaded class-versions? Tha...
If you happen to be using JBoss, there is an MBean (the class loader repository iirc) where you can ask for all classloaders that have loaded a certain class. If all else fails, there's always java -verbose:class which will print the location of the jar for every class file that is being loaded.
Classloader issues - How to determine which library versions (jar-files) are loaded I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify (or monitor) whether your ap...
TITLE: Classloader issues - How to determine which library versions (jar-files) are loaded QUESTION: I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify (or monito...
[ "java", "jar", "classloader" ]
27
19
22,794
5
0
2008-09-26T13:34:02.910000
2008-09-26T21:05:08.677000
139,537
139,554
How do I upgrade from Drupal 5 to 6?
I'm running Drupal 5 on my website and want to upgrade to V6. I've not got any obscure or unsupported modules running. What do I do though? I can't seem to find any step-by-step upgrade methods. Do I just have to overwrite all the files and then re-run the installer again?
Drupal: Upgrading from 5.x to 6.x It's a video though. I have no idea what's up with all these video tutorials. Does anybody like them? Can't I get the same information in a quarter the time in text? Is the web now for illiterates only? Edit: There's some text here
How do I upgrade from Drupal 5 to 6? I'm running Drupal 5 on my website and want to upgrade to V6. I've not got any obscure or unsupported modules running. What do I do though? I can't seem to find any step-by-step upgrade methods. Do I just have to overwrite all the files and then re-run the installer again?
TITLE: How do I upgrade from Drupal 5 to 6? QUESTION: I'm running Drupal 5 on my website and want to upgrade to V6. I've not got any obscure or unsupported modules running. What do I do though? I can't seem to find any step-by-step upgrade methods. Do I just have to overwrite all the files and then re-run the installe...
[ "drupal", "drupal-6" ]
1
2
308
1
0
2008-09-26T13:34:24.360000
2008-09-26T13:38:13.913000
139,568
139,838
Creating an online catalogue using Drupal, what are the best modules/techniques?
I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method. It'd be great if I could somehow define a record consisting of certain fie...
Look harder at the CCK module, it's exactly what you want. You can define records and then assign taxonomys and views to make it all work, just need your own creativity. CCK is THE module for doing this kind of stuff. Also, this link maybe helpful for pre-made modules. http://drupal.org/search/node/type%3Aproject_proje...
Creating an online catalogue using Drupal, what are the best modules/techniques? I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured m...
TITLE: Creating an online catalogue using Drupal, what are the best modules/techniques? QUESTION: I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of...
[ "database", "drupal", "module" ]
2
2
4,254
3
0
2008-09-26T13:41:47.120000
2008-09-26T14:22:34.570000
139,578
139,628
How do I programmatically change ASP.NET ajax AccordionPane with javascript?
I've got an asp.net ajax style AccordionPane control that I am trying to get/set based on some user interactions. However it seems not let me do this with javascript: function navPanelMove() { var aPane = $get('ctl00_Accordion1_AccordionExtender_ClientState'); openPaneID = aPane.get_SelectedIndex(); // doesn't work }
You'll need to use $find('behaviorId') You want the AjaxControlToolkit.AccordionBehavior object, not the DOM elements
How do I programmatically change ASP.NET ajax AccordionPane with javascript? I've got an asp.net ajax style AccordionPane control that I am trying to get/set based on some user interactions. However it seems not let me do this with javascript: function navPanelMove() { var aPane = $get('ctl00_Accordion1_AccordionExtend...
TITLE: How do I programmatically change ASP.NET ajax AccordionPane with javascript? QUESTION: I've got an asp.net ajax style AccordionPane control that I am trying to get/set based on some user interactions. However it seems not let me do this with javascript: function navPanelMove() { var aPane = $get('ctl00_Accordio...
[ "asp.net-ajax", "accordionpane" ]
0
2
1,219
1
0
2008-09-26T13:44:23.743000
2008-09-26T13:53:21.677000
139,580
139,827
Balanced Distribution Algorithm
I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My balancing is basically just making sure that each chil...
@zvrba: You do not even have to sort the list. When traversing the list the second time just move all items with less the average workload to the end of the list (you can keep a pointer to the last item at your first traversal). The order does not have to be perfect, it just changes when the iterators have to be augmen...
Balanced Distribution Algorithm I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My balancing is basically...
TITLE: Balanced Distribution Algorithm QUESTION: I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My bala...
[ "algorithm", "big-o", "load-balancing", "cluster-computing" ]
6
4
2,628
4
0
2008-09-26T13:44:38.437000
2008-09-26T14:21:28.367000
139,583
139,928
Wise to run MS Velocity on my development machine?
I've never developed a web application that uses distributed memory. Is it common practice to run a tool such as Microsoft Velocity on my local machine as I develop, should I run Velocity on another server as I develop, or should I just develop as normal (default session & cache) and use Velocity only after I've deploy...
I'm looking at using Velocity on a project as well. What I've done thus far is to write a common caching interface and a simple implementation that utilizes the standard ASP.NET caching system. This way I can program against that interface and later plug in the Velocity caching via a concrete implementation of the inte...
Wise to run MS Velocity on my development machine? I've never developed a web application that uses distributed memory. Is it common practice to run a tool such as Microsoft Velocity on my local machine as I develop, should I run Velocity on another server as I develop, or should I just develop as normal (default sessi...
TITLE: Wise to run MS Velocity on my development machine? QUESTION: I've never developed a web application that uses distributed memory. Is it common practice to run a tool such as Microsoft Velocity on my local machine as I develop, should I run Velocity on another server as I develop, or should I just develop as nor...
[ "asp.net", "session", "memory-management", "distributed" ]
1
3
222
2
0
2008-09-26T13:45:18.017000
2008-09-26T14:38:11.303000
139,592
139,841
What is the best way to clone/deep copy a .NET generic Dictionary<string, T>?
I've got a generic dictionary Dictionary that I would like to essentially make a Clone() of..any suggestions.
Okay, the.NET 2.0 answers: If you don't need to clone the values, you can use the constructor overload to Dictionary which takes an existing IDictionary. (You can specify the comparer as the existing dictionary's comparer, too.) If you do need to clone the values, you can use something like this: public static Dictiona...
What is the best way to clone/deep copy a .NET generic Dictionary<string, T>? I've got a generic dictionary Dictionary that I would like to essentially make a Clone() of..any suggestions.
TITLE: What is the best way to clone/deep copy a .NET generic Dictionary<string, T>? QUESTION: I've got a generic dictionary Dictionary that I would like to essentially make a Clone() of..any suggestions. ANSWER: Okay, the.NET 2.0 answers: If you don't need to clone the values, you can use the constructor overload to...
[ "c#", "generics", "collections", "clone" ]
280
208
278,059
14
0
2008-09-26T13:46:51.240000
2008-09-26T14:22:46.147000
139,607
139,611
What is the difference between myCustomer.GetType() and typeof(Customer) in C#?
I've seen both done in some code I'm maintaining, but don't know the difference. Is there one? let me add that myCustomer is an instance of Customer
The result of both are exactly the same in your case. It will be your custom type that derives from System.Type. The only real difference here is that when you want to obtain the type from an instance of your class, you use GetType. If you don't have an instance, but you know the type name (and just need the actual Sys...
What is the difference between myCustomer.GetType() and typeof(Customer) in C#? I've seen both done in some code I'm maintaining, but don't know the difference. Is there one? let me add that myCustomer is an instance of Customer
TITLE: What is the difference between myCustomer.GetType() and typeof(Customer) in C#? QUESTION: I've seen both done in some code I'm maintaining, but don't know the difference. Is there one? let me add that myCustomer is an instance of Customer ANSWER: The result of both are exactly the same in your case. It will be...
[ "c#", ".net" ]
75
162
33,223
7
0
2008-09-26T13:50:01.310000
2008-09-26T13:50:35.537000
139,622
139,632
Does the CAutoPtr class implement reference counting?
Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.). Does the CAutoPtr class implement reference counting?
Having checked the CAutoPtr source, no, reference counting is not supported. Using boost::shared_ptr instead if this ability is required.
Does the CAutoPtr class implement reference counting? Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.). Does the CAutoPtr class implement reference counting?
TITLE: Does the CAutoPtr class implement reference counting? QUESTION: Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.). Does the CAutoPtr class implement reference counting? ANSWER: Having checked the CAutoPtr sou...
[ "c++", "memory-management", "cautoptr" ]
1
4
593
2
0
2008-09-26T13:52:53.830000
2008-09-26T13:53:38.900000
139,623
139,660
Delayed jump to a new web page
How do I cause the page to make the user jump to a new web page after X seconds. If possible I'd like to use HTML but a niggly feeling tells me it'll have to be Javascript. So far I have the following but it has no time delay
A meta refresh is ugly but will work. The following will go to the new url after 5 seconds: http://en.wikipedia.org/wiki/Meta_refresh
Delayed jump to a new web page How do I cause the page to make the user jump to a new web page after X seconds. If possible I'd like to use HTML but a niggly feeling tells me it'll have to be Javascript. So far I have the following but it has no time delay
TITLE: Delayed jump to a new web page QUESTION: How do I cause the page to make the user jump to a new web page after X seconds. If possible I'd like to use HTML but a niggly feeling tells me it'll have to be Javascript. So far I have the following but it has no time delay ANSWER: A meta refresh is ugly but will work...
[ "javascript", "html" ]
2
15
1,341
6
0
2008-09-26T13:52:57.700000
2008-09-26T13:58:20.167000
139,630
139,633
What's the difference between TRUNCATE and DELETE in SQL
What's the difference between TRUNCATE and DELETE in SQL? If your answer is platform specific, please indicate that.
Here's a list of differences. I've highlighted Oracle-specific features, and hopefully the community can add in other vendors' specific difference also. Differences that are common to most vendors can go directly below the headings, with differences highlighted below. General Overview If you want to quickly delete all ...
What's the difference between TRUNCATE and DELETE in SQL What's the difference between TRUNCATE and DELETE in SQL? If your answer is platform specific, please indicate that.
TITLE: What's the difference between TRUNCATE and DELETE in SQL QUESTION: What's the difference between TRUNCATE and DELETE in SQL? If your answer is platform specific, please indicate that. ANSWER: Here's a list of differences. I've highlighted Oracle-specific features, and hopefully the community can add in other v...
[ "sql", "database", "truncate" ]
390
314
592,760
33
0
2008-09-26T13:53:31.070000
2008-09-26T13:53:40.490000
139,639
140,407
.NET Architectural issue: 2 Web Services, how do I change which one is used at run time?
I am working with Reporting Services and Sharepoint, I have an application that leverages reporting services however a client would like our application integrated into sharepoint. Currently we are tightly coupled to the ReportService.asmx webservice which exposes various methods for performing operations. Reporting Se...
The most robust solution is to create a CatalogItem interface and create wrappers for each of your web services and hide the whole thing behind a factory. The factory will contain the logic for calling the "correct" web service and the client code will have to be changed to use the interface but it is a change for the ...
.NET Architectural issue: 2 Web Services, how do I change which one is used at run time? I am working with Reporting Services and Sharepoint, I have an application that leverages reporting services however a client would like our application integrated into sharepoint. Currently we are tightly coupled to the ReportServ...
TITLE: .NET Architectural issue: 2 Web Services, how do I change which one is used at run time? QUESTION: I am working with Reporting Services and Sharepoint, I have an application that leverages reporting services however a client would like our application integrated into sharepoint. Currently we are tightly coupled...
[ "c#", ".net", "sharepoint", "architecture", "reporting-services" ]
1
1
674
5
0
2008-09-26T13:55:18.367000
2008-09-26T16:03:49.837000
139,650
139,671
When writing XML, is it better to hand write it, or to use a generator such as simpleXML in PHP?
I have normally hand written xml like this: Having found tools such as simpleXML, should I be using those instead? What's the advantage of doing it using a tool like that?
Good XML tools will ensure that the resulting XML file properly validates against the DTD you are using. Good XML tools also save a bunch of repetitive typing of tags.
When writing XML, is it better to hand write it, or to use a generator such as simpleXML in PHP? I have normally hand written xml like this: Having found tools such as simpleXML, should I be using those instead? What's the advantage of doing it using a tool like that?
TITLE: When writing XML, is it better to hand write it, or to use a generator such as simpleXML in PHP? QUESTION: I have normally hand written xml like this: Having found tools such as simpleXML, should I be using those instead? What's the advantage of doing it using a tool like that? ANSWER: Good XML tools will ensu...
[ "php", "xml", "language-agnostic" ]
5
10
2,623
10
0
2008-09-26T13:57:03.540000
2008-09-26T13:59:15.593000
139,655
139,712
Convert Pixels to Points
I have a need to convert Pixels to Points in C#. I've seen some complicated explanations about the topic, but can't seem to locate a simple formula. Let's assume a standard 96dpi, how do I calulate this conversion?
There are 72 points per inch; if it is sufficient to assume 96 pixels per inch, the formula is rather simple: points = pixels * 72 / 96 There is a way to get the configured pixels per inch of your display in Windows using GetDeviceCaps. Microsoft has a guide called "Developing DPI-Aware Applications", look for the sect...
Convert Pixels to Points I have a need to convert Pixels to Points in C#. I've seen some complicated explanations about the topic, but can't seem to locate a simple formula. Let's assume a standard 96dpi, how do I calulate this conversion?
TITLE: Convert Pixels to Points QUESTION: I have a need to convert Pixels to Points in C#. I've seen some complicated explanations about the topic, but can't seem to locate a simple formula. Let's assume a standard 96dpi, how do I calulate this conversion? ANSWER: There are 72 points per inch; if it is sufficient to ...
[ "c#", ".net", "pixel", "point" ]
137
222
230,802
12
0
2008-09-26T13:57:28.360000
2008-09-26T14:04:53.193000
139,665
139,779
How to deal with .NET TabPage controls all ending up in one Form class?
I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or suggest alternatives: 1) Write a UserControl for each TabPage 2) Leave only the Control on the...
In any complex WinForms application, you will probably run into the problem of too many controls on a form. Not that you'll run into a hard limit, but rather you'll run into a pain point -- such as you're describing. In most scenarios, for me, your option #1 -- a user control for each tab page -- is the least painful a...
How to deal with .NET TabPage controls all ending up in one Form class? I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or suggest alternatives: ...
TITLE: How to deal with .NET TabPage controls all ending up in one Form class? QUESTION: I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or sugg...
[ ".net", "visual-studio", "winforms" ]
3
3
1,660
2
0
2008-09-26T13:58:44.567000
2008-09-26T14:14:40.067000
139,668
140,387
Why would the Win32 OleGetClipboard() function return CLIPBRD_E_CANT_OPEN?
Under what circumstances will the Win32 API function OleGetClipboard() fail and return CLIPBRD_E_CANT_OPEN? More background: I am assisting with a Firefox bug fix. Details here: bug 444800 - cannot retrieve image data from clipboard in lossless format In the automated test that I helped write, we see that OleGetClipboa...
The documentation says that OleGetClipboard can fail with this error code if OpenClipboard fails. In turn, if you read that documentation, it says: " OpenClipboard fails if another window has the clipboard open." It's an exclusive resource: only one window can have the clipboard open at a time. Basically, if you can't ...
Why would the Win32 OleGetClipboard() function return CLIPBRD_E_CANT_OPEN? Under what circumstances will the Win32 API function OleGetClipboard() fail and return CLIPBRD_E_CANT_OPEN? More background: I am assisting with a Firefox bug fix. Details here: bug 444800 - cannot retrieve image data from clipboard in lossless ...
TITLE: Why would the Win32 OleGetClipboard() function return CLIPBRD_E_CANT_OPEN? QUESTION: Under what circumstances will the Win32 API function OleGetClipboard() fail and return CLIPBRD_E_CANT_OPEN? More background: I am assisting with a Firefox bug fix. Details here: bug 444800 - cannot retrieve image data from clip...
[ "c++", "windows", "winapi", "ole" ]
3
5
2,691
3
0
2008-09-26T13:58:57.577000
2008-09-26T15:56:38.510000
139,683
681,095
tool for reading glassfish logs?
I'm dealing with huge glassfish log files (in windows, eek!) and well... Wordpad isn't cutting it. Are there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome: View all lines of a certain log level (info, warning, severe) Show logs between two timestam...
http://sourceforge.net/project/screenshots.php?group_id=212019
tool for reading glassfish logs? I'm dealing with huge glassfish log files (in windows, eek!) and well... Wordpad isn't cutting it. Are there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome: View all lines of a certain log level (info, warning, sever...
TITLE: tool for reading glassfish logs? QUESTION: I'm dealing with huge glassfish log files (in windows, eek!) and well... Wordpad isn't cutting it. Are there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome: View all lines of a certain log level (in...
[ "logging", "glassfish" ]
6
1
5,523
5
0
2008-09-26T14:01:19.303000
2009-03-25T11:02:49.703000
139,700
139,839
Does the latest release May 2008 of .NET enterprise library have the updater app block?
Does the latest version of the enterprise library ( http://msdn.microsoft.com/en-us/library/cc512464.aspx ) come with the updater application block?
Looks like it doesn't: http://msdn.microsoft.com/en-us/library/cc511823.aspx It's now in the 'Archived Application Blocks' section of the MSDN docs. http://msdn.microsoft.com/en-us/library/cc485231.aspx
Does the latest release May 2008 of .NET enterprise library have the updater app block? Does the latest version of the enterprise library ( http://msdn.microsoft.com/en-us/library/cc512464.aspx ) come with the updater application block?
TITLE: Does the latest release May 2008 of .NET enterprise library have the updater app block? QUESTION: Does the latest version of the enterprise library ( http://msdn.microsoft.com/en-us/library/cc512464.aspx ) come with the updater application block? ANSWER: Looks like it doesn't: http://msdn.microsoft.com/en-us/l...
[ "enterprise-library" ]
0
1
280
2
0
2008-09-26T14:03:37.567000
2008-09-26T14:22:37.067000
139,705
673,642
Indirect Typelib not imported well from Debug dll
Using VC2005, I have 3 projects to build: libA (contains a typelib, results in libA.dll): IDL has a line library libA {... libB (contains a typelib importing libA, results in libB.dll): IDL has a line importlib( "libA " ); libC (imports libB): one of the source files contains #import the #import is handled by the compi...
Finally Found It! In the Visual Studio project, the A.idl file in LibA had the MkTypeLib Compatible setting ON. This overruled the behaviour inherited from the A project. To make things worse, it was only ON in the Debug configuration. The consequence was that for every typedef [public] tagE enum { cE1, cE2 } eE; This ...
Indirect Typelib not imported well from Debug dll Using VC2005, I have 3 projects to build: libA (contains a typelib, results in libA.dll): IDL has a line library libA {... libB (contains a typelib importing libA, results in libB.dll): IDL has a line importlib( "libA " ); libC (imports libB): one of the source files co...
TITLE: Indirect Typelib not imported well from Debug dll QUESTION: Using VC2005, I have 3 projects to build: libA (contains a typelib, results in libA.dll): IDL has a line library libA {... libB (contains a typelib importing libA, results in libB.dll): IDL has a line importlib( "libA " ); libC (imports libB): one of t...
[ "c++", "visual-c++", "import", "typelib" ]
2
1
1,105
4
0
2008-09-26T14:03:54.553000
2009-03-23T14:44:40.637000
139,721
139,939
PHP parse_ini_file() - where does it look?
if I call php's parse_ini_file("foo.ini"), in what paths does it look for foo.ini? the include path? the function's documentation doesn't mention it.
The filename argument for parse_ini_file is a standard php filename, so the same rules will apply as opening a file using fopen. You must either specify an absolute file path ("/path/to/my.ini") or a path relative to your current working directory ("my.ini"). See getcwd for your current working directory. Unlike the de...
PHP parse_ini_file() - where does it look? if I call php's parse_ini_file("foo.ini"), in what paths does it look for foo.ini? the include path? the function's documentation doesn't mention it.
TITLE: PHP parse_ini_file() - where does it look? QUESTION: if I call php's parse_ini_file("foo.ini"), in what paths does it look for foo.ini? the include path? the function's documentation doesn't mention it. ANSWER: The filename argument for parse_ini_file is a standard php filename, so the same rules will apply as...
[ "php", "file", "parsing", "path", "ini" ]
3
6
3,727
4
0
2008-09-26T14:06:35.187000
2008-09-26T14:40:19.803000
139,723
139,846
Which Javascript Framework is the simplest and most powerful?
I've been using various javascript frameworks including mootools, jquery, prototype and scriptaculous and have found them all good, but difficult to extend to more complex ideas. If I am going to knuckle down and learn one, which is the simplest to extend and use whilst staying powerful enough to use in a variety of di...
I propose jQuery. I'll give you some of the major arguments from the presentation that my team put on yesterday for senior management to convince them of that. Reasons: Community acceptance. Look at this graph. It shows searches for "prototype", "yui" and "scriptaculous" growing from 2004 to 2008. Then out of nowhere i...
Which Javascript Framework is the simplest and most powerful? I've been using various javascript frameworks including mootools, jquery, prototype and scriptaculous and have found them all good, but difficult to extend to more complex ideas. If I am going to knuckle down and learn one, which is the simplest to extend an...
TITLE: Which Javascript Framework is the simplest and most powerful? QUESTION: I've been using various javascript frameworks including mootools, jquery, prototype and scriptaculous and have found them all good, but difficult to extend to more complex ideas. If I am going to knuckle down and learn one, which is the sim...
[ "javascript", "frameworks" ]
2
21
2,379
7
0
2008-09-26T14:06:57.120000
2008-09-26T14:23:36.910000
139,759
139,871
CVS: List all files changed between tags (or dates)
Is there any way to list all the files that have changed between two tags in CVS? Every time we do a release we apply a tag to all the files in that release. I want to find all the files that changed between releases. It would also work if I could find all files that had changed between two dates.
I suppose this command would help: cvs diff -N -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs where RELEASE_1_0 and RELEASE_1_1 are the names of your tags. You can find a little more information on cvs diff command here plus it should be fairly simple to create a script to make report more suitbable for your needs, ex: numbe...
CVS: List all files changed between tags (or dates) Is there any way to list all the files that have changed between two tags in CVS? Every time we do a release we apply a tag to all the files in that release. I want to find all the files that changed between releases. It would also work if I could find all files that ...
TITLE: CVS: List all files changed between tags (or dates) QUESTION: Is there any way to list all the files that have changed between two tags in CVS? Every time we do a release we apply a tag to all the files in that release. I want to find all the files that changed between releases. It would also work if I could fi...
[ "cvs" ]
57
35
84,926
7
0
2008-09-26T14:11:44.003000
2008-09-26T14:27:06.853000
139,760
139,792
Are there alternatives to CGI (and do I really need one)?
I am designing an application that is going to consist of 3-4 services that run as separate processes and are linked by a suitable IPC. The system is going to have a web interface and I want to use whatever webserver is there. The web interface should be accessed under some URL that allows to have other URLs on the sam...
OK, I overlooked this previously. Explaining my question here brought me onto it: Instead of creating a new process for every request, FastCGI can use a single persistent process which handles many requests over its lifetime. -- Wikipedia: FastCGI
Are there alternatives to CGI (and do I really need one)? I am designing an application that is going to consist of 3-4 services that run as separate processes and are linked by a suitable IPC. The system is going to have a web interface and I want to use whatever webserver is there. The web interface should be accesse...
TITLE: Are there alternatives to CGI (and do I really need one)? QUESTION: I am designing an application that is going to consist of 3-4 services that run as separate processes and are linked by a suitable IPC. The system is going to have a web interface and I want to use whatever webserver is there. The web interface...
[ "cgi", "ipc" ]
3
5
5,316
2
0
2008-09-26T14:11:46.110000
2008-09-26T14:16:50.357000
139,794
139,874
Can I get the path of the PHP file originally called within an included file?
Let's say we have index.php and it is stored in /home/user/public/www and index.php calls the class Foo->bar() from the file inc/app/Foo.class.php. I'd like the bar function in the Foo class to get a hold of the path /home/user/public/www in this instance — I don't want to use a global variable, pass a variable, etc.
Wouldn't this get you the directory of the running script more easily? $dir=dirname($_SERVER["SCRIPT_FILENAME"])
Can I get the path of the PHP file originally called within an included file? Let's say we have index.php and it is stored in /home/user/public/www and index.php calls the class Foo->bar() from the file inc/app/Foo.class.php. I'd like the bar function in the Foo class to get a hold of the path /home/user/public/www in ...
TITLE: Can I get the path of the PHP file originally called within an included file? QUESTION: Let's say we have index.php and it is stored in /home/user/public/www and index.php calls the class Foo->bar() from the file inc/app/Foo.class.php. I'd like the bar function in the Foo class to get a hold of the path /home/u...
[ "php", "path" ]
3
12
15,355
4
0
2008-09-26T14:16:52.527000
2008-09-26T14:27:36.510000
139,809
139,886
Sending messages to WCF host process
I have a Console application hosting a WCF service. I would like to be able to fire an event from a method in the WCF service and handle the event in the hosting process of the WCF service. Is this possible? How would I do this? Could I derive a custom class from ServiceHost?
You don't need to inherit from ServiceHost. There are other approaches to your problem. You can pass an instance of the service class, instead of a type to ServiceHost. Thus, you can create the instance before you start the ServiceHost, and add your own event handlers to any events it exposes. Here's some sample code: ...
Sending messages to WCF host process I have a Console application hosting a WCF service. I would like to be able to fire an event from a method in the WCF service and handle the event in the hosting process of the WCF service. Is this possible? How would I do this? Could I derive a custom class from ServiceHost?
TITLE: Sending messages to WCF host process QUESTION: I have a Console application hosting a WCF service. I would like to be able to fire an event from a method in the WCF service and handle the event in the hosting process of the WCF service. Is this possible? How would I do this? Could I derive a custom class from S...
[ "c#", "wcf" ]
17
15
8,845
2
0
2008-09-26T14:18:36.873000
2008-09-26T14:30:05.380000
139,811
139,842
Algorithm to score similarness of sets of numbers
What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"? One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a day that had similar weather. The similarity of two sets is a bit su...
I think the mean square error metric might work for applications such as weather compares. It's easy to calculate and gives numbers that do make sense. Since your want to compare measurements over time you can just leave out missing values from the calculation. For values that are not time-bound or even unsorted, multi...
Algorithm to score similarness of sets of numbers What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"? One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a day that had simil...
TITLE: Algorithm to score similarness of sets of numbers QUESTION: What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"? One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a ...
[ "algorithm", "statistics" ]
4
4
1,783
11
0
2008-09-26T14:18:50.243000
2008-09-26T14:22:51.543000
139,819
139,899
Why results of map() and list comprehension are different?
The following test fails: #!/usr/bin/env python def f(*args): """ >>> t = 1, -1 >>> f(*map(lambda i: lambda: i, t)) [1, -1] >>> f(*(lambda: i for i in t)) # -> [-1, -1] [1, -1] >>> f(*[lambda: i for i in t]) # -> [-1, -1] [1, -1] """ alist = [a() for a in args] print(alist) if __name__ == '__main__': import doctest; d...
They are different, because the value of i in both the generator expression and the list comp are evaluated lazily, i.e. when the anonymous functions are invoked in f. By that time, i is bound to the last value if t, which is -1. So basically, this is what the list comprehension does (likewise for the genexp): x = [] i...
Why results of map() and list comprehension are different? The following test fails: #!/usr/bin/env python def f(*args): """ >>> t = 1, -1 >>> f(*map(lambda i: lambda: i, t)) [1, -1] >>> f(*(lambda: i for i in t)) # -> [-1, -1] [1, -1] >>> f(*[lambda: i for i in t]) # -> [-1, -1] [1, -1] """ alist = [a() for a in args]...
TITLE: Why results of map() and list comprehension are different? QUESTION: The following test fails: #!/usr/bin/env python def f(*args): """ >>> t = 1, -1 >>> f(*map(lambda i: lambda: i, t)) [1, -1] >>> f(*(lambda: i for i in t)) # -> [-1, -1] [1, -1] >>> f(*[lambda: i for i in t]) # -> [-1, -1] [1, -1] """ alist = [...
[ "python", "closures", "list-comprehension", "late-binding", "generator-expression" ]
12
9
2,714
3
0
2008-09-26T14:19:48.963000
2008-09-26T14:31:47.577000
139,821
140,017
Bare Minimum Configuration for RESTful WCF
What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.
I discovered that you can add the following to the ServiceHost directive in the *.svc file, and it will automatically setup WebHttpBinding and WebHttpBehavior for you: Factory="System.ServiceModel.Activation.WebServiceHostFactory" Note that the namespace is a little different from what is mentioned elsewhere on the web...
Bare Minimum Configuration for RESTful WCF What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.
TITLE: Bare Minimum Configuration for RESTful WCF QUESTION: What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message. ANSWER: I discovered that you can add the following to the ServiceHost directive in the *.svc ...
[ ".net", "asp.net", "wcf", "rest", "web-config" ]
6
6
3,771
3
0
2008-09-26T14:20:04.857000
2008-09-26T14:54:16.273000
139,826
140,352
Track Data Execution Prevention (DEP)
When running one of our software, a tester was faced with the data execution prevention dialog of Windows. We try to reproduce this situation on a developer computer for debugging purposes: with no success. Does anyone know how to find what may cause the DEP protection to kill the application? Is there any existing too...
The DEP dialog will typically only show when you try to execute code from a region that you're not marking as executable. This might be caused by 'thunks' in a library you're using, e.g. ATL windowing. This problem is fixed in ATL 8.0. A stack-trashing bug - for example, a buffer overrun - can also cause this problem, ...
Track Data Execution Prevention (DEP) When running one of our software, a tester was faced with the data execution prevention dialog of Windows. We try to reproduce this situation on a developer computer for debugging purposes: with no success. Does anyone know how to find what may cause the DEP protection to kill the ...
TITLE: Track Data Execution Prevention (DEP) QUESTION: When running one of our software, a tester was faced with the data execution prevention dialog of Windows. We try to reproduce this situation on a developer computer for debugging purposes: with no success. Does anyone know how to find what may cause the DEP prote...
[ "c++", "dep" ]
2
4
3,197
3
0
2008-09-26T14:21:12.827000
2008-09-26T15:48:16.800000
139,835
159,897
How can I open a window's system menu by code?
I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does not show the window's system menu, nor does it show up when right...
A borderless window, if I am not mistaken, is flagged such that it offers no system menu, and that it does not appear in the taskbar. The fact that any given window does not have a border and does not appear in the taskbar is the result of the style flags set on the window. These particular Style flags can be set using...
How can I open a window's system menu by code? I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does not show the windo...
TITLE: How can I open a window's system menu by code? QUESTION: I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does ...
[ "winforms", "winapi" ]
4
5
3,085
3
0
2008-09-26T14:22:26.240000
2008-10-01T21:46:36.647000
139,837
139,869
Is there a practical example of how they have used attributes on method parameters in .NET?
I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage? I'm not interested in seeing a text...
You can for example create a ValidatorAttribute for every parameter, then before calling the method, you can reflect the parameter attributes and do parameter validation. Then call the method if all ok.
Is there a practical example of how they have used attributes on method parameters in .NET? I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? I use attributes at the class and method level all the time, but have never used them on method parameters. What are ...
TITLE: Is there a practical example of how they have used attributes on method parameters in .NET? QUESTION: I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? I use attributes at the class and method level all the time, but have never used them on method par...
[ "c#", ".net" ]
8
10
1,075
6
0
2008-09-26T14:22:28.440000
2008-09-26T14:26:38.120000
139,843
139,905
Cursor verus while loop - what are the advantages/disadvantages of cursors?
Is it a good idea to use while loop instead of a cursor? What are the advantages/disadvantages of cursors?
Some of these depends on the DBMS, but generally: Pros: Outperform loops when it comes to row-by-row processing Works reasonably well with large datasets Cons: Don't scale as well Use more server resources Increases load on tempdb Can cause leaks if used incorrectly (eg. Open without corresponding Close)
Cursor verus while loop - what are the advantages/disadvantages of cursors? Is it a good idea to use while loop instead of a cursor? What are the advantages/disadvantages of cursors?
TITLE: Cursor verus while loop - what are the advantages/disadvantages of cursors? QUESTION: Is it a good idea to use while loop instead of a cursor? What are the advantages/disadvantages of cursors? ANSWER: Some of these depends on the DBMS, but generally: Pros: Outperform loops when it comes to row-by-row processin...
[ "sql-server", "t-sql", "while-loop", "database-cursor" ]
20
9
26,982
3
0
2008-09-26T14:23:07.487000
2008-09-26T14:32:47.480000
139,844
147,553
Can Delphi 2009 be installed on the same machine as Delphi 2006 or Delphi 2007?
Is there any conflict?
All new versions of Delphi can always be installed safely /next/ to older version. Each new version should be installed in its own directory. If you are going to install multiple versions, always install the oldest version first, and then work your way to the newest. We work very hard to make sure that all versions of ...
Can Delphi 2009 be installed on the same machine as Delphi 2006 or Delphi 2007? Is there any conflict?
TITLE: Can Delphi 2009 be installed on the same machine as Delphi 2006 or Delphi 2007? QUESTION: Is there any conflict? ANSWER: All new versions of Delphi can always be installed safely /next/ to older version. Each new version should be installed in its own directory. If you are going to install multiple versions, a...
[ "delphi", "installation" ]
11
22
2,684
18
0
2008-09-26T14:23:30.403000
2008-09-29T04:52:26.057000
139,852
248,872
WCF customheader or messagebody for context?
I'm witting a WCF service for a customer to send part information to our application. We have multiple customers that will have one or many locations, and part information is scoped to each location for the customer. When the customer calls our service they will need to specify the location. Options that we have consid...
I would say if it's only one or two operations that need it, make it part of the data contract - sort of like making it a parameter to a method call. If every operation requires it, put it in the header, since it's just as much context as username, roles, tenant, or other authentication information - sort of like somet...
WCF customheader or messagebody for context? I'm witting a WCF service for a customer to send part information to our application. We have multiple customers that will have one or many locations, and part information is scoped to each location for the customer. When the customer calls our service they will need to spec...
TITLE: WCF customheader or messagebody for context? QUESTION: I'm witting a WCF service for a customer to send part information to our application. We have multiple customers that will have one or many locations, and part information is scoped to each location for the customer. When the customer calls our service they...
[ "c#", "wcf" ]
0
1
479
3
0
2008-09-26T14:25:03.397000
2008-10-30T00:03:32.687000
139,859
140,001
Setting the thread /proc/PID/cmdline?
On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my process? That would be very helpful for debugging.
If you want to do this in a portable way, something that will work across multiple Unix variations, there are very few options available. What you have to do is that your caller process must call exec with the argv [0] argument pointing to the name that you would like to see in the process output, and the filename poin...
Setting the thread /proc/PID/cmdline? On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my process? That would be very helpfu...
TITLE: Setting the thread /proc/PID/cmdline? QUESTION: On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my process? That wo...
[ "linux", "multithreading", "debugging", "cmd", "nptl" ]
5
6
4,398
3
0
2008-09-26T14:25:37.700000
2008-09-26T14:51:36.983000
139,884
139,943
How do I disable referential integrity in Postgres 8.2?
Google results on this one are a bit thin, but suggest that it is not easily possible. My specific problem is that I need to renumber the IDs in two tables that are related to each other such that table B has an "table_a_id" column in it. I can't renumber table A first because then its children in B point to the old ID...
It does not seem possible. Other suggestions almost always refer to dropping the constraints and recreating them after work is done. However, it seems you can make constraints DEFERRABLE, such that they are not checked until the end of a transaction. See PostgreSQL documentation for CREATE TABLE (search for 'deferrable...
How do I disable referential integrity in Postgres 8.2? Google results on this one are a bit thin, but suggest that it is not easily possible. My specific problem is that I need to renumber the IDs in two tables that are related to each other such that table B has an "table_a_id" column in it. I can't renumber table A ...
TITLE: How do I disable referential integrity in Postgres 8.2? QUESTION: Google results on this one are a bit thin, but suggest that it is not easily possible. My specific problem is that I need to renumber the IDs in two tables that are related to each other such that table B has an "table_a_id" column in it. I can't...
[ "postgresql", "referential-integrity" ]
36
18
45,828
7
0
2008-09-26T14:29:06.397000
2008-09-26T14:41:22.950000
139,889
139,911
Multiple domains for one site: alias or redirect?
I'm setting up a number sites right now and many of them have multiple domains. The question is: do I alias the domain (with ServerAlias ) or do I Redirect the request? Obviously ServerAlias is better/easier from a readability or scripting perspective. I have heard however that Google likes it better if everything redi...
Redirecting is better, then there is always one, canonical domain for your content. I hear Google penalises multiple domains hosting the same content, but I can't find a source for that at the moment (edit, here's one article, but from 2005, which is ancient history in Internet years!) (not correct, see edit below) Her...
Multiple domains for one site: alias or redirect? I'm setting up a number sites right now and many of them have multiple domains. The question is: do I alias the domain (with ServerAlias ) or do I Redirect the request? Obviously ServerAlias is better/easier from a readability or scripting perspective. I have heard howe...
TITLE: Multiple domains for one site: alias or redirect? QUESTION: I'm setting up a number sites right now and many of them have multiple domains. The question is: do I alias the domain (with ServerAlias ) or do I Redirect the request? Obviously ServerAlias is better/easier from a readability or scripting perspective....
[ "apache", "seo", "multiple-domains" ]
21
23
31,077
6
0
2008-09-26T14:30:23.197000
2008-09-26T14:34:41.407000
139,891
139,942
What's the foolproof way to tell which version(s) of .NET are installed on a production Windows Server?
This question is not so much programming related as it is deployment related. I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code on them. For legal and compliance reasons, I do not have direct visibility or any control over the serv...
You should open up IE on the server for which you are looking for this info, and go to this site: http://www.hanselman.com/smallestdotnet/ That's all it takes. The site has a script that looks your browser's "UserAgent" and figures out what version (if any) of the.NET Framework you have (or don't have) installed, and d...
What's the foolproof way to tell which version(s) of .NET are installed on a production Windows Server? This question is not so much programming related as it is deployment related. I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code...
TITLE: What's the foolproof way to tell which version(s) of .NET are installed on a production Windows Server? QUESTION: This question is not so much programming related as it is deployment related. I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers a...
[ ".net", "windows", "deployment" ]
98
54
114,378
19
0
2008-09-26T14:30:40.840000
2008-09-26T14:41:16.897000
139,909
139,917
Java Multicast Time To Live is always 0
I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0
Basically you have to set an special system property telling the JVM to use an IPv4 stack: -Djava.net.preferIPv4Stack=true
Java Multicast Time To Live is always 0 I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0
TITLE: Java Multicast Time To Live is always 0 QUESTION: I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0 ANSWER: Basically you hav...
[ "java", "oracle", "sockets", "multicast", "ttl" ]
8
6
4,279
2
0
2008-09-26T14:34:20.190000
2008-09-26T14:35:33.010000
139,921
140,058
How to submit form with data before logging someone out?
I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've typed. When I try this the page reloads (the action is #) but any new text...
I guess I put the answer here. What I found was that doing this: setTimeout('frm.submit();', 2000); caused the page to reload but didn't submit the form. When I did this: frm.submit(); The form was submitted and the data was passed. I don't know why the first way didn't work, but I don't need to know that:)
How to submit form with data before logging someone out? I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've typed. When I try...
TITLE: How to submit form with data before logging someone out? QUESTION: I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've...
[ "javascript", "forms", "submit" ]
0
1
352
4
0
2008-09-26T14:36:49.747000
2008-09-26T15:01:43.387000