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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36,350 | 1 | 36,367 | null | 128 | 133,456 | I have a method which takes params object[] such as:
```
void Foo(params object[] items)
{
Console.WriteLine(items[0]);
}
```
When I pass two object arrays to this method, it works fine:
```
Foo(new object[]{ (object)"1", (object)"2" }, new object[]{ (object)"3", (object)"4" } );
// Output: System.Object[]
```
... | How to pass a single object[] to a params object[] | CC BY-SA 2.5 | 0 | 2008-08-30T21:22:06.433 | 2022-06-26T10:17:37.633 | 2008-08-31T06:35:08.897 | 832 | 31,505 | [
"c#",
"arrays"
] |
36,360 | 2 | null | 36,350 | 3 | null | You need to encapsulate it into another object[] array, like this:
```
Foo(new Object[] { new object[]{ (object)"1", (object)"2" }});
```
| null | CC BY-SA 2.5 | null | 2008-08-30T21:31:28.517 | 2008-08-30T21:31:28.517 | null | null | 267 | null |
36,342 | 2 | null | 26,799 | 1 | null | I've finally gotten my "fully automated data back-up strategy" down to a fine art. I never have to manually intervene, and I'll never lose another harddrive worth of data. If my computer dies, I'll always have a full bootable back-up that is no more than 24 hours old, and incremental back-ups no more than an hour old. ... | null | CC BY-SA 2.5 | null | 2008-08-30T21:07:31.790 | 2008-08-30T21:07:31.790 | null | null | 3,407 | null |
36,340 | 2 | null | 36,314 | 49 | null | Currying is a transformation that can be applied to functions to allow them to take one less argument than previously.
For example, in F# you can define a function thus:-
```
let f x y z = x + y + z
```
Here function f takes parameters x, y and z and sums them together so:-
```
f 1 2 3
```
Returns 6.
From our... | null | CC BY-SA 4.0 | null | 2008-08-30T21:06:05.350 | 2019-01-11T12:03:08.313 | 2019-01-11T12:03:08.313 | 5,555,803 | 3,394 | null |
36,359 | 2 | null | 36,315 | 1 | null | The is the "cut down" version of .NET that only includes what Microsoft perceive to be the "useful" bits of .NET for client applications. So, useful things like the `HttpUtility` classes are missing.
For more on that see [ScottGu's blog](http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-fra... | null | CC BY-SA 2.5 | null | 2008-08-30T21:30:54.713 | 2008-09-03T19:52:36.380 | 2008-09-03T19:52:36.380 | 3,546 | 3,546 | null |
36,366 | 2 | null | 36,274 | 7 | null | The term lazy loading is usually used when talking about object relational mappers. If you use ADO.NET directly you always get eager loading (ie it always loads just what you specify).
OR-mappers like nHibernate support returning proxy objects that get "filled in" with the right data only when you access the data. Tha... | null | CC BY-SA 2.5 | null | 2008-08-30T21:36:29.753 | 2008-08-30T21:36:29.753 | null | null | 3,320 | null |
36,356 | 2 | null | 36,347 | 95 | null | C++ has templates. Java has generics, which look kinda sorta like C++ templates, but they're very, very different.
Templates work, as the name implies, by providing the compiler with a (wait for it...) template that it can use to generate type-safe code by filling in the template parameters.
Generics, as I understan... | null | CC BY-SA 4.0 | null | 2008-08-30T21:30:13.637 | 2019-03-10T07:35:26.377 | 2019-03-10T07:35:26.377 | 2,361,308 | 811 | null |
36,367 | 2 | null | 36,350 | 103 | null | A simple typecast will ensure the compiler knows what you mean in this case.
```
Foo((object)new object[]{ (object)"1", (object)"2" }));
```
As an array is a subtype of object, this all works out. Bit of an odd solution though, I'll agree.
| null | CC BY-SA 3.0 | null | 2008-08-30T21:36:59.377 | 2017-08-17T17:21:30.877 | 2017-08-17T17:21:30.877 | 1,849,664 | 1,200 | null |
36,369 | 2 | null | 36,294 | 6 | null | Without doubt, you should purchase Don Syme's excellent book "Expert F#". The book is very well written and is suitable for both beginners and experts alike. In it, you'll find both introductory material and much more challenging material too. At nearly 600 pages it is good value for money.
I found that it taught me a... | null | CC BY-SA 2.5 | null | 2008-08-30T21:45:55.363 | 2008-08-30T21:45:55.363 | null | null | 3,010 | null |
36,364 | 2 | null | 36,347 | 170 | null | There is a big difference between them. In C++ you don't have to specify a class or an interface for the generic type. That's why you can create truly generic functions and classes, with the caveat of a looser typing.
```
template <typename T> T sum(T a, T b) { return a + b; }
```
The method above adds two objects of ... | null | CC BY-SA 4.0 | null | 2008-08-30T21:34:05.967 | 2022-04-15T16:39:10.817 | 2022-04-15T16:39:10.817 | 3,924,118 | 3,280 | null |
36,370 | 2 | null | 15,681 | 0 | null | I've been dabbling in Cocoa for the past couple years, and recently picked up Fritz Anderson's "[Xcode 3 Unleashed](https://rads.stackoverflow.com/amzn/click/com/0321552636)." Highly recommended for getting into Xcode — especially with some of the big changes 3.0/Leopard brought.
Don't forget Hillegass' defacto Cocoa ... | null | CC BY-SA 2.5 | null | 2008-08-30T21:46:01.073 | 2008-08-30T21:46:01.073 | null | null | null | null |
36,361 | 2 | null | 36,350 | 1 | null | One option is you can wrap it into another array:
```
Foo(new object[]{ new object[]{ (object)"1", (object)"2" } });
```
Kind of ugly, but since each item is an array, you can't just cast it to make the problem go away... such as if it were Foo(params object items), then you could just do:
```
Foo((object) new obje... | null | CC BY-SA 2.5 | null | 2008-08-30T21:31:49.343 | 2008-08-30T21:46:04.973 | 2008-08-30T21:46:04.973 | 122 | 122 | null |
36,390 | 2 | null | 36,344 | 1 | null | This isn't necessarily an answer to your question, but I've had great success using [MacPorts](http://macports.org) for installing Perl stuff on OS X. It's much smoother than trying to use CPAN because it knows that it's installing for OS X and will patch modules appropriately. Definitely recommended.
| null | CC BY-SA 2.5 | null | 2008-08-30T22:02:05.400 | 2008-08-30T22:02:05.400 | null | null | 893 | null |
36,384 | 2 | null | 30,800 | 3 | null | If you're on an intranet, Windows authentication can be handled for "free" by configuration alone.
If this isn't appropriate, token services work just fine, but for some situations they may be just too much.
The application I'm working on needed bare-bones authentication. Our server and client run inside a (very sec... | null | CC BY-SA 2.5 | null | 2008-08-30T21:56:23.107 | 2008-08-30T21:56:23.107 | null | null | 3,546 | null |
36,395 | 2 | null | 36,139 | 61 | null | It is also worth noting the [sorted()](https://docs.python.org/3/library/functions.html#sorted) function:
```
for x in sorted(list):
print x
```
This returns a new, sorted version of a list without changing the original list.
| null | CC BY-SA 3.0 | null | 2008-08-30T22:14:36.557 | 2018-02-14T07:39:10.407 | 2018-02-14T07:39:10.407 | 1,762,073 | 893 | null |
36,407 | 1 | 36,419 | null | 20 | 1,958 | What Firefox add-ons do you use that are useful for programmers?
| Firefox add-ons | CC BY-SA 2.5 | 0 | 2008-08-30T22:23:42.010 | 2010-08-28T15:53:03.807 | 2008-09-24T14:56:14.347 | 277 | 3,305 | [
"firefox",
"add-on"
] |
36,406 | 1 | 36,423 | null | 3 | 957 | I am working on an ASP.NET project which is physically located at C:\Projects\MyStuff\WebSite2. When I run the app with the Visual Studio debugger it seems that the built in web server considers "C:\Projects\MyStuff\" to be the relative root, not "C:\Projects\MyStuff\WebSite2". Is there a web.config setting or somethin... | Relative Root with Visual Studio ASP.NET debugger | CC BY-SA 2.5 | null | 2008-08-30T22:22:50.360 | 2010-10-01T04:49:10.907 | 2008-09-03T16:12:57.767 | -1 | 3,799 | [
"asp.net"
] |
36,397 | 2 | null | 36,182 | 1 | null | I don't believe `ST_GeomFromText()` is particularly expensive, although in the past I've optimized `PostGIS` queries by creating a function, declaring a variable and then assigning the result of `ST_GeomFromText` to the variable.
Have you tried checking the execution plan for you query with a variety of different para... | null | CC BY-SA 3.0 | null | 2008-08-30T22:16:10.093 | 2016-07-13T09:36:38.437 | 2016-07-13T09:36:38.437 | 5,520,058 | 2,562 | null |
36,398 | 2 | null | 24,179 | 50 | null | It's hard to find much about Hive, but I found this [snippet](http://wiki.apache.org/hadoop/Hive) on the Hive site that leans heavily in favor of HBase (bold added):
Hive is based on Hadoop which is a batch processing system. Accordingly, this system does not and . The paradigm here is strictly of submitting jobs and ... | null | CC BY-SA 2.5 | null | 2008-08-30T22:16:14.213 | 2008-08-30T22:16:14.213 | null | null | 422 | null |
36,335 | 2 | null | 36,326 | 1 | null | app.config isn't what you want to use for user-tweakable data, as it'll be stored somewhere in Program Files (which the user shouldn't have write permissions to). Instead, settings marked with `a UserScopedSettingAttribute` will end up in a user-scoped .config file somewhere in %LocalAppData%.
I found the best way to ... | null | CC BY-SA 2.5 | null | 2008-08-30T20:44:49.520 | 2008-08-30T20:44:49.520 | null | null | 3,191 | null |
36,413 | 2 | null | 36,407 | 2 | null | As far as web development, especially for javascript, I find [Firebug](http://getfirebug.com/) to be invaluable. [Web developer toolbar](https://addons.mozilla.org/en-US/firefox/addon/60) is also very useful.
| null | CC BY-SA 2.5 | null | 2008-08-30T22:26:02.693 | 2008-08-30T22:26:02.693 | null | null | 3,757 | null |
36,409 | 2 | null | 25,950 | 0 | null | Check out "Writing Efficient Ruby Code" from Addison Wesley Professional:
[http://safari.oreilly.com/9780321540034](http://safari.oreilly.com/9780321540034)
I found some very helpful and interesting insights in this short work. And if you sign up for the free 10-day trial you could read it for free. (It's 50 pages an... | null | CC BY-SA 2.5 | null | 2008-08-30T22:24:30.543 | 2008-08-30T22:24:30.543 | null | null | 3,796 | null |
36,414 | 2 | null | 36,407 | 0 | null | [Web Developer](https://addons.mozilla.org/en-US/firefox/addon/60) for web development. [Scribefire](https://addons.mozilla.org/en-US/firefox/addon/1730) if you're a blogger-progammer
| null | CC BY-SA 2.5 | null | 2008-08-30T22:26:45.013 | 2008-08-30T22:26:45.013 | null | null | 2,562 | null |
36,416 | 2 | null | 36,407 | 5 | null | I'd also recommend the [Web Developer](https://addons.mozilla.org/en-US/firefox/addon/60) extension by Chris Pederick.
| null | CC BY-SA 2.5 | null | 2008-08-30T22:27:06.217 | 2008-08-30T22:27:06.217 | null | null | 3,654 | null |
36,383 | 2 | null | 36,296 | 3 | null | I'm still fiddling with this -- no answer yet, or even a clear direction, but some of this random assortment of facts might be useful to someone..
The code is 708 digits long. Prime factorization: 2 2 3 59. Unless they're being tricky by padding the ends, the chunk size must be 1, 2, 4, 6, or 12; the higher factor... | null | CC BY-SA 2.5 | null | 2008-08-30T21:54:44.797 | 2008-08-30T21:54:44.797 | null | null | 2,391 | null |
36,421 | 2 | null | 36,417 | 0 | null | There's a lot that can be said on this topic but a very basic starting point would be to move as much code as possible out into separate files and then use include statements.
| null | CC BY-SA 2.5 | null | 2008-08-30T22:29:19.627 | 2008-08-30T22:29:19.627 | null | null | 305 | null |
36,417 | 1 | 36,444 | null | 15 | 1,944 | What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code.
I've tried moving blocks of code out into functions, so now there are functions ... | PHP best practices? | CC BY-SA 2.5 | 0 | 2008-08-30T22:27:15.653 | 2008-09-04T15:12:21.537 | 2008-08-30T22:28:27.163 | 305 | 3,800 | [
"php"
] |
36,420 | 2 | null | 36,407 | 0 | null | For web developing I use the [Web Developer Toolbar](https://addons.mozilla.org/en-US/firefox/addon/60), [CSS Viewer](https://addons.mozilla.org/en-US/firefox/addon/2104) [MeasureIt](https://addons.mozilla.org/en-US/firefox/addon/539)
But I'm really not one of those who has a thousand of extensions to do everything. I... | null | CC BY-SA 2.5 | null | 2008-08-30T22:28:54.230 | 2008-08-30T22:46:01.053 | 2017-05-23T12:08:35.993 | -1 | 802 | null |
36,419 | 2 | null | 36,407 | 18 | null | I guess it's silly to mention Firebug -- doubt any of us could live without it. Other than that I use the following (only listing dev-related):
- - - - - - - - - - -
| null | CC BY-SA 2.5 | null | 2008-08-30T22:28:50.580 | 2008-08-30T22:28:50.580 | null | null | 2,757 | null |
36,429 | 2 | null | 36,417 | 2 | null | Does the outside person need to edit the logic, or just the display (HTML)?
If it's the latter case, check out the [Smarty](http://www.smarty.net/) template engine.
| null | CC BY-SA 2.5 | null | 2008-08-30T22:36:09.937 | 2008-08-30T22:36:09.937 | null | null | 2,391 | null |
36,423 | 2 | null | 36,406 | 2 | null | you can try this trick that Scott Guthrie posted on his blog [http://weblogs.asp.net/scottgu/archive/2006/12/19/tip-trick-how-to-run-a-root-site-with-the-local-web-server-using-vs-2005-sp1.aspx](http://weblogs.asp.net/scottgu/archive/2006/12/19/tip-trick-how-to-run-a-root-site-with-the-local-web-server-using-vs-2005-sp... | null | CC BY-SA 2.5 | null | 2008-08-30T22:31:01.790 | 2008-08-30T22:31:01.790 | 2020-06-20T09:12:55.060 | -1 | 3,747 | null |
36,428 | 2 | null | 36,417 | 0 | null | I usually use includes, as they can be very useful for organising and grouping functions together. Also, comment your code. There's nothing worse than for someone else to see your work and not know why you've done this. Naming variables and functions sensibly can go a long way too - for example:
```
$userName = "John ... | null | CC BY-SA 2.5 | null | 2008-08-30T22:35:47.083 | 2008-08-30T22:35:47.083 | null | null | 3,654 | null |
36,425 | 2 | null | 36,417 | 6 | null | Take a look at how some of the popular PHP frameworks use templating. Examples include cakePHP, Zend Framework, and Code Igniter. Even if you are not going to base your site on these frameworks, the template design pattern is a good way to keep php code away from your web designers, so they can focus on layout and not ... | null | CC BY-SA 2.5 | null | 2008-08-30T22:34:14.793 | 2008-08-30T22:34:14.793 | null | null | 3,757 | null |
36,430 | 1 | 39,103 | null | 8 | 10,981 | I'm not sure of all of them, but what are the commands to do things like update Ruby, download a new gem, or update an existing gem? What other important things are there?
Since it might matter, I'm running Windows.
| What are the important Ruby commands? | CC BY-SA 2.5 | 0 | 2008-08-30T22:36:52.697 | 2008-10-31T03:47:16.883 | 2008-08-30T23:12:37.277 | 572 | 572 | [
"ruby"
] |
36,433 | 2 | null | 36,407 | 1 | null | @Flávio Amieiro
MeasureIt is an unnecessary extension to have if you install the Web Developer Toolbar. Web Developer Toolbar includes a ruler as one of its features. Under the "`Miscellaneous`" category for Web Developer click the option "`Display Ruler`" to use a ruler identical to the MeasureIt one.
That will allo... | null | CC BY-SA 2.5 | null | 2008-08-30T22:40:41.097 | 2008-08-30T22:40:41.097 | null | null | 392 | null |
36,424 | 2 | null | 1,387 | 10 | null | Your first step is to find and understand the parallelism in your problem. It is really easy to write multi-threaded code that performs no better than the single-threaded code it replaces. "Patterns for Parallel Programming" [(Amazon)](https://rads.stackoverflow.com/amzn/click/com/0321228111) is a great introduction to... | null | CC BY-SA 2.5 | null | 2008-08-30T22:32:36.390 | 2008-08-30T22:32:36.390 | null | null | 3,776 | null |
36,437 | 2 | null | 36,407 | 2 | null | The ones I have are...
- [Y-SLow](https://addons.mozilla.org/en-US/firefox/addon/5369)- [Live Headers](https://addons.mozilla.org/en-US/firefox/addon/3829)- [Firebug](https://addons.mozilla.org/en-US/firefox/addon/1843)- [Dom Inspector](https://addons.mozilla.org/en-US/firefox/addon/6622)
| null | CC BY-SA 2.5 | null | 2008-08-30T22:42:39.440 | 2008-08-30T22:42:39.440 | null | null | 3,720 | null |
36,438 | 2 | null | 25,033 | 1 | null | There's a nice [apache commons lang](http://commons.apache.org/lang/) library which has a good api for common :) actions. You could use statically import StringUtils and use its method isNotEmpty(String ) to get:
```
while(isNotEmpty(line)) {
System.out.println(line);
line = br.readLine();
}
```
It might be ... | null | CC BY-SA 2.5 | null | 2008-08-30T22:43:46.627 | 2008-08-30T22:43:46.627 | null | null | 3,666 | null |
36,412 | 2 | null | 2,968 | 13 | null | Parsing manually is a lot of fun... at the beginning:)
In practice if commands aren't very sophisticated you can treat them the same way as those used in command line interpreters. There's a list of libraries that you can use: [http://java-source.net/open-source/command-line](http://java-source.net/open-source/comman... | null | CC BY-SA 3.0 | null | 2008-08-30T22:26:00.180 | 2012-05-06T05:29:03.290 | 2012-05-06T05:29:03.290 | 139,010 | 3,666 | null |
36,440 | 2 | null | 4,724 | 5 | null | I took a "lisp class" in college back in the eighties. Despite grokking all the concepts presented in the class, I was left without appreciation for what makes lisp great. I'm afraid that a lot of people look at lisp as just another programming language, which is what that course in college did for me so many years a... | null | CC BY-SA 2.5 | null | 2008-08-30T22:47:55.930 | 2008-08-30T22:47:55.930 | null | null | 3,792 | null |
36,212 | 2 | null | 35,677 | 4 | null | The XMPP gateway protocol you've heard of is most likely to do with transports. A transport is a server that connects to both a XMPP server and a non-XMPP server. By running a transport, I can use my Jabber client to talk to someone using, say, MSN Messenger.
A transport typically connects once to the remote network... | null | CC BY-SA 2.5 | null | 2008-08-30T17:59:05.407 | 2008-08-30T17:59:05.407 | null | null | 2,391 | null |
36,444 | 2 | null | 36,417 | 19 | null | You don't need a "system" to do templating.
You can do it on your own by keeping presentation & logic separate.
This way the designer can screw up the display, but not the logic behind it.
Here's a simple example:
```
<?php
$people = array('derek','joel','jeff');
$people[0] = 'martin'; // all your logic goes here
in... | null | CC BY-SA 2.5 | null | 2008-08-30T22:53:41.207 | 2008-08-30T22:53:41.207 | null | null | 3,407 | null |
36,439 | 2 | null | 1,387 | 0 | null | There are many options and the best solution will depend on the nature of the problem you are trying to solve. If you are trying to solve an [embarassingly parallel](http://en.wikipedia.org/wiki/Embarrassingly_parallel) problem then dividing and parallelising the tasks will be trivial. In that case the challenge will... | null | CC BY-SA 2.5 | null | 2008-08-30T22:46:12.893 | 2008-08-30T22:46:12.893 | null | null | 3,305 | null |
36,452 | 2 | null | 36,430 | 1 | null | ```
sudo gem install gemname
sudo gem update gemname
```
| null | CC BY-SA 2.5 | null | 2008-08-30T23:04:36.733 | 2008-08-30T23:04:36.733 | null | null | 1,450 | null |
36,441 | 2 | null | 27,148 | 4 | null | I create a the [stackoverflow tag feeds pipe](http://pipes.yahoo.com/pipes/pipe.info?_id=uP22vN923RG_c71O1ZzWFw). You can list your tags of choice into the text box and it will combine them into a single feed with all the unique posts. It escapes `'#'` and `'+'` characters for you.
Alternatively, you can use the pipe'... | null | CC BY-SA 2.5 | null | 2008-08-30T22:50:07.797 | 2008-08-30T23:57:40.833 | 2008-08-30T23:57:40.833 | 2,495 | 2,495 | null |
36,458 | 2 | null | 36,430 | -1 | null | > @John Topley: Thanks. Is there a
similar command to update Ruby itself?
Not really. You don't say which operating system you're using. I use Mac OS X and tend to [build Ruby from source](http://hivelogic.com/articles/2008/02/ruby-rails-leopard).
| null | CC BY-SA 2.5 | null | 2008-08-30T23:11:30.727 | 2008-08-30T23:11:30.727 | null | null | 1,450 | null |
36,459 | 2 | null | 36,455 | 4 | null | Alignment is still quite important today. Some processors (the 68k family jumps to mind) would throw an exception if you tried to access a word value on an odd boundary. Today, most processors will run two memory cycles to fetch an unaligned word, but this will definitely be slower than an aligned fetch. Some other pro... | null | CC BY-SA 2.5 | null | 2008-08-30T23:11:51.990 | 2008-08-30T23:11:51.990 | null | null | 893 | null |
36,465 | 2 | null | 36,407 | 0 | null | I use [Web Developer](https://addons.mozilla.org/en-US/firefox/addon/60), it's a real time saver.
| null | CC BY-SA 2.5 | null | 2008-08-30T23:21:03.027 | 2008-08-30T23:21:03.027 | null | null | 2,493 | null |
36,464 | 2 | null | 36,407 | 0 | null | Adding to everyones lists, [Tamper Data](https://addons.mozilla.org/en-US/firefox/addon/966) is quite useful, lets you intercept requests and change the data in them.
It can be used to bypass javascript validation and check whether the server side is doing its thing.
| null | CC BY-SA 2.5 | null | 2008-08-30T23:18:48.790 | 2008-08-30T23:18:48.790 | null | null | 550 | null |
36,473 | 2 | null | 36,077 | 0 | null | I use my own exceptions. You can handle them quite simple - also they contain text. I use the format:
```
throw Exception( "comms::serial::serial( )", "Something failed!" );
```
Also I have a second exception format:
```
throw Exception( "comms::serial::serial( )", ::GetLastError( ) );
```
Which is then convert... | null | CC BY-SA 2.5 | null | 2008-08-30T23:27:36.693 | 2008-08-30T23:27:36.693 | null | null | 342 | null |
36,469 | 2 | null | 36,430 | 1 | null | > Is there a similar command to update Ruby itself?
Alas, [no there is not](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/262569). I'm afraid that if you want to update Ruby itself you will have to either download an installer from the Ruby website, or compile it from source.
I should mention though th... | null | CC BY-SA 2.5 | null | 2008-08-30T23:24:07.590 | 2008-10-31T03:47:16.870 | 2008-10-31T03:47:16.870 | 792 | 792 | null |
36,466 | 2 | null | 36,455 | 1 | null | You still need to be aware of alignment issues when laying out a class or struct in C(++). In these cases the compiler will do the right thing for you, but the overall size of the struct/class may be more wastefull than necessary
For example:
```
struct
{
char A;
int B;
char C;
int D;
};
```
Would... | null | CC BY-SA 2.5 | null | 2008-08-30T23:22:35.707 | 2008-08-30T23:22:35.707 | null | null | 3,631 | null |
36,475 | 1 | null | null | 4 | 3,072 | What would be the best way to design a threaded commenting system so that it doesn't hammer the database?
| Designing a threaded commenting system | CC BY-SA 2.5 | 0 | 2008-08-30T23:27:50.203 | 2009-01-28T17:28:21.207 | null | null | 1,745 | [
"sql"
] |
36,463 | 2 | null | 36,430 | 1 | null | Okay. I see what you're going for but again try to go abstract because I know someone will give you a direct answer (which people should up-vote over this).
Everyone should get comfortable with man pages. But even if you are, you'll find that these commands lack decent man pages. However, those that do will point y... | null | CC BY-SA 2.5 | null | 2008-08-30T23:17:59.137 | 2008-10-30T04:29:38.033 | 2008-10-30T04:29:38.033 | 792 | 792 | null |
36,480 | 2 | null | 36,407 | 2 | null | One that wasn't mentioned yet is this [HTML Validator](http://users.skynet.be/mgueury/mozilla/) extension that I found very useful.
| null | CC BY-SA 2.5 | null | 2008-08-30T23:32:12.627 | 2008-08-30T23:32:12.627 | null | null | 792 | null |
36,477 | 1 | null | null | 4 | 822 | I maintain several client sites that have no dynamic data whatsoever, everything is static asp.net with c#.
Are there any pitfalls to caching the entire page for extreme periods of time, like a week?
Kibbee, We use a couple controls on the sites (ad rotator, some of the ajax extensions) on the sites. They could proba... | Long-term Static Page Caching | CC BY-SA 2.5 | null | 2008-08-30T23:28:54.290 | 2009-02-25T22:17:35.213 | 2008-08-30T23:50:58.870 | 2,066 | 2,066 | [
"c#",
"asp.net",
"caching",
"static"
] |
36,393 | 2 | null | 36,294 | 31 | null | Not to whore myself horribly but I wrote a couple F# overview posts on my blog [here](http://www.codegrunt.co.uk/blog/?p=58) and [here](http://www.codegrunt.co.uk/blog/?p=81). Chris Smith (guy on the F# team at MS) has an article called 'F# in 20 minutes' - [part 1](http://blogs.msdn.com/chrsmith/archive/2008/05/02/f-i... | null | CC BY-SA 2.5 | null | 2008-08-30T22:09:05.697 | 2008-08-30T22:09:05.697 | null | null | 3,394 | null |
36,484 | 2 | null | 36,477 | 0 | null | When you say that you have no data, how are you even using asp.net or c#. What functionality does that provide you over plain HTML? Also, if you do plan on caching, it's probably best to cache to a file, and then when a request is made, stream out the file. The OS will take care of keeping the file in memory so that ... | null | CC BY-SA 2.5 | null | 2008-08-30T23:36:59.353 | 2008-08-30T23:36:59.353 | null | null | 1,862 | null |
36,485 | 2 | null | 36,477 | 0 | null | You may want to build in a cache updating mechanism if you want to do this, just to make sure you can clear the cache if you need to do a code update. Other than that, there aren't any problems that I can think of.
| null | CC BY-SA 2.5 | null | 2008-08-30T23:37:05.860 | 2008-08-30T23:37:05.860 | null | null | 2,567 | null |
36,447 | 2 | null | 36,430 | 16 | null | By Ruby commands you probably mean the command line programs for Ruby. These are also called Ruby Helper programs. Here are a few:
- [ruby](http://linux.die.net/man/1/ruby) - The interpreter itself. Run Ruby scripts or statements.- [gem](http://www.rubygems.org/read/book/2) - Ruby Package Manager. Great for automa... | null | CC BY-SA 2.5 | null | 2008-08-30T23:02:07.020 | 2008-10-30T04:36:05.447 | 2017-05-23T12:17:05.463 | -1 | 792 | null |
36,487 | 2 | null | 36,475 | 0 | null | What I normally do in this case is to have a single thread that is responsible for putting the data into the database, and have all auxiliary threads report to that thread, which then queues up the data, and writes it either serially, or in batches (depending on the requirements, and how much database activity I'm will... | null | CC BY-SA 2.5 | null | 2008-08-30T23:47:34.697 | 2008-08-30T23:47:34.697 | null | null | 1,975,282 | null |
36,490 | 2 | null | 16,320 | 0 | null | Another "it depends". However, I can also think of a very common scenario where static just won't work. If you have a web site that gets a decent amount of traffic, and you have a static database layer with a shared connection, you could be in trouble. In ASP.Net, there is instance of your application created by de... | null | CC BY-SA 2.5 | null | 2008-08-30T23:52:01.940 | 2008-08-30T23:52:01.940 | null | null | 3,043 | null |
36,494 | 2 | null | 34,544 | 0 | null | The best thing I could recommend is the [Internet Explorer Developer Toolbar](http://www.microsoft.com/downloads/details.aspx?FamilyId=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en) which allow you to view changes in the DOM.
| null | CC BY-SA 2.5 | null | 2008-08-31T00:00:50.857 | 2008-08-31T00:00:50.857 | null | null | 383 | null |
36,498 | 1 | 36,500 | null | 21 | 20,467 | I would like to quickly send email from the command line. I realize there are probably a number of different ways to do this.
I'm looking for a simple way to do this from a linux terminal (likely a bash shell but anything should do) and an alternative way to do this on Windows. I want to be able to whip up an email ... | How do I Send Email from the Command Line? | CC BY-SA 3.0 | 0 | 2008-08-31T00:06:37.257 | 2020-04-10T08:43:47.127 | 2020-04-10T08:43:47.127 | 286,807 | 792 | [
"linux",
"email",
"command-line"
] |
36,482 | 2 | null | 31,840 | 23 | null | Log4j has been around for a long time, and it works very well. I have no scientific study to back it, but based on what I've seen at a large number of clients, it is easily the logging framework that I see used more than any other. It has been around for a long time, and not been replaced by the Next Big Logging Fram... | null | CC BY-SA 2.5 | null | 2008-08-30T23:34:39.797 | 2008-08-30T23:34:39.797 | null | null | 2,885 | null |
36,488 | 2 | null | 36,477 | 2 | null | The only significant pitfall to long cache times occurs when you want to update that data. To be safe, you have to assume that it will take up to a week for the new version to become available. Intermediate hosts such as a ISP level proxy servers often do cache aggressively so this delay will happen.
If there are larg... | null | CC BY-SA 2.5 | null | 2008-08-30T23:48:26.380 | 2008-08-30T23:48:26.380 | null | null | 3,736 | null |
36,499 | 2 | null | 36,498 | 15 | null | ```
$ echo "This is the email body" | mail -s "This is the subject" me@email.com
```
Alternatively:
```
$ cat | mail -s "A few lines off the top of my head" me@here.com
This is where my
multiline
message would go
^D
```
^D - means press +
| null | CC BY-SA 3.0 | null | 2008-08-31T00:11:36.247 | 2014-03-15T12:50:40.627 | 2014-03-15T12:50:40.627 | 1,317,271 | 3,288 | null |
36,497 | 2 | null | 36,475 | 1 | null | I'm guessing your question is about arranging the system so you don't have to work as:
1. Select all the top level comments
2. Select all comments whose parents were found in the step prior
3. Select all comments whose parents were found in the step prior
4. ... repeat until no comments found
I would suggest desig... | null | CC BY-SA 2.5 | null | 2008-08-31T00:05:15.450 | 2008-08-31T00:05:15.450 | null | null | 3,288 | null |
36,502 | 1 | 36,529 | null | 0 | 2,214 | I know Windows Vista (and XP) cache recently loaded DLL's in memory...
How can this be disabled via the command prompt?
| How can I disable DLL Caching in Windows Vista via CMD? | CC BY-SA 2.5 | 0 | 2008-08-31T00:18:55.993 | 2009-05-20T00:01:31.940 | 2009-05-20T00:01:31.940 | 23,118 | 383 | [
"windows-vista",
"command-prompt"
] |
36,501 | 2 | null | 30,972 | 1 | null | If you are looking to inject code into processes (which is what Input Managers are most commonly used for), the Windows equivalents are:
- `AppInit_DLLs`- `CreateRemoteThread`- `SetWindowsHookEx`
All of these methods require a DLL which will be injected into the remote process. C would be the best language to write s... | null | CC BY-SA 2.5 | null | 2008-08-31T00:15:43.770 | 2008-08-31T00:15:43.770 | null | null | 3,736 | null |
36,504 | 1 | 36,513 | null | 345 | 190,188 | I see a lot of talk on here about functional languages and stuff. Why would you use one over a "traditional" language? What do they do better? What are they worse at? What's the ideal functional programming application?
| Why functional languages? | CC BY-SA 2.5 | 0 | 2008-08-31T00:21:51.900 | 2023-02-20T17:01:01.943 | 2008-09-04T00:30:26.137 | 3,641 | 655 | [
"programming-languages",
"functional-programming"
] |
36,500 | 2 | null | 36,498 | 11 | null | You can use mail:
```
$mail -s <subject> <recipients>
```
You then type your message and end it with a line that has only a period. This signals you are done and sends the message.
You can also pipe your email in from STDIN and it will be sent as the text of an email:
```
$<mail-generating-program> | mail -s <subj... | null | CC BY-SA 2.5 | null | 2008-08-31T00:12:15.323 | 2008-08-31T00:37:17.667 | 2008-08-31T00:37:17.680 | 658 | 658 | null |
36,517 | 2 | null | 36,498 | 3 | null | If you are looking to do this from a Windows command line, there is a tool called [blat](http://www.blat.net/) that can be used from a CMD prompt.
It is a bit more fun from PowerShell. Since PowerShell has access to the .NET Framework, you can use the classes from System.Net.Mail to send email. There is an example s... | null | CC BY-SA 2.5 | null | 2008-08-31T00:41:34.490 | 2008-08-31T00:41:34.490 | null | null | 1,233 | null |
36,507 | 2 | null | 36,504 | 13 | null | One key feature in a functional language is the concept of first-class functions. The idea is that you can pass functions as parameters to other functions and return them as values.
Functional programming involves writing code that does not change state. The primary reason for doing so is so that successive calls to a ... | null | CC BY-SA 4.0 | null | 2008-08-31T00:29:54.377 | 2023-02-20T14:38:29.790 | 2023-02-20T14:38:29.790 | 63,550 | 658 | null |
36,511 | 1 | null | null | 10 | 8,768 | I'm attempting to create a dataset based on the properties of an object. For example, I have an instance of a Person class with properties including ID, Forename, Surname, DOB etc. Using reflection, I'm adding columns to a new dataset based on the object properties:
```
For Each pi As PropertyInfo In person.GetType().... | VB.NET Get underlying system.type from nullable type | CC BY-SA 2.5 | 0 | 2008-08-31T00:33:30.670 | 2012-01-23T07:21:29.720 | 2008-08-31T06:34:12.970 | 832 | null | [
"vb.net",
"reflection",
"dataset"
] |
36,515 | 1 | 42,792 | null | 9 | 14,891 | I have a page with a Google Maps mashup that has pushpins that are color-coded by day (Monday, Tuesday, etc.) The IFrame containing the map is dynamically sized, so it gets resized when the browser window is resized.
I'd like to put a legend in the corner of the map window that tells the user what each color means. T... | Fixed Legend in Google Maps Mashup | CC BY-SA 2.5 | 0 | 2008-08-31T00:41:03.070 | 2013-04-19T11:36:35.373 | 2013-04-19T11:36:35.373 | 684,229 | 1,482 | [
"javascript",
"html",
"google-maps",
"google-maps-api-2"
] |
36,513 | 2 | null | 36,504 | 223 | null | Functional languages use a different paradigm than imperative and object-oriented languages. They use side-effect-free functions as a basic building block in the language. This enables lots of things and makes a lot of things more difficult (or in most cases different from what people are used to).
One of the biggest a... | null | CC BY-SA 4.0 | null | 2008-08-31T00:38:05.340 | 2023-02-20T14:46:14.373 | 2023-02-20T14:46:14.373 | 63,550 | 3,320 | null |
36,526 | 2 | null | 36,129 | 1 | null | C#, Java and Python have a standard implementation of the Iterator pattern. In C# and Python this has been intergrated in the language so you can just use yield return statements.
| null | CC BY-SA 2.5 | null | 2008-08-31T00:55:12.240 | 2008-08-31T00:55:12.240 | null | null | 3,320 | null |
36,505 | 2 | null | 36,296 | 0 | null | I wrote some C# code to scan the cipher and give me some stats back. Here are some interesting results:
With a chunk size of 3,
- There are 236 chunks.- There are 172 duplicates.- The 323 code shows up a whopping
total of 29 times!- The 333 code shows up 11 times.- All other codes show up 7 times or less.- 35 chunks... | null | CC BY-SA 2.5 | null | 2008-08-31T00:27:04.540 | 2008-08-31T00:41:11.977 | 2008-08-31T00:41:11.977 | 536 | 536 | null |
36,519 | 2 | null | 36,511 | 1 | null | I'm guessing that the problem is recognizing whether the property is nullable or not. In C# you do this with this code:
```
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
```
... but I'm not sure what the equivalent of that last clause is in VB.NET.
| null | CC BY-SA 2.5 | null | 2008-08-31T00:46:07.973 | 2008-08-31T00:46:07.973 | null | null | 615 | null |
36,524 | 2 | null | 31,158 | 2 | null | Metanet Software has published [some relevant tutorials](http://www.harveycartel.org/metanet/tutorials.html). Metanet develops [N](http://www.thewayoftheninja.org/n.html) (Flash-based, for Windows, Mac, Linux) and [N+](http://www.thewayoftheninja.org/n_future.html) (for the X360, DS, and PSP).
| null | CC BY-SA 2.5 | null | 2008-08-31T00:52:43.340 | 2008-08-31T00:52:43.340 | null | null | 853 | null |
36,527 | 2 | null | 36,260 | 16 | null | Recursive definitions need to appear in the same file. If you want to separate definitions, statements, and expressions into separate modules, you can do so using [recursive modules](http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc100), but they will still need to appear in the same file. DAG-ifying inter... | null | CC BY-SA 2.5 | null | 2008-08-31T01:00:05.537 | 2008-08-31T01:00:05.537 | null | null | 1,412 | null |
36,518 | 2 | null | 4,508 | 1 | null | I have done this using the MAPISendMail function and several internal classes to wrap some of the other MAPI related structures. As long as this is the only use, it is possible although not trivial to do safely as it requires a very close attention to the various unmanaged data types and memory allocation/deallocation ... | null | CC BY-SA 2.5 | null | 2008-08-31T00:43:06.763 | 2008-08-31T00:43:06.763 | null | null | 1,559 | null |
36,532 | 2 | null | 36,417 | 1 | null | I think I'd like to stay away from an unweildy framework. Just some approach I can use that generally makes the pages more readable with cleaner code.
Stack Overflow wants me to decide which answer is best, when best is a subjective opinion. Who is to say what the 'best' practice is.
| null | CC BY-SA 2.5 | null | 2008-08-31T01:07:04.130 | 2008-08-31T01:07:04.130 | null | null | 3,800 | null |
36,529 | 2 | null | 36,502 | 6 | null | The only thing you can do is disable SuperFetch, which can be done from the command prompt with this command (there has to be a space between the = sign and disabled).
```
sc config Superfetch start= disabled
```
There is a myth out there that you can disable DLL caching, but that only worked for systems prior to Wi... | null | CC BY-SA 2.5 | null | 2008-08-31T01:04:14.653 | 2008-08-31T01:04:14.653 | null | null | 291 | null |
36,535 | 2 | null | 5,724 | 2 | null | Have you thought through what behavior you want to replace the current + functionality?
| null | CC BY-SA 3.0 | null | 2008-08-31T01:16:59.380 | 2015-08-20T22:26:38.360 | 2015-08-20T22:26:38.360 | 7,226 | 3,043 | null |
36,533 | 1 | 36,684 | null | 3 | 5,609 | my primary language is spanish, but I use all my software in english, including windows; however I'd like to use speech recognition in spanish.
Do you know if there's a way to use vista's speech recognition in other language than the primary os language?
| Vista speech recognition in multiple languages | CC BY-SA 2.5 | null | 2008-08-31T01:08:48.493 | 2009-09-17T20:38:42.700 | 2009-01-28T19:47:56.617 | 18,154 | 1,782 | [
"windows-vista",
"nlp",
"speech-recognition",
"multilingual"
] |
36,455 | 1 | null | null | 9 | 5,076 | Older K&R (2nd ed.) and other C-language texts I have read that discuss the implementation of a dynamic memory allocator in the style of `malloc()` and `free()` usually also mention, in passing, something about data type alignment restrictions. Apparently certain computer hardware architectures (CPU, registers, and mem... | Alignment restrictions for malloc()/free() | CC BY-SA 3.0 | 0 | 2008-08-30T23:07:20.877 | 2016-07-15T03:52:05.717 | 2016-07-15T03:52:05.717 | 1,466,970 | null | [
"c",
"memory",
"malloc",
"allocation"
] |
36,538 | 2 | null | 36,534 | 2 | null | Joel mentioned adding a second datacenter, with the same setup, and then assigning your users randomly to each. Changes to the data are logged and sent from one location to the other, so that both locations contain all the data.
| null | CC BY-SA 2.5 | null | 2008-08-31T01:18:36.303 | 2008-08-31T01:18:36.303 | null | null | 1,862 | null |
36,534 | 1 | 36,545 | null | 3 | 827 | So I was listening to the latest Stackoverflow podcast ([episode 19](https://blog.stackoverflow.com/2008/08/podcast-19/)), and Jeff and Joel talked a bit about scaling server hardware as a website grows. From what Joel was saying, the first few steps are pretty standard:
1. One server running both the webserver and t... | Website Hardware Scaling | CC BY-SA 4.0 | 0 | 2008-08-31T01:11:47.740 | 2010-03-04T10:54:30.200 | 2021-01-18T12:38:11.483 | -1 | 2,600 | [
"hardware",
"scaling"
] |
36,540 | 2 | null | 36,534 | 1 | null | A certain next step would be a cluster of webservers (a web farm) and a clustered system of database servers (replication or Oracle RAC etc. etc.)
| null | CC BY-SA 2.5 | null | 2008-08-31T01:21:09.980 | 2008-08-31T01:21:09.980 | null | null | 1,796 | null |
36,539 | 2 | null | 36,534 | 1 | null | The talk Scalable Web Architectures Common Patterns & Approaches from Cal Henderson (Yahoo) on Web 2.0 Expo was quite interesting. I thought there was an video, but I could not find it. But here are the slides:
[http://www.slideshare.net/techdude/scalable-web-architectures-common-patterns-and-approaches](http://www.s... | null | CC BY-SA 2.5 | null | 2008-08-31T01:20:33.660 | 2008-08-31T01:20:33.660 | null | null | 720 | null |
36,541 | 2 | null | 36,315 | 0 | null | Two main ways :
1. Deploy using the full .NET Framework
2. Write your own / 3rd party lib for these functionalities
| null | CC BY-SA 2.5 | null | 2008-08-31T01:23:20.143 | 2008-08-31T01:23:20.143 | null | null | 1,796 | null |
36,531 | 2 | null | 2,968 | 4 | null | If this is to parse command lines I would suggest using [Commons Cli](http://commons.apache.org/cli/).
> The Apache Commons CLI library provides an API for processing command line interfaces.
| null | CC BY-SA 2.5 | null | 2008-08-31T01:05:38.457 | 2008-08-31T01:32:43.740 | 2008-08-31T01:32:43.740 | 883 | 883 | null |
36,544 | 2 | null | 36,455 | 1 | null | As Greg mentioned it is still important today (perhaps more so in some ways) and compilers usually take care of the alignment based on the target of the architecture. In managed environments, the JIT compiler can optimize the alignment based on the runtime architecture.
You may see pragma directives (in C/C++) that ch... | null | CC BY-SA 2.5 | null | 2008-08-31T01:32:57.063 | 2008-08-31T01:32:57.063 | null | null | 748 | null |
36,549 | 2 | null | 2,968 | 6 | null | Another vote for ANTLR/ANTLRWorks. If you create two versions of the file, one with the Java code for actually executing the commands, and one without (with just the grammar), then you have an executable specification of the language, which is great for testing, a boon for documentation, and a big timesaver if you eve... | null | CC BY-SA 2.5 | null | 2008-08-31T01:38:29.890 | 2008-08-31T01:38:29.890 | null | null | 279 | null |
36,551 | 1 | null | null | 0 | 3,612 | The command line interface to MySQL works perfectly well in itself, but when using my local copy I'm forced to interact with it using the old-fashioned DOS windows. Is there some way I can redirect it through a better shell?
| MySQL shell on Windows | CC BY-SA 2.5 | null | 2008-08-31T01:39:45.627 | 2012-08-02T12:03:07.073 | null | null | 1,000 | [
"mysql",
"windows",
"shell"
] |
36,548 | 2 | null | 36,498 | 2 | null | IIRC you'll also have to configure a mail transfer agent (MTA) to use `mail` or most email libraries. [Sendmail](http://www.sendmail.org/) is the most well known but is a real pig when it comes to configuration. [Exim](http://www.exim.org/), [Qmail](http://www.qmail.org/) and [Postfix](http://www.postfix.org/) are all ... | null | CC BY-SA 2.5 | null | 2008-08-31T01:38:03.900 | 2009-02-18T11:24:28.663 | 2009-02-18T11:24:28.677 | null | 199 | null |
36,543 | 2 | null | 34,926 | 1 | null | If you don't want to use regular expressions (for example if you need better performance) you could try [a small method I wrote a while ago, posted at CodeProject](http://www.codeproject.com/KB/MCMS/htmlTagStripper.aspx).
| null | CC BY-SA 2.5 | null | 2008-08-31T01:31:02.763 | 2008-08-31T01:31:02.763 | null | null | 1,796 | null |
36,552 | 2 | null | 36,315 | 3 | null | I’d strongly not recommend rolling your own encoding. I’d use the [Microsoft Anti-Cross Site Scripting Library](http://www.microsoft.com/en-us/download/details.aspx?id=43126) which is very small (v1.5 is ~30kb) if HttpUtility.HtmlEncode isn’t available.
As for decoding, maybe you could use the decoding routine from [M... | null | CC BY-SA 3.0 | null | 2008-08-31T01:41:17.013 | 2015-01-01T15:35:31.607 | 2015-01-01T15:35:31.607 | 102,915 | 3,709 | null |