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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
483 | 2 | null | 438 | 28 | null | You should almost certainly not be extending the session cookie to be long lived.
Although not dealing specifically with rails [this article](http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice) goes to some length to explain 'remember me' best practices.
In summary though you should:
- - -... | null | CC BY-SA 2.5 | null | 2008-08-02T16:10:42.817 | 2008-08-02T16:10:42.817 | null | null | 147 | null |
471 | 2 | null | 337 | 33 | null | [ElementTree](http://effbot.org/zone/element-index.htm) has a nice pythony API. I think it's even shipped as part of python 2.5
It's in pure python and as I say, pretty nice, but if you wind up needing more performance, then [lxml](http://codespeak.net/lxml/) exposes the same API and uses libxml2 under the hood. You... | null | CC BY-SA 2.5 | null | 2008-08-02T15:21:03.587 | 2008-08-02T15:21:03.587 | null | null | 147 | null |
518 | 2 | null | 469 | 6 | null | I haven't been able to find anything that does this directly. I think you'll have to iterate through the various font folders on the system: `/System/Library/Fonts`, `/Library/Fonts`, and there can probably be a user-level directory as well `~/Library/Fonts`.
| null | CC BY-SA 3.0 | null | 2008-08-02T17:42:28.607 | 2013-03-22T09:27:54.323 | 2013-03-22T09:27:54.323 | 725,306 | 153 | null |
482 | 1 | 509 | null | 56 | 20,721 | Assume you are doing something like the following
```
List<string> myitems = new List<string>
{
"Item 1",
"Item 2",
"Item 3"
};
ComboBox box = new ComboBox();
box.DataSource = myitems;
ComboBox box2 = new ComboBox();
box2.DataSource = myitems
```
So now we have 2 combo boxes bound to that array, and ev... | WinForms ComboBox data binding gotcha | CC BY-SA 4.0 | 0 | 2008-08-02T16:09:56.780 | 2019-12-24T07:28:40.060 | 2019-01-20T13:47:33.730 | 567,854 | 77 | [
"c#",
"winforms",
"data-binding"
] |
519 | 2 | null | 514 | 9 | null | Using fcgi with Ruby is known to be very buggy.
Practically everybody has moved to [Mongrel](http://mongrel.rubyforge.org/) for this reason, and I recommend you do the same.
| null | CC BY-SA 2.5 | null | 2008-08-02T17:50:34.987 | 2008-08-02T17:50:34.987 | null | null | 136 | null |
514 | 1 | 519 | null | 24 | 2,287 | I have a Ruby on Rails Website that makes HTTP calls to an external Web Service.
About once a day I get a SystemExit (stacktrace below) error email where a call to the service has failed. If I then try the exact same query on my site moments later it works fine.
It's been happening since the site went live and I've h... | Frequent SystemExit in Ruby when making HTTP calls | CC BY-SA 3.0 | 0 | 2008-08-02T17:26:39.793 | 2016-12-21T04:13:07.130 | 2016-12-21T04:13:07.130 | 2,912,665 | 151 | [
"ruby-on-rails",
"ruby",
"crash"
] |
525 | 2 | null | 337 | 6 | null | Since you mentioned that you'll be building "fairly simple" XML, the [minidom module](http://www.python.org/doc/current/lib/module-xml.dom.minidom.html) (part of the Python Standard Library) will likely suit your needs. If you have any experience with the DOM representation of XML, you should find the API quite straigh... | null | CC BY-SA 2.5 | null | 2008-08-02T18:04:10.543 | 2008-08-02T18:04:10.543 | null | null | 154 | null |
521 | 2 | null | 173 | 10 | null | You didn't mention any specifics about your target environment or constraints, so this may not be entirely applicable... but if you're looking for a way to effectively track an evolving DB schema and aren't adverse to the idea of using Ruby, ActiveRecord's migrations are right up your alley.
Migrations programatically... | null | CC BY-SA 2.5 | null | 2008-08-02T17:54:50.687 | 2008-08-02T19:22:50.497 | 2008-08-02T19:22:50.497 | 154 | 154 | null |
522 | 2 | null | 88 | 9 | null | > So it says microseconds explicitly, but says the resolution of the system clock is unspecified. I suppose resolution in this context means how the smallest amount it will ever be incremented?
The data structure is defined as having microseconds as a unit of measurement, but that doesn't mean that the clock or operat... | null | CC BY-SA 3.0 | null | 2008-08-02T17:57:06.033 | 2013-12-19T04:39:01.137 | 2013-12-19T04:39:01.137 | 471,164 | 156 | null |
529 | 2 | null | 180 | 5 | null | Isn't it also a factor which order you set up the colors?
Like if you use Dillie-Os idea you need to mix the colors as much as possible.
0 64 128 256 is from one to the next. but 0 256 64 128 in a wheel would be more "apart"
Does this make sense?
| null | CC BY-SA 2.5 | null | 2008-08-02T18:16:07.867 | 2008-08-02T18:16:07.867 | null | null | 86 | null |
530 | 2 | null | 264 | 5 | null | Doesn't this depend on the hardware as well as number of threads and stuff?
I would make a simple test and run it with increasing amounts of threads hammering and see what seems best.
| null | CC BY-SA 2.5 | null | 2008-08-02T18:21:21.993 | 2008-08-02T18:21:21.993 | null | null | 86 | null |
532 | 2 | null | 265 | 2 | null | Maven helps quite a lot with this problem when I'm coding java. We commit the pom.xml to the scs and the maven repository contains all our dependencies.
For me that seems like a nice way to do it.
| null | CC BY-SA 2.5 | null | 2008-08-02T18:30:34.673 | 2008-08-02T18:30:34.673 | null | null | 86 | null |
509 | 2 | null | 482 | 39 | null | This has to do with how data bindings are set up in the dotnet framework, especially the `BindingContext`. On a high level it means that if you haven't specified otherwise each form and all the controls of the form share the same `BindingContext`. When you are setting the `DataSource` property the `ComboBox` will use t... | null | CC BY-SA 4.0 | null | 2008-08-02T17:18:12.680 | 2019-12-24T07:28:40.060 | 2019-12-24T07:28:40.060 | 5,407,188 | 143 | null |
535 | 1 | 541 | null | 69 | 9,567 | I am starting to work on a hobby project with a codebase and I would like to set up some form of continuous integration (i.e. running a battery of test-cases each time a check-in is made and sending nag e-mails to responsible persons when the tests fail) similar to or .
I realize I could do this with hooks in most ,... | Continuous Integration System for a Python Codebase | CC BY-SA 4.0 | 0 | 2008-08-02T18:43:54.787 | 2018-05-14T17:46:14.650 | 2018-05-14T17:46:14.650 | 7,232,508 | 154 | [
"python",
"continuous-integration",
"extreme-programming"
] |
538 | 2 | null | 535 | 29 | null | One possibility is Hudson. It's written in Java, but there's integration with Python projects:
> [Hudson embraces Python](http://redsolo.blogspot.com/2007/11/hudson-embraces-python.html)
I've never tried it myself, however.
(, Sept. 2011: After a trademark dispute Hudson has been renamed to [Jenkins](http://jenkins... | null | CC BY-SA 3.0 | null | 2008-08-02T18:56:56.460 | 2013-01-28T03:54:17.217 | 2013-01-28T03:54:17.217 | null | 156 | null |
516 | 2 | null | 173 | 188 | null | Martin Fowler wrote my favorite article on the subject, [http://martinfowler.com/articles/evodb.html](http://martinfowler.com/articles/evodb.html). I choose not to put schema dumps in under version control as and others suggest because I want an easy way to upgrade my production database.
For a web application where... | null | CC BY-SA 2.5 | null | 2008-08-02T17:33:54.927 | 2008-08-02T17:33:54.927 | null | null | 150 | null |
540 | 2 | null | 123 | 8 | null | As far as I know, there's no ready-made library to do this for you, but producing a tool capable of translating from CSV to XML should only require you to write a crude CSV parser and hook up JDOM (or your XML Java library of choice) with some glue code.
| null | CC BY-SA 3.0 | null | 2008-08-02T19:06:38.717 | 2016-04-10T20:56:11.613 | 2016-04-10T20:56:11.613 | 1,564,659 | 154 | null |
536 | 2 | null | 502 | 16 | null | You can use ImageMagick's convert utility for this, see some examples in [http://studio.imagemagick.org/pipermail/magick-users/2002-May/002636.html](https://web.archive.org/web/20120413111338/http://studio.imagemagick.org/pipermail/magick-users/2002-May/002636.html)
:
> ```
Convert taxes.pdf taxes.jpg
```
Will convert... | null | CC BY-SA 3.0 | null | 2008-08-02T18:49:07.740 | 2015-08-29T23:20:48.107 | 2015-08-29T23:20:48.107 | 2,581,872 | 161 | null |
537 | 2 | null | 263 | 5 | null | A few things:
You are creating (and not using) an unnecessary toplevel window, named `window`. You can just delete these lines:
```
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBAC... | null | CC BY-SA 2.5 | null | 2008-08-02T18:49:30.390 | 2008-08-02T19:50:01.017 | 2008-08-02T19:50:01.017 | 156 | 156 | null |
551 | 2 | null | 387 | 9 | null | You may also be interested in the output of the [explain() method](https://lucene.apache.org/core/3_6_2/api/all/org/apache/lucene/search/IndexSearcher.html#explain(org.apache.lucene.search.Query,%20int)), and the resulting [Explanation object](https://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Explan... | null | CC BY-SA 3.0 | null | 2008-08-02T20:03:06.483 | 2015-12-30T18:08:30.057 | 2015-12-30T18:08:30.057 | 1,628,375 | 156 | null |
562 | 1 | null | null | 51 | 4,479 | Uploading my first decently sized web app to my shared host provided me with a fresh set of challenges, by which I mean, sleepless nights. The issue was that I had most certainly not developed my application for medium trust (or had any clue what that was.)
I mitigated all of the issues, save one.
I had written an ... | How to write to Web.Config in Medium Trust? | CC BY-SA 4.0 | 0 | 2008-08-02T21:39:11.733 | 2019-01-20T13:48:44.203 | 2019-01-20T13:48:44.203 | 567,854 | null | [
"c#",
"asp.net",
"medium-trust"
] |
561 | 1 | 794 | null | 29 | 10,951 | I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns `true` whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is mo... | How to use combinations of sets as test data | CC BY-SA 3.0 | 0 | 2008-08-02T21:34:24.223 | 2017-09-13T09:21:16.293 | 2017-02-14T17:16:15.033 | 4,595,675 | 157 | [
"unit-testing",
"language-agnostic",
"testing"
] |
541 | 2 | null | 535 | 33 | null | We run [Buildbot - Trac](http://buildbot.net/trac) at work. I haven't used it too much since my codebase isn't part of the release cycle yet. But we run the tests on different environments (OSX/Linux/Win) and it sends emails — and it's written in Python.
| null | CC BY-SA 4.0 | null | 2008-08-02T19:06:40.667 | 2018-05-14T15:19:44.427 | 2018-05-14T15:19:44.427 | 7,232,508 | 157 | null |
564 | 1 | 566 | null | 269 | 247,710 | I was reading [More Joel on Software](https://rads.stackoverflow.com/amzn/click/com/1430209879) when I came across [Joel Spolsky](http://en.wikipedia.org/wiki/Joel_Spolsky) saying something about a particular type of programmer knowing the difference between an `int` and an `Integer` in Java/C# (Object-Oriented Program... | What is the difference between an int and an Integer in Java and C#? | CC BY-SA 4.0 | 0 | 2008-08-02T21:47:34.820 | 2022-12-23T23:40:23.233 | 2020-03-18T11:24:39.983 | 1,442,180 | 25 | [
"c#",
"java",
"integer",
"int"
] |
576 | 2 | null | 371 | 30 | null | Sign up for an account on as many major email providers as possible (gmail/yahoo/hotmail/aol/etc). If you make changes to your emails, either major rewording, changes to the code that sends the emails, changes to your email servers, etc, make sure to send test messages to all your accounts and verify that they are not ... | null | CC BY-SA 2.5 | null | 2008-08-02T23:00:53.237 | 2008-08-02T23:00:53.237 | null | null | 163 | null |
566 | 2 | null | 564 | 252 | null | the 'int' type is a primitive, whereas the 'Integer' type is an object.
the 'int' type is the same as `System.Int32` and is [a value type](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/value-types) (ie more like the java 'int'). An integer (just like any other value types) can be [boxed... | null | CC BY-SA 4.0 | null | 2008-08-02T21:55:45.477 | 2020-03-18T11:25:23.447 | 2020-03-18T11:25:23.447 | 1,442,180 | 154 | null |
568 | 2 | null | 564 | 154 | null | Well, in Java an int is a primitive while an Integer is an Object. Meaning, if you made a new Integer:
```
Integer i = new Integer(6);
```
You could call some method on i:
```
String s = i.toString();//sets s the string representation of i
```
Whereas with an int:
```
int i = 6;
```
You cannot call any methods on it... | null | CC BY-SA 4.0 | null | 2008-08-02T22:05:08.093 | 2022-12-23T23:40:23.233 | 2022-12-23T23:40:23.233 | 11,107,541 | 58 | null |
580 | 1 | 586 | null | 30 | 8,117 | I wonder how you guys manage deployment of a database between 2 SQL Servers, specifically SQL Server 2005.
Now, there is a development and a live one. As this should be part of a buildscript (standard windows batch, even do with current complexity of those scripts, i might switch to PowerShell or so later), Enterprise ... | Deploying SQL Server Databases from Test to Live | CC BY-SA 2.5 | 0 | 2008-08-02T23:30:59.090 | 2014-11-25T20:58:47.550 | 2014-11-25T20:58:47.550 | 2,641,576 | 91 | [
"sql-server",
"sql-server-2005",
"deployment",
"release-management"
] |
583 | 2 | null | 564 | 11 | null | In C#, int is just an for `System.Int32`, string for `System.String`, double for `System.Double` etc...
Personally I prefer int, string, double, etc. because they don't require a `using System;` statement :) A silly reason, I know...
| null | CC BY-SA 3.0 | null | 2008-08-02T23:37:10.077 | 2014-06-05T10:12:06.170 | 2014-06-05T10:12:06.170 | 2,935,678 | 39 | null |
586 | 2 | null | 580 | 19 | null | I've taken to hand-coding all of my DDL (creates/alter/delete) statements, adding them to my .sln as text files, and using normal versioning (using subversion, but any revision control should work). This way, I not only get the benefit of versioning, but updating live from dev/stage is the same process for code and dat... | null | CC BY-SA 2.5 | null | 2008-08-02T23:51:09.410 | 2008-08-03T00:58:16.573 | 2008-08-03T00:58:16.573 | 34 | 34 | null |
585 | 2 | null | 580 | 13 | null | For my projects I alternate between SQL Compare from REd Gate and the Database Publishing Wizard from Microsoft which you can download free
[here](http://www.microsoft.com/downloads/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en).
The Wizard isn't as slick as SQL Compare or SQL Data Compare b... | null | CC BY-SA 2.5 | null | 2008-08-02T23:40:04.733 | 2008-08-02T23:40:04.733 | 2020-06-20T09:12:55.060 | -1 | 149 | null |
588 | 1 | 633 | null | 58 | 59,516 | I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used [WebDAV](http://en.wikipedia.org/wiki/WebDAV) to do it, but now I'm leaning away from that.
I will be run... | Best way to access Exchange using PHP? | CC BY-SA 3.0 | 0 | 2008-08-03T00:03:58.510 | 2020-07-13T09:02:05.310 | 2020-06-20T09:12:55.060 | -1 | 172 | [
"php",
"windows",
"exchange-server",
"webdav",
"mapi"
] |
582 | 2 | null | 562 | 24 | null | That actually sounds like IIS's `Low` level. If it is, then you won't be able to write to any file, not just the web.config.
Here are the levels from IIS's help file:
> - - - - - - - - - - - - - - -
I would suggest that if you are dead set on having an installer, have it create a `web.config` in memory that the use... | null | CC BY-SA 3.0 | null | 2008-08-02T23:33:30.740 | 2015-09-25T11:46:57.640 | 2015-09-25T11:46:57.640 | 316,799 | 149 | null |
549 | 1 | 477,578 | null | 5,518 | 667,058 | >
#### Moderator note:
This question is not a good fit for our question and answer format with the [topicality rules](/help/on-topic) which currently apply for Stack Overflow. We normally use a "historical lock" for such questions where the content still has value. However, the answers on this question are actively m... | The definitive guide to form-based website authentication | CC BY-SA 4.0 | 0 | 2008-08-02T19:51:50.250 | 2022-04-27T11:40:47.520 | 2021-11-11T19:35:16.907 | 3,773,011 | 136 | [
"forms",
"http",
"security",
"authentication",
"language-agnostic"
] |
539 | 2 | null | 180 | 28 | null | My first thought on this is "how to generate N vectors in a space that maximize distance from each other."
You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at [Random Point Picking](http://mathworld.wolfram.com/topics/RandomPointPicking.html). Once y... | null | CC BY-SA 4.0 | null | 2008-08-02T19:03:52.170 | 2018-05-30T13:55:59.787 | 2018-05-30T13:55:59.787 | 5,321,363 | 157 | null |
590 | 2 | null | 580 | 2 | null | If you have a company buying it, Toad from Quest Software has this kind of management functionality built in. It's basically a two-click operation to compare two schemas and generate a sync script from one to the other.
They have editions for most of the popular databases, including of course Sql Server.
| null | CC BY-SA 2.5 | null | 2008-08-03T00:22:03.997 | 2008-08-03T00:22:03.997 | null | null | 116 | null |
589 | 2 | null | 561 | 3 | null | Interesting question!
I would do this by picking combinations, something like the following in python. The hardest part is probably first pass verification, i.e. `if f(1,2,3) returns true`, is that a correct result? Once you have verified that, then this is a good basis for regression testing.
Probably it's a good ... | null | CC BY-SA 3.0 | null | 2008-08-03T00:04:59.023 | 2011-09-29T15:14:05.817 | 2011-09-29T15:14:05.817 | 231,716 | 116 | null |
594 | 1 | 595 | null | 55 | 58,127 | There are several ways to iterate over a result set. What are the tradeoff of each?
| cx_Oracle: How do I iterate over a result set? | CC BY-SA 3.0 | 0 | 2008-08-03T01:15:08.507 | 2016-10-15T20:47:11.027 | 2016-10-14T18:15:27.420 | 116 | 116 | [
"python",
"sql",
"database",
"oracle",
"cx-oracle"
] |
597 | 2 | null | 580 | 2 | null | I agree that scripting everything is the best way to go and is what I advocate at work. You should script everything from DB and object creation to populating your lookup tables.
Anything you do in UI only won't translate (especially for changes... not so much for first deployments) and will end up requiring a tools ... | null | CC BY-SA 2.5 | null | 2008-08-03T01:38:02.640 | 2008-08-03T01:38:02.640 | null | null | 76 | null |
598 | 2 | null | 371 | 23 | null | Confirm that you have the correct email address before sending out emails. If someone gives the wrong email address on sign-up, beat them over the head about it ASAP.
Always include clear "how to unsubscribe" information in EVERY email. Do not require the user to login to unsubscribe, it should be a unique url for 1-c... | null | CC BY-SA 2.5 | null | 2008-08-03T01:39:56.117 | 2008-08-03T01:39:56.117 | null | null | 175 | null |
599 | 2 | null | 173 | 6 | null | The typical solution is to dump the database as necessary and backup those files.
Depending on your development platform, there may be opensource plugins available. Rolling your own code to do it is usually fairly trivial.
Note: You may want to backup the database dump instead of putting it into version control. The... | null | CC BY-SA 2.5 | null | 2008-08-03T01:49:58.983 | 2008-08-03T01:49:58.983 | null | null | 175 | null |
591 | 2 | null | 580 | 3 | null | I work the same way Karl does, by keeping all of my SQL scripts for creating and altering tables in a text file that I keep in source control. In fact, to avoid the problem of having to have a script examine the live database to determine what ALTERs to run, I usually work like this:
- - -
The one thing this will n... | null | CC BY-SA 2.5 | null | 2008-08-03T00:37:03.903 | 2008-08-03T00:37:03.903 | null | null | 111 | null |
605 | 2 | null | 601 | 8 | null | [The Gnu Scientific Library](http://www.gnu.org/software/gsl) (GSL) has a pretty extensive set of RN generators, test harness, etc. If you're on linux, it's probably already available on your system.
| null | CC BY-SA 2.5 | null | 2008-08-03T02:26:33.213 | 2008-09-20T07:27:11.447 | 2008-08-03T02:38:04.783 | 116 | 116 | null |
602 | 2 | null | 601 | 31 | null | For C++, [Boost.Random](http://www.boost.org/libs/random/) is probably what you're looking for. It has support for MT (among many other algorithms), and can collect entropy via the `nondet_random` class. Check it out! :-)
| null | CC BY-SA 2.5 | null | 2008-08-03T02:18:57.987 | 2008-09-20T07:27:11.447 | null | null | 13 | null |
601 | 1 | 602 | null | 42 | 2,097 | I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a `drand48()` which generates 48 random bits. I'd like a similar function/class for C++ or C# which can genera... | Robust Random Number Generation | CC BY-SA 3.0 | 0 | 2008-08-03T02:05:59.620 | 2015-12-17T11:17:22.100 | 2015-12-17T11:17:22.100 | 5,550,041 | null | [
"c#",
"c++",
"random"
] |
607 | 2 | null | 263 | 18 | null | Hmm, ok. I'd suggest code like this, then:
```
typedef struct {
int type;
int result;
} DialogData;
static gboolean
display_dialog(gpointer user_data)
{
DialogData *dialog_data = user_data;
GtkWidget *dialog;
if (dialog_data->type & MB_YESNO)
dialog = gtk_message_dialog_new(...);
... | null | CC BY-SA 4.0 | null | 2008-08-03T02:30:05.907 | 2020-07-08T14:45:18.700 | 2020-07-08T14:45:18.700 | 156 | 156 | null |
595 | 2 | null | 594 | 55 | null | The canonical way is to use the built-in cursor iterator.
```
curs.execute('select * from people')
for row in curs:
print row
```
---
You can use `fetchall()` to get all rows at once.
```
for row in curs.fetchall():
print row
```
It can be convenient to use this to create a Python list containing the ... | null | CC BY-SA 3.0 | null | 2008-08-03T01:17:36.393 | 2016-10-15T20:47:11.027 | 2016-10-15T20:47:11.027 | 116 | 116 | null |
555 | 2 | null | 549 | 432 | null |
# Definitive Article
### Sending credentials
The only practical way to send credentials 100% securely is by using [SSL](http://en.wikipedia.org/wiki/SSL). Using JavaScript to hash the password is not safe. Common pitfalls for client-side password hashing:
- [vulnerable to man-in-the-middle attacks](https://sta... | null | CC BY-SA 4.0 | null | 2008-08-02T20:40:45.533 | 2018-11-19T13:54:03.990 | 2018-11-19T13:54:03.990 | 9,978,535 | 136 | null |
611 | 2 | null | 588 | 7 | null | I'm not a PHP dev but Google says that PHP 5+ can instantiate COM components. If you can install Outlook on a box you could write a PHP web service around the COM component to handle the requests you need.
```
$outlook = COM("Outlook.Application")
```
[Outlook API referance](http://msdn.microsoft.com/en-us/library/... | null | CC BY-SA 2.5 | null | 2008-08-03T03:07:30.150 | 2008-08-03T03:07:30.150 | null | null | 173 | null |
619 | 2 | null | 514 | 8 | null | It's been awhile since I used FCGI but I think a FCGI process could throw a SystemExit if the thread was taking too long. This could be the web service not responding or even a slow DNS query. Some google results show a similar error with Python and FCGI so moving to mongrel would be a good idea. [This post](http://... | null | CC BY-SA 3.0 | null | 2008-08-03T05:22:20.457 | 2013-01-09T05:47:56.510 | 2013-01-09T05:47:56.510 | 1,471,203 | 183 | null |
626 | 1 | 723 | null | 345 | 82,540 | In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and `Proc.new` on the other.
- - -
| When to use lambda, when to use Proc.new? | CC BY-SA 3.0 | 0 | 2008-08-03T06:40:54.120 | 2018-11-15T10:00:54.907 | 2012-05-18T06:25:18.533 | 211,563 | 136 | [
"ruby",
"lambda",
"proc"
] |
623 | 2 | null | 622 | 50 | null | [The Sieve of Atkin](http://en.wikipedia.org/wiki/Sieve_of_Atkin) is probably what you're looking for, its upper bound running time is O(N/log log N).
If you only run the numbers 1 more and 1 less than the multiples of 6, it could be even faster, as all prime numbers above 3 are 1 away from some multiple of six.
[Res... | null | CC BY-SA 3.0 | null | 2008-08-03T06:03:35.973 | 2013-03-01T06:44:35.933 | 2013-03-01T06:44:35.933 | 718,379 | 154 | null |
622 | 1 | 623 | null | 64 | 71,698 | I want to print the first 10000 prime numbers.
Can anyone give me the most efficient code for this?
Clarifications:
1. It does not matter if your code is inefficient for n >10000.
2. The size of the code does not matter.
3. You cannot just hard code the values in any manner.
| Most efficient code for the first 10000 prime numbers? | CC BY-SA 2.5 | 0 | 2008-08-03T05:45:21.423 | 2022-11-14T01:01:29.870 | 2012-08-07T09:41:33.377 | 1,261,166 | 184 | [
"performance",
"algorithm",
"primes"
] |
608 | 2 | null | 564 | 40 | null | I'll add to the excellent answers given above, and talk about boxing and unboxing, and how this applies to Java (although C# has it too). I'll use just Java terminology because I am more with that.
As the answers mentioned, `int` is just a number (called the type), whereas `Integer` is an object (which contains the ... | null | CC BY-SA 4.0 | null | 2008-08-03T02:32:50.690 | 2020-03-18T11:26:48.067 | 2020-03-18T11:26:48.067 | 1,442,180 | 13 | null |
531 | 2 | null | 19 | 222 | null | The [Monte Carlo method](http://en.wikipedia.org/wiki/Monte_Carlo_method), as mentioned, applies some great concepts but it is, clearly, not the fastest, not by a long shot, not by any reasonable measure. Also, it all depends on what kind of accuracy you are looking for. The fastest π I know of is the one with the digi... | null | CC BY-SA 4.0 | null | 2008-08-02T18:22:52.690 | 2018-09-05T11:46:23.093 | 2018-09-05T11:46:23.093 | 9,267,451 | 157 | null |
609 | 1 | null | null | 21 | 4,251 | An MFC application that I'm trying to migrate uses `afxext.h`, which causes `_AFXDLL` to get set, which causes this error if I set `/MT`:
> Please use the /MD switch for _AFXDLL builds
My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++,... | Build for Windows NT 4.0 using Visual Studio 2005? | CC BY-SA 3.0 | 0 | 2008-08-03T02:48:43.497 | 2017-01-17T17:15:43.383 | 2012-05-01T17:33:22.013 | 7,116 | 179 | [
"c++",
"visual-studio",
"compatibility",
"windows-nt"
] |
650 | 1 | 655 | null | 114 | 78,599 | I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want.
I'm also using a settings file and in earlier attempts... | Automatically update version number | CC BY-SA 2.5 | 0 | 2008-08-03T11:12:52.463 | 2021-04-19T16:31:55.373 | 2012-08-01T21:03:09.177 | 868,546 | 143 | [
"c#",
"visual-studio",
"versioning"
] |
635 | 2 | null | 337 | 6 | null | I write a SOAP server that receives XML requests and creates XML responses. (Unfortunately, it's not my project, so it's closed source, but that's another problem).
It turned out for me that creating (SOAP) XML documents is fairly simple if you have a data structure that "fits" the schema.
I keep the envelope since ... | null | CC BY-SA 4.0 | null | 2008-08-03T08:34:57.103 | 2019-05-22T00:27:38.800 | 2019-05-22T00:27:38.800 | 3,768,871 | 188 | null |
644 | 1 | 665 | null | 70 | 18,210 | I have a database table and one of the fields (not the primary key) is having a unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hacks I know are:
1. Delete both rows and re-insert them.
2. Update rows with some other value and swap and then update to actual va... | Swap unique indexed column values in database | CC BY-SA 4.0 | 0 | 2008-08-03T09:55:26.257 | 2018-11-22T01:32:31.887 | 2018-11-22T01:32:31.887 | 623,913 | 191 | [
"sql",
"database"
] |
657 | 1 | 669 | null | 38 | 5,822 | What is the fastest, yet secure way to encrypt passwords (in PHP preferably), and for whichever method you choose, is it portable?
In other words, if I later migrate my website to a different server, will my passwords continue to work?
The method I am using now, as I was told, is dependent on the exact versions of th... | Encrypting Passwords | CC BY-SA 4.0 | 0 | 2008-08-03T11:50:33.137 | 2020-08-13T10:43:55.057 | 2019-11-26T13:33:15.133 | 460,407 | 115 | [
"php",
"encryption",
"passwords"
] |
629 | 2 | null | 626 | 42 | null | I found [this page](http://raulparolari.com/Ruby2/lambda_Proc) which shows what the difference between `Proc.new` and `lambda` are. According to the page, the only difference is that a lambda is strict about the number of arguments it accepts, whereas `Proc.new` converts missing arguments to `nil`. Here is an example... | null | CC BY-SA 3.0 | null | 2008-08-03T07:28:54.070 | 2016-10-21T18:36:33.597 | 2016-10-21T18:36:33.597 | 3,257,186 | 122 | null |
651 | 1 | 725 | null | 34 | 6,834 | I've been having trouble getting my ASP.NET application to automatically log users into the Intranet site I'm building. No matter the googling or the experimentation I applied, there is always a login box displayed by IE7.
I've got Windows authentication mode set in the Web.config, disabled anonymous access and confi... | Checklist for IIS 6/ASP.NET Windows Authentication? | CC BY-SA 2.5 | 0 | 2008-08-03T11:21:54.520 | 2019-06-12T17:00:05.673 | 2009-03-10T03:47:54.460 | 5,640 | 192 | [
"asp.net",
"iis",
"authentication",
"active-directory"
] |
665 | 2 | null | 644 | 17 | null | I think you should go for solution 2. There is no 'swap' function in any SQL variant I know of.
If you need to do this regularly, I suggest solution 1, depending on how other parts of the software are using this data. You can have locking issues if you're not careful.
But in short: there is no other solution than the... | null | CC BY-SA 2.5 | null | 2008-08-03T12:26:35.843 | 2008-08-03T12:26:35.843 | null | null | 197 | null |
676 | 2 | null | 227 | 27 | null | Perhaps this is a little academic and off topic but `hX` tags are probably not the best choice for a tag cloud for reasons of document structure and all that sort of thing.
Maybe `span`s or an `ol` with appropriate class attributes (plus some CSS)?
| null | CC BY-SA 3.0 | null | 2008-08-03T13:01:24.243 | 2016-04-10T21:21:22.227 | 2016-04-10T21:21:22.227 | 1,564,659 | 199 | null |
660 | 2 | null | 535 | 19 | null | Second the Buildbot - Trac integration. You can find more information about the integration on the [Buildbot website](http://buildbot.net/trac/wiki/BuildbotAndTrac). At my previous job, we wrote and used the plugin they mention (tracbb).
What the plugin does is rewriting all of the Buildbot urls so you can use Buildbot... | null | CC BY-SA 2.5 | null | 2008-08-03T12:09:18.357 | 2008-08-03T12:09:18.357 | null | null | 197 | null |
667 | 2 | null | 264 | 15 | null | It depends on what kind of application you are building. Create a representative test scenario, and start hammering away. Then you will know the definitive answer.
Besides your use case, it also depends on CPU, memory, front-side bus, operating system, cache settings, etcetera.
Seriously, just test your own scenario.... | null | CC BY-SA 2.5 | null | 2008-08-03T12:34:36.060 | 2008-08-03T12:34:36.060 | null | null | 197 | null |
681 | 2 | null | 328 | 3 | null | The main problem with PHP sessions and security (besides session hijacking) comes with what environment you are in. By default PHP stores the session data in a file in the OS's temp directory. Without any special thought or planning this is a world readable directory so all of your session information is public to anyo... | null | CC BY-SA 2.5 | null | 2008-08-03T13:14:48.600 | 2008-08-03T13:14:48.600 | null | null | 200 | null |
633 | 2 | null | 588 | 24 | null |
Over a decade since this question and things have moved on. Microsft now has a [Rest API](https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/office-365-rest-apis-for-mail-calendars-and-contacts) that will allow you to easily access this data.
---
I have not used PHP to do this but ha... | null | CC BY-SA 4.0 | null | 2008-08-03T07:50:37.617 | 2020-07-13T09:02:05.310 | 2020-07-13T09:02:05.310 | 33 | 33 | null |
679 | 2 | null | 48 | 17 | null | I would use JavaScript to submit the form. The function would be triggered by the OnKeyPress event of the form element and would detect whether the key was selected. If this is the case, it will submit the form.
Here are two pages that give techniques on how to do this: [1](http://www.htmlcodetutorial.com/forms/index... | null | CC BY-SA 4.0 | null | 2008-08-03T13:12:21.007 | 2019-07-14T14:30:42.800 | 2019-07-14T14:30:42.800 | 63,550 | 51 | null |
693 | 2 | null | 371 | 11 | null | I've found that using the recipients real first and last name in the body is a sure fire way of getting through a spam filter.
| null | CC BY-SA 2.5 | null | 2008-08-03T13:57:01.633 | 2008-08-03T13:57:01.633 | null | null | 209 | null |
655 | 2 | null | 650 | 97 | null | With the "Built in" stuff, you can't, as using 1.0.* or 1.0.0.* will replace the revision and build numbers with a coded date/timestamp, which is usually also a good way.
For more info, see the [Assembly Linker](http://msdn2.microsoft.com/en-us/library/c405shex(vs.80).aspx) Documentation in the /v tag.
As for automa... | null | CC BY-SA 3.0 | null | 2008-08-03T11:41:38.490 | 2013-01-28T04:10:16.497 | 2013-01-28T04:10:16.497 | null | 91 | null |
684 | 2 | null | 644 | 3 | null | I also think that #2 is the best bet, though I would be sure to wrap it in a transaction in case something goes wrong mid-update.
An alternative (since you asked) to updating the Unique Index values with different values would be to update all of the other values in the rows to that of the other row. Doing this means ... | null | CC BY-SA 2.5 | null | 2008-08-03T13:22:25.340 | 2008-08-03T13:22:25.340 | null | null | 51 | null |
683 | 1 | 57,833 | null | 58 | 13,878 | I don't remember whether I was dreaming or not but I seem to recall there being a function which allowed something like,
```
foo in iter_attr(array of python objects, attribute name)
```
I've looked over the docs but this kind of thing doesn't fall under any obvious listed headers
| Using 'in' to match an attribute of Python objects in an array | CC BY-SA 2.5 | null | 2008-08-03T13:19:16.983 | 2011-11-24T09:57:27.813 | 2008-08-23T16:11:59.307 | 1,190 | 199 | [
"python",
"arrays",
"iteration"
] |
691 | 2 | null | 657 | 16 | null | I'm with Peter. Developer don't seem to understand passwords. We all pick (and I'm guilty of this too) MD5 or SHA1 because they are fast. Thinking about it ('cuz someone recently pointed it out to me) that doesn't make any sense. We should be picking a hashing algorithm that's stupid slow. I mean, on the scale of thing... | null | CC BY-SA 4.0 | null | 2008-08-03T13:48:25.367 | 2020-08-13T10:43:05.960 | 2020-08-13T10:43:05.960 | 13,536,893 | 34 | null |
704 | 2 | null | 696 | 18 | null | Have you looked at connecting to the server using [unixODBC](http://www.unixodbc.org/)? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out [http://www.php.net/odbc](http://www.php.net/odbc) for more information regarding the PHP side.
If you can't get that to work, the option to setu... | null | CC BY-SA 3.0 | null | 2008-08-03T14:39:09.710 | 2015-05-20T00:18:44.193 | 2015-05-20T00:18:44.193 | 200 | 200 | null |
696 | 1 | 704 | null | 37 | 8,792 | I've got an upcoming project wherein I will need to connect our website (`PHP5/Apache 1.3/OpenBSD 4.1`) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.
From what I've seen the DB2 extensions ... | Connect PHP to IBM i (AS/400) | CC BY-SA 4.0 | 0 | 2008-08-03T14:03:28.830 | 2019-06-04T09:26:42.767 | 2019-06-04T09:26:42.767 | 6,556,397 | 204 | [
"php",
"database",
"odbc",
"db2",
"ibm-midrange"
] |
699 | 2 | null | 164 | 47 | null | The following works for me in Firefox and Internet Explorer:
```
<object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading microsoft windows media player components..." type="applica... | null | CC BY-SA 3.0 | null | 2008-08-03T14:27:20.967 | 2013-07-14T11:45:15.310 | 2013-07-14T11:45:15.310 | 868,014 | 30 | null |
707 | 2 | null | 705 | 25 | null | [SQLite](http://www.sqlite.org/) came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive you keep yourself to the constraint of 1 user at a time.
[SQLite on .NET - Get up and running in 3 minutes](http://web.archive.org/web/20100208133236/www.mikeduncan.com... | null | CC BY-SA 3.0 | null | 2008-08-03T14:48:52.497 | 2013-01-28T04:20:50.873 | 2013-01-28T04:20:50.873 | null | 46 | null |
710 | 2 | null | 705 | 7 | null | Check out [VistaDB](http://www.gibraltarsoftware.com/VistaDB). They have a very good product, the server version (3.4) is in Beta and is very close to release.
| null | CC BY-SA 4.0 | null | 2008-08-03T14:57:18.907 | 2018-07-17T13:45:36.413 | 2018-07-17T13:45:36.413 | 51 | 51 | null |
709 | 1 | 713 | null | 55 | 6,686 | I'm looking to introduce a unit testing framework into the mix at my job. We're using Visual Studio 2005 (though we may be moving to 2008 within the next six months) and work primarily in C#. If the framework has some kind of IDE integration that would be best, but I'm open to frameworks that don't have integration bu... | .NET testing framework advice | CC BY-SA 4.0 | 0 | 2008-08-03T14:53:53.550 | 2020-07-30T10:57:38.657 | 2020-07-30T10:39:38.410 | 63,550 | 111 | [
"c#",
".net",
"visual-studio",
"unit-testing",
"nunit"
] |
705 | 1 | 62,459,099 | null | 38 | 8,079 | I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time.
Now, my first idea was [SQL Server Compact edition](http://www.microsoft.com/sql/editions/compact/default.... | Embedded Database for .net that can run off a network | CC BY-SA 4.0 | 0 | 2008-08-03T14:41:43.103 | 2020-06-18T20:44:01.777 | 2020-06-18T20:34:15.997 | 9,780,149 | 91 | [
".net",
"database",
"embedded-database"
] |
701 | 2 | null | 683 | 7 | null | No, you were not dreaming. Python has a pretty excellent list comprehension system that lets you manipulate lists pretty elegantly, and depending on exactly what you want to accomplish, this can be done a couple of ways. In essence, what you're doing is saying "For item in list if criteria.matches", and from that you... | null | CC BY-SA 3.0 | null | 2008-08-03T14:30:50.850 | 2011-11-24T09:57:27.813 | 2011-11-24T09:57:27.813 | 447,356 | 111 | null |
712 | 2 | null | 709 | 18 | null | Scott Hanselman had a good about this, entitled:
> "The Past, Present and Future of .NET Unit Testing Frameworks"
:
[Hanselminutes #112](http://www.hanselminutes.com/default.aspx?showID=130)
| null | CC BY-SA 4.0 | null | 2008-08-03T14:57:44.600 | 2020-07-30T10:33:45.140 | 2020-07-30T10:33:45.140 | 63,550 | 91 | null |
695 | 2 | null | 36 | 20 | null | How often do you need to check for changes and how large (in terms of row size) are the tables in the database? If you use the `CHECKSUM_AGG(BINARY_CHECKSUM(*))` method suggested by John, it will scan every row of the specified table. The `NOLOCK` hint helps, but on a large database, you are still hitting every row. ... | null | CC BY-SA 3.0 | null | 2008-08-03T13:59:24.063 | 2012-10-14T12:19:25.500 | 2012-10-14T12:19:25.500 | 967,315 | 206 | null |
717 | 1 | 799 | null | 31 | 11,670 | I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb pr... | Why doesn't VFP .NET OLEdb provider work in 64 bit Windows? | CC BY-SA 3.0 | null | 2008-08-03T15:07:10.073 | 2014-11-25T20:41:05.157 | 2014-11-25T20:41:05.157 | 2,641,576 | null | [
".net",
"sql-server-2005",
"oledb",
"legacy",
"visual-foxpro"
] |
713 | 2 | null | 709 | 44 | null | I think [NUnit](https://en.wikipedia.org/wiki/NUnit) your best bet. With [TestDriven.NET](https://testdriven.net/), you get great integration within Visual Studio. (ReSharper also has a unit test runner if you're using it). NUnit is simple to use and follows an established paradigm. You'll also find plenty of projects... | null | CC BY-SA 4.0 | null | 2008-08-03T14:59:20.993 | 2020-07-30T10:33:01.410 | 2020-07-30T10:33:01.410 | 63,550 | 34 | null |
718 | 2 | null | 709 | 8 | null | Visual Studio 2008 has a built-in test project type that works in a similar way to NUnit, but obviously has much tighter integration with Visual Studio (can run on every build and shows the results in a similar way to the conversion results page when upgrading solution files), but it is obviously not as mature as NUnit... | null | CC BY-SA 4.0 | null | 2008-08-03T15:07:20.213 | 2020-07-30T10:35:46.667 | 2020-07-30T10:35:46.667 | 63,550 | 27 | null |
725 | 2 | null | 651 | 20 | null | It sounds like you've covered all the server-side bases--maybe it's a client issue? I assume your users have integrated authentication enabled in IE7? (Tools -> Internet Options -> Advanced -> Security). This is enabled by default.
Also, is your site correctly recognized by IE7 as being in the Local Intranet zone? ... | null | CC BY-SA 2.5 | null | 2008-08-03T15:24:38.290 | 2008-08-03T15:24:38.290 | null | null | 205 | null |
737 | 2 | null | 705 | 9 | null | It sounds like ADO/Access is perfect for your needs. It's baked into the MS stack, well seasoned, and multi-user.
You can programatically create a DB like so:
```
Dim catalog as New ADOX.Catalog
Catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\server\path\to\db.mdb")
```
You can then use standard ADO.... | null | CC BY-SA 2.5 | null | 2008-08-03T15:48:43.657 | 2008-08-04T13:56:01.917 | 2008-08-04T13:56:01.917 | 173 | 173 | null |
746 | 1 | null | null | 30 | 9,779 | How do I format a string to [title case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)?
| Format string to title case | CC BY-SA 3.0 | 0 | 2008-08-03T16:03:48.290 | 2020-12-12T14:20:39.237 | 2016-01-02T15:40:35.187 | 1,957,401 | 192 | [
"string",
"language-agnostic",
"format",
"title-case"
] |
745 | 2 | null | 683 | 12 | null | Are you looking to get a list of objects that have a certain attribute? If so, a [list comprehension](http://docs.python.org/tut/node7.html#SECTION007140000000000000000) is the right way to do this.
```
result = [obj for obj in listOfObjs if hasattr(obj, 'attributeName')]
```
| null | CC BY-SA 2.5 | null | 2008-08-03T15:59:19.797 | 2008-08-03T15:59:19.797 | null | null | 154 | null |
669 | 2 | null | 657 | 33 | null | If you are choosing an encryption method for your login system then speed is not your friend, Jeff had a to-and-frow with Thomas Ptacek about passwords and the [conclusion](http://chargen.matasano.com/chargen/2007/9/7/enough-with-the-rainbow-tables-what-you-need-to-know-about-s.html) was that you should use the slowest... | null | CC BY-SA 3.0 | null | 2008-08-03T12:48:36.657 | 2012-05-16T01:48:22.800 | 2012-05-16T01:48:22.800 | 17,174 | 117 | null |
730 | 2 | null | 705 | 5 | null | Why not use [SQL Server 2005 Express edition](http://www.microsoft.com/sql/editions/express/default.mspx)?
It really depends on what you mean by "embedded" - but you can redistribute SQLServer2005E with your applications and the user never has to know it's there.
[Embedding SQL Server Express in Applications](http:/... | null | CC BY-SA 3.0 | null | 2008-08-03T15:34:17.523 | 2013-01-28T04:20:26.910 | 2013-01-28T04:20:26.910 | null | null | null |
742 | 1 | 33,957 | null | 62 | 15,090 | [Django](http://www.djangoproject.com/) view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if statements in the function, but I was thinking more of an object oriented approach.
For example, I have a page that d... | Class views in Django | CC BY-SA 2.5 | 0 | 2008-08-03T15:55:28.633 | 2014-10-08T05:53:09.677 | 2008-09-11T20:14:02.330 | -1 | 189 | [
"python",
"django",
"view",
"oop"
] |
747 | 2 | null | 746 | 16 | null | Here is a simple static method to do this in C#:
```
public static string ToTitleCaseInvariant(string targetString)
{
return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(targetString);
}
```
| null | CC BY-SA 2.5 | null | 2008-08-03T16:05:57.537 | 2008-08-03T16:05:57.537 | null | null | 192 | null |
749 | 2 | null | 746 | 5 | null | In what language?
In PHP it is:
[ucwords()](http://php.net/manual/en/function.ucwords.php)
example:
```
$HelloWorld = ucwords('hello world');
```
| null | CC BY-SA 3.0 | null | 2008-08-03T16:12:43.747 | 2011-12-26T17:11:26.727 | 2011-12-26T17:11:26.727 | null | 58 | null |
751 | 2 | null | 746 | -1 | null | Without using a ready-made function, a super-simple low-level algorithm to convert a string to title case:
```
convert first character to uppercase.
for each character in string,
if the previous character is whitespace,
convert character to uppercase.
```
This asssumes the "convert character to uppercase... | null | CC BY-SA 2.5 | null | 2008-08-03T16:25:07.700 | 2008-08-03T16:25:07.700 | null | null | 219 | null |
723 | 2 | null | 626 | 383 | null | Another important but subtle difference between procs created with `lambda` and procs created with `Proc.new` is how they handle the `return` statement:
- `lambda``return`- `Proc.new``return`
Here's `lambda`-created proc's `return` in action. It behaves in a way that you probably expect:
```
def whowouldwin
mylam... | null | CC BY-SA 3.0 | null | 2008-08-03T15:21:52.760 | 2016-12-30T06:28:30.057 | 2016-12-30T06:28:30.057 | 2,909,897 | 216 | null |
752 | 1 | 755 | null | 896 | 696,855 | One may not always know the `Type` of an object at compile-time, but may need to create an instance of the `Type`.
How do you get a new object instance from a `Type`?
| How to create a new object instance from a Type | CC BY-SA 4.0 | 0 | 2008-08-03T16:29:03.607 | 2022-11-16T07:35:48.033 | 2020-04-19T17:56:29.830 | 806,202 | 192 | [
"c#",
".net",
"performance",
"reflection",
"types"
] |
750 | 2 | null | 683 | 5 | null | What I was thinking of can be achieved using list comprehensions, but I thought that there was a function that did this in a slightly neater way.
i.e. 'bar' is a list of objects, all of which have the attribute 'id'
The mythical functional way:
```
foo = 12
foo in iter_attr(bar, 'id')
```
The list comprehension wa... | null | CC BY-SA 2.5 | null | 2008-08-03T16:13:29.363 | 2008-08-03T16:13:29.363 | null | null | 199 | null |