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
6,380
2
null
6,371
56
null
There are a couple of good options. I wouldn't use the "restore a backup" strategy. 1. Script all your schema changes, and have your CI server run those scripts on the database. Have a version table to keep track of the current database version, and only execute the scripts if they are for a newer version. 2. Use a ...
null
CC BY-SA 3.0
null
2008-08-08T21:01:09.490
2011-08-12T23:05:35.993
2011-08-12T23:05:35.993
571
571
null
6,378
1
8,431
null
5
761
[http://en.wikipedia.org/wiki/ICalendar](http://en.wikipedia.org/wiki/ICalendar) I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlook, and Google's Gmail. I'm starting t...
What client(s) should be targeted in implementing an ICalendar export for events?
CC BY-SA 3.0
null
2008-08-08T20:58:11.103
2011-10-07T19:38:20.633
2011-10-07T19:38:20.633
709,619
326
[ "outlook", "gmail", "icalendar", "recurrence" ]
6,377
2
null
6,369
0
null
Do you need to use a comma separated list? The last couple of years, I've been taking this type of idea and passing in an XML file. The openxml "function" takes a string and makes it like xml and then if you create a temp table with the data, it is queryable. ``` DECLARE @idoc int DECLARE @doc varchar(1000) SET @doc =...
null
CC BY-SA 2.5
null
2008-08-08T20:57:51.150
2008-08-08T20:57:51.150
null
null
721
null
6,386
2
null
6,209
6
null
``` import csv reader = csv.reader(open("some.csv")) for row in reader: print row ```
null
CC BY-SA 2.5
null
2008-08-08T21:07:28.450
2009-10-01T21:54:30.603
2009-10-01T21:54:30.603
116
116
null
6,387
2
null
6,373
5
null
@Lance: the first one is also executing. Compare it with a named constructor: ``` function Blah() { alert('blah'); } new Bla(); ``` this is actually also executing code. The same goes for the anonymous constructor... But that was not the question ;-)
null
CC BY-SA 2.5
null
2008-08-08T21:08:38.197
2008-08-08T21:08:38.197
null
null
56
null
6,371
1
6,380
null
182
40,201
I've had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers. Here's our setup. Each developer has a virtual machine running our app and the MySQL database. It is their personal sandbox to do whatever they want. Currently, developers wil...
How do you manage databases in development, test, and production?
CC BY-SA 3.0
0
2008-08-08T20:50:02.930
2020-06-25T08:29:24.153
2011-10-18T13:56:08.697
496,830
763
[ "mysql", "svn" ]
6,384
2
null
6,369
1
null
Pass the comma separated list into a function that returns a table value. There is a MS SQL example somewhere on StackOverflow, damned if I can see it at the moment. > ``` CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (fn_GetKeyList(@keyList)) ``` Call with - > ``` exec g...
null
CC BY-SA 2.5
null
2008-08-08T21:04:58.703
2008-08-08T21:08:20.490
2008-08-08T21:08:20.490
419
419
null
6,412
2
null
6,406
17
null
I believe you do this by using this.Master.FindControl or something similar, but you probably shouldn't - it requires the content page to know too much about the structure of the master page. I would suggest another method, such as firing an event in the content area that the master could listen for and re-bind when ...
null
CC BY-SA 2.5
null
2008-08-08T21:46:22.053
2008-08-08T21:46:22.053
null
null
521
null
6,413
2
null
6,406
3
null
Assuming the control is called "PeopleListView" on the master page ``` ListView peopleListView = (ListView)this.Master.FindControl("PeopleListView"); peopleListView.DataSource = [whatever]; peopleListView.DataBind(); ``` But @[palmsey](https://stackoverflow.com/users/521/palmsey) is more correct, especially if your ...
null
CC BY-SA 3.0
null
2008-08-08T21:48:28.193
2011-07-14T10:58:01.920
2017-05-23T12:00:46.690
-1
419
null
6,414
1
6,417
null
857
830,157
In a C# (feel free to answer for other languages) loop, what's the difference between `break` and `continue` as a means to leave the structure of the loop, and go to the next iteration? Example: ``` foreach (DataRow row in myTable.Rows) { if (someConditionEvalsToTrue) { break; //what's the difference be...
C# loop - break vs. continue
CC BY-SA 4.0
0
2008-08-08T21:49:01.127
2023-01-26T04:19:30.747
2021-07-07T20:59:01.183
5,519,709
357
[ "c#", "loops", "enumeration" ]
6,405
2
null
1,145
13
null
First off, sorry I'm late to the party. This is my first stackoverflow answer. :) As has been pointed out, when realloc() is called, you can potentially change the pointer to the memory being reallocated. When this happens, the argument "string" becomes invalid. Even if you reassign it, the change goes out of scope on...
null
CC BY-SA 3.0
null
2008-08-08T21:37:38.887
2016-02-07T00:40:46.133
2016-02-07T00:40:46.133
2,921,691
773
null
6,411
2
null
6,406
-1
null
Assuming your master page was named MyMaster: ``` (Master as MyMaster).PeopleListView.DataBind(); ``` since PeopleListView will be declared protected by default, you will either need to change this to public, or create a public property wrapper so that you can access it from your page.
null
CC BY-SA 2.5
null
2008-08-08T21:44:53.863
2008-08-08T21:49:18.567
2008-08-08T21:49:18.567
423
423
null
6,392
1
6,496
null
34
44,438
I am running a Tomcat application, and I need to display some time values. Unfortunately, the time is coming up an hour off. I looked into it and discovered that my default TimeZone is being set to: ``` sun.util.calendar.ZoneInfo[id="GMT-08:00", offset=-28800000, ...
Java Time Zone is messed up
CC BY-SA 3.0
0
2008-08-08T21:24:01.490
2021-02-27T20:36:19.483
2016-02-07T18:06:11.540
2,921,691
122
[ "java", "linux", "timezone" ]
6,415
2
null
6,414
30
null
`break` would stop the `foreach` loop completely, `continue` would skip to the next `DataRow`.
null
CC BY-SA 3.0
null
2008-08-08T21:50:09.347
2016-10-04T18:28:05.463
2016-10-04T18:28:05.463
6,290,553
521
null
6,406
1
6,412
null
15
11,592
Is it possible to access an element on a Master page from the page loaded within the `ContentPlaceHolder` for the master? I have a ListView that lists people's names in a navigation area on the Master page. I would like to update the ListView after a person has been added to the table that the ListView is data bound t...
How to access .Net element on Master page from a Content page?
CC BY-SA 3.0
0
2008-08-08T21:39:04.283
2016-02-11T09:54:13.050
2016-02-11T09:54:13.050
3,026,283
576
[ "c#", ".net" ]
6,416
2
null
5,727
156
null
In my first Comp Sci class, we did the following exercise. Granted, this was a lecture hall with roughly 200 students in it... Professor writes on the board: `int john;` John stands up Professor writes: `int *sally = &john;` Sally stands up, points at john Professor: `int *bill = sally;` Bill stands up, points at...
null
CC BY-SA 3.0
null
2008-08-08T21:50:15.883
2016-04-21T20:41:01.003
2016-04-21T20:41:01.003
365,102
773
null
6,435
2
null
6,430
5
null
``` foreach(var row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- foreach(DataGridRow row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- for(int i = 0; i< DataGrid1.Rows.Count - 1; i++) { DoStuff(DataGrid1.Rows[i]); } ```
null
CC BY-SA 3.0
null
2008-08-08T22:20:28.973
2012-03-14T15:22:16.653
2012-03-14T15:22:16.653
1,244,630
303
null
6,436
2
null
6,373
0
null
Well, I made a page like this: ``` <html> <body> <script type="text/javascript"> var a = new function() { alert("method 1"); return "test"; }; var b = (function() { alert("method 2"); return "test"; })(); alert(a); //a is a function alert(b); //b is a string containing "test" </script> </body> </html> ...
null
CC BY-SA 2.5
null
2008-08-08T22:20:46.540
2008-08-08T22:20:46.540
null
null
571
null
6,428
2
null
6,110
0
null
Yes, that step 4 from my previous post is a doozy. No matter what, you're probably going to have to do some of this by hand, but you may be able to automate the bulk of it. For the example locations you gave, a query like the following would set the appropriate company_id value: ``` UPDATE Location SET Company_I...
null
CC BY-SA 2.5
null
2008-08-08T22:07:02.527
2008-08-08T22:07:02.527
null
null
726
null
6,430
1
6,435
null
4
9,046
I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an `ArrayList` of business objects bound to a Windows Forms `DataGrid`. I'd like the user to be able to edit the cells, and when finished, press a Save button. At that point I'd like t...
How to programmatically iterate datagrid rows?
CC BY-SA 3.0
0
2008-08-08T22:08:29.980
2015-10-07T09:40:16.083
2015-10-06T17:27:22.613
462,639
785
[ "winforms" ]
6,424
2
null
6,373
12
null
Both cases will execute the function, the only real difference is what the return value of the expression may be, and what the value of "this" will be inside the function. Basically behaviour of ``` new expression ``` Is effectively equivalent to ``` var tempObject = {}; var result = expression.call(tempObject); i...
null
CC BY-SA 2.5
null
2008-08-08T22:02:14.830
2008-08-09T01:08:34.907
2008-08-09T01:08:34.907
784
784
null
6,437
2
null
6,209
1
null
> What if an odd number of quotes appear in the original string? This looks uncannily like CSV parsing, which has some peculiarities to handling quoted fields. The field is only escaped if the field is delimited with double quotations, so: > field1, "field2, field3", field4, "field5, field6" field7 becomes > fiel...
null
CC BY-SA 2.5
null
2008-08-08T22:21:53.510
2008-08-08T22:21:53.510
null
null
214
null
6,417
2
null
6,414
1,589
null
`break` will exit the loop completely, `continue` will just the current iteration. For example: ``` for (int i = 0; i < 10; i++) { if (i == 0) { break; } DoSomeThingWith(i); } ``` The break will cause the loop to exit on the first iteration - `DoSomeThingWith` will never be executed. This here...
null
CC BY-SA 3.0
null
2008-08-08T21:51:35.397
2016-07-08T17:21:23.143
2016-07-08T17:21:23.143
91
91
null
6,442
2
null
6,414
397
null
A really easy way to understand this is to place the word "loop" after each of the keywords. The terms now make sense if they are just read like everyday phrases. `break` loop - looping is broken and stops. `continue` loop - loop continues to execute with the next iteration.
null
CC BY-SA 3.0
null
2008-08-08T22:33:31.020
2016-10-04T18:27:22.613
2016-10-04T18:27:22.613
6,290,553
581
null
6,440
1
6,445
null
19
12,001
I've been using a lot of new .NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps ) of the .NET framework on their machines. I went to go [download the .NET 3.5 redistributabl...
.NET 3.5 Redistributable -- 200 MB? Other options?
CC BY-SA 2.5
0
2008-08-08T22:32:01.243
2010-09-07T16:55:31.393
null
null
560
[ ".net", "redistributable" ]
6,451
2
null
6,440
5
null
Have you looked at the .NET Framework Client Profile? It is much smaller than the full redistributable package and is optimized for delivering just the functionality needed for smart clients. [Here is a nice overview.](http://blogs.windowsclient.net/trickster92/archive/2008/05/21/introducing-the-net-framework-client-p...
null
CC BY-SA 2.5
null
2008-08-08T22:58:45.760
2008-08-08T22:58:45.760
null
null
541
null
6,452
2
null
6,440
1
null
Also, it is worth including (in some fashion) the Service Pack downloads as well. In fact, depending on how your executables are built, you might be forced to install the Framework and the Service Packs.
null
CC BY-SA 2.5
null
2008-08-08T22:59:48.473
2008-08-08T22:59:48.473
null
null
243
null
6,445
2
null
6,440
21
null
That's one of the sad reasons i'm still targeting .net 2.0 whenever possible :/ But people don't neccessarily need the full 200 MB Package. There is a 3 MB Bootstrapper which will only download the required components: [.net 3.5 SP1 Bootstrapper](http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-...
null
CC BY-SA 2.5
null
2008-08-08T22:35:06.417
2009-01-29T13:30:33.690
2009-01-29T13:30:33.690
91
91
null
6,453
2
null
6,440
12
null
Once .NET Framework 3.5 SP1 comes out (should be fairly soon) there will be a second option of frameworks, namely the "Client Profile", which is a cut-down framework that only weighs in about about 30Mb from memory. It doesn't include all of the namespaces and classes of the full framework, but should be enough for mos...
null
CC BY-SA 2.5
null
2008-08-08T23:00:49.343
2008-08-08T23:00:49.343
null
null
489
null
6,454
2
null
85
51
null
You might consider [SQLite](http://www.sqlite.org/). It's almost as simple as flat files, but you do get a SQL engine for querying. It [works well with PHP](http://ca3.php.net/sqlite) too.
null
CC BY-SA 2.5
null
2008-08-08T23:00:54.507
2008-08-08T23:00:54.507
null
null
726
null
6,446
2
null
6,414
20
null
There are more than a few people who don't like `break` and `continue`. The latest complaint I saw about them was in by Douglas Crockford. But I find that sometimes using one of them really simplifies things, especially if your language doesn't include a `do-while` or `do-until` style of loop. I tend to use `break` i...
null
CC BY-SA 2.5
null
2008-08-08T22:35:46.757
2008-08-08T22:35:46.757
null
null
726
null
6,465
2
null
6,441
1
null
Why not grab one of the AJAX scripting libraries, they abstract away a lot of the cross browser DOM scripting black magic and make life a hell of a lot easier.
null
CC BY-SA 2.5
null
2008-08-08T23:21:24.777
2008-11-02T02:35:27.477
null
null
419
null
6,441
1
6,868
null
19
3,524
The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" option. These both work... However, if yo...
How can I enable disabled radio buttons?
CC BY-SA 4.0
0
2008-08-08T22:33:19.960
2021-07-12T20:35:45.973
2021-07-12T20:35:45.973
1,772,933
232
[ "javascript", "html", "radio-button" ]
6,456
2
null
6,441
3
null
Well, IE has a somewhat non-standard object model; what you're doing shouldn't work but you're getting away with it because IE is being nice to you. In Firefox and Safari, document.frm in your code evaluates to undefined. You need to be using id values on your form elements and use `document.getElementById('whatever')...
null
CC BY-SA 3.0
null
2008-08-08T23:01:17.050
2016-02-10T16:03:00.227
2016-02-10T16:03:00.227
92,701
137
null
6,458
2
null
826
1
null
In SQL: ``` create table numbers(n int not null) insert into numbers(n) values(1),(1), (2), (2), (3), (4) select distinct num1.n+num2.n sum2n from numbers num1 inner join numbers num2 on num1.n<>num2.n order by sum2n ``` C# LINQ: ``` List<int> num = new List<int>{ 1, 1, 2, 2, 3, 4}; var uNum = num.Distinct()...
null
CC BY-SA 2.5
null
2008-08-08T23:05:47.057
2008-08-08T23:31:25.007
2008-08-08T23:31:25.007
224
224
null
6,468
2
null
6,467
76
null
Assuming you have [GNU date](http://www.gnu.org/software/coreutils/manual/coreutils.html#date-invocation), like so: ``` date --date='1 days ago' '+%a' ``` And [similar phrases](http://www.gnu.org/software/coreutils/manual/coreutils.html#Date-input-formats).
null
CC BY-SA 3.0
null
2008-08-08T23:26:55.827
2015-02-11T22:14:15.453
2015-02-11T22:14:15.453
387,076
573
null
6,463
2
null
4,369
0
null
> > @Flubba, does this allow me to have folders inside my include directory? flat include directories give me nightmares. as the whole objects directory should be in the inc directory. Oh yes, absolutely. So for example, we use a single layer of subfolders, generally: ``` require_once('library/string.class.php') ``` ...
null
CC BY-SA 2.5
null
2008-08-08T23:17:12.273
2008-08-08T23:17:12.273
null
null
137
null
6,474
2
null
6,467
5
null
Why not write your scripts using a language like perl or python instead which more naturally supports complex date processing? Sure you do it all in bash, but I think you will also get more consistency across platforms using python for example, so long as you can ensure that perl or python is installed. I should add...
null
CC BY-SA 2.5
null
2008-08-08T23:42:33.330
2008-08-08T23:48:23.053
2008-08-08T23:48:23.053
92
92
null
6,471
2
null
6,467
5
null
``` date --date='1 days ago' '+%a' ``` It's not a very compatible solution. It will work only in Linux. At least, it didn't worked in Aix and Solaris. It works in RHEL: ``` date --date='1 days ago' '+%Y%m%d' 20080807 ```
null
CC BY-SA 3.0
null
2008-08-08T23:33:24.503
2014-09-05T04:10:47.093
2014-09-05T04:10:47.093
970,195
527
null
6,472
2
null
3,315
10
null
Just to clarify ``` private static IEnumerator<TextBox> FindTextBoxes(Control rootControl) ``` Changes to ``` private static IEnumerable<TextBox> FindTextBoxes(Control rootControl) ``` That should be all :-)
null
CC BY-SA 2.5
null
2008-08-08T23:34:44.237
2008-08-08T23:34:44.237
null
null
234
null
6,467
1
3,125,174
null
22
75,381
I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. I'm using a function to increment a day and another to decrement: ``` IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes[3] = 31 dias...
Date arithmetic in Unix shell scripts
CC BY-SA 2.5
0
2008-08-08T23:24:02.933
2016-07-13T22:22:28.487
2008-08-08T23:37:26.867
527
527
[ "unix", "shell", "date", "math", "scripting" ]
6,483
2
null
6,369
0
null
Regarding Kevin's idea of passing the parameter to a function that splits the text into a table, here's my implementation of that function from a few years back. Works a treat. [Splitting Text into Words in SQL](http://www.madprops.org/blog/splitting-text-into-words-in-sql-revisited/)
null
CC BY-SA 2.5
null
2008-08-09T00:05:04.847
2008-08-09T00:05:04.847
null
null
615
null
6,496
2
null
6,392
29
null
It's a "quirk" in the way the JVM looks up the zoneinfo file. See [Bug ID 6456628](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456628). The easiest workaround is to make /etc/localtime a symlink to the correct zoneinfo file. For Pacific time, the following commands should work: ``` # sudo cp /etc/localtime ...
null
CC BY-SA 2.5
null
2008-08-09T00:46:46.260
2008-08-09T00:46:46.260
null
null
737
null
6,489
2
null
6,373
-4
null
Yes, there are differences between the two. Both are anonymous functions and execute in the exact same way. But, the difference between the two is that in the second case scope of the variables is restricted to the anonymous function itself. There is no chance of accidentally adding variables to the global scope. Thi...
null
CC BY-SA 3.0
null
2008-08-09T00:29:38.633
2011-11-13T15:16:01.120
2011-11-13T15:16:01.120
126,039
384
null
6,503
2
null
4,582
14
null
The result of a DCT is a transformation of the original source into the frequency domain. The top left entry stores the "amplitude" the "base" frequency and frequency increases both along the horizontal and vertical axes. The outcome of the DCT is usually a collection of amplitudes at the more usual lower frequencies (...
null
CC BY-SA 2.5
null
2008-08-09T01:03:18.317
2008-08-09T01:03:18.317
null
null
488
null
6,502
2
null
6,392
0
null
It may help to double-check the timezone rules your OS is using. ``` /usr/bin/zdump -v /etc/localtime | less ``` This file should contain your daylight savings rules, like this one for the year 2080: ``` /etc/localtime Sun Mar 31 01:00:00 2080 UTC = Sun Mar 31 02:00:00 2080 BST isdst=1 gmtoff=3600 ``` You can co...
null
CC BY-SA 2.5
null
2008-08-09T01:01:17.587
2008-08-09T01:01:17.587
null
null
304
null
6,508
2
null
6,499
2
null
Well, I don't really have an expert opinion on this. I usually end up using closures based approach just because it keeps the code simpler to manager. But, I have found myself using prototypes for methods that have loads of lines of code.
null
CC BY-SA 2.5
null
2008-08-09T01:12:26.863
2008-08-09T01:12:26.863
null
null
384
null
6,499
1
6,531
null
24
1,017
There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this: ``` function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this; } Vector.prototype.length = function () { return Math.sqrt(this.x * this.x ... ); } ``` and closure bas...
What style do you use for creating a "class"?
CC BY-SA 3.0
0
2008-08-09T00:56:15.040
2016-07-24T07:17:31.523
2013-01-27T14:09:00.370
933,198
784
[ "javascript" ]
6,475
1
null
null
3
1,575
In a machine with AIX without `PERL` I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours. I implemented this filter using `AWK` and work pretty well but I need a solution much faster: Any suggestions? Are there ways to impro...
Faster way to find duplicates conditioned by time
CC BY-SA 2.5
null
2008-08-08T23:46:31.357
2013-01-09T06:01:27.853
2017-05-23T12:02:50.043
-1
527
[ "performance", "unix", "awk", "aix" ]
6,484
1
6,716
null
77
52,306
[Mocking sealed classes](http://www.google.com/search?q=how%20to%20mock%20sealed%20class) can be quite a pain. I currently favor an [Adapter pattern](http://en.wikipedia.org/wiki/Adapter_pattern) to handle this, but something about just keeps feels weird. . In fact, I would anticipate that the Java community has...
How do you mock a Sealed class?
CC BY-SA 2.5
0
2008-08-09T00:14:22.143
2022-09-02T13:45:18.163
2009-10-30T17:17:59.860
307
307
[ "unit-testing", "language-agnostic", "tdd", "mocking" ]
6,509
2
null
6,130
5
null
I occasionally get similar things, usually with files that nobody has been near in weeks. Generally, if you know you haven't been working in the directory in question, you can just delete the directory with the problem and run ``` svn update ``` to recreate it. If you have live changes in the directory then as las...
null
CC BY-SA 2.5
null
2008-08-09T01:12:37.393
2008-08-09T01:12:37.393
null
null
137
null
6,515
2
null
6,512
1
null
Use an explicit stack instead.
null
CC BY-SA 2.5
null
2008-08-09T01:29:33.537
2008-08-09T01:29:33.537
null
null
429
null
6,512
1
6,566
null
54
10,019
I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution...
How to implement continuations?
CC BY-SA 2.5
0
2008-08-09T01:18:37.943
2019-06-26T15:40:34.463
2011-10-30T15:18:29.767
201,359
658
[ "c", "lisp", "scheme", "continuations" ]
6,516
2
null
6,499
2
null
You also have the choice of: ``` function Vector(x, y, z) { function length() { return Math.sqrt(x * x + ...); } } ``` Which is probably just as slow as example two, but it looks more like Java/C# and is a bit more explicit.
null
CC BY-SA 2.5
null
2008-08-09T01:32:17.120
2008-08-09T01:32:17.120
null
null
429
null
6,514
2
null
6,085
0
null
Sorry, but what could lead for a need to replicated the exact same build in the future? In my experience, either you keep your product installers safe or start a new build from scratch. Also IMO the only way to replicated the exact same build in the future is to run your build machine on a Virtual Machine and keep the ...
null
CC BY-SA 4.0
null
2008-08-09T01:28:45.113
2021-10-25T12:12:08.177
2021-10-25T12:12:08.177
17,169,050
727
null
6,534
2
null
6,530
7
null
App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.
null
CC BY-SA 2.5
null
2008-08-09T02:10:12.800
2008-08-09T02:10:12.800
null
null
106
null
6,531
2
null
6,499
12
null
Assigning functions to the prototype is better (for public methods) because all instances of the class will share the same copy of the method. If you assign the function inside the constructor as in the second example, every time you create a new instance, the constructor creates a new copy of the length function and a...
null
CC BY-SA 2.5
null
2008-08-09T02:05:33.840
2008-08-09T02:05:33.840
null
null
588
null
6,541
2
null
6,430
0
null
> Is there anything about WinForms 3.0 that is so much better than in 1.1 I don't know about 3.0, but you can write code in VS 2008 which runs on the .NET 2.0 framework. (So, you get to use the latest C# language, but you can only use the 2.0 libraries) This gets you Generics (`List<DataRow>` instead of those GodAwfu...
null
CC BY-SA 2.5
null
2008-08-09T02:17:38.293
2008-08-09T02:17:38.293
null
null
234
null
6,517
2
null
3,088
4
null
I'd just let him write tons of code. Let him drive in everything you guys do, and just be available to answer questions. Believe it or not, after a few months of writings tons of crappy code, he'll start to get the idea and start writing better programs. At that point, you can get bogged down in details (memory, etc),...
null
CC BY-SA 2.5
null
2008-08-09T01:37:07.920
2008-08-13T21:28:51.350
2008-08-13T21:28:51.367
92
781
null
6,543
2
null
6,484
0
null
Is there a way to implement a sealed class from an interface... and mock the interface instead? Something in me feels that having sealed classes is wrong in the first place, but that's just me :)
null
CC BY-SA 2.5
null
2008-08-09T02:21:32.853
2008-08-09T02:21:32.853
null
null
372
null
6,530
1
6,534
null
11
4,407
I have a ASP.NET application that we've written our own logging module for. My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to. Cheers,
Where should I put my log file for an asp.net application?
CC BY-SA 3.0
0
2008-08-09T02:03:52.033
2013-02-13T06:04:34.047
2012-05-03T07:40:22.830
1,280,410
233
[ "asp.net", "logging", "permissions" ]
6,542
2
null
6,373
3
null
They both create a closure by executing the code block. As a matter of style I much prefer the second for a couple of reasons: It's not immediately obvious by glancing at the first that the code will actually be executed; the line it is a new function, rather than executing it as a constructor, but that's not what's...
null
CC BY-SA 2.5
null
2008-08-09T02:20:29.597
2008-08-09T02:20:29.597
null
null
588
null
6,533
2
null
6,499
3
null
Fortunately I get to use [prototype.js](http://prototypejs.org/), which provides some nice wrappers. So you can do this: ``` var Person = Class.create({ initialize: function(name) { this.name = name; }, say: function(message) { return this.name + ': ' + message; } }); ``` [Prototype.j...
null
CC BY-SA 3.0
null
2008-08-09T02:09:04.673
2016-07-24T07:17:31.523
2016-07-24T07:17:31.523
92,701
234
null
6,553
2
null
6,547
2
null
They each break when dropped from the same height, or are they different? If they're the same, I go to the 50th floor and drop the first marble. If it doesn't break, I go to the 75th floor and do the same, as long as it keeps not breaking I keep going up by 50% of what's left. When it does break, I go back to one hi...
null
CC BY-SA 2.5
null
2008-08-09T02:29:48.110
2008-08-09T02:29:48.110
null
null
271
null
6,548
2
null
3,088
1
null
I was taught by learning how to solve problems in a language agnostic way using flowcharts and [PDL](http://en.wikipedia.org/wiki/Program_Design_Language) (Program Design Language). After a couple weeks of that, I learned to convert the PDL I had written to a language. I am glad I learned that way because I have spen...
null
CC BY-SA 2.5
null
2008-08-09T02:23:54.160
2008-08-09T02:23:54.160
null
null
791
null
6,559
2
null
6,557
11
null
The reason is that a generic class like `List<>` is, for most purposes, treated externally as a normal class. e.g. when you say `List<string>()` the compiler says `ListString()` (which contains strings). [Technical folk: this is an extremely plain-English-ified version of what's going on] Consequently, obviously the c...
null
CC BY-SA 2.5
null
2008-08-09T02:38:02.883
2008-08-09T02:38:02.883
null
null
67
null
6,558
2
null
6,547
1
null
I'm personally not very big a fan of such puzzle questions, I prefer actual programming exercises in interviews. That said, first it would depend on if I can tell if they are broken or not from the floor I am dropping them at. I will presume I can. I would go up to the second floor, drop the first marble. If it bro...
null
CC BY-SA 2.5
null
2008-08-09T02:37:41.760
2008-08-09T02:37:41.760
null
null
122
null
6,565
2
null
6,547
54
null
The interesting thing here is how you can do it in the least amount of drops possible. Going to the 50th floor and dropping the first would be disastrous if the breaking floor is the 49th, resulting in us having to do 50 drops. We should drop the first marble at floor n, where n is the max amount of drops required. If ...
null
CC BY-SA 2.5
null
2008-08-09T02:45:43.070
2008-08-10T03:28:23.797
2008-08-10T03:28:23.797
613
613
null
6,560
2
null
6,547
3
null
I think the question is how accurate do you want the answer. Because your efficiency is going to really depend on that. I'm going to agree with Justin if you want 100% accuracy on the marbles then once the first marble breaks your going to have to go up 1 floor at a time from the last known "good" floor until you fi...
null
CC BY-SA 2.5
null
2008-08-09T02:40:56.653
2008-08-09T03:49:02.617
2008-08-09T03:49:02.633
792
792
null
6,557
1
6,567
null
85
77,154
It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way. ``` List<string> sl = new List<string>(); List<object> ol; ol = sl; ``` results in Cannot implicitly convert type `System.Collections.Generic.List<string>` to `System.Collections.Generic.List<object>` ...
In C#, why can't a List<string> object be stored in a List<object> variable
CC BY-SA 3.0
0
2008-08-09T02:32:01.507
2017-04-27T09:52:30.337
2012-09-27T04:25:55.163
512,251
797
[ "c#", ".net", "generics", "covariance", "type-safety" ]
6,569
2
null
6,557
3
null
Mike - I believe contravariance isn't allowed in C# either See [Generic type parameter variance in the CLR](http://blogs.msdn.com/rmbyers/archive/2005/02/16/375079.aspx) for some more info.
null
CC BY-SA 3.0
null
2008-08-09T02:53:18.237
2013-01-27T13:29:04.023
2013-01-27T13:29:04.023
null
797
null
6,555
2
null
6,414
5
null
Ruby unfortunately is a bit different. PS: My memory is a bit hazy on this so apologies if I'm wrong instead of break/continue, it has break/next, which behave the same in terms of loops Loops (like everything else) are expressions, and "return" the last thing that they did. Most of the time, getting the return valu...
null
CC BY-SA 2.5
null
2008-08-09T02:31:13.537
2008-08-09T02:31:13.537
null
null
234
null
6,568
2
null
176
4
null
My Apache had something like this in httpd.conf. Just change the ErrorLog and CustomLog settings ``` <VirtualHost myvhost:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /opt/web ServerName myvhost ErrorLog logs/myvhost-error_log CustomLog logs/myvhost-access_log common </VirtualHost...
null
CC BY-SA 2.5
null
2008-08-09T02:51:15.417
2008-08-09T02:51:15.417
null
null
796
null
6,567
2
null
6,557
39
null
Think of it this way, if you were to do such a cast, and then add an object of type Foo to the list, the list of strings is no longer consistent. If you were to iterate the first reference, you would get a class cast exception because once you hit the Foo instance, the Foo could not be converted to string! As a side ...
null
CC BY-SA 2.5
null
2008-08-09T02:50:14.903
2008-08-09T02:50:14.903
null
null
122
null
6,566
2
null
6,512
19
null
I remember reading an article that may be of help to you: [Cheney on the M.T.A.](http://home.pipeline.com/~hbaker1/CheneyMTA.html) :-) Some implementations of Scheme I know of, such as [SISC](http://sisc.sourceforge.net/), allocate their call frames on the heap. @ollie: You don't need to do the hoisting if all your c...
null
CC BY-SA 2.5
null
2008-08-09T02:49:25.903
2008-08-09T03:20:13.190
2008-08-09T03:20:13.190
13
13
null
6,572
2
null
6,512
1
null
Patrick is correct, the only way you can really do this is to use an explicit stack in your interpreter, and hoist the appropriate segment of stack into the heap when you need to convert to a continuation. This is basically the same as what is needed to support closures in languages that support them (closures and con...
null
CC BY-SA 2.5
null
2008-08-09T02:55:01.947
2008-08-09T02:55:01.947
null
null
784
null
6,577
2
null
6,557
36
null
If you're using .NET 3.5 have a look at the Enumerable.Cast method. It's an extension method so you can call it directly on the List. ``` List<string> sl = new List<string>(); IEnumerable<object> ol; ol = sl.Cast<object>(); ``` It's not exactly what you asked for but should do the trick. Edit: As noted by Zooba, yo...
null
CC BY-SA 2.5
null
2008-08-09T03:07:44.337
2008-08-10T20:54:56.977
2008-08-10T20:54:56.977
233
233
null
6,579
1
6,588
null
3
845
There are numerous [Agile software development](http://en.wikipedia.org/wiki/Agile_software_development) methods. Which ones have you used in practice to deliver a successful project, and how did the method contribute to that success?
Which Agile software development methods have you had the most success with?
CC BY-SA 2.5
null
2008-08-09T03:19:59.117
2008-09-24T21:59:07.137
2008-08-26T18:52:04.063
null
null
[ "methods", "agile" ]
6,581
2
null
6,579
6
null
Scrum because it shows where the slackers are. It also identifies much faster that the business unit usually doesn't have a clue what they really want delivered
null
CC BY-SA 2.5
null
2008-08-09T03:21:59.923
2008-08-09T03:21:59.923
null
null
740
null
6,576
2
null
1,644
7
null
- [FLOSS Weekly](http://twit.tv/FLOSS)- [Pragmatic Podcasts](http://www.pragprog.com/podcasts)- [Rails Envy](http://railsenvy.com/podcast)- [Webdev Radio](http://webdevradio.com/)
null
CC BY-SA 2.5
null
2008-08-09T03:00:11.030
2008-08-09T03:00:11.030
null
null
796
null
6,574
2
null
6,557
6
null
This has a lot to do with covariance, e.g., generic types are considered as parameters, and if the parameters do not resolve properly to a more specific type then the operation fails. The implication of such is that you really cannot cast to a more general type like object. And as stated by Rex, the List object won't c...
null
CC BY-SA 2.5
null
2008-08-09T02:58:26.463
2008-08-09T02:58:26.463
null
null
372
null
6,578
1
6,614
null
123
35,989
I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's `malloc` and `free` concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. H...
Understanding reference counting with Cocoa and Objective-C
CC BY-SA 2.5
0
2008-08-09T03:13:04.000
2016-12-19T03:41:31.810
2011-04-06T09:33:43.243
63,550
797
[ "iphone", "objective-c", "cocoa", "memory" ]
6,582
2
null
871
7
null
Git also makes branching and merging really easy. Subversion 1.5 just added merge tracking, but Git is still better. With Git branching is very fast and cheap. It makes creating a branch for each new feature more feasible. Oh and Git repositories are very efficient with storage space as compared to Subversion.
null
CC BY-SA 2.5
null
2008-08-09T03:22:14.510
2010-07-28T18:30:37.787
2010-07-28T18:30:37.787
63,550
796
null
6,585
2
null
328
2
null
If you you use [session_set_save_handler()](http://www.php.net/manual/en/function.session-set-save-handler.php) you can set your own session handler. For example you could store your sessions in the database. Refer to the php.net comments for examples of a database session handler. DB sessions are also good if you hav...
null
CC BY-SA 2.5
null
2008-08-09T03:28:43.640
2008-08-09T03:28:43.640
null
null
796
null
6,444
2
null
5,223
17
null
> > @palmsey: In fairness to the OP, the JavaScript documentation actually explicitly refer to using variables of type Object in this manner as "associative arrays". And in fairness to @palmsey he was quite correct. They aren't associative arrays; they're definitely objects :) - doing the job of an associative array. ...
null
CC BY-SA 4.0
null
2008-08-08T22:34:56.557
2020-07-10T18:34:24.613
2020-07-10T18:34:24.613
63,550
137
null
6,598
2
null
6,578
6
null
Joshua (#6591) - The Garbage collection stuff in Mac OS X 10.5 seems pretty cool, but isn't available for the iPhone (or if you want your app to run on pre-10.5 versions of Mac OS X). Also, if you're writing a library or something that might be reused, using the GC mode locks anyone using the code into also using the ...
null
CC BY-SA 2.5
null
2008-08-09T03:59:35.683
2008-08-09T03:59:35.683
null
null
797
null
6,594
1
6,617
null
11
2,224
What are some good steps to follow for a smooth migration from PHP4 to PHP5. What are some types of code that are likely to break?
PHP4 to PHP5 Migration
CC BY-SA 2.5
0
2008-08-09T03:49:36.017
2011-05-02T00:36:06.480
null
null
796
[ "php", "migration" ]
6,606
2
null
6,594
1
null
We had an app that relied heavily on the PHP 4 XML DOM functions and it required a lot of retooling to change over PHP 5. Beyond that most changes were improvements to things like error handling (to take advantage of exceptions) and PHP Classes.
null
CC BY-SA 2.5
null
2008-08-09T04:12:31.290
2008-08-09T04:12:31.290
null
null
305
null
6,547
1
6,565
null
40
19,801
One of those classic programming interview questions... You are given two marbles, and told that they will break when dropped from some certain height (and presumably suffer no damage if dropped from below that height). You’re then taken to a 100 story building (presumably higher than the certain height), and asked to...
Two marbles and a 100 story building
CC BY-SA 3.0
0
2008-08-09T02:23:27.890
2019-03-27T11:15:10.377
2015-08-27T10:54:42.120
1,401,975
797
[ "algorithm", "puzzle" ]
6,588
2
null
6,579
7
null
I've been involved with quite a few organisations which claimed to work in an 'agile' way, and their processed usually seemed to be base on XP (extreme programming), but none of them ever followed anywhere near all the practices. That said, I can probably comment on a few of the XP practices - seems to prove very us...
null
CC BY-SA 2.5
null
2008-08-09T03:39:44.600
2008-08-09T03:39:44.600
null
null
797
null
6,607
1
6,620
null
55
25,159
I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application settings, like an Edit | Settings form or similar. But where should I store the values after the user hits the Apply butt...
Registry vs. INI file for storing user configurable application settings
CC BY-SA 2.5
0
2008-08-09T04:13:02.740
2021-06-03T09:41:06.947
2009-06-06T02:57:24.373
27,687
27,687
[ "windows", "registry", "settings", "configuration-files", "ini" ]
6,592
2
null
6,578
6
null
Objective-C uses [Reference Counting](http://en.wikipedia.org/wiki/Reference_counting), which means each Object has a reference count. When an object is created, it has a reference count of "1". Simply speaking, when an object is referred to (ie, stored somewhere), it gets "retained" which means its reference count is ...
null
CC BY-SA 2.5
null
2008-08-09T03:48:10.417
2008-08-09T03:48:10.417
null
null
457
null
6,610
2
null
6,578
4
null
NilObject's answer is a good start. Here's some supplemental info pertaining to manual memory management (). If you personally `alloc/init` an object, it comes with a reference count of 1. You are responsible for cleaning up after it when it's no longer needed, either by calling `[foo release]` or `[foo autorelease]`....
null
CC BY-SA 3.0
null
2008-08-09T04:25:46.537
2016-03-25T21:13:23.980
2016-03-25T21:13:23.980
5,208,764
544
null
6,618
2
null
4,689
66
null
I really really like [DejaVu Sans Mono](http://dejavu.sourceforge.net/wiki/index.php/Main_Page). It is very clean and easy on the eyes. ![enter image description here](https://i.stack.imgur.com/iZYIQ.png)
null
CC BY-SA 3.0
null
2008-08-09T04:49:02.557
2011-11-02T14:08:17.383
2011-11-02T14:08:17.383
810
810
null
6,621
2
null
6,579
4
null
Scrum. The daily standup meeting is a great way to make sure things stay on track and progress is being made. I also think it's key to get the product/market folks involved in the process in a real, meaningful way. It'll create a more collaborative environment and removes a lot of the adversarial garbage that comes up...
null
CC BY-SA 2.5
null
2008-08-09T04:52:54.610
2008-08-09T04:52:54.610
null
null
821
null
6,617
2
null
6,594
8
null
I also once worked on an app which used PHP4's XML support quite heavily, and would have required quite a bit of work to move to PHP5. One of the other significant changes I was looking at at the time was the change of the default handling of function parameters. In PHP4 if I remember, they were pass-by-copy unless yo...
null
CC BY-SA 3.0
null
2008-08-09T04:44:49.710
2011-05-02T00:36:06.480
2011-05-02T00:36:06.480
797
797
null
6,613
1
15,811
null
19
24,431
What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.
What rule engine should I use?
CC BY-SA 2.5
0
2008-08-09T04:34:29.467
2016-06-02T16:51:15.093
2008-10-23T15:03:46.513
27,687
27,687
[ "language-agnostic", "rule-engine" ]
6,612
1
6,655
null
45
32,277
On a recent Java project, we needed a free Java based real-time data plotting utility. After much searching, we found this tool called the [Scientific Graphics Toolkit or SGT](http://www.epic.noaa.gov/java/sgt/) from NOAA. It seemed pretty robust, but we found out that it wasn't terribly configurable. Or at least no...
Are there any decent free Java data plotting libraries out there?
CC BY-SA 3.0
0
2008-08-09T04:29:42.190
2019-10-13T22:47:11.170
2019-10-13T21:37:03.403
3,002,139
27,687
[ "java", "plot", "configuration" ]
6,625
2
null
6,594
2
null
The best advice I could give anyone working with PHP4 is this: ``` error_reporting( E_ALL ); ``` It pretty much will tell you exactly what you need to do.
null
CC BY-SA 2.5
null
2008-08-09T05:00:11.927
2008-08-09T05:00:11.927
null
null
795
null
6,629
2
null
6,628
0
null
If $index is a string there is no difference because $index, "$index", and "{$index}" all evaluate to the same string. If $index is a number, for example 10, the first line will evaluate to $array[10] and the other two lines will evaluate to $array["10"] which is a different element than $array[10].
null
CC BY-SA 2.5
null
2008-08-09T05:05:38.203
2008-08-09T05:05:38.203
null
null
813
null