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
5,909
1
5,985
null
56
55,053
I'm downloading an entire directory from a web server. It works OK, but I can't figure how to get the file size before download to compare if it was updated on the server or not. Can this be done as if I was downloading the file from a FTP server? ``` import urllib import re url = "http://www.someurl.com" # Download...
Get size of a file before downloading in Python
CC BY-SA 3.0
0
2008-08-08T13:35:19.970
2022-11-28T01:16:33.860
2013-07-06T01:43:48.180
498,705
394
[ "python", "urllib" ]
5,924
2
null
5,913
7
null
``` document.getElementById('newSkill').options[document.getElementById('newSkill').selectedIndex].value ``` Should work
null
CC BY-SA 3.0
null
2008-08-08T13:41:11.737
2017-02-15T11:26:52.587
2017-02-15T11:26:52.587
3,030,434
482
null
5,923
2
null
5,916
3
null
I use [Textmate](http://macromates.com/) (Mac only) which has Code folding and I find it really useful for folding functions, I know what my "getGet" function does, I don't need it taking up 10 lines of oh so valuable screen space. I never use it to hide a for loop, if statement or similar unless showing the code to s...
null
CC BY-SA 2.5
null
2008-08-08T13:40:55.510
2008-08-08T13:40:55.510
null
null
1,384,652
null
5,921
2
null
5,913
1
null
Does this get the correct answer? ``` document.getElementById("newSkill").innerHTML ```
null
CC BY-SA 2.5
null
2008-08-08T13:40:04.780
2008-08-08T20:52:40.880
2008-08-08T20:52:40.880
1
721
null
5,927
2
null
5,909
7
null
The size of the file is sent as the Content-Length header. Here is how to get it with urllib: ``` >>> site = urllib.urlopen("http://python.org") >>> meta = site.info() >>> print meta.getheaders("Content-Length") ['16535'] >>> ```
null
CC BY-SA 2.5
null
2008-08-08T13:41:43.043
2008-08-08T13:44:47.390
2008-08-08T13:44:47.390
309,844
309,844
null
5,916
1
7,767
null
26
6,972
For those of you in the Visual Studio environment, how do you feel about wrapping any of your code in #regions? (or if any other IDE has something similar...)
How do you feel about code folding?
CC BY-SA 2.5
0
2008-08-08T13:38:30.260
2021-10-25T12:28:13.667
2008-10-20T09:02:02.300
1
396
[ "visual-studio", "folding" ]
5,929
2
null
5,916
15
null
This was talked about on [Coding Horror](https://blog.codinghorror.com/the-problem-with-code-folding/). My personal belief is that is that they are useful, but like anything in excess can be too much. I use it to order my code blocks into: Enumerations Declarations Constructors Methods Event Handlers Properties
null
CC BY-SA 4.0
null
2008-08-08T13:42:09.080
2018-10-21T11:58:15.537
2018-10-21T11:58:15.537
1,033,581
36
null
5,930
2
null
5,916
1
null
I personally use #Regions all the time. I find that it helps me to keep things like properties, declarations, etc separated from each other. This is probably a good answer, too! [Coding Horror](https://blog.codinghorror.com/the-problem-with-code-folding/) Edit: Dang, Pat beat me to this!
null
CC BY-SA 4.0
null
2008-08-08T13:42:56.757
2018-10-21T12:00:33.943
2018-10-21T12:00:33.943
1,033,581
721
null
5,939
2
null
5,913
9
null
This should return the text value of the selected value ``` var vSkill = document.getElementById('newSkill'); var vSkillText = vSkill.options[vSkill.selectedIndex].innerHTML; alert(vSkillText); ``` Props: @Tanerax for reading the question, knowing what was asked and answering it before others figured it out. Edit...
null
CC BY-SA 2.5
null
2008-08-08T13:52:02.883
2008-08-08T14:18:05.390
2008-08-08T14:18:05.390
567
567
null
5,913
1
5,947
null
86
249,544
This gets the value of whatever is selected in my dropdown menu. ``` document.getElementById('newSkill').value ``` I cannot however find out what property to go after for the text that's currently displayed by the drop down menu. I tried "text" then looked at [W3Schools](http://w3schools.com/) but that didn't have t...
Getting the text from a drop-down box
CC BY-SA 3.0
0
2008-08-08T13:36:16.877
2021-10-25T12:28:28.320
2013-01-09T06:32:38.550
1,471,203
1,384,652
[ "javascript", "dom", "browser", "client-side" ]
5,944
2
null
3,894
3
null
You should never ever use the money datatype to store monetary values. If you do any calculations you will get truncated results. Run the following to see what I mean ``` DECLARE @mon1 MONEY, @mon2 MONEY, @mon3 MONEY, @mon4 MONEY, @num1 DECIMAL(19,4), @num2 DECIMAL(19,4), @num3 DECIMAL(19,4), @num4 DECIMAL(19,4) SELE...
null
CC BY-SA 3.0
null
2008-08-08T13:53:26.377
2012-05-21T18:38:10.893
2012-05-21T18:38:10.893
866,022
740
null
5,938
2
null
5,909
6
null
Also if the server you are connecting to supports it, look at [Etags](http://en.wikipedia.org/wiki/HTTP_ETag) and the [If-Modified-Since](http://en.wikipedia.org/wiki/List_of_HTTP_headers#Requests) and [If-None-Match](http://en.wikipedia.org/wiki/List_of_HTTP_headers#Requests) headers. Using these will take advantage ...
null
CC BY-SA 2.5
null
2008-08-08T13:51:23.290
2008-08-08T13:51:23.290
null
null
309,844
null
5,943
2
null
3,255
8
null
Big O notation is useful because it's easy to work with and hides unnecessary complications and details (for some definition of unnecessary). One nice way of working out the complexity of divide and conquer algorithms is the tree method. Let's say you have a version of quicksort with the median procedure, so you split ...
null
CC BY-SA 2.5
null
2008-08-08T13:53:20.930
2008-08-08T13:53:20.930
null
null
null
null
5,935
2
null
5,909
28
null
Using the returned-urllib-object method `info()`, you can get various information on the retrieved document. Example of grabbing the current Google logo: ``` >>> import urllib >>> d = urllib.urlopen("http://www.google.co.uk/logos/olympics08_opening.gif") >>> print d.info() Content-Type: image/gif Last-Modified: Thu, 0...
null
CC BY-SA 4.0
null
2008-08-08T13:47:26.373
2021-10-25T12:28:46.357
2021-10-25T12:28:46.357
17,169,050
745
null
5,945
2
null
5,892
0
null
Presuming you haven't futzed around with the Project settings deleting something you ought not have (which is where I'd expect external dependencies like User32.lib to be): Check Tools | Options | Directories | Libraries (going from memory here) and ensure that you're not missing the common-all-garden variety lib dire...
null
CC BY-SA 2.5
null
2008-08-08T13:54:35.763
2008-08-08T13:57:57.707
2008-08-08T13:57:57.707
257
257
null
5,954
2
null
5,916
0
null
I prefer #regions myself, but an old coworker couldn't stand to have things hidden. I understood his point once I worked on a page with 7 #regions, at least 3 of which had been auto-generated and had the same name, but in general I think they're a useful way of splitting things up and keeping everything less cluttered....
null
CC BY-SA 2.5
null
2008-08-08T13:57:31.657
2008-08-08T13:57:31.657
null
null
517
null
5,953
2
null
5,916
5
null
While I understand the problem that Jeff, et. al. have with regions, what I understand is why hitting +,+ to expand all regions in a file is so difficult to deal with.
null
CC BY-SA 3.0
null
2008-08-08T13:56:58.660
2015-04-21T16:00:52.503
2015-04-21T16:00:52.503
3,906,965
35
null
5,947
2
null
5,913
151
null
Based on your example HTML code, here's one way to get the displayed text of the currently selected option: ``` var skillsSelect = document.getElementById("newSkill"); var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text; ```
null
CC BY-SA 2.5
null
2008-08-08T13:54:55.983
2008-10-02T13:24:05.037
2008-10-02T13:24:05.037
437
437
null
5,940
2
null
5,892
0
null
windows.h is declared at the top of IOCompletionPort.h as an include - I was sick of seeing 7 lines just to include 1 file so I have wrapped it its own file and includes that itself. This also contains some additional #defines (i.e. ULONG_PTR) as our main app won't compile with the Platform SDK installed:-( 1. That is...
null
CC BY-SA 4.0
null
2008-08-08T13:52:29.013
2021-10-25T12:23:13.527
2021-10-25T12:23:13.527
17,169,050
342
null
5,956
2
null
5,880
0
null
As with anything abstraction creates complexity, and so the complexity of doing N-tiered should be properly justified, e.g., does N-tiered actually benefit the system? There be small systems that will work best with N-tiered, although a lot of them will not. Also, even if your system is small at the moment, you might...
null
CC BY-SA 2.5
null
2008-08-08T13:58:59.250
2008-08-08T13:58:59.250
null
null
372
null
5,952
2
null
5,509
2
null
Are you sure you have debug build? Or rather you have all PDB's enabled? Try WindDbg on your executable and check with !lmi command what is visible. Is whole code properly instrumented? Also consider using something else like [free Visual Leak Detector](http://www.codeproject.com/KB/applications/visualleakdetector.as...
null
CC BY-SA 2.5
null
2008-08-08T13:56:40.487
2008-08-08T13:56:40.487
null
null
501
null
5,963
2
null
5,949
35
null
I can't say about the web side of your question. But uuids are great for n-tier applications. PK generation can be decentralized: each client generates it's own pk without risk of collision. And the speed difference is generally small. Make sure your database supports an efficient storage datatype (16 bytes, 128 bits...
null
CC BY-SA 2.5
null
2008-08-08T14:03:00.833
2008-08-08T14:03:00.833
null
null
626
null
5,948
1
587,244
null
10
4,354
In my web application I have a file which hold the current revision number via $Rev$. This work fine except, if I don't make any changes to that file, it doesn't get committed.
Always Commit the same file with SVN
CC BY-SA 2.5
0
2008-08-08T13:55:04.453
2021-10-25T12:26:52.947
2009-02-24T14:42:13.150
383
383
[ "svn" ]
5,958
2
null
5,949
2
null
I work with a student management system which uses UUID's in the form of an integer. They have a table which hold the next unique ID. Although this is probably a good idea for an architectural point of view, it makes working with on a daily basis difficult. Sometimes there is a need to do bulk inserts and having a UUI...
null
CC BY-SA 2.5
null
2008-08-08T13:59:46.673
2008-08-08T13:59:46.673
null
null
383
null
5,960
2
null
5,949
1
null
I think using a GUID would be the better choice in your situation. It takes up more space but it's more secure.
null
CC BY-SA 3.0
null
2008-08-08T14:00:49.323
2017-06-23T15:55:20.533
2017-06-23T15:55:20.533
444,991
299
null
5,964
2
null
2,527
0
null
If you want the context menu to be dependent on the selected item you're best move I think is to use Jonesinator's code to select the clicked item. Your context menu content can then be dependent on the selected item. Selecting the item first as opposed to just using it for the context menu gives a few advantages. The...
null
CC BY-SA 2.5
null
2008-08-08T14:04:11.503
2008-08-08T14:04:11.503
null
null
214
null
5,962
2
null
5,916
3
null
I prefer partial classes as opposed to regions. Extensive use of regions by others also give me the impression that someone, somewhere, is violating the Single Responsibility Principle and is trying to do too many things with one object.
null
CC BY-SA 2.5
null
2008-08-08T14:01:16.750
2008-08-08T14:01:16.750
null
null
372
null
5,965
2
null
4,738
10
null
In addition to Ishmaeel's answer, the method `OpenMappedMachineConfiguration()` will always return a `Configuration` object. So to check to see if it loaded you should check the `HasFile` property where true means it came from a file.
null
CC BY-SA 3.0
null
2008-08-08T14:04:32.857
2014-04-23T09:14:57.430
2014-04-23T09:14:57.430
2,264,626
507
null
5,970
2
null
5,948
1
null
Depending on your client, some of them offer a pre-commit hook that you can implement something that simply "touches" the file and flags it as changed. If your using something like Visual Studio you could create a post build task that would "touch" the file but you would have to make sure that you do a build before com...
null
CC BY-SA 2.5
null
2008-08-08T14:07:49.357
2008-08-08T14:07:49.357
null
null
567
null
5,971
2
null
5,916
2
null
I'm not a fan of partial classes - I try to develop my classes such that each class has a very clear, single issue for which it's responsible. To that end, I don't believe that something with a clear responsibility should be split across multiple files. That's why I don't like partial classes. With that said, I'm on t...
null
CC BY-SA 2.5
null
2008-08-08T14:08:10.043
2008-08-08T14:08:10.043
null
null
20
null
5,917
2
null
5,908
6
null
- `2000``sp_who2``dbo.sysprocesses`- `2005``sys.dm_exec_sessions` Below is an example ``` SELECT COUNT(*) AS StatusCount,CASE status WHEN 'Running' THEN 'Running - Currently running one or more requests' WHEN 'Sleeping ' THEN 'Sleeping - Currently running no requests' ELSE 'Dormant – Session is in prelogin state' ...
null
CC BY-SA 3.0
null
2008-08-08T13:38:51.070
2011-10-11T08:27:24.180
2011-10-11T08:27:24.180
805,252
740
null
5,949
1
5,963
null
80
27,092
I've always preferred to use long integers as primary keys in databases, for simplicity and (assumed) speed. But when using a [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) or Rails-like URL scheme for object instances, I'd then end up with URLs like this: ``` http://example.com/user/783 ``` An...
What's your opinion on using UUIDs as database row identifiers, particularly in web apps?
CC BY-SA 2.5
0
2008-08-08T13:55:48.773
2022-05-30T22:46:20.797
2008-08-08T18:34:04.140
726
726
[ "database", "web-applications", "uuid" ]
5,973
2
null
5,948
3
null
> This work fine except, if I don't make any changes to that file, it doesn't get committed. If the file never changes, why would you need it to commmit every single time? [EDIT] @Sean = I understand what he's trying to do, but if the file is never getting updated via a hook or some other process and therefore never ...
null
CC BY-SA 2.5
null
2008-08-08T14:08:33.957
2008-08-08T14:21:42.513
2008-08-08T14:21:42.513
204
204
null
5,974
2
null
5,948
1
null
@gradonmantank: Because he wants that file to be updated with the latest revision number. Did you read his question completely? The pre-commit hook might work.
null
CC BY-SA 2.5
null
2008-08-08T14:12:15.463
2008-08-08T14:12:15.463
null
null
106
null
5,980
2
null
5,876
3
null
try querying with a trailing dot to explicitly set the root: ``` host dlksfhoiahdsfiuhsdf.com. ```
null
CC BY-SA 2.5
null
2008-08-08T14:17:08.760
2008-08-08T14:17:08.760
null
null
430
null
5,978
2
null
5,948
1
null
I used to have a manual way of doing that. I'd run a script that would use sed to replace a comment with the current timestamp in my $Rev$ file. That way, the file contents would change and Subversion would commit it. What I didn't do was to take that to the next step: using [Subversion's repository hooks](http://svnb...
null
CC BY-SA 2.5
null
2008-08-08T14:15:49.717
2008-08-08T14:15:49.717
null
null
726
null
5,972
2
null
5,916
10
null
Sometimes you might find yourself working on a team where #regions are encouraged or required. If you're like me and you can't stand messing around with folded code you can turn off outlining for C#: 1. Options -> Text Editor -> C# -> Advanced Tab 2. Uncheck "Enter outlining mode when files open"
null
CC BY-SA 2.5
null
2008-08-08T14:08:27.797
2008-08-11T12:34:06.550
2008-08-11T12:34:06.550
507
507
null
5,990
2
null
5,916
5
null
I use #Region to hide ugly and useless automatically generated code, which really belongs in the automatically generated part of the partial class. But, when working with old projects or upgraded projects, you don't always have that luxury. As for other types of folding, I fold Functions all the time. If you name the ...
null
CC BY-SA 2.5
null
2008-08-08T14:24:50.663
2008-08-08T14:24:50.663
null
null
106
null
5,982
1
null
null
8
1,757
Does anyone know why when using BindingUtils on the selectedItem property of a ComboBox you get the following warning? Any ideas how to resolve the issue? The binding still works properly, but it would be nice to get rid of the warning. ``` warning: multiple describeType entries for 'selectedItem' on type 'mx.control...
How do I get rid of the "multiple describeType entries" warning?
CC BY-SA 3.0
null
2008-08-08T14:18:09.913
2021-10-25T12:24:03.480
2013-01-09T06:31:55.837
1,471,203
22
[ "apache-flex", "actionscript-3", "air" ]
5,966
1
10,778
null
17
1,693
Basically, I've written an API to www.thetvdb.com in Python. The current code can be found [here](http://github.com/dbr/tvdb_api/tree/master/tvdb_api.py). It grabs data from the API as requested, and has to store the data somehow, and make it available by doing: ``` print tvdbinstance[1][23]['episodename'] # get the ...
Best way to abstract season/show/episode data
CC BY-SA 3.0
null
2008-08-08T14:05:45.290
2021-10-25T12:24:20.477
2017-03-29T20:45:42.267
604,687
745
[ "python", "data-structures" ]
5,977
2
null
5,894
4
null
If you're really looking for an application that you can modify try out [Family.Show](http://www.codeplex.com/familyshow) on CodePlex.
null
CC BY-SA 2.5
null
2008-08-08T14:15:08.047
2008-08-08T14:15:08.047
null
null
627
null
5,994
2
null
2,786
6
null
One of the best things you can do if developing with Visual Studio for Mono is to get MoMA [http://www.mono-project.com/MoMA](http://www.mono-project.com/MoMA). This will inspect any number of assemblies that you build and generate a report showing potential Mono problems (e.g., methods not implemented in the mono libr...
null
CC BY-SA 2.5
null
2008-08-08T14:29:04.727
2008-08-08T14:29:04.727
null
null
748
null
5,997
1
6,018
null
6
1,463
If I have .Net Form with a component/object such as a textbox that I need to access from a parent or other form I obviously need to "upgrade" the modifier to this component to an Internal or Public level variable. Now, if I were providing a public variable of an int or string type etc. in my form class I wouldn't thin...
Should I provide accessor methods / Getter Setters for public/protected components on a form?
CC BY-SA 3.0
null
2008-08-08T14:35:25.353
2021-10-25T12:23:28.773
2015-10-08T00:57:25.790
67,579
445
[ ".net", "winforms" ]
6,005
2
null
5,997
2
null
The reason for not implementing Getters and Setters for components on a form I believe is cause they wouldn't be "Thread Safe" .NET objects are suppose to be only modified by the form thread that created them, If you put on getter and setters you are potentially opening it up for any thread. Instead your suppose to imp...
null
CC BY-SA 4.0
null
2008-08-08T14:42:13.233
2021-10-25T12:23:28.773
2021-10-25T12:23:28.773
17,169,050
567
null
6,007
1
10,383
null
65
113,056
How do I make [Log4net](http://logging.apache.org/log4net/index.html) only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info? ``` <logger name="BrokerCollection.Model.XmlDocu...
Log4Net configuring log level
CC BY-SA 3.0
0
2008-08-08T14:43:11.877
2017-11-01T13:25:59.577
2013-10-01T13:29:30.410
463,828
230
[ "log4net" ]
5,967
2
null
5,949
23
null
I can answer you that in SQL server if you use a uniqueidentifier (GUID) datatype and use the NEWID() function to create values you will get horrible fragmentation because of page splits. The reason is that when using NEWID() the value generated is not sequential. SQL 2005 added the NEWSEQUANTIAL() function to remedy t...
null
CC BY-SA 2.5
null
2008-08-08T14:05:56.630
2008-08-08T14:05:56.630
null
null
740
null
5,992
2
null
5,948
4
null
@gatekiller: It seems TortoiseSVN does support [Client Side Hooks](http://tortoisesvn.tigris.org/tsvn_1.5_releasenotes.html#client-side-hooks).
null
CC BY-SA 2.5
null
2008-08-08T14:28:17.087
2008-08-08T14:28:17.087
null
null
567
null
6,003
2
null
5,997
1
null
I always do that, and if you ARE following an MVP design creating getter/setters for your view components would be a design requirement. I do not understand what you mean by "does not comply with good programming practice". Microsoft violates of good programming practices to make it easier to create stuff on Visual S...
null
CC BY-SA 2.5
null
2008-08-08T14:41:48.697
2008-08-08T14:41:48.697
null
null
372
null
6,011
2
null
6,009
19
null
Don't version that file. Version a template or something.
null
CC BY-SA 2.5
null
2008-08-08T14:46:15.020
2008-08-08T14:46:15.020
null
null
30
null
5,984
2
null
5,918
1
null
I don't know about yahoo, but there is another mapping website that provides an API for India. [http://biz.mapmyindia.com/APIs.html](http://biz.mapmyindia.com/APIs.html)
null
CC BY-SA 4.0
null
2008-08-08T14:21:09.830
2021-10-25T12:27:22.547
2021-10-25T12:27:22.547
17,169,050
106
null
6,009
1
6,017
null
102
21,265
Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source control? Not check in this file at all, check it with different names or do som...
How do you deal with configuration files in source control?
CC BY-SA 2.5
0
2008-08-08T14:44:25.570
2021-10-25T12:22:09.663
2008-08-17T02:13:54.053
55
556
[ "svn", "git", "version-control", "cvs" ]
6,016
2
null
6,009
3
null
@Grant is right. I'm on a team with close to 100 other developers, and our config files are not checked into source control. We have versions of the files in the repository that are pulled with each check out but they don't change. It's worked out pretty well for us.
null
CC BY-SA 2.5
null
2008-08-08T14:49:52.453
2008-08-08T14:49:52.453
null
null
20
null
6,017
2
null
6,009
73
null
What I've done in the past is to have a default config file which is checked in to source control. Then, each developer has their own override config file which is excluded from source control. The app first loads the default, and then if the override file is present, loads that and uses any settings from the override ...
null
CC BY-SA 2.5
null
2008-08-08T14:50:00.287
2008-08-08T14:50:00.287
null
null
726
null
5,993
2
null
5,948
1
null
Committing the file wouldn't do you any good. The file isn't committed with the full version inside, it is replaced with just the keyword. If you look at the file inside the repository you will see this. As such, you need to force the file to be updated in some way instead. If you're on the Windows platform, you can us...
null
CC BY-SA 4.0
null
2008-08-08T14:28:52.887
2021-10-25T12:26:52.947
2021-10-25T12:26:52.947
17,169,050
267
null
5,985
2
null
5,909
39
null
I have reproduced what you are seeing: ``` import urllib, os link = "http://python.org" print "opening url:", link site = urllib.urlopen(link) meta = site.info() print "Content-Length:", meta.getheaders("Content-Length")[0] f = open("out.txt", "r") print "File on disk:",len(f.read()) f.close() f = open("out.txt", "...
null
CC BY-SA 2.5
null
2008-08-08T14:21:51.107
2008-08-08T14:26:40.817
2008-08-08T14:26:40.817
309,844
309,844
null
6,019
2
null
6,009
1
null
I version control it, but never push it to the other servers. If the production server requires a change, I make that change directly to the config file. It may not be pretty, but it works just fine.
null
CC BY-SA 2.5
null
2008-08-08T14:50:48.617
2008-08-08T14:50:48.617
null
null
106
null
6,014
2
null
5,948
1
null
You can use svn pre-commit-hooks to do it. The general idea I have in mind is create one that before the commit will put the new revision number in the file (get it using svnlook) or maybe change a bogus property on the file (it has to change or SVN will ignore it). For more information about pre-commit-hooks I found ...
null
CC BY-SA 2.5
null
2008-08-08T14:48:29.213
2008-08-08T14:48:29.213
null
null
573
null
6,012
2
null
6,009
6
null
Currently I have the "template" config file with an added extension for example: ``` web.config.rename ``` However, I can see an issue with this method if critical changes have changed.
null
CC BY-SA 2.5
null
2008-08-08T14:47:06.593
2008-08-08T14:47:06.593
null
null
383
null
6,020
2
null
6,009
2
null
The checked-in, plain-vanilla version of app/web.config should be generic enough to work on all developer machines, and be kept up to date with any new setting changes, etc. If you require a specific set of settings for dev/test/production settings, check in separate files with those settings, as GateKiller stated, wi...
null
CC BY-SA 2.5
null
2008-08-08T14:51:35.400
2008-08-08T14:51:35.400
null
null
35
null
6,037
2
null
5,802
0
null
We have a SProc that adds audit columns to a given table, and (optionally) creates a history table and associated triggers to track changes to a value. Unfortunately, company policy means I can't share, but it really isn't difficult to achieve.
null
CC BY-SA 2.5
null
2008-08-08T14:59:43.777
2008-08-08T14:59:43.777
null
null
377
null
6,018
2
null
5,997
5
null
"" If you mean the controls you're dragging and dropping onto the form, these are marked as private instance members and are added to the form's Controls collection. Why would they be otherwise? A form could have forty or fifty controls, it'd be somewhat unnecessary and unwieldy to provide a getter/setter for every co...
null
CC BY-SA 3.0
null
2008-08-08T14:50:30.130
2015-10-08T00:57:46.193
2015-10-08T00:57:46.193
67,579
419
null
6,081
2
null
6,009
2
null
We use a template config file that is checked in to version control and then a step in our automated build to replace specific entries in the template file with environment-specific settings. The environment-specific settings are stored in a separate XML file that is also under version control. We're using MSBuild in...
null
CC BY-SA 2.5
null
2008-08-08T15:41:29.137
2008-08-08T15:41:29.137
null
null
729
null
6,062
2
null
5,949
28
null
For what it's worth, I've seen a long running stored procedure (9+ seconds) drop to just a few hundred milliseconds of run time simply by switching from GUID primary keys to integers. That's not to say a GUID is a bad idea, but as others have pointed out, joining on them, and indexing them, by definition, is not going...
null
CC BY-SA 2.5
null
2008-08-08T15:20:35.857
2008-08-08T15:20:35.857
null
null
751
null
6,052
2
null
5,949
3
null
I don't think a GUID gives you many benefits. Users hate long, incomprehensible URLs. Create a shorter ID that you can map to the URL, or enforce a unique user name convention ([http://example.com/user/brianly](http://example.com/user/brianly)). The guys at [37Signals](http://gettingreal.37signals.com/) would probably...
null
CC BY-SA 2.5
null
2008-08-08T15:10:04.240
2008-08-08T15:10:04.240
null
null
636
null
6,022
2
null
4,080
0
null
I am looking for many answers to learn about new tools and consolidate this knowledge in a one question/thread, so I doubt there will be 1 true answer to this question. My answer to my own question is that we use: - - Hudson also has a task-scanner plugin that will display a count of your TODO and FIXMEs, as well a...
null
CC BY-SA 2.5
null
2008-08-08T14:53:12.293
2008-08-08T14:53:12.293
null
null
235
null
6,083
2
null
6,080
0
null
OpenID seems to be a very good alternative to writing your own user management/authentication piece. I'm seeing more and more sites using OpenID these days, so the barrier to entry for your users should be relatively low.
null
CC BY-SA 2.5
null
2008-08-08T15:42:21.303
2008-08-08T15:42:21.303
null
null
423
null
6,084
2
null
6,080
4
null
I like OpenID, but I'd still go with the email address, unless your user community is very technically savvy. It's still much easier for most people to understand and remember.
null
CC BY-SA 2.5
null
2008-08-08T15:44:12.563
2008-08-08T15:44:12.563
null
null
676
null
6,086
2
null
6,009
10
null
My team keeps separate versions of the config files for each environment (web.config.dev, web.config.test, web.config.prod). Our deployment scripts copy out the correct version, renaming it to web.config. This way, we have full version control on the config files for each environment, can easily perform a diff, etc.
null
CC BY-SA 2.5
null
2008-08-08T15:44:59.723
2008-08-08T15:44:59.723
null
null
423
null
6,080
1
6,088
null
17
6,978
We are in the early design stages of a major rewrite of our product. Right now our customers are mostly businesses. We manage accounts. User names for an account are each on their own namespace but it means that we can't move assets between servers. We want to move to a single namespace. But that brings the problem of...
What to use for login ID?
CC BY-SA 2.5
0
2008-08-08T15:40:58.903
2021-10-25T12:12:57.620
2008-08-23T17:23:39.073
2,134
758
[ "authentication", "web-applications", "account" ]
6,089
2
null
6,080
1
null
I personally would say Email w/ Verification, OpenId is a great idea but I find that finding a provider that your already with is a pain, I only had an openId for here cause just 2 days before beta I decided to start a blog on blogspot. But everyone on the internet has an email address, especially when dealing with bus...
null
CC BY-SA 4.0
null
2008-08-08T15:46:36.227
2021-10-25T12:12:57.620
2021-10-25T12:12:57.620
17,169,050
567
null
6,087
2
null
2,988
1
null
[Algorithms for Java: Part 5](https://rads.stackoverflow.com/amzn/click/com/0201361213) by Robert Sedgewick is all about graph algorithms and datastructures. This would be a good first book to work through if you want to implement some graph algorithms.
null
CC BY-SA 2.5
null
2008-08-08T15:46:05.617
2008-08-08T15:46:05.617
null
null
null
null
6,093
2
null
6,080
6
null
OpenID is very slick, and something you should seriously consider as it basically removes the requirement to save local usernames and passwords and worry about authentication. A lot of sites nowadays are using both OpenID and their own, giving users the option. If you do decide to roll your own, I'd recommend using t...
null
CC BY-SA 2.5
null
2008-08-08T15:49:41.913
2008-08-08T15:49:41.913
null
null
722
null
6,096
2
null
6,076
3
null
Is SearchButton a LinkButton? If so, the javascript that is written to the browser doesn't work properly. Here is a good blog post explaining the issue and how to solve it: [Using Panel.DefaultButton property with LinkButton control in ASP.NET](http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-link...
null
CC BY-SA 2.5
null
2008-08-08T15:53:23.030
2008-08-08T15:53:23.030
null
null
519
null
6,091
2
null
6,080
1
null
I think that OpenID is definitely worth looking at. Besides giving you a framework in which to provide a unified id for customers, it can also provide large businesses with the ability to manage their own logins and provide a common login across all products that they use, including your own. This isn't that large of...
null
CC BY-SA 2.5
null
2008-08-08T15:48:06.567
2008-08-08T16:01:24.697
2008-08-08T16:01:24.697
121
121
null
6,078
2
null
3,400
0
null
When it comes to full-text searching, for my money nothing beats [Lucene](http://lucene.apache.org). There is a [.Net port available](http://incubator.apache.org/projects/lucene.net.html) that is compatible with indexes created with the Java version. There's a little work involved in that you have to create/maintain ...
null
CC BY-SA 2.5
null
2008-08-08T15:34:28.997
2008-08-08T15:34:28.997
null
null
729
null
6,098
2
null
6,080
1
null
If most of your customers are mostly businesses then I think that using anything other than email creates problems for your customers. Most people are comfortable with email address login and since they are a business customer will likely want to use their work email rather than a personal account. OpenID creates a sit...
null
CC BY-SA 2.5
null
2008-08-08T15:54:51.077
2008-08-08T15:54:51.077
null
null
757
null
6,076
1
7,740
null
7
1,676
I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: ``` MyPanel.DefaultButton = SearchButton.ID ``` On the Con...
Default Form Button in FireFox
CC BY-SA 4.0
null
2008-08-08T15:32:15.787
2021-10-25T12:20:50.397
2021-10-25T12:20:50.397
17,169,050
225
[ "asp.net", "vb.net" ]
6,097
2
null
6,076
0
null
I might be wrong and this might not make a difference but have you tried: ``` Me.Page.Form.DefaultButton = SearchButton.ID ``` instead of ``` Me.Page.Form.DefaultButton = SearchButton.UniqueID ```
null
CC BY-SA 2.5
null
2008-08-08T15:53:58.130
2008-08-08T15:53:58.130
null
null
299
null
6,104
2
null
2,988
1
null
Scene graphs for drawing graphics in games and multimedia applications heavily use trees and graphs. Nodes represents objects to be rendered, transformations, controls, groups, ... Scene graphs usually have multiple layers and attributes which mean that you can draw only some node of a graph (attributes) in a specifi...
null
CC BY-SA 2.5
null
2008-08-08T15:58:36.530
2008-08-08T15:58:36.530
null
null
42
null
6,105
2
null
6,085
0
null
If you are building on the you could tell it to be verbose and capture all of the output to a text file to archiving with each build. `eg, msbuild <build_file> > myfile.txt`
null
CC BY-SA 3.0
null
2008-08-08T15:59:58.680
2017-07-04T09:34:19.573
2017-07-04T09:34:19.573
5,423,108
636
null
6,088
2
null
6,080
42
null
Rational 1. Users don't change emails very often 2. Removes the step of asking for username and email address, which you'll need anyway 3. Users don't often forget their email address (see number one) 4. Email will be unique unless the user already registered for the site, in which case forward them to a forgot you...
null
CC BY-SA 2.5
null
2008-08-08T15:46:12.187
2008-08-08T16:33:47.223
2008-08-08T16:33:47.223
302
302
null
6,109
2
null
1,994
0
null
In WPF and Silverlight the binding infrastructure takes care of the switching to the UI thread.
null
CC BY-SA 2.5
null
2008-08-08T16:19:17.923
2008-08-08T16:19:17.923
null
null
580
null
6,100
2
null
5,598
30
null
Document versus RPC is only a question if you are using SOAP Web Services which require a service description ([WSDL](http://en.wikipedia.org/wiki/Web_Services_Description_Language)). RESTful web services do not not use WSDL because the service can't be described by it, and the feeling is that REST is simpler and easie...
null
CC BY-SA 3.0
null
2008-08-08T15:55:58.517
2014-01-14T21:18:44.873
2014-01-14T21:18:44.873
636
636
null
6,085
1
6,514
null
6
414
Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.) I see the command "msinfo32.exe" can be used to dump a whole load of system version informat...
Gathering OS and tool version numbers for build archive purposes
CC BY-SA 2.5
null
2008-08-08T15:44:25.823
2021-10-25T12:12:08.177
2008-09-09T22:13:47.767
-1
755
[ "build-automation", "versions", "archive" ]
6,112
2
null
5,605
3
null
Emacs ships with url.el and url-http.el. Although http-get.el, http-post.el and http-cookies.el are in vogue today. Here's the GitHub link where you can get it from. [http://github.com/wfarr/dotfiles/tree/master/.elisp](http://github.com/wfarr/dotfiles/tree/master/.elisp) Any other suggestions are also welcome.
null
CC BY-SA 2.5
null
2008-08-08T16:24:48.020
2008-08-08T16:24:48.020
2020-06-20T09:12:55.060
-1
617
null
6,095
2
null
5,997
2
null
This is a classic example of encapsulation in object-oriented design. A Form is an object whose responsibility is to present UI to the user and accept input. The interface between the Form object and other areas of the code should be a data-oriented interface, not an interface which exposes the inner implementation de...
null
CC BY-SA 2.5
null
2008-08-08T15:51:49.770
2008-08-08T16:28:49.807
2008-08-08T16:28:49.807
756
756
null
6,110
1
6,120
null
6
852
I've been handed a table with about 18000 rows. Each record describes the location of one customer. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations. For example, here are some records that describe the same...
Normalizing a Table with Low Integrity
CC BY-SA 3.0
null
2008-08-08T16:19:20.607
2014-11-25T13:26:34.720
2014-11-25T13:26:34.720
2,641,576
754
[ "database" ]
6,117
2
null
6,113
10
null
I'm not certain, but I believe you can put it in a config file and encrypt the config file. Update: See Jon Galloway's post [here.](http://weblogs.asp.net/jongalloway/archive/2008/04/13/encrypting-passwords-in-a-net-app-config-file.aspx)
null
CC BY-SA 3.0
null
2008-08-08T16:38:34.513
2015-12-15T14:38:20.887
2015-12-15T14:38:20.887
517
517
null
6,124
2
null
6,110
0
null
I was going to recommend some complicated token matching algorithm but it's really tricky to get right and if you're data does not have a lot of correlation (typos, etc) then it's not going to give very good results. I would recommend you submit a job to the [Amazon Mechanical Turk](http://www.mturk.com/mturk/welcome)...
null
CC BY-SA 2.5
null
2008-08-08T16:44:48.480
2008-08-08T16:44:48.480
null
null
758
null
6,119
2
null
6,110
1
null
I've had to do this before. The only real way to do it is to manually match up the various locations. Use your database's console interface and grouping select statements. First, add your "Company Name" field. Then: ``` SELECT count(*) AS repcount, "Location Name" FROM mytable WHERE "Company Name" IS NULL GROUP BY "...
null
CC BY-SA 2.5
null
2008-08-08T16:40:43.933
2008-08-08T17:33:30.720
2008-08-08T17:33:30.720
619
619
null
6,116
2
null
4,004
3
null
The [class documentation](http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx) has this note: > If you create an HttpListener using https, you must select a Server Certificate for that listener. Otherwise, an HttpWebRequest query of this HttpListener will fail with an unexpected close of th...
null
CC BY-SA 2.5
null
2008-08-08T16:37:29.820
2008-08-08T16:37:29.820
null
null
525
null
6,111
2
null
1,898
9
null
Brian gives a nice solution for converting it to a strongly typed collection. Most of the CSV parsing methods given don't take into account escaping fields or some of the other subtleties of CSV files (like trimming fields). Here is the code I personally use. It's a bit rough around the edges and has pretty much no er...
null
CC BY-SA 2.5
null
2008-08-08T16:20:53.863
2008-08-08T22:21:38.207
2017-05-23T12:25:45.393
-1
214
null
6,113
1
6,117
null
17
15,381
The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to have a DB username and password. The DLL cu...
What is the best way to store connection string in .NET DLLs?
CC BY-SA 3.0
0
2008-08-08T16:32:30.440
2015-12-15T14:38:20.887
2013-01-09T06:07:18.333
1,471,203
702
[ ".net", "sql-server", "connection-string" ]
6,123
2
null
6,113
0
null
If the app is an ASP.NET app then just encrypt the connection strings section of your `web.config`. If the app is a client application running on multiple machines, instead of storing the connection string locally, consider using a web service or some other kind of secure mechanism to store it centrally. This would fac...
null
CC BY-SA 3.0
null
2008-08-08T16:44:30.180
2015-04-21T01:07:58.787
2020-06-20T09:12:55.060
-1
419
null
6,125
2
null
5,966
4
null
Why not use SQLite? There is good support in Python and you can write SQL queries to get the data out. Here is the Python docs for [sqlite3](http://docs.python.org/lib/module-sqlite3.html) --- If you don't want to use SQLite you could do an array of dicts. ``` episodes = [] episodes.append({'season':1, 'episode':...
null
CC BY-SA 2.5
null
2008-08-08T16:45:50.117
2008-08-08T16:53:10.973
2008-08-08T16:53:10.973
309,844
309,844
null
6,126
1
6,140
null
29
5,938
It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there any other methods that you've found that might be of u...
How do you handle huge if-conditions?
CC BY-SA 2.5
0
2008-08-08T16:45:58.540
2017-05-03T17:11:48.390
2010-05-10T15:50:40.153
157,882
1,384,652
[ "language-agnostic", "if-statement" ]
6,120
2
null
6,110
1
null
Please update the question, do you have a list of CompanyNames available to you? I ask because you maybe able to use Levenshtein algo to find a relationship between your list of CompanyNames and LocationNames. --- > There is not a list of Company Names, I will have to generate the company name from the most desc...
null
CC BY-SA 2.5
null
2008-08-08T16:41:29.623
2008-08-08T17:14:55.157
2008-08-08T17:14:55.157
302
302
null
6,134
1
10,525,736
null
68
90,802
I have a problem with some zombie-like processes on a certain server that need to be killed every now and then. How can I best identify the ones that have run for longer than an hour or so?
How do you kill all Linux processes that are older than a certain age?
CC BY-SA 3.0
0
2008-08-08T16:50:46.643
2018-08-26T04:29:40.417
2016-05-09T06:11:31.793
116
726
[ "linux", "bash", "unix", "process" ]
6,132
2
null
6,126
1
null
I resort to separate boolean values: ``` Bool cond1 == (var1 && var2); Bool cond2 == (var3 && var4); if ( cond1 && cond2 ) {} ```
null
CC BY-SA 2.5
null
2008-08-08T16:49:54.427
2008-08-08T16:49:54.427
null
null
32
null
6,131
2
null
6,126
5
null
First, I'd remove all the `== true` parts, that would make it 50% shorter ;) When I have big condition I search for the reasons. Sometimes I see I should use polymorphism, sometimes I need to add some state object. Basically, it implies a refactoring is needed (a code smell). Sometimes I use [De-Morgan's laws](http:...
null
CC BY-SA 3.0
null
2008-08-08T16:49:48.530
2012-06-25T12:09:49.020
2012-06-25T12:09:49.020
573
573
null