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
136,837
136,874
How do I make sure a user is only logged in once?
A few years ago I developed a web app for which we wanted to make sure the users weren't sharing credentials. One of the things we decided to to, was only allow the user to be logged in from one computer at a time. The way I did this, was to have a little iframe ping the server every N seconds; as long as the server ha...
I've implemented this by maintaining a hashtable of currently logged in users, the key was the username, the value was their last activity time. When logging in, you just check this hashtable for the key, and if it exists, reject the login. When the user does anything, you update the hashtable with the time (This is ea...
How do I make sure a user is only logged in once? A few years ago I developed a web app for which we wanted to make sure the users weren't sharing credentials. One of the things we decided to to, was only allow the user to be logged in from one computer at a time. The way I did this, was to have a little iframe ping th...
TITLE: How do I make sure a user is only logged in once? QUESTION: A few years ago I developed a web app for which we wanted to make sure the users weren't sharing credentials. One of the things we decided to to, was only allow the user to be logged in from one computer at a time. The way I did this, was to have a lit...
[ "security" ]
9
12
1,963
7
0
2008-09-25T23:22:52.980000
2008-09-25T23:31:09.153000
136,856
138,685
Are you using BizTalk? If so, how are you using it?
At my last place of employment, I used BTS quite a bit. However, I've noticed that managers often want to use it for the wrong things, and developers are hesitant to adopt it. So, I'm just wondering, how's BTS being used? Please post experiences, not theories. Thanks!
I've worked as a consultant for one the largest oil/energy companies in Europe and they basically use BizTalk for all their messaging/integration stuff. Examples are: Invoices (electronic invoices) sent from and to partners in different formats, sync jobs between AD and third party software that maintains it's own user...
Are you using BizTalk? If so, how are you using it? At my last place of employment, I used BTS quite a bit. However, I've noticed that managers often want to use it for the wrong things, and developers are hesitant to adopt it. So, I'm just wondering, how's BTS being used? Please post experiences, not theories. Thanks!
TITLE: Are you using BizTalk? If so, how are you using it? QUESTION: At my last place of employment, I used BTS quite a bit. However, I've noticed that managers often want to use it for the wrong things, and developers are hesitant to adopt it. So, I'm just wondering, how's BTS being used? Please post experiences, not...
[ ".net", "biztalk" ]
15
3
1,181
9
0
2008-09-25T23:26:29.243000
2008-09-26T10:47:50.183000
136,880
136,917
Sell me const-correctness
So why exactly is it that it's always recommended to use const as often as possible? It seems to me that using const can be more of a pain than a help in C++. But then again, I'm coming at this from the python perspective: if you don't want something to be changed, don't change it. So with that said, here are a few que...
This is the definitive article on "const correctness": https://isocpp.org/wiki/faq/const-correctness. In a nutshell, using const is good practice because... It protects you from accidentally changing variables that aren't intended be changed, It protects you from making accidental variable assignments. For instance, yo...
Sell me const-correctness So why exactly is it that it's always recommended to use const as often as possible? It seems to me that using const can be more of a pain than a help in C++. But then again, I'm coming at this from the python perspective: if you don't want something to be changed, don't change it. So with tha...
TITLE: Sell me const-correctness QUESTION: So why exactly is it that it's always recommended to use const as often as possible? It seems to me that using const can be more of a pain than a help in C++. But then again, I'm coming at this from the python perspective: if you don't want something to be changed, don't chan...
[ "c++", "const-correctness" ]
164
188
36,201
16
0
2008-09-25T23:34:21.270000
2008-09-25T23:40:30.943000
136,884
136,921
How do I simultaneously (1) keep a <div> from taking up all available width and (2) make it collapse margins with its neighbors?
Is it possible to have a simultaneously (1) not take up all available width and (2) collapse margins with its neighbors? I learned recently that setting a div to display:table will stop it from expanding to take up the whole width of the parent container -- but now I realize that this introduces a new problem: it stops...
You could wrap the display: table div with another div and put the margin on the wrapper div instead. Nasty, but it works. This is a paragraph with 100px margin all around. This is a div which had 100px margin all around and display:table, but the margin was moved to a wrapper div. The problem was that it didn't collap...
How do I simultaneously (1) keep a <div> from taking up all available width and (2) make it collapse margins with its neighbors? Is it possible to have a simultaneously (1) not take up all available width and (2) collapse margins with its neighbors? I learned recently that setting a div to display:table will stop it fr...
TITLE: How do I simultaneously (1) keep a <div> from taking up all available width and (2) make it collapse margins with its neighbors? QUESTION: Is it possible to have a simultaneously (1) not take up all available width and (2) collapse margins with its neighbors? I learned recently that setting a div to display:tab...
[ "html", "css" ]
0
1
494
2
0
2008-09-25T23:35:10.657000
2008-09-25T23:41:10.440000
136,899
138,110
Suppress error with @ operator in PHP
In your opinion, is it ever valid to use the @ operator to suppress an error/warning in PHP whereas you may be handling the error? If so, in what circumstances would you use this? Code examples are welcome. Edit: Note to repliers. I'm not looking to turn error reporting off, but, for example, common practice is to use ...
I would suppress the error and handle it. Otherwise you may have a TOCTOU issue (Time-of-check, time-of-use. For example a file may get deleted after file_exists returns true, but before fopen). But I wouldn't just suppress errors to make them go away. These better be visible.
Suppress error with @ operator in PHP In your opinion, is it ever valid to use the @ operator to suppress an error/warning in PHP whereas you may be handling the error? If so, in what circumstances would you use this? Code examples are welcome. Edit: Note to repliers. I'm not looking to turn error reporting off, but, f...
TITLE: Suppress error with @ operator in PHP QUESTION: In your opinion, is it ever valid to use the @ operator to suppress an error/warning in PHP whereas you may be handling the error? If so, in what circumstances would you use this? Code examples are welcome. Edit: Note to repliers. I'm not looking to turn error rep...
[ "php", "operators", "error-suppression" ]
77
28
72,153
19
0
2008-09-25T23:37:41.637000
2008-09-26T07:11:09.597000
136,928
137,093
With DojoX Layout, is it possible to replace the content of a layout?
I have a div in which a page is loaded with the DojoX Layout capability: Initial content, will be replace by href. paths in folder.html will be adjusted to match this page Is there an API I can use to later replace the content of this div with some other content from another page (other URI)? Alex
Add an id on the div (say id="myPane"), and write: dijit.byId("myPane").setHref("path/page.html"); Alex
With DojoX Layout, is it possible to replace the content of a layout? I have a div in which a page is loaded with the DojoX Layout capability: Initial content, will be replace by href. paths in folder.html will be adjusted to match this page Is there an API I can use to later replace the content of this div with some o...
TITLE: With DojoX Layout, is it possible to replace the content of a layout? QUESTION: I have a div in which a page is loaded with the DojoX Layout capability: Initial content, will be replace by href. paths in folder.html will be adjusted to match this page Is there an API I can use to later replace the content of th...
[ "layout", "dojo" ]
0
1
1,300
1
0
2008-09-25T23:42:15.057000
2008-09-26T00:26:06.260000
136,937
136,965
Is there a way to catch the back button event in javascript?
Is there a way to respond to the back button being hit (or backspace being pressed) in javascript when only the location hash changes? That is to say when the browser is not communicating with the server or reloading the page.
Use the hashchange event: window.addEventListener("hashchange", function(e) { //... }) If you need to support older browsers, check out the hashChange Event section in Modernizr's HTML5 Cross Browser Polyfills wiki page.
Is there a way to catch the back button event in javascript? Is there a way to respond to the back button being hit (or backspace being pressed) in javascript when only the location hash changes? That is to say when the browser is not communicating with the server or reloading the page.
TITLE: Is there a way to catch the back button event in javascript? QUESTION: Is there a way to respond to the back button being hit (or backspace being pressed) in javascript when only the location hash changes? That is to say when the browser is not communicating with the server or reloading the page. ANSWER: Use t...
[ "javascript" ]
64
31
115,262
5
0
2008-09-25T23:45:13.380000
2008-09-25T23:50:48.703000
136,946
136,954
Difference between Enum and Define Statements
What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)? For example, when should one use enum {BUFFER = 1234}; over #define BUFFER 1234
enum defines a syntactical element. #define is a pre-preprocessor directive, executed before the compiler sees the code, and therefore is not a language element of C itself. Generally enums are preferred as they are type-safe and more easily discoverable. Defines are harder to locate and can have complex behavior, for ...
Difference between Enum and Define Statements What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)? For example, when should one use enum {BUFFER = 1234}; over #define BUFFER 1234
TITLE: Difference between Enum and Define Statements QUESTION: What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)? For example, when should one use enum {BUFFER = 1234}; over #define BUFFER 1234 ANSWER: enum defines ...
[ "c++", "c", "enums", "c-preprocessor" ]
55
73
43,057
18
0
2008-09-25T23:47:24.047000
2008-09-25T23:48:21.483000
136,948
675,454
Launching a registered mime helper application
I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in Internet Explorer 5 (most of the time) and Firefo...
Some follow-up to close out this question. Turned out the real issue was how I was creating the file handle using TFileStream. I changed to open with fmOpenRead or fmShareDenyWrite which solved what turned out to be a file locking issue. srcFile:= TFileStream.Create(physicalFilename, fmOpenRead or fmShareDenyWrite);
Launching a registered mime helper application I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in In...
TITLE: Launching a registered mime helper application QUESTION: I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This...
[ "windows", "delphi", "mime", "mime-types" ]
1
0
2,505
5
0
2008-09-25T23:47:38.210000
2009-03-23T22:22:56.060000
136,961
137,035
In jQuery Form, 'success' is being called before 'beforeSubmit' is finished
I'm using the jQuery Form plugin to upload an image. I've assigned a fade animation to happen the beforeSubmit callback, but as I'm running locally, it doesn't have time to finish before the success function is called. I am using a callback function in my fade(); call to make sure that one fade completes, before the ne...
I think you may be getting too fancy with those fade animations:)... In the beforeSubmit the fadeOut is setup but the function returns immediately causing the submit to happen. I guess the upload is happening under 3 seconds causing the new image to appear before your animations are complete. So if you really really wa...
In jQuery Form, 'success' is being called before 'beforeSubmit' is finished I'm using the jQuery Form plugin to upload an image. I've assigned a fade animation to happen the beforeSubmit callback, but as I'm running locally, it doesn't have time to finish before the success function is called. I am using a callback fun...
TITLE: In jQuery Form, 'success' is being called before 'beforeSubmit' is finished QUESTION: I'm using the jQuery Form plugin to upload an image. I've assigned a fade animation to happen the beforeSubmit callback, but as I'm running locally, it doesn't have time to finish before the success function is called. I am us...
[ "javascript", "jquery", "ajax" ]
1
2
2,602
2
0
2008-09-25T23:49:43.197000
2008-09-26T00:10:15.410000
136,975
136,998
Has an event handler already been added?
Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list has a property changed it needs to be flagged, which the event handler took care of properly before. However now when th...
From outside the defining class, as @Telos mentions, you can only use EventHandler on the left-hand side of a += or a -=. So, if you have the ability to modify the defining class, you could provide a method to perform the check by checking if the event handler is null - if so, then no event handler has been added. If n...
Has an event handler already been added? Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list has a property changed it needs to be flagged, which the event handler took car...
TITLE: Has an event handler already been added? QUESTION: Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list has a property changed it needs to be flagged, which the even...
[ "c#", ".net", "asp.net" ]
220
139
179,223
8
0
2008-09-25T23:53:29.430000
2008-09-25T23:58:55.593000
137,005
142,105
Auto-Hide taskbar not appearing when my application is maximized
My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I have the application not maximized, even when sized all the way to the bottom of the s...
I found the problem. My application was handling the WM_GETMINMAXINFO message, and was overriding the values in the parameter MINMAXINFO record. The values that were in the record were inflated by 7 (border width) the screen pixel resolution. That makes sense in that when maximized, it pushes the borders of the window ...
Auto-Hide taskbar not appearing when my application is maximized My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I have the application ...
TITLE: Auto-Hide taskbar not appearing when my application is maximized QUESTION: My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I hav...
[ "windows", "taskbar" ]
4
4
6,534
2
0
2008-09-26T00:00:25.840000
2008-09-26T21:30:56.570000
137,006
137,028
Redefine Class Methods or Class
Is there any way to redefine a class or some of its methods without using typical inheritance? For example: class third_party_library { function buggy_function() { return 'bad result'; } function other_functions(){ return 'blah'; } } What can I do to replace buggy_function()? Obviously this is what I would like to do c...
It's called monkey patching. But, PHP doesn't have native support for it. Though, as others have also pointed out, the runkit library is available for adding support to the language and is the successor to classkit. And, though it seemed to have been abandoned by its creator (having stated that it wasn't compatible wit...
Redefine Class Methods or Class Is there any way to redefine a class or some of its methods without using typical inheritance? For example: class third_party_library { function buggy_function() { return 'bad result'; } function other_functions(){ return 'blah'; } } What can I do to replace buggy_function()? Obviously t...
TITLE: Redefine Class Methods or Class QUESTION: Is there any way to redefine a class or some of its methods without using typical inheritance? For example: class third_party_library { function buggy_function() { return 'bad result'; } function other_functions(){ return 'blah'; } } What can I do to replace buggy_funct...
[ "php", "class", "methods", "redefine" ]
55
47
82,184
13
0
2008-09-26T00:00:45.060000
2008-09-26T00:07:31.737000
137,011
137,754
Why don't I see a significant speed-up when using the MATLAB compiler?
I have a lot of nice MATLAB code that runs too slowly and would be a pain to write over in C. The MATLAB compiler for C does not seem to help much, if at all. Should it be speeding execution up more? Am I screwed?
I'll echo what dwj said: if your MATLAB code is slow, this is probably because it is not sufficiently vectorized. If you're doing explicit loops when you could be doing operations on whole arrays, that's the culprit. This applies equally to all array-oriented dynamic languages: Perl Data Language, Numeric Python, MATLA...
Why don't I see a significant speed-up when using the MATLAB compiler? I have a lot of nice MATLAB code that runs too slowly and would be a pain to write over in C. The MATLAB compiler for C does not seem to help much, if at all. Should it be speeding execution up more? Am I screwed?
TITLE: Why don't I see a significant speed-up when using the MATLAB compiler? QUESTION: I have a lot of nice MATLAB code that runs too slowly and would be a pain to write over in C. The MATLAB compiler for C does not seem to help much, if at all. Should it be speeding execution up more? Am I screwed? ANSWER: I'll ech...
[ "c", "performance", "matlab", "matlab-compiler" ]
9
14
9,906
11
0
2008-09-26T00:02:40.030000
2008-09-26T04:16:49.217000
137,021
137,059
PHP Object as XML Document
What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.
take a look at PEAR's XML_Serializer package. I've used it with pretty good results. You can feed it arrays, objects etc and it will turn them into XML. It also has a bunch of options like picking the name of the root node etc. Should do the trick
PHP Object as XML Document What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.
TITLE: PHP Object as XML Document QUESTION: What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around. ANSWER: take a look at PEAR's XML_Serializer package. I've used it w...
[ "php", "xml", "xml-serialization" ]
51
39
95,080
12
0
2008-09-26T00:05:11.973000
2008-09-26T00:15:11.903000
137,031
137,105
How can I programmatically determine if I have write privileges using C# in .Net?
How can I determine if I have write permission on a remote machine in my intranet using C# in.Net?
The simple answer would be to try it and see. The Windows security APIs are not for the faint of heart, and may be possible you have write permission without having permission to view the permissions!
How can I programmatically determine if I have write privileges using C# in .Net? How can I determine if I have write permission on a remote machine in my intranet using C# in.Net?
TITLE: How can I programmatically determine if I have write privileges using C# in .Net? QUESTION: How can I determine if I have write permission on a remote machine in my intranet using C# in.Net? ANSWER: The simple answer would be to try it and see. The Windows security APIs are not for the faint of heart, and may ...
[ "c#", ".net", "networking", "file-permissions" ]
5
6
8,990
4
0
2008-09-26T00:08:45.337000
2008-09-26T00:28:16.443000
137,038
137,074
How do you get assembler output from C/C++ source in GCC?
How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
Use the -S option to gcc (or g++ ), optionally with -fverbose-asm which works well at the default -O0 to attach C names to asm operands as comments. It works less well at any optimization level, which you normally want to use to get asm worth looking at. gcc -S helloworld.c This will run the preprocessor (cpp) over hel...
How do you get assembler output from C/C++ source in GCC? How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
TITLE: How do you get assembler output from C/C++ source in GCC? QUESTION: How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted assembly code? ANSWER: Use the -S option to gcc (or g++ ), optionally with -fverbose-asm which works well at the default -O0 to attach C ...
[ "c++", "c", "assembly", "gcc", "disassembly" ]
532
593
525,441
17
0
2008-09-26T00:10:21.527000
2008-09-26T00:19:43.220000
137,040
137,083
What's the best way to read and parse a large text file over the network?
I have a problem which requires me to parse several log files from a remote machine. There are a few complications: 1) The file may be in use 2) The files can be quite large (100mb+) 3) Each entry may be multi-line To solve the in-use issue, I need to copy it first. I'm currently copying it directly from the remote mac...
If you are reading a sequential file you want to read it in line by line over the network. You need a transfer method capable of streaming. You'll need to review your IO streaming technology to figure this out. Large IO operations like this won't benefit much by multithreading since you can probably process the items a...
What's the best way to read and parse a large text file over the network? I have a problem which requires me to parse several log files from a remote machine. There are a few complications: 1) The file may be in use 2) The files can be quite large (100mb+) 3) Each entry may be multi-line To solve the in-use issue, I ne...
TITLE: What's the best way to read and parse a large text file over the network? QUESTION: I have a problem which requires me to parse several log files from a remote machine. There are a few complications: 1) The file may be in use 2) The files can be quite large (100mb+) 3) Each entry may be multi-line To solve the ...
[ "c#", ".net", "multithreading", "parsing", "networking" ]
10
2
7,033
9
0
2008-09-26T00:10:35.737000
2008-09-26T00:23:12.523000
137,043
144,938
Can emacs re-indent a big blob of HTML for me?
When editing HTML in emacs, is there a way to automatically pretty-format a blob of markup, changing something like this: blah...into this: blah
By default, when you visit a.html file in Emacs (22 or 23), it will put you in html-mode. That is probably not what you want. You probably want nxml-mode, which is seriously fancy. nxml-mode seems to only come with Emacs 23, although you can download it for earlier versions of emacs from the nXML web site. There is als...
Can emacs re-indent a big blob of HTML for me? When editing HTML in emacs, is there a way to automatically pretty-format a blob of markup, changing something like this: blah...into this: blah
TITLE: Can emacs re-indent a big blob of HTML for me? QUESTION: When editing HTML in emacs, is there a way to automatically pretty-format a blob of markup, changing something like this: blah...into this: blah ANSWER: By default, when you visit a.html file in Emacs (22 or 23), it will put you in html-mode. That is pro...
[ "html", "emacs" ]
79
31
34,593
10
0
2008-09-26T00:10:55.923000
2008-09-28T01:22:01.203000
137,054
163,692
How to validate ASPNET AJAX installation
How can I validate that my ASPNET AJAX installation is correct. I have Visual Studio 2008 and had never previously installed any AJAX version. My UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get is as if the UpdatePanel doesnt exist at all - i.e. it rev...
Check for any JavaScript errors. Sometimes the JavaScript required for the UpdatePanel to work fails to load.
How to validate ASPNET AJAX installation How can I validate that my ASPNET AJAX installation is correct. I have Visual Studio 2008 and had never previously installed any AJAX version. My UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get is as if the Upda...
TITLE: How to validate ASPNET AJAX installation QUESTION: How can I validate that my ASPNET AJAX installation is correct. I have Visual Studio 2008 and had never previously installed any AJAX version. My UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get...
[ "c#", "asp.net", "ajax" ]
3
0
625
3
0
2008-09-26T00:14:10.720000
2008-10-02T17:55:15.117000
137,060
137,148
Too many "pattern suffixes" - design smell?
I just found myself creating a class called "InstructionBuilderFactoryMapFactory". That's 4 "pattern suffixes" on one class. It immediately reminded me of this: http://www.jroller.com/landers/entry/the_design_pattern_facade_pattern Is this a design smell? Should I impose a limit on this number? I know some programmers ...
I see it as a design smell - it will make me think if all those levels of abstraction are pulling enough weight. I can't see why you wanted to name a class 'InstructionBuilderFactoryMapFactory'? Are there other kinds of factories - something that doesn't create an InstructionBuilderFactoryMap? Or are there any other ki...
Too many "pattern suffixes" - design smell? I just found myself creating a class called "InstructionBuilderFactoryMapFactory". That's 4 "pattern suffixes" on one class. It immediately reminded me of this: http://www.jroller.com/landers/entry/the_design_pattern_facade_pattern Is this a design smell? Should I impose a li...
TITLE: Too many "pattern suffixes" - design smell? QUESTION: I just found myself creating a class called "InstructionBuilderFactoryMapFactory". That's 4 "pattern suffixes" on one class. It immediately reminded me of this: http://www.jroller.com/landers/entry/the_design_pattern_facade_pattern Is this a design smell? Sh...
[ "java", "design-patterns", "naming-conventions" ]
6
4
1,763
4
0
2008-09-26T00:15:21.560000
2008-09-26T00:42:58.047000
137,089
137,175
Boost::signal memory access error
I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a memory access assert in the boost::signal code on even the most trivial usage of the library. I have simplified it down to this code: #include typedef boost::signal Event; int main(int argc, char* argv[]) { Event e; return 0; } Than...
I've tested your code on my system, and it works fine. I think that there's a mismatch between your compiler, and the compiler that your Boost.Signals library is built on. Try to download the Boost source, and compile Boost.Signals using the same compiler as you use for building your code. Just for my info, what compil...
Boost::signal memory access error I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a memory access assert in the boost::signal code on even the most trivial usage of the library. I have simplified it down to this code: #include typedef boost::signal Event; int main(int argc, char* arg...
TITLE: Boost::signal memory access error QUESTION: I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a memory access assert in the boost::signal code on even the most trivial usage of the library. I have simplified it down to this code: #include typedef boost::signal Event; int main(i...
[ "c++", "boost-signals" ]
4
1
1,458
4
0
2008-09-26T00:25:10.600000
2008-09-26T00:51:16.857000
137,102
137,141
What's the best visual merge tool for Git?
What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel. Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't g...
Meld is a free, open-source, and cross-platform (UNIX/Linux, OSX, Windows) diff/merge tool. Here's how to install it on: Ubuntu Mac Windows: "The recommended version of Meld for Windows is the most recent release, available as an MSI from https://meldmerge.org "
What's the best visual merge tool for Git? What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel. Also, instructions for invoking said tool would be great. (I still haven't figure out how to s...
TITLE: What's the best visual merge tool for Git? QUESTION: What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel. Also, instructions for invoking said tool would be great. (I still haven't f...
[ "git", "version-control", "merge" ]
725
426
575,314
18
0
2008-09-26T00:27:35.867000
2008-09-26T00:39:54.497000
137,114
137,177
Rounding in MS Access
Whats the best way to round in VBA Access? My current method utilizes the Excel method Excel.WorksheetFunction.Round(... But I am looking for a means that does not rely on Excel.
Be careful, the VBA Round function uses Banker's rounding, where it rounds.5 to an even number, like so: Round (12.55, 1) would return 12.6 (rounds up) Round (12.65, 1) would return 12.6 (rounds down) Round (12.75, 1) would return 12.8 (rounds up) Whereas the Excel Worksheet Function Round, always rounds.5 up. I've don...
Rounding in MS Access Whats the best way to round in VBA Access? My current method utilizes the Excel method Excel.WorksheetFunction.Round(... But I am looking for a means that does not rely on Excel.
TITLE: Rounding in MS Access QUESTION: Whats the best way to round in VBA Access? My current method utilizes the Excel method Excel.WorksheetFunction.Round(... But I am looking for a means that does not rely on Excel. ANSWER: Be careful, the VBA Round function uses Banker's rounding, where it rounds.5 to an even numb...
[ "excel", "vba", "ms-access", "rounding", "worksheet-function" ]
13
26
34,269
13
0
2008-09-26T00:30:29.713000
2008-09-26T00:53:59.860000
137,158
1,877,503
Is there something like ZenTest/Autotest for Java and JUnit
I've used ZenTest and autotest to work on Ruby projects before, and I used to using them for test-driven development a la this configuration. I have a project that I'm currently working on in Java, and I was wondering if there is something similar in the Java world to achieve the same effect.
Might I also suggest Infinitest, it is under active development and works with other languages besides Java. I believe it works fine with Scala, but I haven't had much luck using it with Groovy. It is free for personal use and is being developed by Improving.
Is there something like ZenTest/Autotest for Java and JUnit I've used ZenTest and autotest to work on Ruby projects before, and I used to using them for test-driven development a la this configuration. I have a project that I'm currently working on in Java, and I was wondering if there is something similar in the Java ...
TITLE: Is there something like ZenTest/Autotest for Java and JUnit QUESTION: I've used ZenTest and autotest to work on Ruby projects before, and I used to using them for test-driven development a la this configuration. I have a project that I'm currently working on in Java, and I was wondering if there is something si...
[ "java", "ruby", "unit-testing", "tdd", "autotest" ]
10
5
1,874
5
0
2008-09-26T00:45:35.917000
2009-12-09T22:55:59.530000
137,181
137,200
finding apache build options
I need to rebuild an apache server, but the original source is no longer available. Is there any way ( command line switch to httpd? ) to get the build options which were originally used?
Try -V which "Print the version and build parameters of httpd, and then exit." httpd -V Also, you can see the options for httpd via: httpd -h
finding apache build options I need to rebuild an apache server, but the original source is no longer available. Is there any way ( command line switch to httpd? ) to get the build options which were originally used?
TITLE: finding apache build options QUESTION: I need to rebuild an apache server, but the original source is no longer available. Is there any way ( command line switch to httpd? ) to get the build options which were originally used? ANSWER: Try -V which "Print the version and build parameters of httpd, and then exit...
[ "apache" ]
12
9
15,853
3
0
2008-09-26T00:55:27.453000
2008-09-26T01:01:36.380000
137,182
137,206
How to launch Windows' RegEdit with certain path?
How do I launch Windows' RegEdit with certain path located, like " HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0 ", so I don't have to do the clicking? What's the command line argument to do this? Or is there a place to find the explanation of RegEdit's switches?
There's a program called RegJump, by Mark Russinovich, that does just what you want. It'll launch regedit and move it to the key you want from the command line. RegJump uses (or at least used to) use the same regedit window on each invoke, so if you want multiple regedit sessions open, you'll still have to do things th...
How to launch Windows' RegEdit with certain path? How do I launch Windows' RegEdit with certain path located, like " HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0 ", so I don't have to do the clicking? What's the command line argument to do this? Or is there a place to find the explanation of RegEdit's switches...
TITLE: How to launch Windows' RegEdit with certain path? QUESTION: How do I launch Windows' RegEdit with certain path located, like " HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0 ", so I don't have to do the clicking? What's the command line argument to do this? Or is there a place to find the explanation of ...
[ "command-line", "regedit" ]
49
31
67,785
16
0
2008-09-26T00:55:48.500000
2008-09-26T01:05:31.737000
137,212
137,288
How to deal with a slow SecureRandom generator?
If you want a cryptographically strong random numbers in Java, you use SecureRandom. Unfortunately, SecureRandom can be very slow. If it uses /dev/random on Linux, it can block waiting for sufficient entropy to build up. How do you avoid the performance penalty? Has anyone used Uncommon Maths as a solution to this prob...
If you want true random data, then unfortunately you have to wait for it. This includes the seed for a SecureRandom PRNG. Uncommon Maths can't gather true random data any faster than SecureRandom, although it can connect to the internet to download seed data from a particular website. My guess is that this is unlikely ...
How to deal with a slow SecureRandom generator? If you want a cryptographically strong random numbers in Java, you use SecureRandom. Unfortunately, SecureRandom can be very slow. If it uses /dev/random on Linux, it can block waiting for sufficient entropy to build up. How do you avoid the performance penalty? Has anyon...
TITLE: How to deal with a slow SecureRandom generator? QUESTION: If you want a cryptographically strong random numbers in Java, you use SecureRandom. Unfortunately, SecureRandom can be very slow. If it uses /dev/random on Linux, it can block waiting for sufficient entropy to build up. How do you avoid the performance ...
[ "java", "performance", "security", "random", "entropy" ]
189
95
166,982
17
0
2008-09-26T01:07:04.243000
2008-09-26T01:39:13.217000
137,221
140,167
Where can I find an AutoComplete TextBox code sample for Silverlight?
I've searched around for a while today, but I haven't been able to come up with an AutoComplete TextBox code sample for Silverlight 2 Beta 2. The most promising reference was found on nikhilk.net but the online demo doesn't currently render and after downloading a getting the code to compile with Beta 2, I couldn't get...
You may want to take a look at my blog: http://weblogs.manas.com.ar/ary/2008/09/26/autocomplete-in-silverlight/ You simply write in your XAML: manas:Autocomplete.Suggest="DoSuggest" and then in the class file, you need to implement that method, which report suggestions to a delegate. The options can be hardcoded, reque...
Where can I find an AutoComplete TextBox code sample for Silverlight? I've searched around for a while today, but I haven't been able to come up with an AutoComplete TextBox code sample for Silverlight 2 Beta 2. The most promising reference was found on nikhilk.net but the online demo doesn't currently render and after...
TITLE: Where can I find an AutoComplete TextBox code sample for Silverlight? QUESTION: I've searched around for a while today, but I haven't been able to come up with an AutoComplete TextBox code sample for Silverlight 2 Beta 2. The most promising reference was found on nikhilk.net but the online demo doesn't currentl...
[ "silverlight", "textbox" ]
0
2
6,558
3
0
2008-09-26T01:10:57.793000
2008-09-26T15:19:04.250000
137,226
138,949
How do you optimize tables for specific queries?
What are the patterns you use to determine the frequent queries? How do you select the optimization factors? What are the types of changes one can make?
This is a nice question, if rather broad (and none the worse for that). If I understand you, then you're asking how to attack the problem of optimisation starting from scratch. The first question to ask is: " is there a performance problem? " If there is no problem, then you're done. This is often the case. Nice. On th...
How do you optimize tables for specific queries? What are the patterns you use to determine the frequent queries? How do you select the optimization factors? What are the types of changes one can make?
TITLE: How do you optimize tables for specific queries? QUESTION: What are the patterns you use to determine the frequent queries? How do you select the optimization factors? What are the types of changes one can make? ANSWER: This is a nice question, if rather broad (and none the worse for that). If I understand you...
[ "sql", "database-design" ]
8
12
4,238
9
0
2008-09-26T01:13:06.787000
2008-09-26T11:48:17.267000
137,227
137,311
List all types declared by module in Ruby
How can I list all the types that are declared by a module in Ruby?
Use the constants method defined in the Module module. From the Ruby documentation: Module.constants => array Returns an array of the names of all constants defined in the system. This list includes the names of all modules and classes. p Module.constants.sort[1..5] produces: ["ARGV", "ArgumentError", "Array", "Bignum"...
List all types declared by module in Ruby How can I list all the types that are declared by a module in Ruby?
TITLE: List all types declared by module in Ruby QUESTION: How can I list all the types that are declared by a module in Ruby? ANSWER: Use the constants method defined in the Module module. From the Ruby documentation: Module.constants => array Returns an array of the names of all constants defined in the system. Thi...
[ "ruby" ]
18
23
7,353
2
0
2008-09-26T01:13:08.490000
2008-09-26T01:48:54.660000
137,229
140,225
MSBuild doesn't pick up references of the referenced project
I bumped into a strange situation with MSBuild just now. There's a solution which has three projects: LibX, LibY and Exe. Exe references LibX. LibX in its turn references LibY, has some content files, and also references to a third-party library (several pre-built assemblies installed in both GAC and local lib folder)....
Yes, I've had that problem, too. Though I'd love to say otherwise, I believe you must include all transitive dependencies as references in your build file.
MSBuild doesn't pick up references of the referenced project I bumped into a strange situation with MSBuild just now. There's a solution which has three projects: LibX, LibY and Exe. Exe references LibX. LibX in its turn references LibY, has some content files, and also references to a third-party library (several pre-...
TITLE: MSBuild doesn't pick up references of the referenced project QUESTION: I bumped into a strange situation with MSBuild just now. There's a solution which has three projects: LibX, LibY and Exe. Exe references LibX. LibX in its turn references LibY, has some content files, and also references to a third-party lib...
[ "msbuild", "build-automation", "dependencies" ]
14
2
8,428
6
0
2008-09-26T01:14:28.143000
2008-09-26T15:28:46.923000
137,239
792,685
Lazy Registration on the Web: Best Practices
I first encountered the concept of lazy registration the Ajax Patterns site, where they define it as accumulating "bits of information about the user as they interact, with formal registration occurring later on." I'm looking at doing something similar for my website, but I'd like to know a little bit more about best p...
Have a look at this vid, a very good overview of the lazy registration pattern: http://www.90percentofeverything.com/2009/03/16/signup-forms-must-die-heres-how-we-killed-ours/
Lazy Registration on the Web: Best Practices I first encountered the concept of lazy registration the Ajax Patterns site, where they define it as accumulating "bits of information about the user as they interact, with formal registration occurring later on." I'm looking at doing something similar for my website, but I'...
TITLE: Lazy Registration on the Web: Best Practices QUESTION: I first encountered the concept of lazy registration the Ajax Patterns site, where they define it as accumulating "bits of information about the user as they interact, with formal registration occurring later on." I'm looking at doing something similar for ...
[ "lazy-registration" ]
5
4
4,224
5
0
2008-09-26T01:20:06.523000
2009-04-27T08:45:58.853000
137,243
137,262
Code run by Hudson can't find executable on the command line
I'm setting up my first job in Hudson, and I'm running into some problems. The job monitors two repositories, one containing our DB setup files, the other a bit of code that validates and tests the DB setup files. Part of the code that runs will throw the validated setup files at PostgreSQL, using the psql command line...
I find that you need to have the programme in the path when you launch hudson or the slave. Despite having the ability to set the path in hudson it doesn't seem to work. You could also put the full path in the command, which is really a good idea from a security perspective anyway.
Code run by Hudson can't find executable on the command line I'm setting up my first job in Hudson, and I'm running into some problems. The job monitors two repositories, one containing our DB setup files, the other a bit of code that validates and tests the DB setup files. Part of the code that runs will throw the val...
TITLE: Code run by Hudson can't find executable on the command line QUESTION: I'm setting up my first job in Hudson, and I'm running into some problems. The job monitors two repositories, one containing our DB setup files, the other a bit of code that validates and tests the DB setup files. Part of the code that runs ...
[ "java", "hudson", "runtime.exec" ]
2
3
1,789
1
0
2008-09-26T01:22:45.050000
2008-09-26T01:30:07.917000
137,254
137,263
Is it possible to impersonate a user without logging him on?
Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user.
No, you have to call Win32 API LogonUser function to get windows account token back so you can then impersonate.
Is it possible to impersonate a user without logging him on? Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user.
TITLE: Is it possible to impersonate a user without logging him on? QUESTION: Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user....
[ "security", "winapi", "visual-c++", "impersonation" ]
8
6
5,923
2
0
2008-09-26T01:28:21.400000
2008-09-26T01:30:39.197000
137,255
137,347
How can I determine if a remote drive has enough space to write a file using C#?
How can I determine if a remote drive has enough space for me to upload a given file using C# in.Net?
There are two possible solutions. Call the Win32 function GetDiskFreeSpaceEx. Here is a sample program: internal static class Win32 { [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] internal static extern bool GetDiskFreeSpaceEx(string drive, out long freeBytesForUser, out long totalBytes, out ...
How can I determine if a remote drive has enough space to write a file using C#? How can I determine if a remote drive has enough space for me to upload a given file using C# in.Net?
TITLE: How can I determine if a remote drive has enough space to write a file using C#? QUESTION: How can I determine if a remote drive has enough space for me to upload a given file using C# in.Net? ANSWER: There are two possible solutions. Call the Win32 function GetDiskFreeSpaceEx. Here is a sample program: intern...
[ "c#", ".net", "networking", "filesystems" ]
5
10
6,428
4
0
2008-09-26T01:28:23.553000
2008-09-26T02:02:09.993000
137,258
137,264
std::map iteration - order differences between Debug and Release builds
Here's a common code pattern I have to work with: class foo { public: void InitMap(); void InvokeMethodsInMap(); static void abcMethod(); static void defMethod(); private: typedef std::map TMyMap; TMyMap m_MyMap; } void foo::InitMap() { m_MyMap["abc"] = &foo::abcMethod; m_MyMap["def"] = &foo::defMethod; } void foo::I...
Don't use const char* as the key for maps. That means the map is ordered by the addresses of the strings, not the contents of the strings. Use a std::string as the key type, instead. std::map is not a hash table, it's usually implemented as a red-black tree, and elements are guaranteed to be ordered by some criteria (b...
std::map iteration - order differences between Debug and Release builds Here's a common code pattern I have to work with: class foo { public: void InitMap(); void InvokeMethodsInMap(); static void abcMethod(); static void defMethod(); private: typedef std::map TMyMap; TMyMap m_MyMap; } void foo::InitMap() { m_MyMap["a...
TITLE: std::map iteration - order differences between Debug and Release builds QUESTION: Here's a common code pattern I have to work with: class foo { public: void InitMap(); void InvokeMethodsInMap(); static void abcMethod(); static void defMethod(); private: typedef std::map TMyMap; TMyMap m_MyMap; } void foo::Init...
[ "c++", "stl" ]
4
16
1,700
3
0
2008-09-26T01:29:20.540000
2008-09-26T01:30:41.910000
137,260
137,324
What are the dangers of making a method virtual?
I've been doing some mocking with RhinoMocks and it requires that mocked methods be made virtual. This is fine except we have a custom framework which contains the methods that I want to mock which are currently not marked as virtual. I can't forsee any problem with making these methods virtual but I was wondering what...
Actually it can be very problematic if the method is not designed to be overridden and someone overrides it. In particular, never call a virtual method from a constructor. Consider: class Base { public Base() { InitializeComponent(); } protected virtual void InitializeComponent() {... } } class Derived: Base { private...
What are the dangers of making a method virtual? I've been doing some mocking with RhinoMocks and it requires that mocked methods be made virtual. This is fine except we have a custom framework which contains the methods that I want to mock which are currently not marked as virtual. I can't forsee any problem with maki...
TITLE: What are the dangers of making a method virtual? QUESTION: I've been doing some mocking with RhinoMocks and it requires that mocked methods be made virtual. This is fine except we have a custom framework which contains the methods that I want to mock which are currently not marked as virtual. I can't forsee any...
[ "c#", "unit-testing", "mocking", "virtual-functions" ]
8
10
1,494
3
0
2008-09-26T01:29:39.027000
2008-09-26T01:51:04.123000
137,267
137,365
Running Apache Archiva standalone in Gentoo?
I have a server running Gentoo 2.6.12 r6 and I want to run Apache Archiva as a standalone server at startup. Does anyone have a working init.d script to accomplish this? Thanks!
Assuming that you have created a user account called archiva and Archiva is installed at /opt/archiva-1.0. While logged as root, create a the script /etc/rc.d/init.d/archiva as follows: \#! /bin/sh start() { echo "Starting Archiva..." su -l archiva -c '/opt/archiva-1.0/bin/archiva start > /dev/null 2> /dev/null &' } ...
Running Apache Archiva standalone in Gentoo? I have a server running Gentoo 2.6.12 r6 and I want to run Apache Archiva as a standalone server at startup. Does anyone have a working init.d script to accomplish this? Thanks!
TITLE: Running Apache Archiva standalone in Gentoo? QUESTION: I have a server running Gentoo 2.6.12 r6 and I want to run Apache Archiva as a standalone server at startup. Does anyone have a working init.d script to accomplish this? Thanks! ANSWER: Assuming that you have created a user account called archiva and Archi...
[ "gentoo", "archiva", "init.d" ]
4
2
1,418
1
0
2008-09-26T01:31:10.800000
2008-09-26T02:09:26.670000
137,282
139,329
How can I avoid the Diamond of Death when using multiple inheritance?
http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid it?
A practical example: class A {}; class B: public A {}; class C: public A {}; class D: public B, public C {}; Notice how class D inherits from both B & C. But both B & C inherit from A. That will result in 2 copies of the class A being included in the vtable. To solve this, we need virtual inheritance. It's class A that...
How can I avoid the Diamond of Death when using multiple inheritance? http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid it?
TITLE: How can I avoid the Diamond of Death when using multiple inheritance? QUESTION: http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid it? ANSWER: A practical example: class A {}; class B: public A {}; class C: public A {}; class D: public B, public C {}; Notice h...
[ "c++", "multiple-inheritance" ]
71
82
49,678
9
0
2008-09-26T01:36:14.440000
2008-09-26T12:57:52.653000
137,313
137,323
How to truncate STDIN line length?
I've been parsing through some log files and I've found that some of the lines are too long to display on one line so Terminal.app kindly wraps them onto the next line. However, I've been looking for a way to truncate a line after a certain number of characters so that Terminal doesn't wrap, making it much easier to sp...
Pipe output to: cut -b 1-LIMIT Where LIMIT is the desired line width.
How to truncate STDIN line length? I've been parsing through some log files and I've found that some of the lines are too long to display on one line so Terminal.app kindly wraps them onto the next line. However, I've been looking for a way to truncate a line after a certain number of characters so that Terminal doesn'...
TITLE: How to truncate STDIN line length? QUESTION: I've been parsing through some log files and I've found that some of the lines are too long to display on one line so Terminal.app kindly wraps them onto the next line. However, I've been looking for a way to truncate a line after a certain number of characters so th...
[ "perl", "cut", "truncate" ]
7
12
3,642
9
0
2008-09-26T01:49:02.317000
2008-09-26T01:50:59.757000
137,326
137,349
How to embed a SWF file in an HTML page?
How do you embed a SWF file in an HTML page?
The best approach to embed a SWF into an HTML page is to use SWFObject. It is a simple open-source JavaScript library that is easy-to-use and standards-friendly method to embed Flash content. It also offers Flash player version detection. If the user does not have the version of Flash required or has JavaScript disable...
How to embed a SWF file in an HTML page? How do you embed a SWF file in an HTML page?
TITLE: How to embed a SWF file in an HTML page? QUESTION: How do you embed a SWF file in an HTML page? ANSWER: The best approach to embed a SWF into an HTML page is to use SWFObject. It is a simple open-source JavaScript library that is easy-to-use and standards-friendly method to embed Flash content. It also offers ...
[ "html", "embed", "flash" ]
179
175
478,780
15
0
2008-09-26T01:52:11.593000
2008-09-26T02:03:51.753000
137,336
137,342
How do I prevent using the incorrect type in PHP?
PHP, as we all know is very loosely typed. The language does not require you to specify any kind of type for function parameters or class variables. This can be a powerful feature. Sometimes though, it can make debugging your script a painful experience. For example, passing one kind of object into a method that expect...
Actually for classes you can provide type hinting in PHP (5+). This will also work correctly with inheritance as you would expect it to. As an aside, don't put the word 'object' in your class names...
How do I prevent using the incorrect type in PHP? PHP, as we all know is very loosely typed. The language does not require you to specify any kind of type for function parameters or class variables. This can be a powerful feature. Sometimes though, it can make debugging your script a painful experience. For example, pa...
TITLE: How do I prevent using the incorrect type in PHP? QUESTION: PHP, as we all know is very loosely typed. The language does not require you to specify any kind of type for function parameters or class variables. This can be a powerful feature. Sometimes though, it can make debugging your script a painful experienc...
[ "php", "oop", "type-safety" ]
3
11
614
7
0
2008-09-26T01:56:33.533000
2008-09-26T02:00:01.077000
137,340
137,444
Could a truly random number be generated using pings to pseudo-randomly selected IP addresses?
The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device. This was the only suggestion which didn't depend on non-commodity-class hardware. Subsequently nobody would put their reputation on the line to argue def...
No. A malicious machine on your network could use ARP spoofing (or a number of other techniques) to intercept your pings and reply to them after certain periods. They would then not only know what your random numbers are, but they would also control them. Of course there's still the question of how deterministic your l...
Could a truly random number be generated using pings to pseudo-randomly selected IP addresses? The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device. This was the only suggestion which didn't depend on non-co...
TITLE: Could a truly random number be generated using pings to pseudo-randomly selected IP addresses? QUESTION: The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device. This was the only suggestion which didn'...
[ "algorithm", "theory", "random" ]
56
83
5,815
23
0
2008-09-26T01:57:39.927000
2008-09-26T02:41:45.623000
137,359
142,073
Excel CSV - Number cell format
I produce a report as an CSV file. When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly. For example, if the CSV file contains...,005,... Then Excel shows it as 5. Is there a way to override this and display 005? I would prefer ...
There isn’t an easy way to control the formatting Excel applies when opening a.csv file. However listed below are three approaches that might help. My preference is the first option. Option 1 – Change the data in the file You could change the data in the.csv file as follows..., =”005”,... This will be displayed in Exce...
Excel CSV - Number cell format I produce a report as an CSV file. When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly. For example, if the CSV file contains...,005,... Then Excel shows it as 5. Is there a way to override this a...
TITLE: Excel CSV - Number cell format QUESTION: I produce a report as an CSV file. When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly. For example, if the CSV file contains...,005,... Then Excel shows it as 5. Is there a way ...
[ "excel", "csv", "formatting", "number-formatting" ]
93
132
237,976
16
0
2008-09-26T02:07:20.637000
2008-09-26T21:23:58.880000
137,360
137,414
Is there any way in .NET to programmatically listen to HTTP traffic?
I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy for the browser to use in order to see what its sending? I'm already using Fiddler to watch the traffic ...
I have briefly looked into the same thing and have considered two solutions (but haven't tried them yet). The first suggestion I have would be to use the HttpListener class (and possibly Webclient or other System.Net http related classes to re-post the requests to your application) as a proxy for the WebBrowser test ca...
Is there any way in .NET to programmatically listen to HTTP traffic? I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy for the browser to use in order to ...
TITLE: Is there any way in .NET to programmatically listen to HTTP traffic? QUESTION: I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy for the browser t...
[ ".net", "unit-testing", "http", "proxy", "automation" ]
3
3
430
1
0
2008-09-26T02:07:29.840000
2008-09-26T02:30:53.777000
137,361
137,381
What should I do to keep a tiny Open Source project active and sustainable?
A couple of months ago I've coded a tiny tool that we needed at work for a specific task, and I've decided to share it on CodePlex. It's written in C# and honestly it's not big deal but since it's the first project I've ever built from scratch in that language and with the goal of opening it from the very beginning, on...
I know I sound like a broken record constantly posting this book, but just about everything you could ever need to know about running an open source project is here. In particular, pay attention to these two chapters: Getting Started Managing Volunteers
What should I do to keep a tiny Open Source project active and sustainable? A couple of months ago I've coded a tiny tool that we needed at work for a specific task, and I've decided to share it on CodePlex. It's written in C# and honestly it's not big deal but since it's the first project I've ever built from scratch ...
TITLE: What should I do to keep a tiny Open Source project active and sustainable? QUESTION: A couple of months ago I've coded a tiny tool that we needed at work for a specific task, and I've decided to share it on CodePlex. It's written in C# and honestly it's not big deal but since it's the first project I've ever b...
[ "c#", ".net", "open-source" ]
3
1
208
3
0
2008-09-26T02:07:56.970000
2008-09-26T02:16:06.607000
137,375
137,383
Process to pass from problem to code. How did you learn?
I'm teaching/helping a student to program. I remember the following process always helped me when I started; It looks pretty intuitive and I wonder if someone else have had a similar approach. Read the problem and understand it ( of course ). Identify possible "functions" and variables. Write how would I do it step by ...
I did something similar. Figure out the rules/logic. Figure out the math. Then try and code it. After doing that for a couple of months it just gets internalized. You don't realize your doing it until you come up against a complex problem that requires you to break it down.
Process to pass from problem to code. How did you learn? I'm teaching/helping a student to program. I remember the following process always helped me when I started; It looks pretty intuitive and I wonder if someone else have had a similar approach. Read the problem and understand it ( of course ). Identify possible "f...
TITLE: Process to pass from problem to code. How did you learn? QUESTION: I'm teaching/helping a student to program. I remember the following process always helped me when I started; It looks pretty intuitive and I wonder if someone else have had a similar approach. Read the problem and understand it ( of course ). Id...
[ "process" ]
8
3
2,073
13
0
2008-09-26T02:13:52.803000
2008-09-26T02:17:43.093000
137,380
138,310
NLP: Building (small) corpora, or "Where to get lots of not-too-specialized English-language text files?"
Does anyone have a suggestion for where to find archives or collections of everyday English text for use in a small corpus? I have been using Gutenberg Project books for a working prototype, and would like to incorporate more contemporary language. A recent answer here pointed indirectly to a great archive of usenet mo...
Use the Wikipedia dumps needs lots of cleanup See if anything in nltk-data helps you the corpora are usually quite small the Wacky people have some free corpora tagged you can spider your own corpus using their toolkit Europarl is free and the basis of pretty much every academic MT system spoken language, translated Th...
NLP: Building (small) corpora, or "Where to get lots of not-too-specialized English-language text files?" Does anyone have a suggestion for where to find archives or collections of everyday English text for use in a small corpus? I have been using Gutenberg Project books for a working prototype, and would like to incor...
TITLE: NLP: Building (small) corpora, or "Where to get lots of not-too-specialized English-language text files?" QUESTION: Does anyone have a suggestion for where to find archives or collections of everyday English text for use in a small corpus? I have been using Gutenberg Project books for a working prototype, and w...
[ "nlp", "linguistics", "corpus" ]
5
8
1,346
7
0
2008-09-26T02:15:49.290000
2008-09-26T08:32:24.643000
137,387
137,394
How do I obtain the size of a folder?
I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library: Set fso = CreateObject("Scripting.FileSystemObject") Set folderObject = fso.GetFolder(folder) size = folderObject.Size There isn't an equivalent mechanism on the System.IO.Directory and Syst...
I think that you already know the answer; you will need to add up all of the files in the directory (as well as its child directories.) I don't know of any built in function for this, but hey, I don't know everything (not even close).
How do I obtain the size of a folder? I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library: Set fso = CreateObject("Scripting.FileSystemObject") Set folderObject = fso.GetFolder(folder) size = folderObject.Size There isn't an equivalent mechani...
TITLE: How do I obtain the size of a folder? QUESTION: I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library: Set fso = CreateObject("Scripting.FileSystemObject") Set folderObject = fso.GetFolder(folder) size = folderObject.Size There isn't an ...
[ ".net", "directory" ]
0
2
221
3
0
2008-09-26T02:20:13.570000
2008-09-26T02:23:37.837000
137,391
137,453
Can I do a conditional compile based on compiler version?
I am maintaining.net 1.1 and.net 3.5 c# code at once. For this purpose I created two csproject files, one for.net 1.1 and another for.net 3.5. Now, in my source code I am adding new features that are only available in.net 3.5 version, but I also want the code to compile in VS 2003, without the new features. Is there an...
You can define a different symbols in each CSPROJ file and refer to those in the C# source.
Can I do a conditional compile based on compiler version? I am maintaining.net 1.1 and.net 3.5 c# code at once. For this purpose I created two csproject files, one for.net 1.1 and another for.net 3.5. Now, in my source code I am adding new features that are only available in.net 3.5 version, but I also want the code to...
TITLE: Can I do a conditional compile based on compiler version? QUESTION: I am maintaining.net 1.1 and.net 3.5 c# code at once. For this purpose I created two csproject files, one for.net 1.1 and another for.net 3.5. Now, in my source code I am adding new features that are only available in.net 3.5 version, but I als...
[ "c#", "visual-studio-2008" ]
1
1
426
2
0
2008-09-26T02:22:27.370000
2008-09-26T02:44:29.550000
137,398
137,410
SQL Null set to Zero for adding
I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance: SELECT Column1, Column2, Column3+Column4 AS [Added Values] FROM Table where Column3 or Column4 may be null. In this case, I want null to be considered zero (so 4 + null = 4, null + null = 0 ). Any suggestions as to ...
Since ISNULL in Access is a boolean function (one parameter), use it like this: SELECT Column1, Column2, IIF(ISNULL(Column3),0,Column3) + IIF(ISNULL(Column4),0,Column4) AS [Added Values] FROM Table
SQL Null set to Zero for adding I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance: SELECT Column1, Column2, Column3+Column4 AS [Added Values] FROM Table where Column3 or Column4 may be null. In this case, I want null to be considered zero (so 4 + null = 4, null + nu...
TITLE: SQL Null set to Zero for adding QUESTION: I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance: SELECT Column1, Column2, Column3+Column4 AS [Added Values] FROM Table where Column3 or Column4 may be null. In this case, I want null to be considered zero (so 4 + n...
[ "sql", "ms-access", "database-design" ]
10
14
36,681
7
0
2008-09-26T02:26:02.743000
2008-09-26T02:29:58.850000
137,399
137,438
Unit Testing without Assertions
Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed. I personally don't have a problem with this, however it seems to be...
This would be the official way to do it: // Act Exception ex = Record.Exception(() => someCode()); // Assert Assert.Null(ex);
Unit Testing without Assertions Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed. I personally don't have a problem w...
TITLE: Unit Testing without Assertions QUESTION: Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed. I personally don'...
[ "unit-testing", "assert" ]
38
22
24,957
16
0
2008-09-26T02:26:24.833000
2008-09-26T02:39:07.127000
137,400
137,431
What's the difference between a worker thread and an I/O thread?
Looking at the processmodel element in the Web.Config there are two attributes. maxWorkerThreads="25" maxIoThreads="25" What is the difference between worker threads and I/O threads?
Fundamentally not a lot, it's all about how ASP.NET and IIS allocate I/O wait objects and manage the contention and latency of communicating over the network and transferring data. I/O threads are set aside as such because they will be doing I/O (as the name implies) and may have to wait for "long" periods of time (hun...
What's the difference between a worker thread and an I/O thread? Looking at the processmodel element in the Web.Config there are two attributes. maxWorkerThreads="25" maxIoThreads="25" What is the difference between worker threads and I/O threads?
TITLE: What's the difference between a worker thread and an I/O thread? QUESTION: Looking at the processmodel element in the Web.Config there are two attributes. maxWorkerThreads="25" maxIoThreads="25" What is the difference between worker threads and I/O threads? ANSWER: Fundamentally not a lot, it's all about how A...
[ "asp.net", "multithreading", "web-config", "processmodel" ]
27
26
13,084
2
0
2008-09-26T02:27:00.417000
2008-09-26T02:35:57.650000
137,407
137,627
Is there any way in .NET to programmatically listen to HTTP traffic?
I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer for the browser to use in order to see what its sending? I'm already using Fiddler to ...
Try winpcap. It's a driver/library combination which can be used to monitor packets. Based on what you are trying to do (watch traffic w/o a UI), this is probably a simpler solution than writing your own proxy.
Is there any way in .NET to programmatically listen to HTTP traffic? I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer for the browser t...
TITLE: Is there any way in .NET to programmatically listen to HTTP traffic? QUESTION: I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer...
[ ".net", "http", "proxy", "automation", "winpcap" ]
2
2
4,567
4
0
2008-09-26T02:29:31.143000
2008-09-26T03:38:23.287000
137,425
1,085,377
How do I automate a web proxy in .NET for unit tests (including set up and tear down)?
Following Jonathan Holland's suggestion in his comment for my previous question: Is there any way in.NET to programmatically listen to HTTP traffic? I've made a separate (but not exactly a duplicate) question for what I really want to know: How do I automate a web proxy in.NET for unit tests (including set up and tear ...
WebAii 2.0 has a built-in HTTP proxy: http://www.artoftest.com/community/blogs/09-03-25/WebAii_2_0_Beta_Released.aspx
How do I automate a web proxy in .NET for unit tests (including set up and tear down)? Following Jonathan Holland's suggestion in his comment for my previous question: Is there any way in.NET to programmatically listen to HTTP traffic? I've made a separate (but not exactly a duplicate) question for what I really want t...
TITLE: How do I automate a web proxy in .NET for unit tests (including set up and tear down)? QUESTION: Following Jonathan Holland's suggestion in his comment for my previous question: Is there any way in.NET to programmatically listen to HTTP traffic? I've made a separate (but not exactly a duplicate) question for wh...
[ ".net", "unit-testing", "proxy", "automation", "browser-automation" ]
1
2
959
4
0
2008-09-26T02:34:27.637000
2009-07-06T04:07:07.230000
137,443
137,509
How can I turn an image file of a game map into boundaries in my program?
I have an image of a basic game map. Think of it as just horizontal and vertical walls which can't be crossed. How can I go from a png image of the walls to something in code easily? The hard way is pretty straight forward... it's just if I change the image map I would like an easy way to translate that to code. Thanks...
I dabble in video games, and I personally would not want the hassle of checking the boundaries of pictures on the map. Wouldn't it be cleaner if these walls were objects that just happened to have an image property (or something like it)? The image would display, but the object would have well defined coordinates and a...
How can I turn an image file of a game map into boundaries in my program? I have an image of a basic game map. Think of it as just horizontal and vertical walls which can't be crossed. How can I go from a png image of the walls to something in code easily? The hard way is pretty straight forward... it's just if I chang...
TITLE: How can I turn an image file of a game map into boundaries in my program? QUESTION: I have an image of a basic game map. Think of it as just horizontal and vertical walls which can't be crossed. How can I go from a png image of the walls to something in code easily? The hard way is pretty straight forward... it...
[ "language-agnostic" ]
0
1
417
5
0
2008-09-26T02:41:33.270000
2008-09-26T02:59:40.823000
137,448
137,537
Redundancy in C#?
Take the following snippet: List distances = new List (); Was the redundancy intended by the language designers? If so, why?
The reason the code appears to be redundant is because, to a novice programmer, it appears to be defining the same thing twice. But this is not what the code is doing. It is defining two separate things that just happen to be of the same type. It is defining the following: A variable named distances of type List. An ob...
Redundancy in C#? Take the following snippet: List distances = new List (); Was the redundancy intended by the language designers? If so, why?
TITLE: Redundancy in C#? QUESTION: Take the following snippet: List distances = new List (); Was the redundancy intended by the language designers? If so, why? ANSWER: The reason the code appears to be redundant is because, to a novice programmer, it appears to be defining the same thing twice. But this is not what t...
[ "c#", ".net", "generics", "programming-languages" ]
12
74
4,770
17
0
2008-09-26T02:43:28.037000
2008-09-26T03:07:56.340000
137,452
137,505
How do I change SQL Server 2005 to be case sensitive?
I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?
How about: ALTER DATABASE database_name COLLATE collation_name See BOL for a list of collation options and pick the case-sensitive one that best fits your needs (i.e. the one your client is using). Obviously, it's probably a good idea to make a full backup of your database before you try this. I've never personally tri...
How do I change SQL Server 2005 to be case sensitive? I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?
TITLE: How do I change SQL Server 2005 to be case sensitive? QUESTION: I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries? ANSWER: How about: ALTER DATABASE database_name COLLA...
[ "sql-server" ]
7
9
19,105
4
0
2008-09-26T02:43:55.837000
2008-09-26T02:58:37.300000
137,487
138,954
Null vs. False vs. 0 in PHP
I am told that good developers can spot/utilize the difference between Null and False and 0 and all the other good "nothing" entities. What is the difference, specifically in PHP? Does it have something to do with ===?
It's language specific, but in PHP: Null means " nothing ". The var has not been initialized. False means " not true in a boolean context ". Used to explicitly show you are dealing with logical issues. 0 is an int. Nothing to do with the rest above, used for mathematics. Now, what is tricky, it's that in dynamic langua...
Null vs. False vs. 0 in PHP I am told that good developers can spot/utilize the difference between Null and False and 0 and all the other good "nothing" entities. What is the difference, specifically in PHP? Does it have something to do with ===?
TITLE: Null vs. False vs. 0 in PHP QUESTION: I am told that good developers can spot/utilize the difference between Null and False and 0 and all the other good "nothing" entities. What is the difference, specifically in PHP? Does it have something to do with ===? ANSWER: It's language specific, but in PHP: Null means...
[ "php", "null" ]
163
245
180,883
18
0
2008-09-26T02:53:10.620000
2008-09-26T11:50:05.920000
137,523
137,542
Where can I find tools for learning assembler on OS X?
I'd like to learn assembler. However, there are very few resources for doing assembler with OS X. Is there anyone out there who has programmed in assembly on a Mac? Where did you learn? And, is there any reason I shouldn't be doing assembly? Do I risk (significantly) crashing my computer irreparably?
If you're using a PowerPC Mac, look into gcc inline assembler. Otherwise, look into nasm. I can't give any decent references to PPC ASM (they're few and far between), but I suggest the following things to learn x86 asm: The book Reversing by Eldad Eilam Compile simple C source with gcc -S and read the assembly generate...
Where can I find tools for learning assembler on OS X? I'd like to learn assembler. However, there are very few resources for doing assembler with OS X. Is there anyone out there who has programmed in assembly on a Mac? Where did you learn? And, is there any reason I shouldn't be doing assembly? Do I risk (significantl...
TITLE: Where can I find tools for learning assembler on OS X? QUESTION: I'd like to learn assembler. However, there are very few resources for doing assembler with OS X. Is there anyone out there who has programmed in assembly on a Mac? Where did you learn? And, is there any reason I shouldn't be doing assembly? Do I ...
[ "macos", "assembly" ]
22
13
9,732
10
0
2008-09-26T03:03:32.577000
2008-09-26T03:09:29.973000
137,530
177,214
Why is my stored procedure receiving a null parameter?
Ok, this is a curly one. I'm working on some Delphi code that I didn't write, and I'm encountering a very strange problem. One of my stored procedures' parameters is coming through as null, even though it's definitely being sent 1. The Delphi code uses a TADOQuery to execute the stored procedure (anonymized): ADOQuery1...
Ok, progress is made.. sort of. @Robsoft was correct, setting the parameter direction to pdInput fixed the issue. I traced into the VCL code, and it came down to TParameters.InternalRefresh.RefreshFromOleDB. This function is being called when I set the SQL.Text. Here's the (abridged) code: function TParameters.Internal...
Why is my stored procedure receiving a null parameter? Ok, this is a curly one. I'm working on some Delphi code that I didn't write, and I'm encountering a very strange problem. One of my stored procedures' parameters is coming through as null, even though it's definitely being sent 1. The Delphi code uses a TADOQuery ...
TITLE: Why is my stored procedure receiving a null parameter? QUESTION: Ok, this is a curly one. I'm working on some Delphi code that I didn't write, and I'm encountering a very strange problem. One of my stored procedures' parameters is coming through as null, even though it's definitely being sent 1. The Delphi code...
[ "sql-server", "delphi", "stored-procedures" ]
2
0
4,433
8
0
2008-09-26T03:05:03.430000
2008-10-07T04:08:43.707000
137,534
137,725
What makes this the fastest JavaScript for printing 1 to 1,000,000 (separated by spaces) in a web browser?
I was reading about output buffering in JavaScript here, and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to the header "The winning one million number script".) After studying it a bit, I have a few questions: What makes this script ...
What makes this script so efficient compared to other approaches? There are several optimizations that the author is making to this algorithm. Each of these requires a fairly deep understanding of how the are underlying mechanisms utilized (e.g. Javascript, CPU, registers, cache, video card, etc.). I think there are 2 ...
What makes this the fastest JavaScript for printing 1 to 1,000,000 (separated by spaces) in a web browser? I was reading about output buffering in JavaScript here, and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to the header "The wi...
TITLE: What makes this the fastest JavaScript for printing 1 to 1,000,000 (separated by spaces) in a web browser? QUESTION: I was reading about output buffering in JavaScript here, and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to ...
[ "javascript", "optimization", "buffer" ]
10
7
1,947
4
0
2008-09-26T03:07:30.883000
2008-09-26T04:07:06.620000
137,544
138,299
Assembler library for .NET, assembling runtime-variable strings into machine code for injection
Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own? To be clear - I don't want to call assembly code from C# - I just want to be able to assemble code from instructions and ge...
As part of some early prototyping I did on a personal project, I wrote quite a bit of code to do something like this. It doesn't take strings -- x86 opcodes are methods on an X86Writer class. Its not documented at all, and has nowhere near complete coverage, but if it would be of interest, I would be willing to open-so...
Assembler library for .NET, assembling runtime-variable strings into machine code for injection Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own? To be clear - I don't want ...
TITLE: Assembler library for .NET, assembling runtime-variable strings into machine code for injection QUESTION: Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own? To be cle...
[ "c#", "assembly", "x86" ]
19
15
7,803
8
0
2008-09-26T03:09:51.733000
2008-09-26T08:28:46.897000
137,550
137,591
Is programming a subset of math?
I've heard many times that all programming is really a subset of math. Some suggest that OO, at its roots, is mathematically based, but I don't get the connection, aside from some obvious examples: using induction to prove a recursive algorithm, formal correctness proofs, functional languages, lambda calculus, asymptot...
Overall, remember that mathematics is a formal codification of logic, which is also what we do in software. The list of topics in your question is loaded with mathematical problems. We are able to do programming on a fairly high level of abstraction, so the raw mathematics may not be staring you in the face. For exampl...
Is programming a subset of math? I've heard many times that all programming is really a subset of math. Some suggest that OO, at its roots, is mathematically based, but I don't get the connection, aside from some obvious examples: using induction to prove a recursive algorithm, formal correctness proofs, functional lan...
TITLE: Is programming a subset of math? QUESTION: I've heard many times that all programming is really a subset of math. Some suggest that OO, at its roots, is mathematically based, but I don't get the connection, aside from some obvious examples: using induction to prove a recursive algorithm, formal correctness proo...
[ "math" ]
66
47
18,545
29
0
2008-09-26T03:11:29.610000
2008-09-26T03:26:40.570000
137,580
137,624
How can I perform a HEAD request with the mechanize library?
I know how to do a HEAD request with httplib, but I have to use mechanize for this site. Essentially, what I need to do is grab a value from the header (filename) without actually downloading the file. Any suggestions how I could accomplish this?
Mechanize itself only sends GETs and POSTs, but you can easily extend the Request class to send HEAD. Example: import mechanize class HeadRequest(mechanize.Request): def get_method(self): return "HEAD" request = HeadRequest("http://www.example.com/") response = mechanize.urlopen(request) print response.info()
How can I perform a HEAD request with the mechanize library? I know how to do a HEAD request with httplib, but I have to use mechanize for this site. Essentially, what I need to do is grab a value from the header (filename) without actually downloading the file. Any suggestions how I could accomplish this?
TITLE: How can I perform a HEAD request with the mechanize library? QUESTION: I know how to do a HEAD request with httplib, but I have to use mechanize for this site. Essentially, what I need to do is grab a value from the header (filename) without actually downloading the file. Any suggestions how I could accomplish ...
[ "python", "http-headers", "mechanize" ]
3
8
1,289
2
0
2008-09-26T03:20:19.027000
2008-09-26T03:37:33.103000
137,621
137,947
Is it ok to call a virtual method from Dispose or a destructor?
I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable. Is this true and if so can someone explain why?
Calling virtual methods from a finalizer/ Dispose is unsafe, for the same reasons it is unsafe to do in a constructor. It is impossible to be sure that the derived class has not already cleaned-up some state that the virtual method requires to execute properly. Some people are confused by the standard Disposable patter...
Is it ok to call a virtual method from Dispose or a destructor? I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable. Is this true and if so can someone explain why?
TITLE: Is it ok to call a virtual method from Dispose or a destructor? QUESTION: I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable. Is this true and if so can someone explain why? ANSWER: Ca...
[ ".net", "principles" ]
2
5
566
4
0
2008-09-26T03:36:24.073000
2008-09-26T05:46:42.420000
137,623
137,631
Is Test Driven Development good for a starter?
Expanding this question on how I learnt to pass from problem description to code Two people mentioned TDD. Would it be good for a starter to get into TDD ( and avoid bad habits in the future? ) Or would it be too complex for a stage when understand what a programming language is?
TDD is meant to be simpler than the "traditional" method (of not testing it till the end) - because the tests clarify what you understand of the problem. If you actually didn't have a clear idea of what the problem was, writing tests is quite hard. So for a beginner, writing tests gets the thinking juice going in the r...
Is Test Driven Development good for a starter? Expanding this question on how I learnt to pass from problem description to code Two people mentioned TDD. Would it be good for a starter to get into TDD ( and avoid bad habits in the future? ) Or would it be too complex for a stage when understand what a programming langu...
TITLE: Is Test Driven Development good for a starter? QUESTION: Expanding this question on how I learnt to pass from problem description to code Two people mentioned TDD. Would it be good for a starter to get into TDD ( and avoid bad habits in the future? ) Or would it be too complex for a stage when understand what a...
[ "tdd" ]
10
9
1,779
14
0
2008-09-26T03:37:21.573000
2008-09-26T03:39:49.057000
137,630
180,440
Encapsulating SQL in a named_scope
I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.
While you can put any SQL you like in the conditions of a named scope, if you then call find_by_sql then the 'scopes' get thrown away. Given: class Item # Anything you can put in an sql WHERE you can put here named_scope:mine,:conditions=>'user_id = 12345 and IS_A_NINJA() = 1' end This works (it just sticks the SQL str...
Encapsulating SQL in a named_scope I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.
TITLE: Encapsulating SQL in a named_scope QUESTION: I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently. ANSWER: While you can put an...
[ "sql", "ruby-on-rails", "named-scope" ]
9
10
5,848
3
0
2008-09-26T03:39:31.820000
2008-10-07T21:09:35.627000
137,645
137,684
How do you pipe an inputstream to a zipped file as it's read in with Java?
I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the zip as I get it.
ZipOutputStream targetStream = new ZipOutputStream(fileToSaveTo); ZipEntry entry = new ZipEntry(nameOfFileInZipFile); targetStream.putNextEntry(entry); byte[] dataBlock = new byte[1024]; int count = inputStream.read(dataBlock, 0, 1024); while (count!= -1) { targetStream.write(dataBlock, 0, count); count = inputStream....
How do you pipe an inputstream to a zipped file as it's read in with Java? I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the zip as I get it.
TITLE: How do you pipe an inputstream to a zipped file as it's read in with Java? QUESTION: I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the...
[ "java", "zip", "inputstream" ]
7
8
7,279
1
0
2008-09-26T03:43:38.190000
2008-09-26T03:51:49.667000
137,647
137,653
IoC Containers - Which is best? (.Net)
I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is ...
"Best" will always be subjective. That said, I favor Castle Windsor because its XML is simpler. I've only tried Windsor and Spring.NET, by the way, so I couldn't say much about the others.
IoC Containers - Which is best? (.Net) I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weakne...
TITLE: IoC Containers - Which is best? (.Net) QUESTION: I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. What are some of the differences amongst those mentioned (and any I neglected)....
[ ".net", "inversion-of-control", "containers" ]
2
4
1,689
3
0
2008-09-26T03:44:07.877000
2008-09-26T03:45:20.837000
137,657
137,734
Free install wizard software
Is there something like InstallShield that I can use for free?
WiX Very powerful and flexible. Can produce MSI packages (Microsoft deployment format of choice) Almost no documentation Very steep learning curve. XML-based. Recommended for very complex installators. Inno Setup Cannot produce MSI packages. Its scripting part looks like INI files structure. Uses Pascal Script based la...
Free install wizard software Is there something like InstallShield that I can use for free?
TITLE: Free install wizard software QUESTION: Is there something like InstallShield that I can use for free? ANSWER: WiX Very powerful and flexible. Can produce MSI packages (Microsoft deployment format of choice) Almost no documentation Very steep learning curve. XML-based. Recommended for very complex installators....
[ "deployment", "installation", "release-management" ]
66
110
31,636
15
0
2008-09-26T03:47:07.010000
2008-09-26T04:09:51.870000
137,659
137,682
Persistence of std::map in C++
Do you know any easy or simple way to make a map object (from the STL library) persistent (i.e. write it to a file) so that you can recover its state later when the program in run later?? Thanks for your help
I believe the Boost Serialization library is capable of serializing std::map, but the standard library itself provides no means. Serialization is a great library with a lot of features and is easy to use and to extend to your own types.
Persistence of std::map in C++ Do you know any easy or simple way to make a map object (from the STL library) persistent (i.e. write it to a file) so that you can recover its state later when the program in run later?? Thanks for your help
TITLE: Persistence of std::map in C++ QUESTION: Do you know any easy or simple way to make a map object (from the STL library) persistent (i.e. write it to a file) so that you can recover its state later when the program in run later?? Thanks for your help ANSWER: I believe the Boost Serialization library is capable ...
[ "c++", "dictionary", "persistence" ]
10
11
5,399
3
0
2008-09-26T03:47:18.883000
2008-09-26T03:51:14.803000
137,660
1,432,088
Where does Console.WriteLine go in ASP.NET?
In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the output of Console.WriteLine() go? The IIS process must have a stdin, stdout ...
If you look at the Console class in.NET Reflector, you'll find that if a process doesn't have an associated console, Console.Out and Console.Error are backed by Stream.Null (wrapped inside a TextWriter ), which is a dummy implementation of Stream that basically ignores all input, and gives no output. So it is conceptua...
Where does Console.WriteLine go in ASP.NET? In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the output of Console.WriteLine() go...
TITLE: Where does Console.WriteLine go in ASP.NET? QUESTION: In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the output of Cons...
[ "asp.net", "iis", "console.writeline" ]
391
229
353,597
14
0
2008-09-26T03:47:41.097000
2009-09-16T10:05:01.097000
137,661
137,675
How do you do polymorphism in Ruby?
In C#, I can do this: class Program { static void Main(string[] args) { List animals = new List (); animals.Add(new Dog()); animals.Add(new Cat()); foreach (Animal a in animals) { Console.WriteLine(a.MakeNoise()); a.Sleep(); } } } public class Animal { public virtual string MakeNoise() { return String.Empty; } publi...
edit: added more code for your updated question disclaimer: I haven't used Ruby in a year or so, and don't have it installed on this machine, so the syntax might be entirely wrong. But the concepts are correct. The exact same way, with classes and overridden methods: class Animal def MakeNoise return "" end def Sleep p...
How do you do polymorphism in Ruby? In C#, I can do this: class Program { static void Main(string[] args) { List animals = new List (); animals.Add(new Dog()); animals.Add(new Cat()); foreach (Animal a in animals) { Console.WriteLine(a.MakeNoise()); a.Sleep(); } } } public class Animal { public virtual string MakeNo...
TITLE: How do you do polymorphism in Ruby? QUESTION: In C#, I can do this: class Program { static void Main(string[] args) { List animals = new List (); animals.Add(new Dog()); animals.Add(new Cat()); foreach (Animal a in animals) { Console.WriteLine(a.MakeNoise()); a.Sleep(); } } } public class Animal { public vir...
[ "c#", "ruby", "polymorphism" ]
14
15
11,608
8
0
2008-09-26T03:47:45.667000
2008-09-26T03:49:52.310000
137,679
137,692
Apache Redirect only when entering a password
I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not worki...
You need to use a Cond to test for both port (http or httpd) and query string: RewriteCond %{SERVER_PORT} 80 RewriteCond %{QUERY_STRING} (.+) RewriteRule /openid/index.php https://%{SERVER_NAME}/openid/index.php?%1 if on.htaccess you must use instead RewriteCond %{SERVER_PORT} 80 RewriteCond %{QUERY_STRING} (.+) Rewrit...
Apache Redirect only when entering a password I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This i...
TITLE: Apache Redirect only when entering a password QUESTION: I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed c...
[ "apache", "mod-rewrite", "phpmyid" ]
2
2
559
2
0
2008-09-26T03:50:38.673000
2008-09-26T03:54:07.167000
137,688
137,702
C# 3 new feature posts (and not about .Net 3.5 features)
There are a lot of new features that came with the.Net Framework 3.5. Most of the posts and info on the subject list stuff about new 3.5 features and C# 3 changes at the same time. But C# 3 can be used without.Net 3.5. Does anyone know of a good post describing the changes to the language? (Besides the boring, explicit...
Update: I can certainly understand. Eric Lippert has some more indepth posts.. Check them out. I liked the series of posts by scottgu on the new language features.. Some more info here as well http://www.danielmoth.com/Blog/2007/11/top-10-things-to-know-about-visual.html esp the section on language features.
C# 3 new feature posts (and not about .Net 3.5 features) There are a lot of new features that came with the.Net Framework 3.5. Most of the posts and info on the subject list stuff about new 3.5 features and C# 3 changes at the same time. But C# 3 can be used without.Net 3.5. Does anyone know of a good post describing t...
TITLE: C# 3 new feature posts (and not about .Net 3.5 features) QUESTION: There are a lot of new features that came with the.Net Framework 3.5. Most of the posts and info on the subject list stuff about new 3.5 features and C# 3 changes at the same time. But C# 3 can be used without.Net 3.5. Does anyone know of a good...
[ "c#", ".net", ".net-3.5", "c#-3.0" ]
11
15
7,090
6
0
2008-09-26T03:53:07.857000
2008-09-26T03:56:35.053000
137,699
969,249
Does WebMethods ESB scale?
I'm looking for people who have had experiences scaling WebMethods ESB to large traffic volumes (both size and number of messages). How has that gone? Were there any issues and how did you solve them?
From the environments I've dealt with (from 4 to 1000 servers) it scales pretty well. It depends wildly on the type of information transport technology you are managing. Fastest is the proprietary webMethods Broker, which, on a well configured server, can easily handle millions of >100kb messages per day. If you use a ...
Does WebMethods ESB scale? I'm looking for people who have had experiences scaling WebMethods ESB to large traffic volumes (both size and number of messages). How has that gone? Were there any issues and how did you solve them?
TITLE: Does WebMethods ESB scale? QUESTION: I'm looking for people who have had experiences scaling WebMethods ESB to large traffic volumes (both size and number of messages). How has that gone? Were there any issues and how did you solve them? ANSWER: From the environments I've dealt with (from 4 to 1000 servers) it...
[ "soa", "esb", "webmethods" ]
1
3
1,896
2
0
2008-09-26T03:56:13.230000
2009-06-09T10:23:48.330000
137,711
467,631
Do you use WaTiR?
Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?
I didn't feel that I could mark any 1 of these as an answer. From what I see from the responses, is that WaTiR is one of the best if you're sticking with Ruby as the testing language. I personally agree with Ryan Guest about Selenium due to the cross browser support and language-agnostic approach. On the other hand, it...
Do you use WaTiR? Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?
TITLE: Do you use WaTiR? QUESTION: Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use? ANSWER: I didn't feel that I could mark any 1 of these as an answer. From what I see from the responses, is that WaTiR is one of the best if you're st...
[ "automated-tests", "integration-testing", "watir", "functional-testing", "web-testing" ]
2
2
1,851
8
0
2008-09-26T03:59:57.357000
2009-01-22T00:24:48.147000
137,717
137,792
Spell-check in Aquamacs Emacs won't work: "Wrong endian order."
This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check: Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order. ADDED: I indeed had the wrong version of cocoAspell. But installing the right version didn't work until I a...
I believe you have the wrong version of the coco interface to Aspell for your mac. Check this site and download the appropriate version (PowerPC/Intel): http://people.ict.usc.edu/~leuski/cocoaspell/
Spell-check in Aquamacs Emacs won't work: "Wrong endian order." This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check: Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order. ADDED: I indeed had the wrong version of co...
TITLE: Spell-check in Aquamacs Emacs won't work: "Wrong endian order." QUESTION: This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check: Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order. ADDED: I indeed had the w...
[ "macos", "emacs", "spell-checking", "aquamacs" ]
1
2
1,019
2
0
2008-09-26T04:02:28.067000
2008-09-26T04:36:30.777000
137,720
137,738
Which distro of Linux is best suited for Java web apps?
There are so many Linux distributions to choose from! What is the "best" linux flavor for a web hosting environment running primarily: Apache HTTP, Tomcat or JBoss, MySQL and Alfresco (not necessarily all in the same instance). Are there any significant differences in terms of ease of administration and configuration, ...
They all use similar tools to administer things like webmin, and sshd. What are you more familiar with. Red Hat based systems(fedora, mandriva) or Debian based systems(Ubuntu). This family divide will determine a few things. First rpm packaging vs deb packaging. You also want to look at the level of activity of the pro...
Which distro of Linux is best suited for Java web apps? There are so many Linux distributions to choose from! What is the "best" linux flavor for a web hosting environment running primarily: Apache HTTP, Tomcat or JBoss, MySQL and Alfresco (not necessarily all in the same instance). Are there any significant difference...
TITLE: Which distro of Linux is best suited for Java web apps? QUESTION: There are so many Linux distributions to choose from! What is the "best" linux flavor for a web hosting environment running primarily: Apache HTTP, Tomcat or JBoss, MySQL and Alfresco (not necessarily all in the same instance). Are there any sign...
[ "java", "mysql", "linux", "hosting", "alfresco" ]
10
7
7,506
8
0
2008-09-26T04:04:09.047000
2008-09-26T04:11:20.713000
137,741
137,786
How to use POP3 over SSL in C
I would like to know and understand the steps involved in fetching mail from pop3 server using plain c language
Steps: Connect to the server's port (usually 995) using OpenSSL Verify the certificate Send regular pop3 commands over the SSL socket you just opened. (LIST, RETR and so on) Retrieve the responses Close the socket Or use a library that does all of the above for you
How to use POP3 over SSL in C I would like to know and understand the steps involved in fetching mail from pop3 server using plain c language
TITLE: How to use POP3 over SSL in C QUESTION: I would like to know and understand the steps involved in fetching mail from pop3 server using plain c language ANSWER: Steps: Connect to the server's port (usually 995) using OpenSSL Verify the certificate Send regular pop3 commands over the SSL socket you just opened. ...
[ "c", "ssl", "pop3" ]
1
3
1,991
3
0
2008-09-26T04:13:48.227000
2008-09-26T04:33:45.293000
137,743
137,761
MDIParent Tiling children
Is there any way to tile all of the form children of an mdi parent easily? I'm looking for most of the functionality that windows offers, tile cascade. Anyone know of an easy way?
try these... // Tile all child forms horizontally. this.LayoutMdi( MdiLayout.TileHorizontal ); // Tile all child forms vertically. this.LayoutMdi( MdiLayout.TileVertical ); // Cascade all MDI child windows. this.LayoutMdi( MdiLayout.Cascade );
MDIParent Tiling children Is there any way to tile all of the form children of an mdi parent easily? I'm looking for most of the functionality that windows offers, tile cascade. Anyone know of an easy way?
TITLE: MDIParent Tiling children QUESTION: Is there any way to tile all of the form children of an mdi parent easily? I'm looking for most of the functionality that windows offers, tile cascade. Anyone know of an easy way? ANSWER: try these... // Tile all child forms horizontally. this.LayoutMdi( MdiLayout.TileHorizo...
[ ".net", "winforms", "parent", "mdi", "mdiparent" ]
6
7
2,344
1
0
2008-09-26T04:14:29.833000
2008-09-26T04:19:57.433000
137,745
137,764
Can i update a signed jar using an ANT Task?
Hi I am trying to deploy an application using webstart. I have a requirement to update a jar which is signed before i actually deploy( basically to update the IP/Port info). I am trying to use ANT to update the jar. Is there are way to achive this?
I can't speak specifically to ANT or to JAR files. But generally speaking, one of the purposes of signing is to prevent tampering with the code. Once the code has been modified, the signature is no longer valid and this is by design. You'd have to re-sign the JAR file after making the updates.
Can i update a signed jar using an ANT Task? Hi I am trying to deploy an application using webstart. I have a requirement to update a jar which is signed before i actually deploy( basically to update the IP/Port info). I am trying to use ANT to update the jar. Is there are way to achive this?
TITLE: Can i update a signed jar using an ANT Task? QUESTION: Hi I am trying to deploy an application using webstart. I have a requirement to update a jar which is signed before i actually deploy( basically to update the IP/Port info). I am trying to use ANT to update the jar. Is there are way to achive this? ANSWER:...
[ "ant", "jar", "java-web-start", "signing" ]
1
6
875
1
0
2008-09-26T04:14:46.040000
2008-09-26T04:21:13.310000
137,753
137,883
What is the best data structure in .NET for look-up by string key or numeric index?
I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas?
You want the OrderedDictionary class. You will need to include the System.Collections.Specialized namespace: OrderedDictionary od = new OrderedDictionary(); od.Add("abc", 1); od.Add("def", 2); od.Add("ghi", 3); od.Add("jkl", 4); // Can access via index or key value: Console.WriteLine(od[1]); Console.WriteLine(od["def"...
What is the best data structure in .NET for look-up by string key or numeric index? I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas?
TITLE: What is the best data structure in .NET for look-up by string key or numeric index? QUESTION: I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas? ...
[ ".net", "data-structures", "collections", "ordereddictionary" ]
6
7
3,608
7
0
2008-09-26T04:16:46.037000
2008-09-26T05:15:02.573000
137,755
138,606
How is a real-world simulation designed?
I am fascinated by the performance of applications such as "Rollercoaster Tycoon" and "The Sims" and FPS games. I would like to know more about the basic application architecture. (Not so concerned with the UI - I assume MVC/MVP piriciples apply here. Nor am I concerned with the math and physics at this point.) My main...
There are two basic ways of doing this kind of simulation Agent Based and System Dynamics. In and agent based simulation each entity in the game would be represented by an instance of a class with properties and behaviors, all the interactions between the entities would have to be explicitly defined and when you want t...
How is a real-world simulation designed? I am fascinated by the performance of applications such as "Rollercoaster Tycoon" and "The Sims" and FPS games. I would like to know more about the basic application architecture. (Not so concerned with the UI - I assume MVC/MVP piriciples apply here. Nor am I concerned with the...
TITLE: How is a real-world simulation designed? QUESTION: I am fascinated by the performance of applications such as "Rollercoaster Tycoon" and "The Sims" and FPS games. I would like to know more about the basic application architecture. (Not so concerned with the UI - I assume MVC/MVP piriciples apply here. Nor am I ...
[ "multithreading", "oop" ]
12
8
1,031
5
0
2008-09-26T04:17:15.583000
2008-09-26T10:14:40.137000
137,775
1,884,696
Should extension properties be added to C# 4.0?
I've wanted this for fluent interfaces. See, for example this Channel9 discussion. Would probably require also adding indexed properties. What are your thoughts? Would the advantages outweigh the "language clutter"?
In my book the #1 most substantial reason for extension properties is implementing fluent interface patterns around unowned code. I built a wrapper around the NHibernate session to make it more intitutive to work with so I can do logic similar to public bool IsInTransaction { get { return _session.Is().Not.Null && _ses...
Should extension properties be added to C# 4.0? I've wanted this for fluent interfaces. See, for example this Channel9 discussion. Would probably require also adding indexed properties. What are your thoughts? Would the advantages outweigh the "language clutter"?
TITLE: Should extension properties be added to C# 4.0? QUESTION: I've wanted this for fluent interfaces. See, for example this Channel9 discussion. Would probably require also adding indexed properties. What are your thoughts? Would the advantages outweigh the "language clutter"? ANSWER: In my book the #1 most substa...
[ "c#" ]
17
6
6,149
13
0
2008-09-26T04:28:28.270000
2009-12-10T22:58:47.823000
137,784
138,193
SSRS: Change SQL Statement Dynamically
I have a report in SSRS 2005 that's based on a query that's similar to this one: SELECT * FROM MyTable (NOLOCK) WHERE col1 = 'ABC' AND col2 LIKE '%XYZ%' I need to be able to dynamically include the AND part of the WHERE clause in the query based on whether the user has checked a checkbox. Basically, this is a dynamic S...
Charles almost had the correct answer. It should be: SELECT * FROM MyTable (NOLOCK) WHERE col1 = 'ABC' AND (@checked = 0 OR col2 LIKE '%XYZ%') This is a classic "pattern" in SQL for conditional predicates. If @checked = 0, then it will return all rows matching the remainder of the predicate ( col1 = 'ABC' ). SQL Server...
SSRS: Change SQL Statement Dynamically I have a report in SSRS 2005 that's based on a query that's similar to this one: SELECT * FROM MyTable (NOLOCK) WHERE col1 = 'ABC' AND col2 LIKE '%XYZ%' I need to be able to dynamically include the AND part of the WHERE clause in the query based on whether the user has checked a c...
TITLE: SSRS: Change SQL Statement Dynamically QUESTION: I have a report in SSRS 2005 that's based on a query that's similar to this one: SELECT * FROM MyTable (NOLOCK) WHERE col1 = 'ABC' AND col2 LIKE '%XYZ%' I need to be able to dynamically include the AND part of the WHERE clause in the query based on whether the us...
[ "sql-server", "t-sql", "reporting-services", "reportingservices-2005" ]
5
15
13,920
8
0
2008-09-26T04:33:41.643000
2008-09-26T07:46:50.383000
137,793
327,301
Suggestions on using Flex with WCF and Linq to Entities
So I am working on a project that uses a ASP.NET server and we have entities being passed over WCF from LINQ-to-Entity queries. I have already overcome the cyclic reference issue with WCF. Now that I am looking toward the next step, the Flex UI, I am wondering what things people have already faced either with dealing w...
I would check out Fluorine FX. It is a very mature and stable AMF implementation for.NET and it does provide WCF integration. A colleague of mine has posted some information here: http://jimdonaghy.com/?p=11
Suggestions on using Flex with WCF and Linq to Entities So I am working on a project that uses a ASP.NET server and we have entities being passed over WCF from LINQ-to-Entity queries. I have already overcome the cyclic reference issue with WCF. Now that I am looking toward the next step, the Flex UI, I am wondering wha...
TITLE: Suggestions on using Flex with WCF and Linq to Entities QUESTION: So I am working on a project that uses a ASP.NET server and we have entities being passed over WCF from LINQ-to-Entity queries. I have already overcome the cyclic reference issue with WCF. Now that I am looking toward the next step, the Flex UI, ...
[ "apache-flex", "wcf", "actionscript-3", "actionscript" ]
3
3
3,346
3
0
2008-09-26T04:37:18.077000
2008-11-29T07:14:14.373000
137,803
137,818
SQL SERVER, SELECT statement with auto generate row id
Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.
If you are making use of GUIDs this should be nice and easy, if you are looking for an integer ID, you will have to wait for another answer. SELECT newId() AS ColId, Col1, Col2, Col3 FROM table1 The newId() will generate a new GUID for you that you can use as your automatically generated id column.
SQL SERVER, SELECT statement with auto generate row id Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.
TITLE: SQL SERVER, SELECT statement with auto generate row id QUESTION: Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000. ANSWER: If you are making use of GUIDs this should be nice and easy, if you are looking for an integer ID, you will have to wait for...
[ "sql-server" ]
24
21
188,125
9
0
2008-09-26T04:40:43.887000
2008-09-26T04:46:58.460000
137,817
137,914
Can Windows PE 2.0 support the .NET framework?
I'm interested in building a PC for a car that will boot off of a USB flash drive. I'm planning on using Windows PE 2.0 for it with the GUI being written in C# or VB.NET. Obviously, for this to work, I'd need to have.NET 2.0 or later installed. Understanding that.NET is not included by default, is there a way to packag...
Not sure if this will help you, but here's a.NET 2.0 plug-in which requires "PE Builder 3.x or Microsoft Windows PE 2004 or 2005".
Can Windows PE 2.0 support the .NET framework? I'm interested in building a PC for a car that will boot off of a USB flash drive. I'm planning on using Windows PE 2.0 for it with the GUI being written in C# or VB.NET. Obviously, for this to work, I'd need to have.NET 2.0 or later installed. Understanding that.NET is no...
TITLE: Can Windows PE 2.0 support the .NET framework? QUESTION: I'm interested in building a PC for a car that will boot off of a USB flash drive. I'm planning on using Windows PE 2.0 for it with the GUI being written in C# or VB.NET. Obviously, for this to work, I'd need to have.NET 2.0 or later installed. Understand...
[ ".net", "winpe" ]
0
2
2,963
2
0
2008-09-26T04:46:14.437000
2008-09-26T05:31:19.320000
137,837
137,843
newline character(s)
Does your software handle newline characters from other systems? Linux/BSD linefeed ^J 10 x0A Windows/IBM return linefeed ^M^J 13 10 x0D x0A old Macs return ^M 13 x0D others? For reasons of insanity, I am going with using the Linux version of the newline character in my text files. But, when I bring my text files over ...
As they say, be strict in what you write and liberal in what you read. Your application should be able to work properly reading both line endings. If you want to use linefeeds, and potentially upset Windows users, that's fine. But save for Notepad, most programs I play with seem to be happy with both methods. (And I us...
newline character(s) Does your software handle newline characters from other systems? Linux/BSD linefeed ^J 10 x0A Windows/IBM return linefeed ^M^J 13 10 x0D x0A old Macs return ^M 13 x0D others? For reasons of insanity, I am going with using the Linux version of the newline character in my text files. But, when I brin...
TITLE: newline character(s) QUESTION: Does your software handle newline characters from other systems? Linux/BSD linefeed ^J 10 x0A Windows/IBM return linefeed ^M^J 13 10 x0D x0A old Macs return ^M 13 x0D others? For reasons of insanity, I am going with using the Linux version of the newline character in my text files...
[ "text", "encoding", "newline" ]
3
3
1,452
8
0
2008-09-26T04:52:18.073000
2008-09-26T04:56:38.450000
137,840
137,908
Moving WCF service from IIS to a Windows service
We have an existing WCF service that makes use of wsDualHttpBinding to enable callbacks to the client. I am considering moving it to netTcpBinding for better performance, but I'm quite wary of moving away from the IIS-hosted service (a "comfort zone" we currently enjoy) into having our own Windows service to host it. I...
So as you cannot host using WAS there are a couple of things to realise. If the service crashes it doesn't restart by default (although you can change this in service properties) IIS will recycle the application pool if it hangs or grows too big; you must do this yourself if you want the same sort of reliability. You m...
Moving WCF service from IIS to a Windows service We have an existing WCF service that makes use of wsDualHttpBinding to enable callbacks to the client. I am considering moving it to netTcpBinding for better performance, but I'm quite wary of moving away from the IIS-hosted service (a "comfort zone" we currently enjoy) ...
TITLE: Moving WCF service from IIS to a Windows service QUESTION: We have an existing WCF service that makes use of wsDualHttpBinding to enable callbacks to the client. I am considering moving it to netTcpBinding for better performance, but I'm quite wary of moving away from the IIS-hosted service (a "comfort zone" we...
[ "wcf", "iis", "windows-services" ]
3
11
8,070
2
0
2008-09-26T04:54:29.237000
2008-09-26T05:28:09.483000
137,845
137,853
Determining whether an object is a member of a collection in VBA
How do I determine whether an object is a member of a collection in VBA? Specifically, I need to find out whether a table definition is a member of the TableDefs collection.
Your best bet is to iterate over the members of the collection and see if any match what you are looking for. Trust me I have had to do this many times. The second solution (which is much worse) is to catch the "Item not in collection" error and then set a flag to say the item does not exist.
Determining whether an object is a member of a collection in VBA How do I determine whether an object is a member of a collection in VBA? Specifically, I need to find out whether a table definition is a member of the TableDefs collection.
TITLE: Determining whether an object is a member of a collection in VBA QUESTION: How do I determine whether an object is a member of a collection in VBA? Specifically, I need to find out whether a table definition is a member of the TableDefs collection. ANSWER: Your best bet is to iterate over the members of the co...
[ "vba", "object", "ms-access", "collections" ]
76
28
157,740
16
0
2008-09-26T04:57:09.887000
2008-09-26T05:00:26.883000
137,868
137,946
Using the "final" modifier whenever applicable in Java
In Java, there is a practice of declaring every variable (local or class), parameter final if they really are. Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly marked. What are your thoughts on this and what do you foll...
I think it all has to do with good coding style. Of course you can write good, robust programs without using a lot of final modifiers anywhere, but when you think about it... Adding final to all things which should not change simply narrows down the possibilities that you (or the next programmer, working on your code) ...
Using the "final" modifier whenever applicable in Java In Java, there is a practice of declaring every variable (local or class), parameter final if they really are. Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly mark...
TITLE: Using the "final" modifier whenever applicable in Java QUESTION: In Java, there is a practice of declaring every variable (local or class), parameter final if they really are. Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intenti...
[ "java", "oop" ]
210
209
74,438
25
0
2008-09-26T05:05:59.070000
2008-09-26T05:45:57.833000
137,870
148,278
How to change directory security attributes using InstallShield?
I'd like to change the security attribute of a directory that InstallShield creates under the CSIDL_COMMON_APPDATA - can someone please advise on how to do that during the installation process? It's a script-defined folder. Thank you.
you can also just easily call Windows commands "CACLS.EXE" or "ICACLS.EXE" -both are easy command line tool, e.g. icacls file /grant Administrator:(D,WDAC) - Will grant the user Administrator Delete and Write DAC permissions to file
How to change directory security attributes using InstallShield? I'd like to change the security attribute of a directory that InstallShield creates under the CSIDL_COMMON_APPDATA - can someone please advise on how to do that during the installation process? It's a script-defined folder. Thank you.
TITLE: How to change directory security attributes using InstallShield? QUESTION: I'd like to change the security attribute of a directory that InstallShield creates under the CSIDL_COMMON_APPDATA - can someone please advise on how to do that during the installation process? It's a script-defined folder. Thank you. A...
[ "installation", "installshield" ]
2
0
7,742
4
0
2008-09-26T05:07:21.297000
2008-09-29T11:06:54.580000
137,893
141,194
C# Mono - Low Level Keyboard Hook
I'm using code that I found on the CodeProject.com for a low-level keyboard hook. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using.net, and Linux using mono? Edit: Clarifying what...
It's not possible to get this behavior using only.Net. You have to use a binary driver for each platform you run on (Windows, Linux, Mac OS). It might be possible to use only P/Invoke (detect what OS you are running on, call appropriate system libraries) so that you won't have to distribute any "extra" dll/so/dylib.
C# Mono - Low Level Keyboard Hook I'm using code that I found on the CodeProject.com for a low-level keyboard hook. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using.net, and Linux...
TITLE: C# Mono - Low Level Keyboard Hook QUESTION: I'm using code that I found on the CodeProject.com for a low-level keyboard hook. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows us...
[ "c#", "mono", "keyboard-hook" ]
3
3
3,739
2
0
2008-09-26T05:20:24.900000
2008-09-26T18:41:31.157000
137,911
438,254
What's the best way to add tags to the head in Plone?
I want to add the link tags to redirect my web-site to my OpenID provider. These tags should go in the head element. What's the best way to add them in Plone? I understand that filling the head_slot is a way to do it, but that can only happen when you are adding a template to the page and that template is being rendere...
I couldn't understand how to fill a slot without a product or anything. I understand that you can fill a slot from a template, but if Plone is not picking up that template, then the filling code would never be run. I ended up modifying main_template and putting my code directly in the. This is bad because different ski...
What's the best way to add tags to the head in Plone? I want to add the link tags to redirect my web-site to my OpenID provider. These tags should go in the head element. What's the best way to add them in Plone? I understand that filling the head_slot is a way to do it, but that can only happen when you are adding a t...
TITLE: What's the best way to add tags to the head in Plone? QUESTION: I want to add the link tags to redirect my web-site to my OpenID provider. These tags should go in the head element. What's the best way to add them in Plone? I understand that filling the head_slot is a way to do it, but that can only happen when ...
[ "openid", "plone" ]
3
0
2,032
4
0
2008-09-26T05:28:53.960000
2009-01-13T07:56:17.347000
137,926
137,931
Is Firebug on Firefox 3 stable yet?
I really should upgrade to Firefox 3, but I'm very dependent on Firebug working properly. I know there is a version of Firebug that is supposed to work with Firefox 3, but last time I looked, there seemed to be problems with it. So, for those that have made the jump, is Firebug on Firefox 3 ready for prime time?
Yes, I've been using Firebug heavily and it's been rock-steady. What problems were you having in particular? We could test and report the results.
Is Firebug on Firefox 3 stable yet? I really should upgrade to Firefox 3, but I'm very dependent on Firebug working properly. I know there is a version of Firebug that is supposed to work with Firefox 3, but last time I looked, there seemed to be problems with it. So, for those that have made the jump, is Firebug on Fi...
TITLE: Is Firebug on Firefox 3 stable yet? QUESTION: I really should upgrade to Firefox 3, but I'm very dependent on Firebug working properly. I know there is a version of Firebug that is supposed to work with Firefox 3, but last time I looked, there seemed to be problems with it. So, for those that have made the jump...
[ "firebug", "firefox-3" ]
1
7
765
10
0
2008-09-26T05:36:06.577000
2008-09-26T05:38:33.407000
137,933
141,848
What is the best scripting language to embed in a C# desktop application?
We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an option), but the managed code derivative VSTA (I think) seems to have withered on the vine. Wh...
I've used CSScript with amazing results. It really cut down on having to do bindings and other low level stuff in my scriptable apps.
What is the best scripting language to embed in a C# desktop application? We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an option), but the man...
TITLE: What is the best scripting language to embed in a C# desktop application? QUESTION: We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an op...
[ "c#", "scripting" ]
100
24
82,134
15
0
2008-09-26T05:40:01.797000
2008-09-26T20:41:35.580000