Id
int64
4
8.51M
PostTypeId
int64
1
7
AcceptedAnswerId
int64
7
75.5M
ParentId
int64
4
41.8M
Score
int64
-208
27.7k
ViewCount
int64
11
12.4M
Body
stringlengths
0
45k
Title
stringlengths
2
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
225
CreationDate
stringdate
2008-07-31 21:42:52
2011-12-14 18:48:47
LastActivityDate
stringdate
2008-08-01 12:19:17
2023-03-05 04:40:26
LastEditDate
stringdate
2008-08-01 13:54:25
2023-03-05 03:12:45
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
-1
21.1M
Tags
listlengths
1
6
23,976
2
null
23,930
7
null
Here is a simple recursive definition: ``` (define (factorial x) (if (= x 0) 1 (* x (factorial (- x 1))))) ``` In Scheme tail-recursive functions use constant stack space. Here is a version of factorial that is tail-recursive: ``` (define factorial (letrec ((fact (lambda (x accum) (if...
null
CC BY-SA 2.5
null
2008-08-23T04:25:31.067
2008-08-23T15:24:44.383
2008-08-23T15:24:44.383
658
658
null
24,023
2
null
23,950
6
null
``` class Producer implements Runnable { private final BlockingQueue queue; Producer(BlockingQueue q) { queue = q; } public void run() { try { while (true) { queue.put(produce()); } } catch (InterruptedException ex) { ... handle ...} } Object produce() { ... } } class Consumer impleme...
null
CC BY-SA 2.5
null
2008-08-23T05:39:15.197
2008-08-23T05:39:15.197
null
null
198
null
24,016
2
null
24,004
2
null
If you are uncertain about how to best access the database you should be using tried and tested solutions like the application blocks from Microsoft - [http://msdn.microsoft.com/en-us/library/cc309504.aspx](http://msdn.microsoft.com/en-us/library/cc309504.aspx). They can also prove helpful to you by examining how that ...
null
CC BY-SA 2.5
null
2008-08-23T05:18:17.633
2008-08-23T05:18:17.633
null
null
202
null
24,039
2
null
18,265
2
null
Dereks solution is probably the best, but here's an alternative anyway: Recent Linux kernel version allow you to pipe core dumps to a script or program. You could write a script to catch the core dump, collect any extra information you need and mail everything back. This is a global setting though, so it'd apply to a...
null
CC BY-SA 2.5
null
2008-08-23T06:31:11.717
2008-08-23T06:31:11.717
null
null
1,466
null
24,012
2
null
21,848
31
null
I think you should consider a different development strategy to prevent issues like this. One that seems to work best for me is to never do development directly on my master branch. Regardless of the changes I'm making, I always create a new branch for new code: From there, I can push out the changes to public rep...
null
CC BY-SA 2.5
null
2008-08-23T05:16:32.177
2008-08-23T05:16:32.177
null
null
2,063
null
24,027
2
null
23,994
0
null
> Why the choice of NHibernate over anything else? It's a very powerful tool, and is (relatively) easy to learn. It takes away all the monotony and repetitiveness of manually implementing object-relational mapping.
null
CC BY-SA 2.5
null
2008-08-23T05:49:34.857
2008-08-23T05:49:34.857
null
null
423
null
24,044
2
null
24,041
298
null
- [Markup](http://en.wikipedia.org/wiki/Markup_language)- [Markdown](http://en.wikipedia.org/wiki/Markdown)[http://daringfireball.net/projects/markdown/](http://daringfireball.net/projects/markdown/)[https://en.wikipedia.org/wiki/Markdown](https://en.wikipedia.org/wiki/Markdown)
null
CC BY-SA 4.0
null
2008-08-23T06:40:08.683
2020-07-31T23:46:56.177
2020-07-31T23:46:56.177
2,780,192
2,477
null
24,041
1
24,044
null
271
106,450
I'm using markdown to edit this question right now. In some [wikis](http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page#Wiki_markup) I used wiki markup. Are they the same thing? Are they related? Please explain. If I want to implement one or the other in a web project (like stackoverflow) what do I need to use?
Markdown vs markup - are they related?
CC BY-SA 2.5
0
2008-08-23T06:34:09.493
2020-07-31T23:46:56.177
2008-08-25T11:37:54.257
1,693
1,363
[ "markdown", "markup", "glossary" ]
24,042
2
null
24,041
32
null
Markdown is a play on words because it is markup. "Markdown" is a proper noun. Markup is just a way of providing functionality above plain text. For example: formatting, links, images, etc.
null
CC BY-SA 2.5
null
2008-08-23T06:38:07.037
2008-08-23T06:38:07.037
null
null
55
null
24,050
2
null
23,963
1
null
Today's web browsers only handle GETS + POSTS. In Rails, for example, PUTS + DELETES are "faked" through hidden form fields. Unless your framework has some workaround to "support" PUTS + DELETES, don't worry about them for now.
null
CC BY-SA 2.5
null
2008-08-23T06:51:40.870
2008-08-23T06:51:40.870
null
null
2,477
null
24,045
1
24,062
null
59
27,553
I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason I should switch to VisualSVN? AnkhSVN is free (in more than one sense of the word) while VisualSVN costs $50. So right there unless I'm missing some great feature of VisualSVN I don't see any reason to switch.
AnkhSVN versus VisualSVN
CC BY-SA 2.5
0
2008-08-23T06:42:01.067
2018-10-04T05:45:54.530
2012-07-19T12:41:21.503
761,095
163
[ "visual-studio", "svn", "version-control", "visualsvn", "ankhsvn" ]
24,053
2
null
24,046
3
null
I've noticed something very similar. I think it is because Firefox and IE, when going back, are retrieving the page from the server again and Safari is not. Have you tried adding a page expiry/no cache header? I was going to look into it when I discovered the behaviour but haven't had time yet.
null
CC BY-SA 2.5
null
2008-08-23T07:05:40.510
2008-08-23T07:05:40.510
null
null
1,142
null
24,049
2
null
24,046
3
null
I have no idea what's causing the problem but I know who might be able to help you. Safari is built on [Webkit](http://webkit.org/) and short of Apple (who are not so community minded) the [Webkit team](http://webkit.org/contact.html) might know what the issue is. It's not a stupid question at all.
null
CC BY-SA 2.5
null
2008-08-23T06:50:34.947
2008-08-23T06:50:34.947
null
null
1,384,652
null
23,930
1
441,229
null
64
29,138
I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language. ## Ideas: - - - - - - - - [Polyglot](http://en.wikipedia.org/wiki/Polyglot_%28computing%29) Basically I want to see an example, ...
Factorial Algorithms in different languages
CC BY-SA 2.5
0
2008-08-23T03:46:32.750
2014-09-21T15:40:13.450
2020-06-20T09:12:55.060
-1
1,337
[ "algorithm", "language-agnostic" ]
24,046
1
null
null
49
40,531
I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years. ...
The Safari Back Button Problem
CC BY-SA 2.5
0
2008-08-23T06:43:08.427
2021-08-27T06:45:26.987
null
null
2,051
[ "javascript", "safari" ]
24,062
2
null
24,045
48
null
I used VisualSVN until Ankh hit 2.0, and ever since, I've abandoned VisualSVN. Ankh has surpassed VisualSVN in functionality, in my mind, and all the 1.x perf and integration issues are gone.
null
CC BY-SA 2.5
null
2008-08-23T07:44:29.870
2008-08-23T07:44:29.870
null
null
1,554
null
24,048
2
null
23,228
4
null
> .NET Strings are Immutable Therefore having an instance method makes absolutely no sense. By that logic the string class should have no instance methods which return modified copies of the object, yet it has (Trim, ToUpper, and so on). Furthermore, lots of other objects in the framework do this too. I agree that...
null
CC BY-SA 2.5
null
2008-08-23T06:44:52.760
2008-08-23T06:44:52.760
null
null
234
null
24,035
2
null
23,962
0
null
> The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers). Really? What computer are you using? It's taking a long time at 44, but the stack is not overflowing. In fact, your going to get a value bigger than an integer can hold (~4 billion unsigned, ~...
null
CC BY-SA 2.5
null
2008-08-23T06:18:55.740
2008-08-23T06:33:46.953
2008-08-23T06:33:46.953
77
77
null
24,073
2
null
23,994
2
null
I have used ASP.NET MVC for a few projects recently and its like a breath of fresh air compared to WebForms. It works the web rather than against it, and feels like a much more natural way to develop. I use SubSonic rather than NHibernate, and find it fits very nice within the MVC architecture. The building blocks I...
null
CC BY-SA 2.5
null
2008-08-23T08:02:51.370
2008-08-23T08:02:51.370
null
null
1,982
null
24,024
2
null
23,228
1
null
Non-overloaded, non-inherited static methods (like Class.b(a,c)) that take an instance as the first variable are semantically equivalent to a method call (like a.b(c)) so the platform team made an arbitrary, aesthetic choice. (Assuming it compiles to the same CIL, which it should.) The only way to know would be to ask ...
null
CC BY-SA 2.5
null
2008-08-23T05:41:40.930
2008-08-23T05:41:40.930
null
null
2,543
null
24,079
2
null
20,386
5
null
Block the finalizer thread. No other objects will be garbage collected until the finalizer thread is unblocked. Thus the amount of memory used will grow and grow. Further reading: [http://dotnetdebug.net/2005/06/22/blocked-finalizer-thread/](http://dotnetdebug.net/2005/06/22/blocked-finalizer-thread/)
null
CC BY-SA 2.5
null
2008-08-23T08:17:01.867
2010-08-01T10:50:32.280
2010-08-01T10:50:32.280
49
49
null
24,078
2
null
3,049
12
null
If you want to code in Java I really recommend SerialIOs [SerialPort](http://serialio.com/products/serialport/serialport.php). It is very easy to use and saves you days of work. I've never found an open source library as good as SerialIO, REALLY! My advice: do not use Sun's serial IO framework! It is from 1998 and ful...
null
CC BY-SA 3.0
null
2008-08-23T08:15:37.253
2014-04-07T08:29:25.017
2014-04-07T08:29:25.017
2,554
2,554
null
24,080
2
null
23,963
3
null
You can also use X-Http-Verb-Override:DELETE inst. of HTTP DELETE. This is also usefull for Silverlight clients who cant change the HTTP verbs and only support GET and POST...
null
CC BY-SA 2.5
null
2008-08-23T08:20:47.070
2008-08-23T08:20:47.070
null
null
1,199,387
null
24,075
2
null
21,514
2
null
davidg was on the right track, and I am crediting him with the answer. But the WMI query necessary was a little less than straightfoward, since I needed not just a list of users for the whole machine, but the subset of users , whether local or domain, that were members of the local Administrators group. For the record...
null
CC BY-SA 2.5
null
2008-08-23T08:14:15.430
2008-08-23T08:23:05.830
2008-08-23T08:23:05.830
2,383
2,383
null
24,087
2
null
19,604
0
null
Carlton : Alfresco seems to be a Java based solution. Ta: I've looked into the plugin folders but none was really good for asp.net mvc. What I'm now testing is a mix between Tiny with the image uploader of FCKEditor: this is the pho version but I think it is pretty easy to convert to .net [Tinyfck][1] [1]: this: [http...
null
CC BY-SA 2.5
null
2008-08-23T08:38:17.200
2008-08-23T08:38:17.200
null
null
1,929
null
24,090
2
null
22,836
48
null
The statement: ``` (my $newstring = $oldstring) =~ s/foo/bar/g; ``` Which is equivalent to: ``` my $newstring = $oldstring; $newstring =~ s/foo/bar/g; ``` Alternatively, as of Perl 5.13.2 you can use `/r` to do a non destructive substitution: ``` use 5.013; #... my $newstring = $oldstring =~ s/foo/bar/gr; ```
null
CC BY-SA 4.0
null
2008-08-23T08:53:44.620
2018-06-30T17:13:22.980
2018-06-30T17:13:22.980
1,753,929
238
null
24,082
2
null
12,927
3
null
If JConsole can't be used you can - - `kill -3 <process id>` to get a full Thread Dump. This doesn't affect performance and can always be run in production.
null
CC BY-SA 3.0
null
2008-08-23T08:22:58.703
2015-08-20T22:20:12.353
2015-08-20T22:20:12.353
7,226
2,554
null
24,093
2
null
24,041
158
null
Mark-up is a term from print editing - the editor would go through the text and add annotations (i.e. this in italic, that in bold) for the printers to use when producing the final version. This was called marking up the text. A computer mark-up language is just a standardised short-hand for these sorts of annotations...
null
CC BY-SA 2.5
null
2008-08-23T09:09:32.880
2019-11-13T07:09:17.727
2019-11-13T07:09:17.727
905
905
null
24,085
2
null
23,994
4
null
I've been building a few sites with the framework since the first preview came out, and it has certainly come a long way already. It feels like a very light-weight and tidy framework. There are a couple of areas where I think it really excels over "vanilla" asp.net: - - - That said, there are some areas where it ha...
null
CC BY-SA 2.5
null
2008-08-23T08:31:23.223
2008-08-23T08:31:23.223
null
null
1,710
null
24,098
2
null
23,962
2
null
According to [wikipedia](http://en.wikipedia.org/wiki/Fibonacci_number) Fib(0) should be 0 but it does not matter. Here is simple C# solution with for cycle: ``` ulong Fib(int n) { ulong fib = 1; // value of fib(i) ulong fib1 = 1; // value of fib(i-1) ulong fib2 = 0; // value of fib(i-2) for (int i = 0; i <...
null
CC BY-SA 2.5
null
2008-08-23T09:18:38.163
2008-08-23T09:23:38.370
2008-08-23T09:23:38.370
2,361
2,361
null
24,084
2
null
23,228
2
null
@Jared: > Non-overloaded, non-inherited static methods (like Class.b(a,c)) that take an instance as the first variable are semantically equivalent to a method call (like a.b(c)) No, they aren't. > (Assuming it compiles to the same CIL, which it should.) That's your mistake. The CIL produced is different. The distin...
null
CC BY-SA 2.5
null
2008-08-23T08:25:19.257
2008-08-23T08:25:19.257
null
null
1,968
null
24,100
2
null
23,961
1
null
It's good that you block bad request after a couple of trials, but you should let it continue. If you block it after 5 bad requests you won't know if the 6th request wouldn't crash your site. EDIT: I meant that some attacker might send only one request but similar to one of those 1495 that You didn't test because you...
null
CC BY-SA 2.5
null
2008-08-23T09:22:05.627
2008-08-23T09:22:05.627
null
null
1,534
null
24,074
2
null
23,802
0
null
@Kevin: > I was just trying to point out that spl_autoload_register is a better alternative to __autoload since you can define multiple loaders, and they won't conflict with each other. Handy if you have to include libraries that define an __autoload function as well. Are you sure? The [documentation](http://www.php....
null
CC BY-SA 2.5
null
2008-08-23T08:14:10.610
2008-08-23T08:14:10.610
null
null
1,968
null
24,099
1
24,140
null
16
4,845
I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer? My previous boss suggested I get a TechNet Plus subscripti...
Best way to license Microsoft software as an independent developer
CC BY-SA 2.5
0
2008-08-23T09:19:54.883
2012-05-03T19:27:46.953
2012-05-03T19:27:46.953
352,841
163
[ "windows", "visual-studio", "licensing" ]
24,102
2
null
24,099
2
null
For non developer tools try Microsoft Action Pack [https://partner.microsoft.com/40016455](https://partner.microsoft.com/40016455) Then use Visual Studio Professional (in some exibitions you will get this for free) For the versioning use svn and not TeamSystem
null
CC BY-SA 2.5
null
2008-08-23T09:27:30.217
2008-08-23T09:27:30.217
null
null
1,929
null
24,103
2
null
23,102
0
null
I'm no expert, but from what I learned so far the golden rule is not to trust any user data (GET, POST, COOKIE). Common attack types and how to save yourself: 1. SQL Injection Attack: Use prepared queries 2. Cross Site Scripting: Send no user data to browser without filtering/escaping first. This also includes user d...
null
CC BY-SA 2.5
null
2008-08-23T09:30:18.057
2008-08-23T09:30:18.057
null
null
1,897
null
24,097
2
null
23,961
2
null
> Isn't it a security flaw of the site to let hackers throw everything in their arsenal against the site? Well, you should focus on closing holes, rather than trying to thwart scanners (which is a futile battle). Consider running such tests yourself.
null
CC BY-SA 2.5
null
2008-08-23T09:17:00.227
2008-08-23T09:17:00.227
null
null
1,600
null
24,059
2
null
24,046
7
null
An iframe solves the problem: ``` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head><title>Safari Back Button Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onload="alert('Hello');"> <a href="http://www.codinghorror.com">Coding Horror</a> ...
null
CC BY-SA 2.5
null
2008-08-23T07:36:39.470
2008-08-23T07:36:39.470
null
null
2,585
null
24,113
1
null
null
0
1,683
We have been developing an Outlook Add-in using Visual Studio 2008. However I am facing a strange behavior while adding a command button to a custom command bar. This behavior is reflected when we add the button in the reply, reply all and forward windows. The issue is that the caption of the command button is not visi...
Outlook Add-in using .NET
CC BY-SA 2.5
null
2008-08-23T09:57:28.693
2009-03-10T04:49:50.630
null
null
2,528
[ ".net", "outlook", "add-in" ]
24,110
2
null
24,109
18
null
Checkout Netbeans, it's written in Java so you'll have the same environment regardless of your OS, and it supports a lot more than just C++. I'm not going to try to convince you, because I think IDEs can be a very personal choice. For me it improves my productivity by being fast, supporting the languages I code in and...
null
CC BY-SA 2.5
null
2008-08-23T09:55:17.153
2008-08-23T09:55:17.153
null
null
1,693
null
24,061
2
null
13,857
23
null
To be honest, I understand closures perfectly well except I've never been clear about what exactly is the thing which is the "closure" and what's so "closure" about it. I recommend you give up looking for any logic behind the choice of term. Anyway, here's my explanation: ``` def foo(): x = 3 def bar(): p...
null
CC BY-SA 2.5
null
2008-08-23T07:43:18.127
2009-04-12T01:42:13.410
2009-04-12T01:42:13.410
1,586
1,586
null
24,130
1
24,134
null
6
1,791
Which is better to use in PHP, a 2D array or a class? I've included an example of what I mean by this. ``` // Using a class class someClass { public $name; public $height; public $weight; function __construct($name, $height, $weight) { $this -> name = $name; $this -> heigh...
Classes vs 2D arrays
CC BY-SA 3.0
null
2008-08-23T10:41:36.340
2012-11-03T20:46:54.423
2011-11-21T03:53:21.450
50,049
1,384,652
[ "php", "arrays", "class" ]
24,136
2
null
24,130
4
null
Generally, I follow this rule: 1) Make it a class if multiple parts of your application use the data structure. 2) Make it a 2D array if you're using it for quick processing of data in one part of your application.
null
CC BY-SA 2.5
null
2008-08-23T10:56:10.427
2008-08-23T10:56:10.427
null
null
1,693
null
24,131
2
null
24,130
4
null
It depends exactly what you mean by 'better'. I'd go for the object oriented way (using classes) because I find it makes for cleaner code (at least in my opinion). However, I'm not sure what the speed penalties might be for that option.
null
CC BY-SA 2.5
null
2008-08-23T10:42:51.347
2008-08-23T10:42:51.347
null
null
1,912
null
24,106
2
null
23,802
6
null
I my applications I usually have `setup.php` file that includes all core classes (i.e. framework and accompanying libraries). My custom classes are loaded using autoloader aided by directory layout map. Each time new class is added I run command line builder script that scans whole directory tree in search for model c...
null
CC BY-SA 2.5
null
2008-08-23T09:37:32.237
2008-08-23T09:37:32.237
null
null
2,169
null
24,068
2
null
23,373
1
null
There's also [Zinc](http://www.multidmedia.com/software/zinc/) that also provides API:s for accessing the filesystem and other thinks that AIR does, but less restrictive.
null
CC BY-SA 2.5
null
2008-08-23T07:55:39.750
2008-08-23T07:55:39.750
null
null
1,109
null
24,142
2
null
23,102
3
null
Most people here have mentioned SQL Injection and XSS, which is correct, but don't be fooled - the most important things you need to worry about as a web developer is INPUT VALIDATION, which is where XSS and SQL Injection stem from. For instance, if you have a form field that will only ever accept integers, make sure...
null
CC BY-SA 2.5
null
2008-08-23T11:03:30.393
2008-08-23T11:03:30.393
null
null
1,693
null
24,138
2
null
17,980
-1
null
One issue that hasn't been raised by others is whether is the same as a . On some systems a different format specifier was needed for a double compared to a float. Not least because the parameters passed could be of different sizes.
null
CC BY-SA 2.5
null
2008-08-23T11:00:49.087
2008-08-23T11:00:49.087
null
null
888
null
24,119
2
null
24,109
259
null
## Initially: confusion When originally writing this answer, I had recently made the switch from Visual Studio (with years of experience) to Linux and the first thing I did was try to find a reasonable IDE. At the time this was impossible: no good IDE existed. ## Epiphany: UNIX is an IDE. All of it.1 And then ...
null
CC BY-SA 3.0
null
2008-08-23T10:06:09.157
2016-11-02T14:49:19.650
2016-11-02T14:49:19.650
1,968
1,968
null
24,143
2
null
23,228
29
null
I don't actually know the answer but I suspect that it has something to do with the aspect of invoking methods on string literals directly. If I recall correctly (I didn't actually verify this because I don't have an old IDE handy), early versions of the C# IDE had trouble detecting method calls against string literal...
null
CC BY-SA 2.5
null
2008-08-23T11:05:01.653
2008-08-23T11:05:01.653
null
null
1,948
null
24,147
2
null
23,228
2
null
This is to avoid confusion with `.ToString()` methods. For instance: ``` double test = 1.54d; //string.Format pattern string.Format("This is a test: {0:F1}", test ); //ToString pattern "This is a test: " + test.ToString("F1"); ``` If Format was an instance method on string this could cause confusion, as the patte...
null
CC BY-SA 2.5
null
2008-08-23T11:10:27.987
2008-08-23T11:16:37.630
2008-08-23T11:16:37.630
905
905
null
24,150
2
null
14,165
2
null
Another possibility could be from side effects. Most min/max macros will include the parameters multiple times and may not do what you expect. Errors and warnings could also be generated. afterwards i is either plus 1 or plus 2 The () in the expansion are to avoid problems if you call it with formulae. Try expandin...
null
CC BY-SA 2.5
null
2008-08-23T11:17:25.570
2008-08-23T11:17:25.570
null
null
888
null
24,122
2
null
24,109
75
null
1. Code::Blocks 2. Eclipse CDT Soon you'll find that IDEs are not enough, and you'll have to learn the GCC toolchain anyway (which isn't hard, at least learning the basic functionality). But no harm in reducing the transitional pain with the IDEs, IMO.
null
CC BY-SA 2.5
null
2008-08-23T10:17:56.477
2008-08-23T10:17:56.477
null
null
1,897
null
24,109
1
24,119
null
209
1,027,514
I want to expand my programming horizons to Linux. A good, dependable basic toolset is important, and what is more basic than an IDE? I could find these SO topics: - [Lightweight IDE for linux](https://stackoverflow.com/questions/2756/lightweight-ide-for-linux)- [What tools do you use to develop C++ applications on L...
C++ IDE for Linux?
CC BY-SA 2.5
0
2008-08-23T09:52:59.517
2016-11-02T14:49:19.650
2017-05-23T12:18:36.167
-1
46
[ "c++", "linux", "ide" ]
24,157
2
null
21,464
1
null
Craig Hockenberry (developer of Twitterrific) blogs about iPhone development issues at [furbo.org](http://furbo.org/)
null
CC BY-SA 2.5
null
2008-08-23T11:31:25.397
2008-08-23T11:31:25.397
null
null
1,450
null
24,134
2
null
24,130
9
null
The "class" that you've constructed above is what most people would use a for in other languages. I'm not sure what the performance implications are in PHP, though I suspect instantiating the objects is probably more costly here, if only by a little bit. That being said, if the cost is relatively low, it IS a bit eas...
null
CC BY-SA 2.5
null
2008-08-23T10:52:51.727
2008-08-23T10:52:51.727
null
null
1,344
null
24,148
2
null
24,130
3
null
> > It's the speed that I am thinking of mostly, for anything more complex than what I have here I'd probably go with classes but the question is, what is the cost of a class? This would seem to be premature optimisation. Your application isn't going to take any real-world performance hit either way, but using a class...
null
CC BY-SA 2.5
null
2008-08-23T11:10:43.370
2008-08-23T11:10:43.370
null
null
137
null
24,137
2
null
23,802
1
null
You can also programmatically determine the location of the class file by using structured naming conventions that map to physical directories. This is how Zend do it in [Zend Framework](http://framework.zend.com/). So when you call `Zend_Loader::loadClass("Zend_Db_Table");` it explodes the classname into an array of d...
null
CC BY-SA 2.5
null
2008-08-23T10:58:06.257
2008-08-23T10:58:06.257
null
null
137
null
24,160
2
null
24,109
23
null
As an old-time UNIX guy, I always use Emacs. But that has a pretty steep and long learning curve, so I'm not sure I can recommend it to newcomers. There really isn't a "good" IDE for Linux. Eclipse is not very good for C/C++ (CDT is improving, but is not very useful yet). The others are missing all the features you...
null
CC BY-SA 2.5
null
2008-08-23T11:38:34.787
2009-05-08T09:39:07.260
2009-05-08T09:39:07.260
1,175
1,175
null
24,158
2
null
10,324
1
null
> Why is a code solution that works getting voted down? Sure, it's ugly ... Perhaps because as well as being ugly it isn't educational and work. Also, I suspect that like me, most people don't have the power to edit at present (and judging by the rank needed - never will). The use of an array can be good for ef...
null
CC BY-SA 2.5
null
2008-08-23T11:32:17.217
2008-08-23T11:32:17.217
null
null
888
null
24,162
2
null
20,262
0
null
Just tossing out a second recommendation for Working Effectively with Legacy Code, an excellent book that really opened my eyes to the fact that almost any old / crappy / untestable code can be wrangled!
null
CC BY-SA 2.5
null
2008-08-23T11:43:53.027
2008-08-23T11:43:53.027
null
null
2,272
null
24,168
1
null
null
37
34,823
When writing database queries in something like TSQL or PLSQL, we often have a choice of iterating over rows with a cursor to accomplish the task, or crafting a single SQL statement that does the same job all at once. Also, we have the choice of simply pulling a large set of data back into our application and then pro...
Why are relational set-based queries better than cursors?
CC BY-SA 2.5
0
2008-08-23T12:04:48.700
2021-12-22T22:36:43.940
2021-12-22T22:36:43.940
4,294,399
1,219
[ "sql", "language-agnostic", "database-cursor" ]
24,140
2
null
24,099
5
null
I recommend that if VS Express is not good enough, use Professional. Standard is missing some really useful features, like a Remote Debugger. Here is a detailed comparison: [http://msdn.microsoft.com/en-us/vs2008/products/cc149003.aspx](http://msdn.microsoft.com/en-us/vs2008/products/cc149003.aspx) I'd say cancel Tec...
null
CC BY-SA 2.5
null
2008-08-23T11:02:29.800
2008-08-23T11:02:29.800
null
null
91
null
24,169
2
null
23,962
4
null
# Quick and dirty memoization in C++: Any recursive method `type1 foo(type2 bar) { ... }` is easily memoized with `map<type2, type1> M`. ``` // your original method int fib(int n) { if(n==0 || n==1) return 1; return fib(n-1) + fib(n-2); } // with memoization map<int, int> M = map<int, int>(); int ...
null
CC BY-SA 2.5
null
2008-08-23T12:07:18.773
2008-08-24T00:25:50.010
2008-08-24T00:25:50.027
88
88
null
24,170
2
null
24,168
20
null
The main reason that I'm aware of is that set-based operations can be optimised by the engine by running them across multiple threads. For example, think of a quicksort - you can separate the list you're sorting into multiple "chunks" and sort each separately in their own thread. SQL engines can do similar things with ...
null
CC BY-SA 2.5
null
2008-08-23T12:08:33.480
2008-08-23T12:08:33.480
null
null
615
null
24,171
2
null
24,130
2
null
The class that you have is not a real class in OO terms - its just been contructed to take the space of the instance variables. That said - there propably isnt much issue with speed - its just a style thing in your example. The intresting bit - is if you contsrtucted the object to be a real "person" class - and think...
null
CC BY-SA 2.5
null
2008-08-23T12:12:18.323
2008-08-23T12:12:18.323
null
null
null
null
24,174
2
null
24,109
5
null
I hear Anjuta is pretty slick for Gnome users. I played a bit with KDevelop and it's nice, but sort of lacking featurewise. Code::Blocks is also very promising, and I like that one best.
null
CC BY-SA 2.5
null
2008-08-23T12:14:51.907
2008-08-23T12:14:51.907
null
null
2,018
null
24,161
2
null
2,873
0
null
is constantly updated... so why would you want a more recent one. BTW flexelint lint
null
CC BY-SA 2.5
null
2008-08-23T11:42:30.360
2008-08-23T11:42:30.360
null
null
888
null
24,156
2
null
24,109
32
null
> could you clarify a little bit more how it was for you, what you had to change. Maybe you could point me in the right direction by providing some links to the information you used. My first source were actually the tools' `man` pages. Just type ``` $ man toolname ``` on the command line (`$` here is part of the p...
null
CC BY-SA 3.0
null
2008-08-23T11:30:54.897
2012-01-18T10:51:02.403
2012-01-18T10:51:02.403
1,968
1,968
null
24,176
2
null
24,168
0
null
The idea behind preferring to do the work in queries is that the database engine can optimize by reformulating it. That's also why you'd want to run EXPLAIN on your query, to see what the db is doing. (e.g. taking advantage of indices, table sizes and sometimes even knowledge about the distributions of values in colum...
null
CC BY-SA 2.5
null
2008-08-23T12:16:59.967
2008-08-23T12:16:59.967
null
null
1,421
null
24,180
2
null
24,045
4
null
The main thing is that VisualSVN uses TortoiseSVN for nearly all of its UI. So you only really have to set up one client (preferred diff viewer, etc), and you can take advantage of things like the same "Previous messages" button on the Commit dialog, whether you're committing from Explorer or Visual Studio.
null
CC BY-SA 2.5
null
2008-08-23T12:26:29.037
2008-08-23T15:00:01.383
2008-08-23T15:00:01.383
1,278
1,278
null
24,179
1
36,398
null
57
44,149
I'm interested in finding out how the recently-released ([http://mirror.facebook.com/facebook/hive/hadoop-0.17/](http://mirror.facebook.com/facebook/hive/hadoop-0.17/)) Hive compares to HBase in terms of performance. The SQL-like interface used by Hive is very much preferable to the HBase API we have implemented.
How does Hive compare to HBase?
CC BY-SA 2.5
0
2008-08-23T12:22:04.993
2016-11-02T14:36:22.383
null
null
2,588
[ "hadoop", "hbase", "hive" ]
24,175
2
null
23,962
1
null
@ESRogs: `std::map` lookup is (log ) which makes it slow here. Better use a vector. ``` vector<unsigned int> fib_cache; fib_cache.push_back(1); fib_cache.push_back(1); unsigned int fib(unsigned int n) { if (fib_cache.size() <= n) fib_cache.push_back(fib(n - 1) + fib(n - 2)); return fib_cache[n]; } `...
null
CC BY-SA 2.5
null
2008-08-23T12:16:51.260
2008-08-23T12:16:51.260
null
null
1,968
null
24,166
2
null
10,949
1
null
I like to write unit tests that use one of the builtin serializers on the original and the cloned object and then check the serialized representations for equality (for a binary formatter, I can just compare the byte arrays). This works great in cases where the object is still serializable, and I'm only changing to a ...
null
CC BY-SA 2.5
null
2008-08-23T12:03:01.513
2008-08-23T12:03:01.513
null
null
1,948
null
24,178
2
null
23,689
5
null
I don't, but there's a Java port called [jchronic](https://jchronic.dev.java.net/). If nothing else, it could provide a good jumping-off point for your own. Or perhaps you could use a semi-automatic Java to C# translator like [Octopus](http://www.remotesoft.com/octopus/try.html) to help translate it. (Or something bett...
null
CC BY-SA 2.5
null
2008-08-23T12:18:29.043
2008-08-23T13:33:50.763
2008-08-23T13:33:50.763
1,199
1,199
null
24,187
2
null
24,099
2
null
I realise that this doesn't apply to the asker but it it is relevent to the question. Any out there try [Microsfts Dream Spark scheme](https://downloads.channel8.msdn.com/). Visual Studio, Expression Studio, XNA and Server 2003 for free! Office is also available to students for less than 60 bucks in [Microsfts `Ulti...
null
CC BY-SA 2.5
null
2008-08-23T12:38:02.707
2008-08-23T12:38:02.707
null
null
199
null
24,185
2
null
22,907
-1
null
> is it good system architecture if you let connect 1000 desktops directly to database? No it's obviously not, it's maybe a poor example but I think the point I was trying to make is clear, your DBA looks after your database infrastructure this is were their expertise is, stuffing SQL in code locks the door to the...
null
CC BY-SA 2.5
null
2008-08-23T12:37:08.187
2008-08-23T12:37:08.187
null
null
1,603
null
24,192
2
null
24,168
0
null
set based is done in one operation cursor as many operations as the rowset of the cursor
null
CC BY-SA 2.5
null
2008-08-23T12:41:07.210
2008-08-23T12:41:07.210
null
null
740
null
24,159
2
null
24,109
5
null
Although I use Vim, some of my co-workers use [SlickEdit](http://www.slickedit.com/) which looks pretty good. I'm not certain about integrated debugging because we wouldn't be able to do that on our particular project anyway. SlickEdit does have good support for navigating large code bases, with cross referencing and ...
null
CC BY-SA 2.5
null
2008-08-23T11:34:54.467
2009-10-07T13:59:22.783
2009-10-07T13:59:22.783
63,550
893
null
24,165
1
null
null
9
1,909
The last time I took on a non-trivial .Net/C# application I used Castle Monorail and, on the whole, enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC. How did ...
From Monorail to ASP.Net MVC
CC BY-SA 2.5
0
2008-08-23T12:01:25.603
2010-06-18T10:29:11.993
2009-09-04T15:54:17.680
1,820
1,820
[ "c#", ".net", "asp.net-mvc", "castle-monorail" ]
24,199
2
null
24,193
2
null
I recall that in previous versions of VS, there was a way to add custom build steps to the build process. I used that a lot to do exactly the kind of automated code generation you describe. I imagine the custom build step feature is still there in 2008.
null
CC BY-SA 2.5
null
2008-08-23T12:49:12.977
2008-08-23T12:49:12.977
null
null
893
null
24,190
2
null
23,907
5
null
The first thing that jumps to mind is the possibility of your git history having a nonlinear history. You might have difficulty determining a sensible sequence of commits. Having said that, it seems like you could keep a log of commit ids and the corresponding lines of code in that commit. In a post-commit hook, start...
null
CC BY-SA 2.5
null
2008-08-23T12:39:52.673
2008-08-23T12:39:52.673
null
null
893
null
24,193
1
24,248
null
5
1,901
I had an idea, if I add a python .py file to my C# project, and tag the file with a custom generator that would execute the python file, and treat the output as the result of the code generation, ie. put it into a C# file, that would allow me to do quite a lot of code generation as part of the build process. Does anyo...
Python code generator for Visual Studio?
CC BY-SA 2.5
0
2008-08-23T12:41:43.433
2008-10-21T20:30:33.330
2008-08-25T12:20:11.487
123
267
[ "python", "visual-studio-2008", "code-generation" ]
24,204
2
null
24,200
-1
null
Yes your ideas will help. Lean on option 1 if there are no reads happening while your loading. Lean on option 2 if you destination table is being queried during your processing. @Andrew Question. Your inserting in chunks of 300. What is the total amount your inserting? SQL server should be able to handle 300 plain ...
null
CC BY-SA 2.5
null
2008-08-23T12:56:59.887
2008-08-23T13:02:43.897
2008-08-23T13:02:43.897
1,293
1,293
null
24,208
2
null
1,607
3
null
For my current PHP project we use the idea of rails migrations and we have a migrations directory in which we keep files title "migration_XX.sql" where XX is the number of the migration. Currently these files are created by hand as updates are made, but their creation could be easily modified. Then we have a script c...
null
CC BY-SA 2.5
null
2008-08-23T12:58:24.407
2008-08-23T12:58:24.407
null
null
2,594
null
24,196
1
24,223
null
0
365
We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press "buttons" (certain bitmaps) that cause actions to occur. We currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button-presses. But we'd like to have the follow...
Simple Frameworks for Displaying Bitmaps and Handling Button Presses
CC BY-SA 2.5
null
2008-08-23T12:47:55.587
2014-03-11T18:42:03.997
2014-03-11T18:42:03.997
321,731
1,175
[ "c++", "user-interface", "graphics", "bitmap" ]
24,200
1
null
null
60
86,606
I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process. I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but I'm still...
What's the fastest way to bulk insert a lot of data in SQL Server (C# client)
CC BY-SA 3.0
0
2008-08-23T12:53:09.520
2022-07-18T10:14:58.810
2013-06-10T16:35:17.160
139,010
1,948
[ "c#", "sql", "sql-server", "sql-server-2005" ]
24,214
2
null
24,200
5
null
Have you tried using transactions? From what you describe, having the server committing 100% of the time to disk, it seems you are sending each row of data in an atomic SQL sentence thus forcing the server to commit (write to disk) every single row. If you used transactions instead, the server would only commit at t...
null
CC BY-SA 2.5
null
2008-08-23T13:10:32.847
2008-08-23T13:10:32.847
null
null
2,384
null
24,212
1
30,029
null
3
2,098
What's the best way to use QT4's [QItemDelegate](http://doc.qt.io/qt-4.8/qitemdelegate.html) to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating `pixmaps` from very large image files (> 500MB)? Can anyone link to some example code that achieves this?...
Use QItemDelegate to show image thumbnails
CC BY-SA 4.0
null
2008-08-23T13:07:19.517
2018-11-10T18:54:32.990
2018-11-10T18:54:32.990
null
1,304
[ "c++", "qt", "image", "thumbnails", "qitemdelegate" ]
24,207
1
71,401
null
1
2,796
I'm trying to use “rusage” statistics in my program to get data similar to that of the [time](http://en.wikipedia.org/wiki/Time_%28Unix%29) tool. However, I'm pretty sure that I'm doing something wrong. The values seem about right but can be a bit weird at times. I didn't find good resources online. Does somebody know ...
“rusage” statistics
CC BY-SA 2.5
null
2008-08-23T12:57:16.483
2008-10-13T09:36:13.937
2008-08-23T13:06:27.897
1,968
1,968
[ "c++", "unix", "time", "profiling" ]
24,219
2
null
16,918
22
null
If you're like me, and like videos of presentations, than this is a good tutorial: - [Part 1](https://www.youtube.com/watch?v=jLj1QV11o9g)- [Part 2](https://www.youtube.com/watch?v=IqXTUbdLig0)- [Slides](https://www.microsoft.com/en-us/research/uploads/prod/2007/07/TasteOfHaskell.pdf) It's a three-hour tutorial, that ...
null
CC BY-SA 4.0
null
2008-08-23T13:19:45.977
2021-05-17T11:04:45.050
2021-05-17T11:04:45.050
2,597
2,597
null
24,191
2
null
24,099
5
null
You have the Microsoft Empower for ISV program, see [https://partner.microsoft.com/40011351](https://partner.microsoft.com/40011351) Gives you a full msdn pro subscription for two years.
null
CC BY-SA 2.5
null
2008-08-23T12:40:44.167
2008-08-23T12:40:44.167
null
null
2,593
null
24,167
2
null
23,448
9
null
Jay Fields and Obie Fernandez have written and talked extensively on the subject. - [Domain Specific Languages](http://blog.jayfields.com/2008/02/designing-domain-specific-language.html)- [Business Natural Language](http://bnl.jayfields.com/01_introduction.html)- [Expressing Contract Terms in a DSL](http://www.jroller...
null
CC BY-SA 2.5
null
2008-08-23T12:04:32.493
2008-08-23T12:04:32.493
null
null
341
null
24,221
1
24,231
null
120
35,156
What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they affect the program at run time? What are their typical usages? Are they unique to Java? Is there a C++ equivalent?
Java Annotations
CC BY-SA 3.0
0
2008-08-23T13:23:14.957
2022-04-13T23:11:04.620
2013-01-31T17:36:03.393
354,009
142
[ "java", "annotations", "glossary" ]
24,225
2
null
24,196
0
null
You could try [wxWidgets](http://www.wxwidgets.org/) (it has wxBitmapButton) or try to implement your own solution using [SDL](http://www.libsdl.org/) for all of the graphics.
null
CC BY-SA 2.5
null
2008-08-23T13:29:08.747
2008-08-23T13:29:08.747
null
null
1,534
null
24,224
2
null
24,200
19
null
You're already using [SqlBulkCopy](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx), which is a good start. However, just using the SqlBulkCopy class does not necessarily mean that SQL will perform a bulk copy. In particular, there are a few requirements that must be met for SQL Server t...
null
CC BY-SA 2.5
null
2008-08-23T13:27:42.807
2008-08-23T13:27:42.807
null
null
1,690
null
24,236
2
null
24,193
1
null
I don't understand what you are trying to do here. Are you trying to execute a Python script that generates a C# file and then compile that with the project? Or are you trying to compile a Python script to C#?
null
CC BY-SA 2.5
null
2008-08-23T13:42:39.837
2008-08-23T13:42:39.837
null
null
2,384
null
24,231
2
null
24,221
86
null
Annotations are primarily used by code that is inspecting other code. They are often used for modifying (i.e. decorating or wrapping) existing classes at run-time to change their behavior. Frameworks such as [JUnit](http://www.junit.org/) and [Hibernate](http://www.hibernate.org/) use annotations to minimize the amount...
null
CC BY-SA 3.0
null
2008-08-23T13:38:25.760
2013-03-22T17:56:44.590
2013-03-22T17:56:44.590
700,533
1,709
null
24,234
2
null
24,168
16
null
In addition to the above "let the DBMS do the work" (which is a great solution), there are a couple other good reasons to leave the query in the DBMS: - - - -
null
CC BY-SA 2.5
null
2008-08-23T13:42:12.210
2008-08-23T22:00:40.063
2008-08-23T22:00:40.063
2,590
2,590
null
24,240
2
null
24,109
7
null
I quite like [Ultimate++](http://www.ultimatepp.org/)'s IDE. It has some features that were designed to use with their own library (which, BTW, is quite a nice toolkit if you don't want to buy on either GTK+ or QT) but it works perfectly well with general C++ projects. It provides decent code completion, good syntax co...
null
CC BY-SA 2.5
null
2008-08-23T13:52:25.837
2008-10-11T17:50:12.240
2008-10-11T17:50:12.240
2,147
2,384
null