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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,025 | 2 | null | 3,021 | 8 | null |
1. A function that calls itself
2. When a function can be (easily) decomposed into a simple operation plus the same function on some smaller portion of the problem. I should say, rather, that this makes it a good candidate for recursion.
3. They do!
The canonical example is the factorial which looks like:
```
int ... | null | CC BY-SA 2.5 | null | 2008-08-06T02:35:07.437 | 2008-08-06T02:39:08.663 | 2008-08-06T02:39:08.663 | 2,089,740 | 2,089,740 | null |
2,982 | 2 | null | 972 | 1,135 | null | In Python, there is a difference between functions and bound methods.
```
>>> def foo():
... print "foo"
...
>>> class A:
... def bar( self ):
... print "bar"
...
>>> a = A()
>>> foo
<function foo at 0x00A98D70>
>>> a.bar
<bound method A.bar of <__main__.A instance at 0x00A9BC88>>
>>>
```
Bound methods... | null | CC BY-SA 4.0 | null | 2008-08-06T00:33:35.063 | 2020-07-22T12:20:37.100 | 2020-07-22T12:20:37.100 | 12,892 | 99 | null |
3,030 | 2 | null | 3,021 | 6 | null | A recursive function is one which calls itself. The most common reason I've found to use it is traversing a tree structure. For example, if I have a TreeView with checkboxes (think installation of a new program, "choose features to install" page), I might want a "check all" button which would be something like this (ps... | null | CC BY-SA 2.5 | null | 2008-08-06T02:44:53.317 | 2008-08-06T02:44:53.317 | null | null | 369 | null |
3,040 | 2 | null | 469 | 22 | null | Unfortunately the only API that isn't deprecated is located in the ApplicationServices framework, which doesn't have a bridge support file, and thus isn't available in the bridge. If you're wanting to use ctypes, you can use ATSFontGetFileReference after looking up the ATSFontRef.
Cocoa doesn't have any native support... | null | CC BY-SA 2.5 | null | 2008-08-06T03:01:23.890 | 2008-08-06T03:01:23.890 | null | null | 457 | null |
3,032 | 2 | null | 3,017 | 54 | null | Visual Studio also has a feature that will generate a Property from a private variable.
If you right-click on a variable, in the context menu that pops up, [click on the "Refactor" item, and then choose Encapsulate Field...](https://stackoverflow.com/questions/3017/how-can-we-generate-getters-and-setters-in-visual-stu... | null | CC BY-SA 4.0 | null | 2008-08-06T02:52:02.910 | 2019-12-09T20:21:57.320 | 2019-12-09T20:21:57.320 | 63,550 | 392 | null |
2,970 | 1 | 2,976 | null | 23 | 4,228 | My dad called me today and said people going to his website were getting 168 viruses trying to download to their computers. He isn't technical at all, and built the whole thing with a WYSIWYG editor.
I popped his site open and viewed the source, and there was a line of Javascript includes at the bottom of the source r... | My website got hacked.. What should I do? | CC BY-SA 3.0 | 0 | 2008-08-05T23:55:25.700 | 2017-12-21T15:07:37.917 | 2017-12-21T15:07:37.917 | 1,695,458 | 58 | [
"security",
"cracking"
] |
3,033 | 1 | 3,360 | null | 119 | 132,111 | If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using `each` may in some way have unintended side effects. So, is that true, and is one of the two following methods best, or is there a better way?
```
# Method 1
while (my ($k... | What's the safest way to iterate through the keys of a Perl hash? | CC BY-SA 2.5 | 0 | 2008-08-06T02:53:13.033 | 2015-12-05T23:00:21.943 | 2008-12-03T04:11:28.983 | 2,766,176 | 219 | [
"perl",
"hash",
"iteration",
"each"
] |
3,045 | 1 | 3,053 | null | 14 | 544 |
I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B.
A solution that would somehow link these two spr... | Linking two Office documents | CC BY-SA 2.5 | null | 2008-08-06T03:14:59.933 | 2012-05-01T15:32:25.707 | 2012-05-01T15:32:25.707 | 123,743 | 271 | [
"office-2007",
"office-2003"
] |
3,044 | 2 | null | 3,021 | 0 | null | I use recursion. What does that have to do with having a CS degree... (which I don't, by the way)
Common uses I have found:
1. sitemaps - recurse through filesystem starting at document root
2. spiders - crawling through a website to find email address, links, etc.
3. ?
| null | CC BY-SA 2.5 | null | 2008-08-06T03:13:35.817 | 2008-12-25T01:26:45.167 | null | null | 40 | null |
3,049 | 1 | 3,054 | null | 49 | 13,494 | I need to send and receive data over serial connections (RS-232 and RS-422).
How do I set up and communicate with such a connection? How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them?
In particular I am looking to do this in Java, C/C++, or one of the major Unix she... | How do I configure and communicate with a serial port? | CC BY-SA 2.5 | 0 | 2008-08-06T03:19:19.470 | 2016-01-28T18:00:18.230 | null | null | 462 | [
"java",
"c++",
"windows",
"unix"
] |
3,037 | 2 | null | 3,021 | 0 | null | I have created a recursive function to concatenate a list of strings with a separator between them. I use it mostly to create SQL expressions, by passing a list of fields as the '' and a '' as the separator. Here's the function (It uses some Borland Builder native data types, but can be adapted to fit any other envir... | null | CC BY-SA 2.5 | null | 2008-08-06T03:00:16.547 | 2008-08-06T03:00:16.547 | null | null | 431 | null |
3,035 | 2 | null | 3,021 | 27 | null | Recursion is a method of solving problems based on the divide and conquer mentality.
The basic idea is that you take the original problem and divide it into smaller (more easily solved) instances of itself, solve those smaller instances (usually by using the same algorithm again) and then reassemble them into the final... | null | CC BY-SA 3.0 | null | 2008-08-06T02:54:58.850 | 2016-02-07T14:18:11.333 | 2016-02-07T14:18:11.333 | 2,921,691 | 358 | null |
3,052 | 2 | null | 3,027 | 4 | null | I think you might be alluding to an "invisible" captcha. Check out the Subkismet project for an invisible captcha implementation.
[http://www.codeplex.com/subkismet](http://www.codeplex.com/subkismet)
| null | CC BY-SA 2.5 | null | 2008-08-06T03:19:56.147 | 2008-08-06T03:19:56.147 | null | null | 285 | null |
3,056 | 2 | null | 3,021 | 2 | null | To recurse on a solved problem: do nothing, you're done.
To recurse on an open problem: do the next step, then recurse on the rest.
| null | CC BY-SA 2.5 | null | 2008-08-06T03:32:35.730 | 2008-08-06T03:32:35.730 | null | null | 101 | null |
3,050 | 2 | null | 3,021 | 0 | null | Mario, I don't understand why you used recursion for that example.. Why not simply loop through each entry? Something like this:
```
String ArrangeString(TStringList* items, String separator)
{
String result = items->Strings[0];
for (int position=1; position < items->count; position++) {
result += sep... | null | CC BY-SA 3.0 | null | 2008-08-06T03:19:31.920 | 2016-02-07T14:19:38.380 | 2016-02-07T14:19:38.380 | 2,921,691 | 369 | null |
3,055 | 2 | null | 2,970 | 5 | null | You mention your Dad was using a website publishing tool.
If the publishing tool publishes from his computer to the server, it may be the case that his local files are clean, and that he just needs to republish to the server.
He should see if there's a different login method to his server than plain FTP, though... th... | null | CC BY-SA 2.5 | null | 2008-08-06T03:31:22.940 | 2008-08-06T03:31:22.940 | null | null | 116 | null |
3,053 | 2 | null | 3,045 | 5 | null | So you mean that AD743 on spreadsheet B must be equal to AD743 on spreadsheet A? Try this:
- - - - -
You'll notice that the formula is something like ''.
The value on spreadsheet B will be updated when you open it. In fact, it will ask you if you want to update. Of course, your connection must be up and running ... | null | CC BY-SA 2.5 | null | 2008-08-06T03:25:25.917 | 2008-08-06T03:25:25.917 | null | null | 431 | null |
3,042 | 2 | null | 3,021 | 4 | null | Recursion works best with what I like to call "fractal problems", where you're dealing with a big thing that's made of smaller versions of that big thing, each of which is an even smaller version of the big thing, and so on. If you ever have to traverse or search through something like a tree or nested identical struct... | null | CC BY-SA 2.5 | null | 2008-08-06T03:12:15.507 | 2008-08-06T03:12:15.507 | null | null | 216 | null |
3,043 | 2 | null | 3,021 | 4 | null | Here's a simple example: how many elements in a set. (there are better ways to count things, but this is a nice simple recursive example.)
First, we need two rules:
1. if the set is empty, the count of items in the set is zero (duh!).
2. if the set is not empty, the count is one plus the number of items in the set ... | null | CC BY-SA 3.0 | null | 2008-08-06T03:12:38.190 | 2016-11-20T00:23:09.927 | 2016-11-20T00:23:09.927 | 6,392,939 | 116 | null |
3,059 | 2 | null | 3,057 | 4 | null | Bottom line: no, because the overhead of interpretation overwhelms the overhead of method dispatching.
| null | CC BY-SA 2.5 | null | 2008-08-06T03:35:31.327 | 2008-08-06T03:42:09.830 | 2008-08-06T03:42:09.830 | 116 | 116 | null |
3,058 | 1 | 3,140 | null | 2,264 | 669,427 | Inversion of Control (IoC) can be quite confusing when it is first encountered.
1. What is it?
2. Which problem does it solve?
3. When is it appropriate to use and when not?
| What is Inversion of Control? | CC BY-SA 4.0 | 0 | 2008-08-06T03:35:27.380 | 2023-02-06T16:26:41.290 | 2023-01-25T07:25:33.770 | 116 | 358 | [
"oop",
"design-patterns",
"language-agnostic",
"inversion-of-control"
] |
3,060 | 2 | null | 3,049 | 3 | null | From the other side, if you want to do it using C#, which will run on both Windows and Linux--with some [limitations](http://www.mono-project.com/HowToSystemIOPorts) (EDIT: which may be out of date. I have no way to test it.). Just create a [SerialPort](http://msdn.microsoft.com/en-us/library/system.io.ports.serialport... | null | CC BY-SA 2.5 | null | 2008-08-06T03:35:50.093 | 2008-08-06T03:35:50.093 | null | null | 429 | null |
3,061 | 1 | 3,071 | null | 2,330 | 1,055,627 | How do I call a function, using a string with the function's name? For example:
```
import foo
func_name = "bar"
call(foo, func_name) # calls foo.bar()
```
| Calling a function of a module by using its name (a string) | CC BY-SA 4.0 | 0 | 2008-08-06T03:36:08.627 | 2022-06-04T21:58:36.523 | 2022-06-04T21:43:08.880 | 365,102 | 121 | [
"python",
"object",
"reflection"
] |
3,054 | 2 | null | 3,049 | 31 | null | Build a time machine and go back to 1987? Ho ho.
Ok, no more snarky comments.
> How do I figure out what the configuration settings (e.g. baud rate) should be...
Read the datasheet? Ok, ok. Seriously, last one. If you don't know the baud rate of the device you are trying to communicate with, you have two choices. St... | null | CC BY-SA 3.0 | null | 2008-08-06T03:27:43.323 | 2016-01-28T17:59:11.807 | 2016-01-28T17:59:11.807 | 982,161 | 2,089,740 | null |
3,068 | 2 | null | 3,057 | 1 | null | If you are using an interpreted language, the difference is irrelevant. You should not be using an interpreted language if performance is an issue. Both will perform about the same.
| null | CC BY-SA 2.5 | null | 2008-08-06T03:49:20.940 | 2008-08-06T03:49:20.940 | null | null | 92 | null |
3,057 | 1 | 3,062 | null | 22 | 9,644 | In interpreted programming languages, such as PHP and JavaScript, what are the repercussions of going with an Object Oriented approach over a Procedural approach?
Specifically what I am looking for is a checklist of things to consider when creating a web application and choosing between Procedural and Object Oriented ... | Speed Comparisons - Procedural vs. OO in interpreted languages | CC BY-SA 2.5 | 0 | 2008-08-06T03:34:01.517 | 2017-05-02T20:04:35.827 | 2017-05-02T20:04:35.827 | 4,490,559 | 58 | [
"performance",
"oop",
"maintainability",
"procedural",
"interpreted-language"
] |
3,062 | 2 | null | 3,057 | 16 | null | Maybe I'm crazy but worrying about speed in cases like this using an interpretive language is like trying to figure out what color to paint the shed. Let's not even get into the idea that this kind of optimization is entirely pre-mature.
You hit the nail on the head when you said 'maintainability'. I'd choose the appr... | null | CC BY-SA 2.5 | null | 2008-08-06T03:36:28.267 | 2008-08-06T03:36:28.267 | null | null | 2,089,740 | null |
3,066 | 2 | null | 3,033 | 3 | null | I may get bitten by this one but I think that it's personal preference. I can't find any reference in the docs to each() being different than keys() or values() (other than the obvious "they return different things" answer. In fact the docs state the use the same iterator and they all return actual list values instea... | null | CC BY-SA 2.5 | null | 2008-08-06T03:43:58.563 | 2008-10-12T12:29:16.020 | 2008-10-12T12:29:16.020 | 2,766,176 | 430 | null |
3,067 | 1 | null | null | 23 | 8,511 | If you've ever used Eclipse, you've probably noticed the great keyboard shortcuts that let you hit a shortcut key combination, then just type the first few characters of a function, class, filename, etc. It's even smart enough to put open files first in the list.

I'm l... | Plugin for Visual Studio to Mimic Eclipse's "Open Type" or "Open Resource" Keyboard Access | CC BY-SA 3.0 | null | 2008-08-06T03:44:41.197 | 2015-08-20T22:14:18.063 | 2012-04-01T10:02:38.760 | 1,219,121 | 291 | [
"visual-studio",
"plugins"
] |
3,072 | 2 | null | 3,033 | 3 | null | I always use method 2 as well. The only benefit of using each is if you're just reading (rather than re-assigning) the value of the hash entry, you're not constantly de-referencing the hash.
| null | CC BY-SA 2.5 | null | 2008-08-06T04:04:16.353 | 2008-08-06T04:04:16.353 | null | null | 153 | null |
3,074 | 2 | null | 2,913 | 3 | null | If you're mostly concerned with data layer testing, you might want to check out this book: . I was always unsure about it myself, but this book does a great job to help enumerate the concerns like performance, reproducibility, etc.
| null | CC BY-SA 2.5 | null | 2008-08-06T04:14:42.433 | 2008-08-06T04:14:42.433 | null | null | 404 | null |
3,073 | 2 | null | 1,598 | 1 | null | The official size is 57x57. I would recommend using the exact size simply due to the fact that it takes less memory when loaded (unless Apple caches the scaled representation). With that said, [Rex is right](https://stackoverflow.com/questions/1598/what-are-the-correct-pixel-dimensions-for-an-apple-touch-icon#1599) tha... | null | CC BY-SA 2.5 | null | 2008-08-06T04:10:52.080 | 2008-08-06T04:10:52.080 | 2017-05-23T11:54:36.703 | -1 | 457 | null |
3,079 | 2 | null | 1,276 | 11 | null | I once was called upon to look at a mysql that had "stopped working". I discovered that the DB files were residing on a Network Appliance filer mounted with NFS2 and with a maximum file size of 2GB. And sure enough, the table that had stopped accepting transactions was exactly 2GB on disk. But with regards to the pe... | null | CC BY-SA 2.5 | null | 2008-08-06T04:27:52.373 | 2008-08-06T04:27:52.373 | null | null | 430 | null |
3,084 | 2 | null | 3,075 | 2 | null | You need to have Sharepoint 2007 service pack 1 -- or else there's no chance.
(Sharepoint 2007 predates ajax 1.0 -- they built some support into service pack 1)
Next, from a trouble shooting point of view, test that the same code functions as expected when hosted in a regular asp.net page. (Literally copy and paste y... | null | CC BY-SA 2.5 | null | 2008-08-06T04:43:31.267 | 2008-08-06T04:47:19.887 | 2008-08-06T04:47:19.887 | 49 | 49 | null |
3,091 | 2 | null | 3,067 | 2 | null | Some of the neat features are available in Visual Assist X, though not all of them. I've asked on their forums, but they haven't appeared as yet. VAX gets updated regularly on a rough 4 week period for bug fixes and a new feature every couple of months.
| null | CC BY-SA 2.5 | null | 2008-08-06T05:06:57.723 | 2008-08-06T05:06:57.723 | null | null | 342 | null |
3,090 | 2 | null | 3,049 | 3 | null | At work we use teraterm and realterm for checking serial data is correctly formatted. Also we have a hardware splitter with a switch so we can monitor traffic to our application via a cable back to another port.
Windows allows you access to the serial port via CreateFile. That gives you a handle and from there you can... | null | CC BY-SA 2.5 | null | 2008-08-06T05:04:57.353 | 2008-08-06T05:04:57.353 | null | null | 342 | null |
3,075 | 1 | 3,084 | null | 14 | 1,559 | I have a simple page with my `ScriptManager` and my `UpdatePanel`, and my `ContentTemplate` has one `ListBox` and one Label. I am just trying to catch its `OnSelectionChanged` so I can update the text in the `Label`. No matter what settings I try to tweak, I always get a full-page postback.
Is this really not going ... | Can ASP.NET AJAX partial rendering work inside a SharePoint 2007 application page? | CC BY-SA 3.0 | null | 2008-08-06T04:20:41.920 | 2015-12-15T05:58:39.890 | 2015-12-15T05:58:39.890 | 2,833,965 | 404 | [
"ajax",
"sharepoint"
] |
3,071 | 2 | null | 3,061 | 2,794 | null | Given a module `foo` with method `bar`:
```
import foo
bar = getattr(foo, 'bar')
result = bar()
```
[getattr](https://docs.python.org/library/functions.html#getattr) can similarly be used on class instance bound methods, module-level methods, class methods... the list goes on.
| null | CC BY-SA 4.0 | null | 2008-08-06T03:57:16.820 | 2022-06-04T21:48:00.263 | 2022-06-04T21:48:00.263 | 365,102 | 363 | null |
3,078 | 2 | null | 2,804 | 6 | null | I wound up just implementing the translation manually. The code's not too bad, but it did leave me wishing that they provided support for it directly. I could see such a method being useful in a lot of different circumstances.
I guess that's why they added extension methods :)
In pseudocode:
```
// Recompute the i... | null | CC BY-SA 2.5 | null | 2008-08-06T04:25:02.490 | 2009-08-07T19:07:44.883 | 2009-08-07T19:07:44.883 | 328 | 328 | null |
3,092 | 2 | null | 3,088 | 4 | null | If he's interested, aren't the minor details the good parts? Using python, you've already cut the GUI off of it so that confusion is gone. Why not pick a project, a game or something, and implement it. The classic hi-lo number guessing game can be simply implemented from the command line in 20-30 lines of code (depe... | null | CC BY-SA 2.5 | null | 2008-08-06T05:08:37.020 | 2008-08-06T05:08:37.020 | null | null | 430 | null |
3,082 | 2 | null | 3,058 | 78 | null |
1. Wikipedia Article. To me, inversion of control is turning your sequentially written code and turning it into an delegation structure. Instead of your program explicitly controlling everything, your program sets up a class or library with certain functions to be called when certain things happen.
2. It solves code d... | null | CC BY-SA 2.5 | null | 2008-08-06T04:33:19.727 | 2008-08-06T04:33:19.727 | 2020-06-20T09:12:55.060 | -1 | 457 | null |
3,095 | 2 | null | 3,088 | 2 | null | First of all, start out like everyone else does: with a [Hello World](http://en.wikipedia.org/wiki/Hello_world) program. It's simple, and it gives them a basic feel for the layout of a program. Try and remember back to when you were first programming, and how difficult some of the concepts were - start simple.
Aft... | null | CC BY-SA 2.5 | null | 2008-08-06T05:13:15.763 | 2008-08-06T05:13:15.763 | null | null | 423 | null |
3,099 | 2 | null | 3,088 | 2 | null | Something you should be very mindful of while teaching your brother to program is for him not to rely too heavily on you. Often when I find myself helping others they will begin to think of me as answer book to all of their questions and instead of experimenting to find an answer they simply ask me. Often the best teac... | null | CC BY-SA 2.5 | null | 2008-08-06T05:18:46.657 | 2008-08-06T05:18:46.657 | null | null | 340 | null |
3,097 | 2 | null | 3,088 | 0 | null | I would actually argue to pick a simpler language with fewer instructions. I personally learned on BASIC at home, as [did Jeff](http://www.codinghorror.com/blog/archives/001104.html). This way, you don't have to delve into more complicated issues like object oriented programming, or even procedures if you don't want ... | null | CC BY-SA 2.5 | null | 2008-08-06T05:16:25.757 | 2008-08-06T05:16:25.757 | null | null | 122 | null |
3,100 | 2 | null | 3,058 | 19 | null | I agree with [NilObject](https://stackoverflow.com/questions/3058/what-is-inversion-of-control#3082), but I'd like to add to this:
> if you find yourself copying an entire method and only changing a small piece of the code, you can consider tackling it with inversion of control
If you find yourself copying and pastin... | null | CC BY-SA 2.5 | null | 2008-08-06T05:20:11.037 | 2008-08-06T05:20:11.037 | 2017-05-23T11:47:31.583 | -1 | 101 | null |
3,107 | 2 | null | 1,171 | 3 | null | As I understand it, random access is in constant time for both Python's dicts and lists, the difference is that you can only do random access of integer indexes with lists. I'm assuming that you need to lookup a node by its label, so you want a dict of dicts.
However, on the performance front, loading it into memory ... | null | CC BY-SA 2.5 | null | 2008-08-06T05:37:33.607 | 2008-08-06T05:37:33.607 | null | null | 101 | null |
3,105 | 2 | null | 3,088 | 30 | null | You could try using [Alice](http://www.alice.org/). It's a 3D program designed for use in introductory programming classes.
The two biggest obstacles for new programmers are often:
- -
Alice uses a drag and drop interface for constructing programs, avoiding the possibility of syntax errors. Alice lets you constru... | null | CC BY-SA 2.5 | null | 2008-08-06T05:29:49.240 | 2008-08-06T10:03:57.593 | 2008-08-06T10:03:57.593 | 99 | 99 | null |
3,106 | 1 | 3,119 | null | 22 | 6,798 | I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygwin from a post-build event, but I was hoping for at best a Visual Studio plugin o... | How can I create Debian install packages in Windows for a Visual Studio project? | CC BY-SA 2.5 | 0 | 2008-08-06T05:36:49.770 | 2018-09-06T11:01:29.123 | 2008-11-03T13:09:51.300 | 23,855 | 327 | [
"windows",
"visual-studio",
"mono",
"cross-platform"
] |
3,108 | 2 | null | 3,058 | 793 | null | Inversion of Control is what you get when your program callbacks, e.g. like a gui program.
For example, in an old school menu, you might have:
```
print "enter your name"
read name
print "enter your address"
read address
etc...
store in database
```
thereby controlling the flow of user interaction.
In a GUI progra... | null | CC BY-SA 4.0 | null | 2008-08-06T05:42:36.233 | 2019-05-09T00:33:03.740 | 2019-05-09T00:33:03.740 | 2,361,308 | 116 | null |
3,109 | 2 | null | 3,088 | 15 | null | A good python course is MIT's [A Gentle Introduction to Programming Using Python](http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-189January--IAP--2008/CourseHome/). It's all free online, and you don't have to be an MIT uberstudent to understand it.
> Edit [[Justin Standard](https://stackoverf... | null | CC BY-SA 2.5 | null | 2008-08-06T05:47:05.553 | 2008-08-15T21:56:22.170 | 2017-05-23T11:54:50.000 | -1 | 116 | null |
3,111 | 2 | null | 2,639 | 1 | null | Personally I use [MediaWiki](http://www.mediawiki.org/wiki/MediaWiki) for this purpose. I've tried a number of other free and paid wikis (including [Confluence](http://www.atlassian.com/software/confluence/)) and have always been impressed with MediaWiki's simplicity and ease of use.
I have MediaWiki installed on a... | null | CC BY-SA 2.5 | null | 2008-08-06T05:49:40.900 | 2008-08-06T05:49:40.900 | null | null | 423 | null |
3,125 | 2 | null | 3,088 | 0 | null | I think the "wisdom of crowds" work here. How did most people learn how to program? Many claim that they did so by copying programs of others, usually games they wanted to play in BASIC.
Maybe that route will work with him too?
| null | CC BY-SA 2.5 | null | 2008-08-06T06:20:28.077 | 2008-08-06T06:20:28.077 | null | null | 372 | null |
3,093 | 2 | null | 3,021 | 86 | null | There are a number of good explanations of [recursion](http://en.wikipedia.org/wiki/Recursion_%28computer_science%29) in this thread, this answer is about why you shouldn't use it in most languages.* In the majority of major imperative language implementations (i.e. every major implementation of C, C++, Basic, Python,... | null | CC BY-SA 3.0 | null | 2008-08-06T05:09:44.770 | 2016-12-26T01:59:29.493 | 2016-12-26T01:59:29.493 | 1,108,891 | 101 | null |
3,112 | 1 | 3,134 | null | 28 | 14,238 | I have a perl variable `$results` that gets returned from a service. The value is supposed to be an array, and `$results` should be an array reference. However, when the array has only one item in it, `$results` will be set to that value, and not a referenced array that contains that one item.
I want to do a `foreac... | Can you force either a scalar or array ref to be an array in Perl? | CC BY-SA 2.5 | null | 2008-08-06T05:56:00.933 | 2017-04-21T15:03:26.520 | 2008-09-09T23:13:45.940 | -1 | 219 | [
"perl",
"arrays",
"reference",
"scalar"
] |
3,122 | 2 | null | 3,067 | 2 | null | [Resharper](http://www.jetbrains.com/resharper/) does this with the - keyword. Unfortunately it doesn't come for free.
Visual Studio doesn't have anything like this feature beyond Find.
| null | CC BY-SA 3.0 | null | 2008-08-06T06:11:31.573 | 2015-08-20T22:14:18.063 | 2015-08-20T22:14:18.063 | 7,226 | 372 | null |
3,120 | 2 | null | 3,088 | 2 | null | I used to teach programming and your brother has one main advantage over most of my students he wants to learn :)
If you decide to go with C [a friend has a site](http://cymonsgames.retroremakes.com/) that has the sort of programs those of use from older generations remember as basic type-ins. The more complex of the... | null | CC BY-SA 2.5 | null | 2008-08-06T06:07:51.003 | 2008-08-06T07:32:14.000 | 2008-08-06T07:32:14.000 | 269 | 269 | null |
3,119 | 2 | null | 3,106 | 3 | null | I am not aware of any plugin that does it natively, especially since Mono users seem to prefer [MonoDevelop](http://www.monodevelop.com/Main_Page).
However, it should be possible to use Cygwin and a custom MSBuild Task or Batch file in order to achieve that by using the native .deb creation tools.
| null | CC BY-SA 2.5 | null | 2008-08-06T06:06:45.607 | 2008-08-06T06:06:45.607 | null | null | 91 | null |
3,128 | 2 | null | 805 | 1 | null | I used to do that with FTP on Windows (create a file of commands and shell out FTP.exe).
| null | CC BY-SA 4.0 | null | 2008-08-06T06:27:19.450 | 2022-09-06T12:00:58.997 | 2022-09-06T12:00:58.997 | 472,495 | 232 | null |
3,129 | 2 | null | 2,780 | 2 | null | if you don't need to know this pre-render, you could always use the win32 method of getpixel, I believe.
Note: typing on iPhone in the middle of Missouri with no inet access. Will look up real win32 example and see if there is a .net equivalent.
In case anyone cares, and doesn't want to use the (excellent) answer po... | null | CC BY-SA 2.5 | null | 2008-08-06T06:39:12.173 | 2008-08-09T05:20:43.507 | 2008-08-09T05:20:43.507 | 232 | 232 | null |
3,126 | 2 | null | 3,112 | -1 | null | I've just tested this with:
> ```
#!/usr/bin/perl -w
use strict;
sub testit {
my @ret = ();
if (shift){
push @ret,1;
push @ret,2;
push @ret,3;
}else{
push @ret,"oneonly";
}
return \@ret;
}
foreach my $r (@{testit(1)}){
print $r." test1\n";
}
foreach my $r (@{testit()}){
print $r." test2\n";
}
```... | null | CC BY-SA 2.5 | null | 2008-08-06T06:22:23.080 | 2008-10-12T12:29:45.943 | 2008-10-12T12:29:45.943 | 2,766,176 | 86 | null |
3,134 | 2 | null | 3,112 | 26 | null | im not sure there's any other way than:
> ```
$result = [ $result ] if ref($result) ne 'ARRAY';
foreach .....
```
| null | CC BY-SA 2.5 | null | 2008-08-06T07:13:16.753 | 2008-08-06T07:13:16.753 | null | null | 86 | null |
3,135 | 2 | null | 3,088 | 1 | null | If you want to teach the basics of programming, without being language specific, there is an application called [Scratch](http://scratch.mit.edu/) that was created in MIT. It's designed to help people develop programming skills. As users create Scratch projects, they learn to create conditions, loops, etc. There is a ... | null | CC BY-SA 2.5 | null | 2008-08-06T07:15:53.953 | 2008-08-06T07:15:53.953 | null | null | 278 | null |
3,130 | 2 | null | 2,775 | 30 | null | SQL Server 2008 has a new [date data type](http://msdn.microsoft.com/en-us/library/bb630352.aspx) and this simplifies this problem to:
```
SELECT CAST(CAST(GETDATE() AS date) AS datetime)
```
| null | CC BY-SA 2.5 | null | 2008-08-06T06:44:32.600 | 2010-09-13T16:57:04.300 | 2010-09-13T16:57:04.300 | 95 | 95 | null |
3,136 | 1 | 3,139 | null | 18 | 953 | How can I set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs?
Right now my crontab looks something like this
```
@daily /path/to/script.sh
```
| How to setup a crontab to execute at specific time | CC BY-SA 3.0 | null | 2008-08-06T07:16:16.373 | 2017-12-14T16:25:07.480 | 2017-12-14T16:25:07.480 | 3,266,847 | 87 | [
"cron",
"settings"
] |
3,088 | 1 | null | null | 324 | 148,257 |
I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. ()
What can I do better to teach him effectively? Is there... | Best ways to teach a beginner to program? | CC BY-SA 3.0 | 0 | 2008-08-06T05:01:16.677 | 2012-08-04T01:54:34.093 | 2011-11-24T11:03:40.387 | 447,356 | 92 | [
"python",
"language-agnostic"
] |
3,117 | 2 | null | 3,088 | 118 | null | I've had to work with several beginner (never wrote a line of code) programmers, and I'll be doing an after school workshop with high school students this fall. This is the closest thing I've got to documentation. It's still a work in progress, but I hope it helps.
1) Start with command line programs. You can write s... | null | CC BY-SA 2.5 | null | 2008-08-06T06:00:28.740 | 2009-04-07T13:34:20.257 | 2009-04-07T13:34:20.257 | 35,070 | 100 | null |
3,144 | 1 | 3,146 | null | 18 | 5,871 | I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms.
Does anybody here know of a 'best' algorithm that I could implement?
| 'Best' Diff Algorithm | CC BY-SA 3.0 | 0 | 2008-08-06T07:42:33.947 | 2013-01-09T05:39:54.330 | 2013-01-09T05:39:54.330 | 1,471,203 | 475 | [
"vb.net",
"diff"
] |
3,145 | 2 | null | 3,136 | 5 | null | You will with the above response receive email with any text written to stderr. Some people redirect that away too, and make sure that the script writes a log instead.
```
... 2>&1 ....
```
| null | CC BY-SA 3.0 | null | 2008-08-06T07:43:29.500 | 2013-07-26T16:01:28.653 | 2013-07-26T16:01:28.653 | 96,780 | 86 | null |
3,139 | 2 | null | 3,136 | 11 | null | When you do crontab -e, try this:
```
59 23 * * * /usr/sbin/myscript > /dev/null
```
That means: At 59 Minutes and 23 Hours on every day (*) on every month on every weekday, execute myscript.
See for some more info and examples.
| null | CC BY-SA 2.5 | null | 2008-08-06T07:21:32.430 | 2008-08-06T07:21:32.430 | null | null | 91 | null |
3,147 | 1 | null | null | 43 | 7,047 | I have seen these being used every which way, and have been accused of using them the wrong way (though in that case, I was using them that way to demonstrate a [point](http://blog.gadodia.net/extension-methods-in-vbnet-and-c/)).
So, what do you think are the best practices for employing Extension Methods?
Should dev... | What are the best practices for using Extension Methods in .Net? | CC BY-SA 2.5 | 0 | 2008-08-06T07:52:31.620 | 2015-06-27T06:05:28.533 | 2008-08-23T18:00:58.860 | 2,134 | 380 | [
".net"
] |
3,146 | 2 | null | 3,144 | 7 | null | Well I've used the c# version on codeproject and its really good for what I wanted...
[http://www.codeproject.com/KB/recipes/diffengine.aspx](http://www.codeproject.com/KB/recipes/diffengine.aspx)
You can probably get this translated into VB.net via an [online converter](http://labs.developerfusion.co.uk/convert/csha... | null | CC BY-SA 2.5 | null | 2008-08-06T07:49:32.407 | 2008-08-06T08:00:17.203 | 2008-08-06T08:00:17.203 | 1 | 445 | null |
3,149 | 2 | null | 3,144 | 3 | null | I don't know for sure if it's the best diff algorithms but you might want to check out those links that talks about SOCT4 and SOCT6
[http://dev.libresource.org/home/doc/so6-user-manual/concepts](http://dev.libresource.org/home/doc/so6-user-manual/concepts)
and also:
[http://www.loria.fr/~molli/pmwiki/uploads/Main/so6... | null | CC BY-SA 2.5 | null | 2008-08-06T07:52:42.180 | 2010-01-29T21:30:02.087 | 2010-01-29T21:30:02.087 | 391 | 391 | null |
3,150 | 1 | 35,963 | null | 94 | 61,688 | I'm having trouble figuring out how to get the testing framework set up and usable in for `C++` presumably with the built-in unit testing suite.
Any links or tutorials would be appreciated.
| How to set up unit testing for Visual Studio C++ | CC BY-SA 4.0 | 0 | 2008-08-06T07:57:50.017 | 2019-12-13T09:30:05.653 | 2019-12-13T09:30:05.653 | 11,383,441 | 370 | [
"c++",
"unit-testing",
"testing",
"visual-studio-2008",
"frameworks"
] |
3,154 | 2 | null | 2,775 | 18 | null | Itzik Ben-Gan in [DATETIME Calculations, Part 1](https://www.itprotoday.com/analytics-and-reporting/datetime-calculations-part-1) (SQL Server Magazine, February 2007) shows three methods of performing such a conversion (; the difference between second and third method is small):
```
SELECT CAST(CONVERT(char(8), GETDATE... | null | CC BY-SA 4.0 | null | 2008-08-06T08:06:19.720 | 2021-12-22T23:03:46.263 | 2021-12-22T23:03:46.263 | 95 | 95 | null |
3,152 | 2 | null | 3,147 | 2 | null | I think that it depends on what purpose the Extension methods serve.
- -
Take care not to globally include Extension methods that have little application, as they just clog up intellisense and can lead to confusion and/or misuse.
| null | CC BY-SA 2.5 | null | 2008-08-06T08:02:10.867 | 2008-08-06T08:02:10.867 | null | null | 51 | null |
3,143 | 1 | 880,219 | null | 17 | 3,486 | I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have been able to generate a test report by running NAnt on mono thru a Command Line Runner but don't have the options of using the report like a NAnt Runner. I'm also using MBUnit for the testing framework.
How can I merge in the tes... | Using MBUnit in TeamCity | CC BY-SA 2.5 | 0 | 2008-08-06T07:41:11.937 | 2010-02-11T17:21:40.647 | 2009-05-18T06:13:54.040 | 253 | 253 | [
"mono",
"nant",
"teamcity",
"mbunit"
] |
3,151 | 2 | null | 3,144 | 7 | null | I like [An O(ND) Difference Algorithm and Its Variations](http://www.xmailserver.org/diff2.pdf) by Eugene Myers. I believe it's the algorithm that was used in GNU diff. For a good background see [Wikipedia](http://en.wikipedia.org/wiki/Diff).
This is quite theoretical and you might wish to find source code, but I'm n... | null | CC BY-SA 2.5 | null | 2008-08-06T07:58:13.557 | 2008-08-06T07:58:13.557 | null | null | 341 | null |
3,155 | 2 | null | 3,147 | 3 | null | I've been including my extension methods in with my Core libraries in the Utils class because people who are working with my framework are likely to find the methods useful, but for mass deployment where the end developer might have a choice of extension method libraries, I would advise putting all of your extensions i... | null | CC BY-SA 2.5 | null | 2008-08-06T08:08:20.557 | 2008-08-06T08:08:20.557 | null | null | 192 | null |
3,159 | 2 | null | 3,157 | 1 | null | Remove the [L] from the previous rules:
```
RewriteBase /appRoot
RewriteRule ^$ app/webroot/
RewriteRule (.*) app/webroot/$1
```
[L] means "Stop the rewriting process here and don't apply any more rewriting rules."
| null | CC BY-SA 2.5 | null | 2008-08-06T08:19:29.677 | 2008-08-06T10:44:20.367 | 2008-08-06T10:44:20.383 | 1 | 383 | null |
3,158 | 2 | null | 3,067 | 2 | null | If you are looking for an add-in like this to quickly navigate to source files in your project:

try the Visual Studio 2005/2008 add-in [SonicFileFinder](http://jens-schaller.de/sonictools/sonicfilefinder/index.htm).
| null | CC BY-SA 3.0 | null | 2008-08-06T08:15:53.960 | 2012-03-28T19:57:33.460 | 2012-03-28T19:57:33.460 | 122,607 | 39 | null |
3,161 | 2 | null | 3,157 | 1 | null | Could you not apply the condition to the following rules, but with negation, as in (with some variation thereof, I'm not too good at remembering .htaccess rules, so the flags might be wrong):
```
RewriteCond $1 !^(static|otherDir).*$ [NC]
RewriteRule ^$ app/webroot/ [L]
RewriteCond $1 !^(static|otherDir).*$ [NC]
Rewr... | null | CC BY-SA 2.5 | null | 2008-08-06T08:26:56.667 | 2008-08-06T08:26:56.667 | null | null | 265 | null |
3,157 | 1 | 4,449 | null | 22 | 3,997 | In an application that heavily relies on `.htaccess` RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is:
```
/appRoot/.htaccess
app/
static/
```
By default every request to `/appRoot/*` is being rewr... | .htaccess directives to *not* redirect certain URLs | CC BY-SA 3.0 | 0 | 2008-08-06T08:15:28.233 | 2013-01-09T05:34:41.623 | 2012-12-04T07:42:28.387 | 1,136,709 | 476 | [
"apache",
".htaccess",
"mod-rewrite"
] |
3,178 | 2 | null | 3,164 | 2 | null | If you used Server.MapPath, then you should already have the relative web path. According to the [MSDN documentation](http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx), this method takes one variable, , which is the virtual path of the Web server. So if you were able to call the method,... | null | CC BY-SA 2.5 | null | 2008-08-06T08:44:34.820 | 2008-08-06T09:23:44.960 | 2008-08-06T09:23:44.960 | 51 | 51 | null |
3,140 | 2 | null | 3,058 | 1,948 | null | The `Inversion-of-Control` pattern, is about providing of `callback`, which "implements" and/or controls reaction, instead of acting ourselves directly (in other words, inversion and/or redirecting control to the external handler/controller).
The `Dependency-Injection` pattern is a more specific version of IoC pattern... | null | CC BY-SA 4.0 | null | 2008-08-06T07:22:09.513 | 2023-02-06T16:26:41.290 | 2023-02-06T16:26:41.290 | 8,740,349 | 373 | null |
3,185 | 2 | null | 3,163 | 2 | null | I'm guessing Date.Parse() doesn't work?
| null | CC BY-SA 2.5 | null | 2008-08-06T08:50:13.373 | 2008-08-06T08:50:13.373 | null | null | 383 | null |
3,164 | 1 | 3,218 | null | 66 | 59,237 | If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the way to convert that absolute path back into a relative web path?
| Absolute path back to web-relative path | CC BY-SA 3.0 | 0 | 2008-08-06T08:34:13.983 | 2018-12-19T11:56:18.067 | 2018-03-20T14:51:34.703 | 5,818,897 | 192 | [
"c#",
"asp.net",
".net",
"path",
"mappath"
] |
3,180 | 1 | 3,188 | null | 35 | 6,488 | Is there anyone working solo and using fogbugz out there? I'm interested in personal experience/overhead versus paper.
I am involved in several projects and get pretty hammered with lots of details to keep track of... Any experience welcome.
(Yes I know Mr. Joel is on the stackoverflow team... I still want good answe... | Anyone soloing using fogbugz? | CC BY-SA 2.5 | 0 | 2008-08-06T08:47:45.423 | 2008-10-22T15:09:53.087 | null | null | 479 | [
"fogbugz"
] |
3,194 | 2 | null | 3,163 | 1 | null | Well then method 2 seems the best way:
```
private function castMethod2(dateString:String):Date {
if ( dateString == null ) {
return null;
}
if ( dateString.indexOf("0000-00-00") != -1 ) {
return null;
}
dateString = dateString.split("-").join("/");
return new Date(Date.parse... | null | CC BY-SA 2.5 | null | 2008-08-06T09:00:31.483 | 2008-08-06T09:00:31.483 | null | null | 383 | null |
3,162 | 2 | null | 3,150 | 2 | null | I use [UnitTest++](https://github.com/unittest-cpp).
In the years since I made this post the source has moved from SourceForge to github. Also the [example tutorial](https://github.com/unittest-cpp/unittest-cpp/wiki/Writing-More-Tests-With-the-Bowling-Game-Kata) is now more agnostic - doesn't go into any configuratio... | null | CC BY-SA 3.0 | null | 2008-08-06T08:28:14.620 | 2016-08-05T06:18:37.250 | 2016-08-05T06:18:37.250 | 342 | 342 | null |
3,204 | 2 | null | 3,027 | 4 | null | Try [akismet](http://akismet.com/) from wp guys
| null | CC BY-SA 2.5 | null | 2008-08-06T09:09:22.620 | 2008-08-06T09:09:22.620 | null | null | 482 | null |
3,205 | 2 | null | 2,898 | 10 | null | I use [SciTE](http://www.scintilla.org/SciTE.html)
very small and simple text editor.
| null | CC BY-SA 2.5 | null | 2008-08-06T09:12:03.643 | 2008-08-06T09:12:03.643 | null | null | 482 | null |
3,163 | 1 | 10,030 | null | 24 | 33,623 | I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings.
Does anyone know any faster ways of doing this or tips to speed up the methods?
```
castMethod1 takes 3673 ms ... | Actionscript 3 - Fastest way to parse yyyy-mm-dd hh:mm:ss to a Date object? | CC BY-SA 3.0 | 0 | 2008-08-06T08:33:53.097 | 2015-12-16T05:35:09.260 | 2015-12-16T05:35:09.260 | 1,213,296 | 22 | [
"apache-flex",
"actionscript-3"
] |
3,197 | 2 | null | 3,196 | 40 | null | Couldn't be simpler...
```
Select Name, Count(Name) As Count
From Table
Group By Name
Having Count(Name) > 1
Order By Count(Name) Desc
```
This could also be extended to delete duplicates:
```
Delete From Table
Where Key In (
Select Max(Key)
From Table
Group By Name
Havi... | null | CC BY-SA 4.0 | null | 2008-08-06T09:02:36.907 | 2019-10-07T07:39:44.040 | 2019-10-07T07:39:44.040 | 3,118,401 | 383 | null |
3,188 | 2 | null | 3,180 | 35 | null | I use it, especially since the hosted Version of FugBugz [is free for up to 2 people](https://stackoverflow.com/questions/3180/anyone-soloing-using-fogbugz#3581). I found it a lot nicer than paper as I'm working on multiple projects, and my paper tends to get rather messy once you start making annotations or if you wan... | null | CC BY-SA 2.5 | null | 2008-08-06T08:52:51.980 | 2008-10-22T15:09:53.087 | 2017-05-23T10:32:58.483 | -1 | 91 | null |
3,203 | 2 | null | 2,898 | 2 | null | The best I've found is gedit unfortunately. Spend a few hours with it and you'll discover it's not so bad, with plugins and themes. You can use the command line to open documents in it.
| null | CC BY-SA 2.5 | null | 2008-08-06T09:08:45.553 | 2008-08-06T09:08:45.553 | null | null | 484 | null |
3,200 | 2 | null | 2,384 | 3 | null | I had no luck using the BinaryFormatter, I guess I have to have a complete struct that matches the content of the file exactly. I realised that in the end I wasn't interested in very much of the file content anyway so I went with the solution of reading part of stream into a bytebuffer and then converting it using
```... | null | CC BY-SA 3.0 | null | 2008-08-06T09:03:28.277 | 2012-01-07T00:53:09.897 | 2012-01-07T00:53:09.897 | 507,519 | 143 | null |
3,207 | 2 | null | 3,027 | 2 | null | I think asking the user simple questions like:
"How many legs does a dog have?"
Would be much more effective that any CAPTCHA systems out there at the moment. Not only is it very difficult for the computer to answer that question, but it is !
| null | CC BY-SA 2.5 | null | 2008-08-06T09:14:18.770 | 2008-08-06T09:14:18.770 | null | null | 383 | null |
3,211 | 2 | null | 2,898 | 2 | null | +1 for pico/nano -- lightweight, gets the job done, good help
| null | CC BY-SA 2.5 | null | 2008-08-06T09:17:08.423 | 2008-08-06T09:17:08.423 | null | null | null | null |
3,217 | 2 | null | 2,898 | 25 | null | Kate, the KDE Advanced Text Editor is quite good. It has syntax highlighting, block selection mode, terminal/console, sessions, window splitting both horizontal and vertical etc.
| null | CC BY-SA 2.5 | null | 2008-08-06T09:26:16.377 | 2008-08-06T09:26:16.377 | null | null | 486 | null |
3,213 | 1 | 3,267 | null | 62 | 46,650 | Is there an efficient method of converting an integer into the written numbers, for example:
```
string Written = IntegerToWritten(21);
```
would return "Twenty One".
Is there any way of doing this that doesn't involve a massive look-up table?
| Convert integers to written numbers | CC BY-SA 3.0 | 0 | 2008-08-06T09:21:09.490 | 2022-10-07T10:55:19.470 | 2012-01-31T14:33:46.707 | 4,714 | 383 | [
"c#",
"integer"
] |