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,816 | 2 | null | 23,603 | 2 | null | You might find [piston](http://piston.rubyforge.org/) provides a solution
It's primarily used for importing ruby on rails plugins, but I don't see why it shouldn't work for any subversion repositories.
Basically what it does is this:
- - -
This means you can keep a reference to a particular version of a remote rep... | null | CC BY-SA 2.5 | null | 2008-08-23T01:16:19.930 | 2008-08-23T01:16:19.930 | null | null | 234 | null |
23,812 | 2 | null | 23,755 | 16 | null | There is another alternative, which is the approach utilized by the STL of C++:
```
find(haystack.begin(), haystack.end(), needle)
```
I think it's a great example of C++ shouting "in your face!" to OOP. The idea is that OOP is not a silver bullet of any kind; sometimes things are best described in terms of action... | null | CC BY-SA 2.5 | null | 2008-08-23T01:05:14.213 | 2008-08-23T01:05:14.213 | null | null | 456 | null |
23,815 | 2 | null | 20,788 | 1 | null | We use Programming Research's [QAC](http://www.programmingresearch.com) for our C code. Works OK.
Recently we have been talking about checking out some of the more advanced and static/dynamic code analyzers like Coverity's [Prevent](http://www.coverity.com/html/coverity-prevent.html) or the analysis tool by [GrammaTe... | null | CC BY-SA 3.0 | null | 2008-08-23T01:11:19.583 | 2012-12-18T15:45:51.900 | 2012-12-18T15:45:51.900 | 1,880,332 | 2,386 | null |
23,819 | 2 | null | 20,788 | 6 | null | For C and Objective-C, you can also use the [LLVM](http://llvm.org/)/[Clang](http://clang.llvm.org/) [Static Analyzer](http://clang-analyzer.llvm.org/).
It's Open Source and under active development.
| null | CC BY-SA 3.0 | null | 2008-08-23T01:19:17.643 | 2012-02-02T22:00:34.127 | 2012-02-02T22:00:34.127 | 76,391 | 714 | null |
23,818 | 2 | null | 23,755 | 3 | null | It depends on your requirements.
For instance, if you don't care about the searcher's properties (e.g. searcher strength, vision, etc.), then I would say haystack.find(needle) would be the cleanest solution.
But, if you do care about the searcher's properties (or any other properties for that matter), I would inject ... | null | CC BY-SA 2.5 | null | 2008-08-23T01:17:31.597 | 2008-08-23T01:17:31.597 | null | null | 1,574 | null |
23,814 | 2 | null | 23,755 | 56 | null | Of the three, I prefer option #3.
The [Single Responsibility Principle](http://en.wikipedia.org/wiki/Single_responsibility_principle) makes me not want to put searching capabilities on my DTOs or models. Their responsibility is to be data, not to find themselves, nor should needles need to know about haystacks, nor ha... | null | CC BY-SA 2.5 | null | 2008-08-23T01:08:11.930 | 2008-08-23T01:08:11.930 | null | null | 1,554 | null |
23,787 | 1 | 23,799 | null | 11 | 23,791 | What is the best way to find something in a list? I know LINQ has some nice tricks, but let's also get suggestions for C# 2.0. Lets get the best refactorings for this common code pattern.
Currently I use code like this:
```
// mObjList is a List<MyObject>
MyObject match = null;
foreach (MyObject mo in mObjList)
{
... | Cleanest Way to Find a Match In a List | CC BY-SA 2.5 | 0 | 2008-08-23T00:22:24.910 | 2008-09-24T14:44:27.557 | 2008-09-24T14:44:27.557 | 12,870 | 1,490 | [
"c#",
"refactoring"
] |
23,820 | 2 | null | 12,633 | 120 | null | If you need a cross-platform solution, try Boost's [Program Options](http://www.boost.org/doc/libs/1_36_0/doc/html/program_options.html) library.
| null | CC BY-SA 2.5 | null | 2008-08-23T01:21:09.857 | 2008-09-10T06:37:08.137 | 2008-09-10T06:37:08.137 | 2,574 | 2,574 | null |
23,828 | 2 | null | 23,166 | 21 | null | Try [Real World Haskell](http://book.realworldhaskell.org/beta/index.html). It's free online.
| null | CC BY-SA 2.5 | null | 2008-08-23T01:29:15.623 | 2008-08-23T01:29:15.623 | null | null | 718 | null |
23,770 | 1 | 23,777 | null | 27 | 18,903 | What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have changed over time. For instance, right now reco... | Effective strategy for leaving an audit trail/change history for DB applications? | CC BY-SA 3.0 | 0 | 2008-08-23T00:05:58.210 | 2019-04-25T01:44:19.517 | 2017-10-11T14:07:25.447 | 2,567 | 2,567 | [
"database",
"postgresql",
"database-design",
"crud",
"audit-trail"
] |
23,817 | 2 | null | 609 | 4 | null | To get rid of the _AFXDLL error, have you tried changing to the settings to use MFC as a static lib instead of a DLL? This is similar to what you're already doing in changing the runtime libs to static instead of DLL.
| null | CC BY-SA 2.5 | null | 2008-08-23T01:16:26.200 | 2008-08-23T01:16:26.200 | null | null | 2,574 | null |
23,825 | 2 | null | 23,770 | 12 | null | If you are using Hibernate, take a look at [JBoss Envers](http://www.jboss.org/envers/). From the project homepage:
> The Envers project aims to enable easy versioning of persistent JPA classes. All that you have to do is annotate your persistent class or some of its properties, that you want to version, with @Version... | null | CC BY-SA 2.5 | null | 2008-08-23T01:28:23.177 | 2008-08-23T01:28:23.177 | 2017-05-23T11:46:41.443 | -1 | 1,793 | null |
23,833 | 2 | null | 23,689 | 2 | null | I'm not aware of one, but it sounded like a cool problem, so here's my whack at it (VB.NET):
```
Private Function ConvertDateTimeToStringRelativeToNow(ByVal d As DateTime) As String
Dim diff As TimeSpan = DateTime.Now().Subtract(d)
If diff.Duration.TotalMinutes < 1 Then Return "Now"
Dim str As String
... | null | CC BY-SA 2.5 | null | 2008-08-23T01:41:34.220 | 2008-08-24T01:27:34.573 | 2008-08-24T01:27:34.573 | 1,493 | 1,493 | null |
23,832 | 2 | null | 20,054 | 0 | null | Firstly, you want to be using sqlite.
In my experience Access itself is a pile of [redacted], but the Jet database engine it uses is actually pretty fast and can handle some pretty complex SQL queries. If you can find a rails adapter that actually works I'd say you'll be fine. Just don't open the DB with the access f... | null | CC BY-SA 2.5 | null | 2008-08-23T01:37:49.050 | 2008-08-23T01:37:49.050 | null | null | 234 | null |
23,829 | 2 | null | 23,802 | 2 | null | You can define multiple autoloading functions with spl_autoload_register:
```
spl_autoload_register('load_controllers');
spl_autoload_register('load_models');
function load_models($class){
if( !file_exists("models/$class.php") )
return false;
include "models/$class.php";
return true;
}
function l... | null | CC BY-SA 2.5 | null | 2008-08-23T01:33:01.760 | 2008-08-23T01:33:01.760 | null | null | 40 | null |
23,831 | 2 | null | 9,589 | 0 | null | One issue to consider is do you want a "makefile" creator or a replacement build system? The problem with replacement build systems is that you typically don't get good IDE integration for platforms whose users expect this (Visual C++).
If you do want a makefile creator instead of a replacement build system, take a lo... | null | CC BY-SA 2.5 | null | 2008-08-23T01:37:17.867 | 2008-08-23T01:37:17.867 | null | null | 2,574 | null |
23,837 | 2 | null | 16,556 | 2 | null | I used to use it a lot. This designer worked good for stubbing out prototype projects, but ultimately I found myself wasting a lot of time moving the mouse around when I could be typing. It seemed like an awesome idea to be able to print out the class diagrams to show APIs to other developers while I was prototyping,... | null | CC BY-SA 2.5 | null | 2008-08-23T01:51:04.743 | 2008-08-23T01:51:04.743 | null | null | 2,547 | null |
23,840 | 2 | null | 23,755 | 11 | null | I am with Brad on this one. The more I work on immensely complex systems, the more I see the need to truly decouple objects. He's right. It's obvious that a needle shouldn't know anything about haystack, so 1 is definitely out. But, a haystack should know nothing about a needle.
If I were modeling a haystack, I ... | null | CC BY-SA 2.5 | null | 2008-08-23T01:52:05.867 | 2008-08-23T01:52:05.867 | null | null | 1,875 | null |
23,830 | 2 | null | 23,787 | 1 | null | Evidently the performance hit of anonymous delegates is pretty significant.
Test code:
```
static void Main(string[] args)
{
for (int kk = 0; kk < 10; kk++)
{
List<int> tmp = new List<int>();
for (int i = 0; i < 100; i++)
tmp.Add(i);
int sum = 0;... | null | CC BY-SA 2.5 | null | 2008-08-23T01:36:44.420 | 2008-08-23T01:36:44.420 | null | null | 1,490 | null |
23,848 | 2 | null | 23,836 | 4 | null | [Dependency Walker](http://www.dependencywalker.com/) is super useful for finding out which dll is missing from the installer. Once you know the dll, you can find what merge module it is in using the [Merge Module Finder](http://www.installsite.org/pages/en/msi/msm.htm).
| null | CC BY-SA 2.5 | null | 2008-08-23T01:57:23.717 | 2008-08-23T01:57:23.717 | null | null | 1,490 | null |
23,857 | 2 | null | 23,836 | 11 | null | [InnoSetup](http://www.jrsoftware.org/) or [NSIS](http://nsis.sourceforge.net/), whichever seems easier to you. [ISTool](http://www.istool.org) is a nice GUI tool for InnoSetup which makes creating setup scripts even easier.
| null | CC BY-SA 2.5 | null | 2008-08-23T02:16:37.897 | 2008-08-23T02:16:37.897 | null | null | 1,897 | null |
23,859 | 2 | null | 23,836 | 1 | null | I have worked with NSIS and getting past some of its minor complexities its a fantastic system. its free, offers tons of plugin ability and managed to do everything I needed to do.
| null | CC BY-SA 2.5 | null | 2008-08-23T02:19:07.407 | 2008-08-23T02:19:07.407 | null | null | 567 | null |
23,842 | 2 | null | 23,689 | 1 | null | @ Burton: I think he meant the other way, at least from the example on the linked page:
```
Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
```
... | null | CC BY-SA 2.5 | null | 2008-08-23T01:53:16.377 | 2008-08-23T01:53:16.377 | null | null | 1,490 | null |
23,867 | 1 | 24,337 | null | 15 | 9,928 | The `Close` method on an `ICommunicationObject` can throw two types of exceptions as MSDN outlines [here](http://msdn.microsoft.com/en-us/library/ms195520.aspx). I understand why the `Close` method can throw those exceptions, but what I don't understand is why the `Dispose` method on a service proxy calls the `Close` m... | Closing and Disposing a WCF Service | CC BY-SA 4.0 | 0 | 2008-08-23T02:29:18.070 | 2018-05-07T01:50:49.417 | 2018-05-07T01:50:49.417 | 5,480,409 | 781 | [
"wcf",
"web-services"
] |
23,835 | 2 | null | 22,801 | 10 | null | For loop and While loops are entry condition loops. They evaluate condition first, so the statement block associated with the loop won't run even once if the condition fails to meet
The statements inside this for loop block will run 10 times, the value of $i will be 0 to 9;
```
for ($i = 0; $i < 10; $i++)
{
... | null | CC BY-SA 2.5 | null | 2008-08-23T01:44:16.553 | 2008-08-23T01:44:16.553 | null | null | 1,897 | null |
23,836 | 1 | 23,857 | null | 7 | 5,303 | Heavy emphasis on simple. I've never made an installer and I'd rather not have to learn much. A system that I could hand a pile of files to and it would make some smart guesses about where to put them would be ideal.
Go ahead and answer the general question.
However In my cases I'm stuck with some extra constraints. ... | How to create a simple install system for VB6 on XP/Vista and newer? | CC BY-SA 3.0 | 0 | 2008-08-23T01:50:44.340 | 2014-09-18T09:49:38.730 | 2014-09-18T09:49:38.730 | 588,306 | 1,343 | [
"windows",
"vb6",
"installation"
] |
23,856 | 2 | null | 22,570 | 1 | null | Eric Z Beard:
> the activity date is meant to indicate the local time zone, but not a specific one
Okay - back to the drawing board. Try this:
```
where t.TheDateINeedToCheck BETWEEN (
dateadd(hh, (tz.Offset + ISNULL(ds.LocalTimeZone, 0)) * -1, @ActivityDate)
AND
dateadd(hh, (tz.Offset + ISNULL(ds.LocalT... | null | CC BY-SA 2.5 | null | 2008-08-23T02:14:08.480 | 2008-08-23T02:14:08.480 | null | null | 2,199 | null |
23,879 | 2 | null | 23,853 | 78 | null | You can mark variables as "[silent](https://velocity.apache.org/engine/1.5/user-guide.html#quietreferencenotation)" like this:
```
$!variable
```
If $variable is null, nothing will be rendered. If it is not null, its value will render as it normally would.
| null | CC BY-SA 3.0 | null | 2008-08-23T02:37:43.103 | 2017-07-25T21:44:39.843 | 2017-07-25T21:44:39.843 | 3,249,197 | 512 | null |
23,871 | 2 | null | 6,406 | 1 | null | One think to remember is the following ASP.NET directive.
```
<%@ MasterType attribute="value" [attribute="value"...] %>
```
[MSDN Reference](http://msdn.microsoft.com/en-us/library/ms228274.aspx)
It will help you when referencing this.Master by creating a strongly typed reference to the master page. You can then ... | null | CC BY-SA 2.5 | null | 2008-08-23T02:33:55.063 | 2008-08-23T02:33:55.063 | null | null | 1,405 | null |
23,899 | 1 | 60,404 | null | 16 | 4,724 | I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development.
One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @ the top o... | Best practices for refactoring classic ASP? | CC BY-SA 2.5 | 0 | 2008-08-23T02:56:37.833 | 2015-06-24T16:57:42.927 | 2020-06-20T09:12:55.060 | -1 | 2,477 | [
"asp.net-mvc",
"coding-style",
"refactoring"
] |
23,907 | 1 | 2,854,506 | null | 50 | 21,207 | Basically I want to get the number of lines-of-code in the repository after each commit.
The only (really crappy) ways I have found is to use `git filter-branch` to run `wc -l *`, and a script that runs `git reset --hard` on each commit, then runs `wc -l`
To make it a bit clearer, when the tool is run, it would outpu... | How can I graph the Lines of Code history for git repo? | CC BY-SA 3.0 | 0 | 2008-08-23T03:00:46.277 | 2022-03-14T22:21:14.063 | 2022-03-14T22:21:14.063 | 792,066 | 745 | [
"git"
] |
23,919 | 2 | null | 23,836 | 5 | null | I've used InnoSetup several years ago, before Vista, and was very happy with it then. I only had a few files to install and a Start menu icon. It worked great, and was easy to learn.
| null | CC BY-SA 2.5 | null | 2008-08-23T03:26:27.713 | 2008-08-23T03:26:27.713 | null | null | 1,254 | null |
23,925 | 2 | null | 23,918 | 7 | null | Ensure that you're modifying the modelview matrix by putting the following before the glRotatef call:
```
glMatrixMode(GL_MODELVIEW);
```
Otherwise, you may be modifying either the projection or a texture matrix instead.
| null | CC BY-SA 2.5 | null | 2008-08-23T03:38:22.613 | 2008-08-23T03:38:22.613 | null | null | 2,276 | null |
23,853 | 1 | 23,879 | null | 46 | 16,800 | I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example:
> : Fernando: {person.age}: Male
I would like to know how to hide it!
| How I hide empty Velocity variable names? | CC BY-SA 2.5 | 0 | 2008-08-23T02:09:25.167 | 2017-07-25T21:44:39.843 | 2020-06-20T09:12:55.060 | -1 | 2,274 | [
"java",
"templates",
"struts",
"velocity"
] |
23,904 | 2 | null | 11,359 | 0 | null | I kind of like Perfmon myself. It comes with windows out of the box and has support for a lot of different measurements.
| null | CC BY-SA 4.0 | null | 2008-08-23T02:59:18.980 | 2020-07-08T08:01:46.303 | 2020-07-08T08:01:46.303 | 171,520 | 1,737,192 | null |
23,926 | 2 | null | 23,918 | 6 | null | Do you get a 1 unit straight line? It seems that 90deg rot. around Y is going to have you looking at the side of a triangle with no depth.
You should try rotating around the Z axis instead and see if you get something that makes more sense.
OpenGL has two matrices related to the display of geometry, the ModelView an... | null | CC BY-SA 2.5 | null | 2008-08-23T03:40:29.037 | 2008-08-23T03:40:29.037 | null | null | 2,146 | null |
23,872 | 2 | null | 23,802 | 0 | null | Of the suggestions so far, I'm partial to Kevin's, but it doesn't need to be absolute. I see a couple different options to use with __autoload.
1. Put all class files into a single directory. Name the file after the class, ie, classes/User.php or classes/User.class.php.
2. Kevin's idea of putting models into one dir... | null | CC BY-SA 2.5 | null | 2008-08-23T02:34:35.497 | 2008-08-23T02:34:35.497 | null | null | 2,185 | null |
23,929 | 2 | null | 23,713 | 1 | null | The latest version of .Net 3.5 SP1 now allows you to run managed executables over a network share without using CasPol.
See this [post](http://blogs.msdn.com/brada/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-code-to-be-launched-from-a-network-share.aspx)
| null | CC BY-SA 2.5 | null | 2008-08-23T03:46:01.147 | 2008-08-23T03:46:01.147 | null | null | 1,327 | null |
23,933 | 2 | null | 11,288 | 1 | null | Update: I found a much more elegant solution:
```
class MyCompositeObject
{
DateTime CreatedDate;
string SomeAttribute;
Object Obj1;
{
class MyCompositeObjects : List<MyCompositeObject> { }
```
I found that due to reflection, the specific type stored in Obj1 is resolved at runtime and the ty... | null | CC BY-SA 2.5 | null | 2008-08-23T03:48:11.093 | 2008-08-23T03:48:11.093 | null | null | 1,346 | null |
23,869 | 2 | null | 23,539 | 1 | null | I don't know the details of the Sony network camera and the server side software. But what do you mean by web-server functionality - is that the UI that get served up to the users in form of a HTML page? Or is it something more, like a server capturing the video stream and transcoding it?
I think the direction you nee... | null | CC BY-SA 2.5 | null | 2008-08-23T02:31:58.267 | 2008-08-23T02:31:58.267 | null | null | 1,199,387 | null |
23,908 | 2 | null | 17,352 | 8 | null | Extensions are, in general, a way for graphics card vendors to add new functionality to OpenGL without having to wait until the next revision of the OpenGL spec. There are different types of extensions:
1. Vendor extension - only one vendor provides a certain type of functionality. Example: NV_vertex_program
2. Mult... | null | CC BY-SA 2.5 | null | 2008-08-23T03:00:59.133 | 2008-08-23T03:00:59.133 | null | null | 2,276 | null |
23,932 | 2 | null | 23,930 | 2 | null |
# Perl 6: Functional
```
multi factorial ( Int $n where { $n <= 0 } ){
return 1;
}
multi factorial ( Int $n ){
return $n * factorial( $n-1 );
}
```
This will also work:
```
multi factorial(0) { 1 }
multi factorial(Int $n) { $n * factorial($n - 1) }
```
[Jonathan Worthington's](http://use.perl.org/~Jonath... | null | CC BY-SA 2.5 | null | 2008-08-23T03:47:32.500 | 2009-07-01T18:38:24.423 | 2009-07-01T18:38:24.423 | 1,337 | 1,337 | null |
23,938 | 2 | null | 23,930 | 2 | null | C:
Edit: Actually C++ I guess, because of the variable declaration in the for loop.
```
int factorial(int x) {
int product = 1;
for (int i = x; i > 0; i--) {
product *= i;
}
return product;
}
```
| null | CC BY-SA 2.5 | null | 2008-08-23T03:50:32.180 | 2008-08-23T03:50:32.180 | null | null | 813 | null |
23,945 | 2 | null | 22,764 | 2 | null | I don't know what ruby would do if you used extended UTF8 characters as identifiers in your source code, but I know what I would do, which would be to slap you upside the back of the head and tell you DON'T DO THAT
| null | CC BY-SA 2.5 | null | 2008-08-23T03:56:32.133 | 2008-08-23T03:56:32.133 | null | null | 234 | null |
23,936 | 2 | null | 23,930 | 2 | null |
# Perl 6:Procedural
```
sub factorial ( int $n ){
my $result = 1;
loop ( ; $n > 0; $n-- ){
$result *= $n;
}
return $result;
}
```
| null | CC BY-SA 2.5 | null | 2008-08-23T03:48:58.207 | 2008-08-23T03:48:58.207 | 2020-06-20T09:12:55.060 | -1 | 1,337 | null |
23,931 | 1 | null | null | 163 | 149,330 | Given two different image files (in whatever format I choose), I need to write a program to predict the chance if one being the illegal copy of another. The author of the copy may do stuff like rotating, making negative, or adding trivial details (as well as changing the dimension of the image).
Do you know any algori... | Algorithm to compare two images | CC BY-SA 3.0 | 0 | 2008-08-23T03:46:57.180 | 2021-04-15T01:52:04.953 | 2015-04-18T20:55:47.417 | 1,090,562 | null | [
"algorithm",
"image",
"image-processing",
"image-recognition"
] |
23,946 | 2 | null | 23,931 | 36 | null | Read the paper: [Porikli, Fatih, Oncel Tuzel, and Peter Meer. “Covariance Tracking Using Model Update Based on Means on Riemannian Manifolds”. (2006) IEEE Computer Vision and Pattern Recognition.](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.81.3347&rep=rep1&type=pdf)
I was successfully able to detect over... | null | CC BY-SA 3.0 | null | 2008-08-23T03:57:38.857 | 2013-04-05T10:57:29.290 | 2013-04-05T10:57:29.290 | 388,614 | 1,490 | null |
23,957 | 2 | null | 23,755 | 1 | null | > @Peter MeyerYou get the idea. I think going as loosely coupled as possible is a good thing, but maybe I was getting a bit carried away! :)
Errr... yeah... I think the `IStuffSmallEnoughToBeLostInAHaystack` kind of is a red flag :-)
| null | CC BY-SA 2.5 | null | 2008-08-23T04:09:00.047 | 2008-08-23T04:09:00.047 | 2020-06-20T09:12:55.060 | -1 | 234 | null |
23,948 | 2 | null | 22,577 | 3 | null | [Here](http://pimpmysafari.com/plugins/keywurl) is a Safari plugin whereby you can customize it to search other sites. May work with Stack Overflow (I haven't tried it). Check out that site too for other Safari plugins.
| null | CC BY-SA 2.5 | null | 2008-08-23T04:01:21.063 | 2008-08-23T04:01:21.063 | null | null | null | null |
23,958 | 2 | null | 23,930 | 2 | null |
# Javascript:
```
factorial = function( n )
{
return n > 0 ? n * factorial( n - 1 ) : 1;
}
```
I'm not sure what a Factorial is but that does what the other programs do in javascript.
| null | CC BY-SA 2.5 | null | 2008-08-23T04:10:43.690 | 2008-10-14T15:11:34.787 | 2020-06-20T09:12:55.060 | -1 | 2,118 | null |
23,961 | 1 | 24,097 | null | 3 | 455 | One of my clients uses McAfee ScanAlert (i.e., HackerSafe). It basically hits the site with about 1500 bad requests a day looking for security holes. Since it demonstrates malicious behavior it is tempting to just block it after a couple bad requests, but maybe I should let it exercise the UI. Is it a true test if I ... | What to do about ScanAlert? | CC BY-SA 2.5 | null | 2008-08-23T04:11:36.047 | 2014-03-08T07:49:35.477 | null | null | 2,580 | [
"performance",
"security"
] |
23,918 | 1 | 23,926 | null | 11 | 31,998 | I'm trying to do a simple rotation in OpenGL but must be missing the point.
I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally.
At the moment I have code like this:
```
glPushMatrix();
glRotatef(90.0, 0.0, 1.0, 0.0);
glBegin(GL_TRIANGLES); ... | OpenGL Rotation | CC BY-SA 3.0 | 0 | 2008-08-23T03:23:44.350 | 2015-07-14T07:48:32.637 | 2015-07-14T07:48:32.637 | 3,218,692 | 364 | [
"c++",
"opengl",
"glut"
] |
23,962 | 1 | 23,975 | null | 18 | 6,904 | For example,
Look at the code that calculates the n-th Fibonacci number:
```
fib(int n)
{
if(n==0 || n==1)
return 1;
return fib(n-1) + fib(n-2);
}
```
The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers).
Assume that we are calcu... | Is there some way to speed up recursion by remembering child nodes? | CC BY-SA 2.5 | 0 | 2008-08-23T04:12:29.240 | 2009-03-20T11:10:23.720 | 2008-08-23T04:38:39.193 | 1,190 | 184 | [
"performance",
"recursion"
] |
23,963 | 1 | 23,971 | null | 14 | 16,682 | What is the minimum set of HTTP verbs that a server should allow for a web service to be classed as RESTful?
What if my hoster doesn't permit and ?
Is this actually important, can I live happily ever after with just and ?
---
Thanks for the answers folks, [Roger's answer](https://stackoverflow.com/questions... | RESTful web services and HTTP verbs | CC BY-SA 2.5 | 0 | 2008-08-23T04:14:17.257 | 2009-07-20T19:04:51.417 | 2017-05-23T12:09:17.910 | -1 | 419 | [
"web-services",
"rest"
] |
23,944 | 2 | null | 23,445 | 11 | null | I have created an approximation of what I think you are looking for just using the Collections Framework in Java. Frankly, I think it is probably overkill as @Mike Deck points out. For such a small set of items to compare and process I think arrays would be a better choice from a procedural standpoint but here is my ps... | null | CC BY-SA 3.0 | null | 2008-08-23T03:54:59.143 | 2017-04-24T08:18:30.727 | 2017-04-24T08:18:30.727 | 4,380,409 | 1,353 | null |
23,966 | 2 | null | 23,963 | 2 | null | If you just use GET and POST, it's still RESTful. Your web service may only do things which only required GET or POST, so that's fine.
| null | CC BY-SA 2.5 | null | 2008-08-23T04:17:31.663 | 2008-08-23T04:17:31.663 | null | null | null | null |
23,968 | 2 | null | 23,962 | 1 | null | What language is this? It doesnt overflow anything in c...
Also, you can try creating a lookup table on the heap, or use a map
| null | CC BY-SA 2.5 | null | 2008-08-23T04:19:28.990 | 2008-08-23T04:19:28.990 | null | null | 522 | null |
23,950 | 1 | 24,023 | null | 4 | 7,821 | What is the best method to get objects out of a BlockingQueue, in a concurrent program, without hitting a race condition? I'm currently doing the following and I'm not convinced it is the best method:
```
BlockingQueue<Violation> vQueue;
/*
in the constructor I pass in a BlockingQueue object
full of violations that... | Best method to get objects from a BlockingQueue in a concurrent program? | CC BY-SA 3.0 | 0 | 2008-08-23T04:03:18.997 | 2012-08-11T16:11:17.730 | 2012-08-11T16:11:17.730 | 1,477,076 | 828 | [
"java",
"concurrency"
] |
23,969 | 2 | null | 23,930 | 12 | null | Haskell:
```
ones = 1 : ones
integers = head ones : zipWith (+) integers (tail ones)
factorials = head integers : zipWith (*) factorials (tail integers)
```
| null | CC BY-SA 2.5 | null | 2008-08-23T04:20:56.973 | 2009-01-14T05:52:35.520 | 2009-01-14T05:52:35.520 | 11,256 | 784 | null |
23,973 | 2 | null | 23,962 | 1 | null | caching is generally a good idea for this kind of thing. Since fibonacci numbers are constant, you can cache the result once you have calculated it. A quick c/pseudocode example
```
class fibstorage {
bool has-result(int n) { return fibresults.contains(n); }
int get-result(int n) { return fibresult.find(n).v... | null | CC BY-SA 2.5 | null | 2008-08-23T04:23:28.280 | 2008-08-23T04:23:28.280 | null | null | 716 | null |
23,971 | 2 | null | 23,963 | 22 | null | Yes, you can live without PUT and DELETE.
This article tells you why:
[http://www.artima.com/lejava/articles/why_put_and_delete.html](http://www.artima.com/lejava/articles/why_put_and_delete.html)
While to true RESTafrians this may be heresy, in the real world you do what you can, with what you have. Be as rational ... | null | CC BY-SA 2.5 | null | 2008-08-23T04:23:10.713 | 2008-08-23T04:23:10.713 | null | null | 2,536 | null |
23,972 | 2 | null | 23,961 | 0 | null | If it's not hurting the performance of the site, I think its a good thing. If you had 1000 clients to the same site all doing that, yeah, block it.
But if the site was built for that client, I think it's fair enough they do that.
| null | CC BY-SA 3.0 | null | 2008-08-23T04:23:14.270 | 2014-03-08T07:49:35.477 | 2014-03-08T07:49:35.477 | 137,626 | 699 | null |
23,970 | 1 | 38,588 | null | 21 | 8,814 | Joe Van Dyk [asked the Ruby mailing list](http://www.zenspider.com/pipermail/ruby/2008-August/004223.html):
> Hi,In Ruby, I guess you can't marshal a lambda/proc object, right? Is
that possible in lisp or other languages?What I was trying to do:
```
l = lamda { ... }
Bj.submit "/path/to/ruby/program", :stdin => Ma... | How do I marshal a lambda (Proc) in Ruby? | CC BY-SA 3.0 | 0 | 2008-08-23T04:22:44.880 | 2018-09-16T10:11:32.987 | 2011-10-05T22:32:14.783 | 38,765 | 1,190 | [
"ruby",
"serialization",
"lambda",
"proc-object"
] |
23,974 | 2 | null | 23,970 | 3 | null | Try [ruby2ruby](http://seattlerb.rubyforge.org/ruby2ruby/)
| null | CC BY-SA 2.5 | null | 2008-08-23T04:24:49.023 | 2008-08-23T04:24:49.023 | null | null | 1,190 | null |
23,943 | 2 | null | 22,577 | 0 | null | AFAIK, Safari doesn't have a Search plugin capability. You could try [Inquisitor](http://www.inquisitorx.com/safari/index_en.php); just add the URL [https://stackoverflow.com/search?s=%@](https://stackoverflow.com/search?s=%@)
| null | CC BY-SA 2.5 | null | 2008-08-23T03:53:34.043 | 2008-08-23T03:53:34.043 | 2017-05-23T11:48:37.237 | -1 | 1,190 | null |
23,979 | 2 | null | 23,930 | 1 | null | C++
```
factorial(int n)
{
for(int i=1, f = 1; i<=n; i++)
f *= i;
return f;
}
```
| null | CC BY-SA 2.5 | null | 2008-08-23T04:27:12.140 | 2008-08-23T04:27:12.140 | null | null | 184 | null |
23,981 | 2 | null | 23,737 | 5 | null | Visual Studio optimisations: [http://stackoverflow.com/questions/8440/visual-studio-optimizations#8453](https://stackoverflow.com/q/8440/202)
The above SO post has unfortunately been deleted.
Microsoft have [provided some tips](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-performance-tips-and-t... | null | CC BY-SA 3.0 | null | 2008-08-23T04:31:06.887 | 2018-03-27T10:34:58.287 | 2018-03-27T10:34:58.287 | 202 | 202 | null |
23,978 | 2 | null | 23,228 | 8 | null | The first thing I did when I got to upgrade to VS2008 and C#3, was to do this
```
public static string F( this string format, params object[] args )
{
return String.Format(format, args);
}
```
So I can now change my code from
```
String.Format("Hello {0}", Name);
```
to
```
"Hello {0}".F(Name);
```
which I... | null | CC BY-SA 3.0 | null | 2008-08-23T04:27:03.323 | 2014-11-25T00:32:22.783 | 2014-11-25T00:32:22.783 | 234 | 234 | null |
23,982 | 2 | null | 23,930 | 5 | null | : Procedural
```
unsigned long factorial(int n)
{
unsigned long factorial = 1;
int i;
for (i = 2; i <= n; i++)
factorial *= i;
return factorial;
}
```
: Procedural
```
function factorial($n)
{
for ($factorial = 1, $i = 2; $i <= $n; $i++)
$factorial *= $i;
return $factorial... | null | CC BY-SA 2.5 | null | 2008-08-23T04:32:03.390 | 2008-08-23T15:24:48.750 | 2017-05-23T12:13:34.637 | -1 | 1,897 | null |
23,964 | 2 | null | 23,962 | 1 | null | Try using a map, n is the key and its corresponding Fibonacci number is the value.
@Paul
Thanks for the info. I didn't know that. From the [Wikipedia link](http://en.wikipedia.org/wiki/Dynamic_programming) you mentioned:
> This technique of saving values that
have already been calculated is called
memoization
Yeah I al... | null | CC BY-SA 2.5 | null | 2008-08-23T04:15:39.780 | 2008-08-23T04:52:19.537 | 2020-06-20T09:12:55.060 | -1 | 718 | null |
23,980 | 2 | null | 23,082 | 3 | null | This is basically ASP.NET vs PHP.. If you (or the developers) have lots of experience with PHP, you use LAMP, or if they have used ASP.NET a lot, you chose WISA..
That said, while not strictly AMP, Apache/MySQL/PHP will run on pretty much any platform you can name, which I would consider a big plus.
> There is never ... | null | CC BY-SA 2.5 | null | 2008-08-23T04:29:49.027 | 2008-08-23T04:29:49.027 | null | null | 745 | null |
23,984 | 2 | null | 23,962 | 7 | null | This is called memoization and there is a very good article about memoization [Matthew Podwysocki](http://codebetter.com/blogs/matthew.podwysocki/default.aspx) posted these days. It uses Fibonacci to exemplify it. And shows the code in C# also. Read it [here](http://codebetter.com/blogs/matthew.podwysocki/archive/2008/... | null | CC BY-SA 2.5 | null | 2008-08-23T04:35:51.040 | 2008-08-23T04:35:51.040 | null | null | 2,274 | null |
23,989 | 2 | null | 23,930 | 124 | null |
## lolcode:
sorry I couldn't resist xD
```
HAI
CAN HAS STDIO?
I HAS A VAR
I HAS A INT
I HAS A CHEEZBURGER
I HAS A FACTORIALNUM
IM IN YR LOOP
UP VAR!!1
TIEMZD INT!![CHEEZBURGER]
UP FACTORIALNUM!!1
IZ VAR BIGGER THAN FACTORIALNUM? GTFO
IM OUTTA YR LOOP
U SEEZ INT
KTHXBYE
```
| null | CC BY-SA 2.5 | null | 2008-08-23T04:40:15.790 | 2008-09-02T01:18:50.310 | 2020-06-20T09:12:55.060 | -1 | 522 | null |
23,988 | 1 | 23,997 | null | 2 | 1,070 | I don't understand where the extra bits are coming from in [this article](http://en.wikipedia.org/wiki/S-box) about s-boxes. Why doesn't the s-box take in the same number of bits for input as output?
| Why is an s-box input longer than its output? | CC BY-SA 3.0 | null | 2008-08-23T04:37:51.270 | 2015-07-22T03:23:01.267 | 2015-07-22T03:23:01.267 | 3,760,216 | 2,581 | [
"cryptography"
] |
23,991 | 2 | null | 23,988 | 1 | null | What extra bits? They are going from 6 to 4.
EDIT: Whoops! I'm an idiot. This is kinda like a 2nd grade multiplication table. They strip the outer bits off of the 6-bit block to be encypted, and leave the middle 4. Just like a table for an arithmatic operation, they go down one side, and find the outer bit sequenc... | null | CC BY-SA 2.5 | null | 2008-08-23T04:43:25.580 | 2008-08-23T04:48:54.787 | 2008-08-23T04:48:54.787 | 522 | 522 | null |
23,985 | 2 | null | 23,962 | 1 | null | Is this a deliberately chosen example? (eg. an extreme case you're wanting to test)
As it's currently O(1.6^n) i just want to make sure you're just looking for answers on handling the general case of this problem (caching values, etc) and not just accidentally writing poor code :D
Looking at this specific case you co... | null | CC BY-SA 2.5 | null | 2008-08-23T04:35:53.897 | 2008-08-23T04:45:07.790 | 2008-08-23T04:45:07.790 | 784 | 784 | null |
23,993 | 2 | null | 72 | 16 | null | A few things that have bitten me:
- `:main:``--main`- `:title:`- `:section:`
| null | CC BY-SA 2.5 | null | 2008-08-23T04:48:20.730 | 2008-08-23T04:48:20.730 | null | null | 1,190 | null |
23,986 | 2 | null | 23,962 | 0 | null | If you're using a language with first-class functions like Scheme, you can add memoization without changing the initial algorithm:
```
(define (memoize fn)
(letrec ((get (lambda (query) '(#f)))
(set (lambda (query value)
(let ((old-get get))
(set! get (lambda (q)
... | null | CC BY-SA 2.5 | null | 2008-08-23T04:36:09.607 | 2008-08-23T15:46:42.160 | 2008-08-23T15:46:42.160 | 658 | 658 | null |
23,975 | 2 | null | 23,962 | 17 | null | Yes your insight is correct.
This is called [dynamic programming](http://en.wikipedia.org/wiki/Dynamic_programming). It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
[edit]
The author of the question seems to be looking for a general method to cache rathe... | null | CC BY-SA 2.5 | null | 2008-08-23T04:24:57.807 | 2008-08-23T15:47:14.530 | 2008-08-23T15:47:14.530 | 446,497 | 446,497 | null |
23,995 | 2 | null | 22,873 | 1 | null | The reference you have listed for Ruby is for Ruby on Rails. While still ruby deep down, it is definitely not a place to start for people wanting to learn Ruby.
For Ruby tutorials, I would suggest [Why's (Poignant) Guide to Ruby](http://poignantguide.net/ruby/) as a great starting point for anyone interested in the l... | null | CC BY-SA 2.5 | null | 2008-08-23T04:51:43.000 | 2008-08-23T04:51:43.000 | null | null | 2,329 | null |
23,996 | 1 | 26,243 | null | 2 | 371 | I'm working with [Webby](http://webby.rubyforge.org) and am looking for some clarification. Can I define attributes like `title` or `author` in my layout?
| Setting Attributes in Webby Layouts | CC BY-SA 2.5 | null | 2008-08-23T04:53:47.863 | 2013-01-24T10:13:25.127 | null | null | 2,165 | [
"ruby",
"webby"
] |
23,997 | 2 | null | 23,988 | 3 | null | It is the way s-boxes work. They can be m * n ==> m bit input , n bit output.
For example, in the [AES](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard) S-box the number of bits in input is equal to the number of bits in output.
In [DES](http://en.wikipedia.org/wiki/Data_Encryption_Standard), m=6 and n=4.
... | null | CC BY-SA 2.5 | null | 2008-08-23T04:55:28.217 | 2008-08-23T05:00:40.483 | 2008-08-23T05:00:40.483 | 184 | 184 | null |
24,000 | 2 | null | 22,907 | 29 | null | I can't speak to anything other than SQL Server, but the performance argument is significantly valid there unless you're on 6.5 or earlier. SQL Server has been caching ad-hoc execution plans for roughly a decade now.
| null | CC BY-SA 2.5 | null | 2008-08-23T04:57:17.620 | 2008-08-23T04:57:17.620 | null | null | 60 | null |
24,003 | 2 | null | 23,250 | 54 | null | Personally, I try to always use when referring to member variables. It helps clarify the code and make it more readable. Even if there is no ambiguity, someone reading through my code for the first time doesn't know that, but if they see used consistently, they will know if they are looking at a member variable or ... | null | CC BY-SA 2.5 | null | 2008-08-23T05:05:44.557 | 2008-08-23T05:05:44.557 | null | null | 423 | null |
24,005 | 2 | null | 23,994 | 0 | null | I've just been recently turned on to MVC and Linq to Sql for Asp.Net. I'm still learning both, and I'm really enjoying them both. There are quite a few screen casts on [http://www.asp.net/learn/](http://www.asp.net/learn/).
| null | CC BY-SA 2.5 | null | 2008-08-23T05:07:21.997 | 2008-08-23T05:07:21.997 | null | null | 2,121 | null |
23,992 | 2 | null | 23,738 | 1 | null | I've found the [TheoryOrg Unofficial BitTorrent Specification](http://wiki.theory.org/BitTorrentSpecification) to be the best online source for Bittorrent information. Also, the Monotorrent code is fairly simple and easy to understand. There's also a project called "GCT" which implements JGroups style P2P for LAN/Mul... | null | CC BY-SA 2.5 | null | 2008-08-23T04:47:55.287 | 2008-08-23T04:47:55.287 | null | null | 1,432 | null |
24,009 | 2 | null | 24,004 | 3 | null | Personally, I think you should know how databases work as well as the relational model and the rhetoric behind it, including all forms of normalization (even though I rarely see a need to go beyond third normal form). The core concepts of the relational model do not change from relational database to relational databas... | null | CC BY-SA 2.5 | null | 2008-08-23T05:12:59.330 | 2008-08-23T05:12:59.330 | null | null | 1,790 | null |
24,004 | 1 | null | null | 3 | 764 | Modern database systems today come with loads of features. And you would agree with me that to learn one database you must unlearn the concepts you learned in another database. For example, each database would implement locking differently than others. So to carry the concepts of one database to another would be a reci... | To what extent should a developer learn specifics about database systems? | CC BY-SA 3.0 | 0 | 2008-08-23T05:06:44.057 | 2017-12-13T19:44:08.700 | 2017-12-13T19:44:08.700 | 14,027 | 2,528 | [
"database"
] |
24,011 | 2 | null | 23,994 | 2 | null | I've been getting into some pretty heavy use of NHibernate with ASP.NET MVC lately, and am really loving it.
| null | CC BY-SA 2.5 | null | 2008-08-23T05:16:10.523 | 2008-08-23T05:16:10.523 | null | null | 423 | null |
23,953 | 2 | null | 23,755 | 4 | null | To quote the great authors of [SICP](https://rads.stackoverflow.com/amzn/click/com/0262011530),
I prefer to have both methods 1 and 2 at hand. Using ruby as an example, it comes with `.include?` which is used like this
```
haystack.include? needle
=> returns true if the haystack includes the needle
```
Sometimes ... | null | CC BY-SA 2.5 | null | 2008-08-23T04:05:52.253 | 2008-08-23T04:05:52.253 | null | null | 234 | null |
24,010 | 2 | null | 23,996 | 0 | null | [I've never used it but the tutorial here:](http://webby.rubyforge.org/tutorial/)
Makes it look like the answer to your question is "yes". Specifically I'm looking under the "Making Changes" header on that page.
| null | CC BY-SA 3.0 | null | 2008-08-23T05:14:19.000 | 2013-01-24T10:13:25.127 | 2013-01-24T10:13:25.127 | 1,410,342 | 2,168 | null |
24,013 | 2 | null | 24,004 | 3 | null | I think it really depends on your job. If you are a developer in a large company with dedicated DBAs then maybe you don't need to know much, but if you are in a small company then it may be really helpful knowing more about databases. In small companies you may wear more than one hat.
It cannot hurt to know more in ... | null | CC BY-SA 2.5 | null | 2008-08-23T05:16:40.257 | 2008-08-23T05:16:40.257 | null | null | 2,305 | null |
24,007 | 2 | null | 24,004 | 3 | null | I think a developer should have a fairly good grasp of how their database system works, not matter which one it is. When making design and architecture decisions, they need to understand the possible implications when it comes to the database.
| null | CC BY-SA 2.5 | null | 2008-08-23T05:09:56.873 | 2008-08-23T05:09:56.873 | null | null | 423 | null |
23,994 | 1 | 24,005 | null | 4 | 687 | I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework.
What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else?
I know stackover... | Experiences Using ASP.NET MVC Framework | CC BY-SA 3.0 | 0 | 2008-08-23T04:51:32.597 | 2011-11-18T02:26:09.347 | 2011-11-18T02:26:09.347 | 1,288 | 2,305 | [
".net",
"asp.net",
"asp.net-mvc"
] |
24,018 | 2 | null | 23,228 | -2 | null |
Therefore having an instance method makes absolutely no sense.
```
String foo = new String();
foo.Format("test {0}",1); // Makes it look like foo should be modified by the Format method.
string newFoo = String.Format(foo, 1); // Indicates that a new string will be returned, and foo will be unaltered.
```
| null | CC BY-SA 2.5 | null | 2008-08-23T05:20:58.437 | 2008-08-23T05:20:58.437 | null | null | 1,965 | null |
24,021 | 2 | null | 24,004 | 3 | null | It certainly can't hurt to be familiar with relational database theory, and have a good working knowledge of the standard SQL syntax, as well as knowing what stored procedures, triggers, views, and indexes are. Obviously it's not terribly important to learn the database-specific extensions to SQL (T-SQL, PL/SQL, etc) u... | null | CC BY-SA 2.5 | null | 2008-08-23T05:30:00.177 | 2008-08-23T05:30:00.177 | null | null | null | null |
24,019 | 2 | null | 23,082 | 2 | null | I personally use both stacks and the reason really depends on the client. If a client can support LAMP, it is certainly cheaper but it is important what the client or company can support.
As an independent developer I would not recommend LAMP when all of the client's assets exist on Windows. It is really a comfort l... | null | CC BY-SA 2.5 | null | 2008-08-23T05:22:07.593 | 2008-08-23T05:22:07.593 | null | null | 2,305 | null |
24,017 | 2 | null | 24,004 | 6 | null | I think these are the most important things (from most important to least, IMO):
- - - - - -
Fortunately, there are some great FOSS and free commercial databases out there today that can be used to learn quite a bit about db fundamentals.
| null | CC BY-SA 2.5 | null | 2008-08-23T05:20:50.590 | 2008-08-23T05:20:50.590 | null | null | 1,432 | null |
24,020 | 2 | null | 23,994 | 1 | null | I used the MVC framework to build a small site, and I found myself frequently frustrated by the tag soup views, and lack of the server controls I had come to love.
I went back to using webforms.
WebForms, once mastered, are great...They just take a very long time to learn all the tricks.
| null | CC BY-SA 2.5 | null | 2008-08-23T05:25:26.913 | 2008-08-23T05:25:26.913 | null | null | 1,965 | null |
24,034 | 2 | null | 4,689 | 0 | null | I'd also have to add another vote for Android's "Droid Sans Mono". It's a very crisp, clear coding font.
| null | CC BY-SA 2.5 | null | 2008-08-23T06:10:58.707 | 2008-08-23T06:10:58.707 | null | null | null | null |