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
39,414
2
null
39,371
2
null
I try to validate on both sides. 1 rule I always follow is never trust input from the user. Following this to it's conclusion, I will usually have some front end validation on the form/web page which will not even allow submission with improperly formed data. This is a blunt tool - meaning you can check/parse the value...
null
CC BY-SA 2.5
null
2008-09-02T12:47:59.547
2008-09-02T12:47:59.547
null
null
1,284
null
39,409
2
null
27,562
2
null
Use UTL_FILE in combination with CREATE DIRECTORY for ease of mapping a directory path with a name (it does not create the actual directory just a reference to it so ensure it is created first) example ``` create directory logfile as 'd:\logfile'; -- must have priv to do this declare vFile utl_file.file_type; begi...
null
CC BY-SA 2.5
null
2008-09-02T12:46:36.710
2008-09-02T12:46:36.710
null
null
1,095
null
39,429
2
null
39,419
12
null
No ... on all Windows platforms DWORD is 32 bits. LONGLONG or LONG64 is used for 64 bit types.
null
CC BY-SA 2.5
null
2008-09-02T12:55:45.487
2008-09-02T12:55:45.487
null
null
3,631
null
39,424
2
null
39,395
25
null
How about using: ``` double pi = Math.PI; ``` If you want better precision than that, you will need to use an algorithmic system and the Decimal type.
null
CC BY-SA 3.0
null
2008-09-02T12:52:20.270
2012-07-03T13:13:16.847
2012-07-03T13:13:16.847
142,162
1,898
null
39,423
2
null
39,392
6
null
I've always found two main issues when working with XML transformations: Firstly they tend to be quite slow, the whole XML file must be parsed and validated before you can do anything with it. Being XML it's also excessively verbose, and therefore larger than it needs to be. Secondly the way transformations work is a...
null
CC BY-SA 2.5
null
2008-09-02T12:51:48.320
2008-09-02T12:51:48.320
null
null
905
null
39,431
2
null
39,391
3
null
No it does not. But if the protocol of the URL is HTTP, you'll get a [HttpURLConnection](http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html) as a return object. This class has a `setRequestMethod` method to specify which HTTP method you want to use. If you want to do more sophisticated stuff you're...
null
CC BY-SA 2.5
null
2008-09-02T12:55:59.073
2008-09-02T12:55:59.073
null
null
2,844
null
39,421
2
null
39,392
0
null
If you only going to display data from DB XSL templates may be convenient solution, but if you gonna handle user interaction. Hm... I don't think it'll be maintainable at all.
null
CC BY-SA 2.5
null
2008-09-02T12:51:14.310
2008-09-02T12:51:14.310
null
null
2,313
null
39,434
2
null
39,392
4
null
I've used that technique in the past, and there are applications where we use it at my current place of employment. (I will admit, I am not totally a fan of it, but I'll play devil's advocate) Really that is one of the main advatages, and pushing this idea can be kinda neat. You're able to dynamically create the xsl...
null
CC BY-SA 2.5
null
2008-09-02T12:57:08.213
2008-09-02T12:57:08.213
null
null
1,942
null
39,433
2
null
15,496
156
null
For most people I interview for Java developer positions labeled blocks are very surprising. Here is an example: ``` // code goes here getmeout:{ for (int i = 0; i < N; ++i) { for (int j = i; j < N; ++j) { for (int k = j; k < N; ++k) { //do something here break ...
null
CC BY-SA 2.5
null
2008-09-02T12:57:04.033
2009-05-12T03:17:42.627
2009-05-12T03:17:42.627
27,536
4,052
null
39,428
2
null
39,371
3
null
You want to reduce unnecessary trips to the DB, so performing validation within the application is a good practice. Also, it allows you to handle data errors where it is most easy to recover from: up near the UI (whether in the controller or within the UI layer for simpler apps) where the data is entered. There are ...
null
CC BY-SA 2.5
null
2008-09-02T12:54:23.993
2008-09-02T12:54:23.993
null
null
null
null
39,404
2
null
39,395
45
null
If you want recursion: ``` PI = 2 * (1 + 1/3 * (1 + 2/5 * (1 + 3/7 * (...)))) ``` This would become, after some rewriting: ``` PI = 2 * F(1); ``` with F(i): ``` double F (int i) { return 1 + i / (2.0 * i + 1) * F(i + 1); } ``` Isaac Newton (you may have heard of him before ;) ) came up with this trick. Not...
null
CC BY-SA 3.0
null
2008-09-02T12:44:04.220
2014-03-07T15:31:37.983
2014-03-07T15:31:37.983
2,018
2,018
null
39,430
2
null
39,419
17
null
It is defined as: ``` typedef unsigned long DWORD; ``` However, according to the MSDN: > On 32-bit platforms, long is synonymous with int. Therefore, DWORD is 32bit on a 32bit operating system. There is a separate define for a 64bit DWORD: ``` typdef unsigned _int64 DWORD64; ``` Hope that helps.
null
CC BY-SA 2.5
null
2008-09-02T12:55:47.700
2008-09-02T12:55:47.700
null
null
986
null
39,437
2
null
38,987
739
null
An alternative: ``` z = x.copy() z.update(y) ```
null
CC BY-SA 2.5
null
2008-09-02T13:00:46.707
2008-09-02T13:00:46.707
null
null
188
null
39,418
2
null
11,099
2
null
I personnally side with McConnell's explanation from Code Complete. Use them whenever you can. They enhance your code's readability and remove the few and scarce confusions that might occur. There is one thing that's more important though....Consistency. Which ever style you use,make sure you always do it the same wa...
null
CC BY-SA 2.5
null
2008-09-02T12:50:15.047
2008-09-02T12:50:15.047
null
null
4,225
null
39,446
2
null
39,371
0
null
The sorts of apps that I was writing (I've since moved jobs) were in-house fat-client apps. I would try to keep the business logic in the client, and do more mechanical validation on the db (ie validation that only related to the procedure's ability to run, as opposed to higher level validation). In short, validate whe...
null
CC BY-SA 2.5
null
2008-09-02T13:05:42.747
2008-09-02T13:05:42.747
null
null
3,590
null
39,441
2
null
39,419
69
null
Actually, on 32-bit computers a word is 32-bit, but the DWORD type is a leftover from the good old days of 16-bit. In order to make it easier to port programs to the newer system, Microsoft has decided all the old types will not change size. You can find the official list here: [http://msdn.microsoft.com/en-us/librar...
null
CC BY-SA 2.5
null
2008-09-02T13:02:40.837
2010-01-27T00:40:47.540
2010-01-27T00:40:47.540
32,638
3,509
null
39,460
2
null
39,447
1
null
You can always write a class that implements IList and forwards all calls to the original list (so it doesn't have it's own copy of the data) after translating the indexes.
null
CC BY-SA 2.5
null
2008-09-02T13:09:28.993
2008-09-02T13:09:28.993
null
null
3,509
null
39,442
2
null
39,395
0
null
In any production scenario, I would compel you to look up the value, to the desired number of decimal points, and store it as a 'const' somewhere your classes can get to it. (unless you're writing scientific 'Pi' specific software...)
null
CC BY-SA 2.5
null
2008-09-02T13:03:14.127
2008-09-02T13:03:14.127
null
null
3,619
null
39,461
2
null
39,371
2
null
An object-relational mapping (ORM) tool, like [NHibernate](http://www.hibernate.org/343.html) (or better yet, [ActiveRecord](http://www.castleproject.org/activerecord/index.html)), can help you avoid a lot of validation by allowing the data model to be built right into your code as a proper C# class. You may avoid trip...
null
CC BY-SA 2.5
null
2008-09-02T13:09:47.903
2008-09-02T13:09:47.903
null
null
3,619
null
39,457
1
40,101
null
3
3,944
Does anyone have a regular expression for matching function calls in C programs ?
Regular expression to match (C) function calls
CC BY-SA 2.5
null
2008-09-02T13:09:02.163
2010-11-14T13:11:50.697
2008-09-02T14:07:59.137
1,414
381
[ "regex" ]
39,448
2
null
39,371
7
null
@aku: DRY is nice, but its not always possible. Validation is one of those places, as you will have three completely different and unrelated places where validation is not only possible but absolutely needed: Within the UI, within the business logic, and within the database. Think of a web application. You want to...
null
CC BY-SA 2.5
null
2008-09-02T13:06:00.343
2008-09-02T13:06:00.343
null
null
null
null
39,462
2
null
39,447
1
null
You could use yield return to create a filtered list ``` IEnumerable<object> FilteredList() { foreach( object item in FullList ) { if( IsItemInPartialList( item ) yield return item; } } ```
null
CC BY-SA 2.5
null
2008-09-02T13:10:00.100
2008-09-02T13:10:00.100
null
null
3,320
null
39,438
1
41,100
null
7
4,077
We are bringing a new project in house and whereas previously all our work was on SQL Server the new product uses an oracle back end. Can anyone advise any crib sheets or such like that gives an SQL Server person like me a rundown of what the major differences are - Would like to be able to get up and running as soon ...
Developer moving from SQL Server to Oracle
CC BY-SA 2.5
0
2008-09-02T13:01:06.737
2015-12-04T04:51:27.403
null
null
770
[ "sql-server", "database", "oracle" ]
39,454
1
39,498
null
6
1,943
Under Windows XP WPF true 3D content (which is usually displayed using the Viewport3D control) looks extremely ugly because it is by default not antialiased as the rest of the WPF graphics are. Especially at lower resolution the experience is so bad that it can not be used in production code. I have managed to force a...
Is there a secret trick to force antialiasing inside Viewport3D in Windows XP?
CC BY-SA 3.0
0
2008-09-02T13:08:22.337
2016-06-09T16:06:10.733
2016-06-09T16:06:10.733
5,733,399
4,227
[ "wpf", "windows-xp", "3d", "antialiasing", "viewport3d" ]
39,464
2
null
39,447
0
null
How do the filtered elements need to be accessed? If it's through an Iterator then maybe you could write a custom iterator that skips the elements you don't want publicly visible? If you need to provide a Collection then you might need to write your own Collection class, which just proxies to the underlying Collectio...
null
CC BY-SA 2.5
null
2008-09-02T13:10:27.510
2008-09-02T13:10:27.510
null
null
1,409
null
39,466
2
null
39,457
3
null
Since C isn't a [regular language](http://en.wikipedia.org/wiki/Regular_language) and C function calls can contain arbitrary argument expressions, I fear the answer to your question is “no.”
null
CC BY-SA 2.5
null
2008-09-02T13:10:49.973
2008-09-02T13:10:49.973
null
null
1,968
null
39,463
2
null
39,438
1
null
Watch out for the difference in the way the empty string is treated. `INSERT INTO atable (a_varchar_column) VALUES ('');` is the same as ``` INSERT INTO atable (a_varchar_column) VALUES (NULL); ``` I have no `sqlserver` experience, but I understand that it differentiates between the two
null
CC BY-SA 3.0
null
2008-09-02T13:10:26.857
2015-12-04T04:51:27.403
2015-12-04T04:51:27.403
4,701,699
3,590
null
39,467
2
null
39,447
15
null
Try a method that returns an enumeration using yield: ``` IEnumerable<T> FilterCollection<T>( ReadOnlyCollection<T> input ) { foreach ( T item in input ) if ( /* criterion is met */ ) yield return item; } ```
null
CC BY-SA 2.5
null
2008-09-02T13:11:08.867
2010-09-13T01:34:36.987
2010-09-13T01:34:36.987
33,225
905
null
39,470
2
null
16,491
10
null
You cannot do this through the SSMS GUI, but you can do it using a script. RESTORE DATABASE from DISK='\unc\path\filename' If you need this process automated, the best way is to setup a SQL Server Job and run it as a user with access to the file location.
null
CC BY-SA 2.5
null
2008-09-02T13:12:21.983
2008-09-02T13:12:21.983
null
null
2,012
null
39,468
1
39,478
null
2
9,239
I've got a Windows DLL that I wrote, written in C/C++ (all exported functions are 'C'). The DLL works fine for me in VC++. I've given the DLL to another company who do all their development in VB. They seem to be having a problem linking to the functions. I haven't used VB in ten years and I don't even have it installe...
Calling DLL functions from VB6
CC BY-SA 3.0
null
2008-09-02T13:11:25.887
2013-07-01T14:35:20.750
2013-07-01T14:35:20.750
214,671
3,685
[ "c++", "c", "vb6" ]
39,465
2
null
39,374
2
null
I don't think it's a subjective question, but it's too broad! It's not just about commenting and giving good variables names. It deals with how humans comprehends code. So your system must be implemented in a way that the reader can easily construct a mental model of its design in two way: - Top-down: assuming the use...
null
CC BY-SA 2.5
null
2008-09-02T13:10:31.050
2009-01-06T16:37:04.797
2009-01-06T16:37:04.797
22,704
4,213
null
39,472
2
null
39,365
14
null
The way I and my partner did it was we each made our own private Facebook applications, that pointed to our IP address where we worked on it. Since we worked in the same place, we each picked a different port, and had our router forward that port to our local IP address. It was kinda slow to refresh a page, but it work...
null
CC BY-SA 2.5
null
2008-09-02T13:12:55.867
2008-09-02T13:12:55.867
null
null
823
null
39,449
2
null
39,391
17
null
If you retrieve the `URLConnection` object using `openConnection()` it doesn't actually start communicating with the server. That doesn't happen until you get the stream from the `URLConnection()`. When you first get the connection you can add/change headers and other connection properties before actually opening it....
null
CC BY-SA 3.0
null
2008-09-02T13:06:11.263
2016-11-28T04:43:12.093
2016-11-28T04:43:12.093
1,672,920
1,409
null
39,447
1
39,467
null
11
2,140
I have a class property exposing an internal IList<> through ``` System.Collections.ObjectModel.ReadOnlyCollection<> ``` How can I pass a part of this `ReadOnlyCollection<>` without copying elements into a new array (I need a live view, and the target device is short on memory)? I'm targetting Compact Framework 2.0....
How can I expose only a fragment of IList<>?
CC BY-SA 2.5
0
2008-09-02T13:05:48.630
2010-09-13T01:34:36.987
2008-09-24T15:26:01.903
12,870
3,205
[ "c#", "windows-mobile", "compact-framework", ".net-2.0" ]
39,469
2
null
39,447
1
null
Depending on how you need to filter the collection, you may want to create a class that implements IList (or IEnumerable, if that works for you) but that mucks about with the indexing and access to only return the values you want. For example ``` class EvenList: IList { private IList innerList; public EvenList...
null
CC BY-SA 2.5
null
2008-09-02T13:11:46.320
2008-09-02T13:11:46.320
null
null
1,199
null
39,473
1
99,990
null
11
17,238
I'm currently implementing a raytracer. Since raytracing is extremely computation heavy and since I am going to be looking into CUDA programming anyway, I was wondering if anyone has any experience with combining the two. I can't really tell if the computational models match and I would like to know what to expect. I g...
raytracing with CUDA
CC BY-SA 2.5
0
2008-09-02T13:12:56.273
2015-07-28T01:12:30.157
null
null
4,055
[ "cuda", "raytracing" ]
39,475
1
39,927
null
9
8,299
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc even in --aggressive mode. What can I do next to fix this repository error? ``` $ git-fsck bad sha1 file: .git/objects/55/tmp_obj_a07724 ```
Git "bad sha1 file" error
CC BY-SA 3.0
0
2008-09-02T13:14:49.030
2018-03-21T11:10:38.050
2015-02-14T21:05:09.960
2,174,085
2,313
[ "git", "version-control" ]
39,479
2
null
39,468
3
null
Try adding __stdcall at the end ``` #define MYDCC_API __declspec(dllexport) __stdcall ``` We have some C++ dlls that interact with our old VB6 apps and they all have that at the end.
null
CC BY-SA 2.5
null
2008-09-02T13:16:30.257
2008-09-02T13:16:30.257
null
null
2,098
null
39,477
2
null
18,197
1
null
There are many ways to test the usability of a system. Please check any available literature you can find. I just want to insist that usability test is not so hard as you or anyone might think. In a famous paper called "A mathematical model of the finding of usability problems" in INTERACT'93 and CHI'93, J. Nielsen and...
null
CC BY-SA 2.5
null
2008-09-02T13:15:35.157
2008-09-02T13:15:35.157
null
null
3,388
null
39,482
2
null
39,476
426
null
Iteration. It creates a state machine "under the covers" that remembers where you were on each additional cycle of the function and picks up from there.
null
CC BY-SA 3.0
null
2008-09-02T13:17:23.250
2014-02-14T17:55:38.410
2014-02-14T17:55:38.410
3,043
3,043
null
39,474
1
39,590
null
40
45,904
Does anyone know how to get IntelliSense to work reliably when working in C/C++ projects? It seems to work for about 1 in 10 files. Visual Studio 2005 seems to be a lot better than 2008. Edit: Whilst not necessarily a solution, the work-around provided here: [How to get IntelliSense to reliably work in Visual Studio...
How to get IntelliSense to reliably work in Visual Studio 2008
CC BY-SA 3.0
0
2008-09-02T13:13:36.567
2017-04-30T02:46:48.040
2017-05-23T10:31:22.283
-1
986
[ "c++", "c", "visual-studio-2008", "intellisense" ]
39,476
1
39,496
null
1,015
465,839
In the [How Can I Expose Only a Fragment of IList<>](https://stackoverflow.com/questions/39447/how-can-i-expose-only-a-fragment-of-ilist) question one of the answers had the following code snippet: ``` IEnumerable<object> FilteredList() { foreach(object item in FullList) { if(IsItemInPartialList(item))...
What is the yield keyword used for in C#?
CC BY-SA 4.0
0
2008-09-02T13:15:24.877
2021-11-06T18:23:24.600
2019-07-15T07:33:09.810
2,631,925
1,409
[ "c#", "yield" ]
39,486
2
null
39,476
7
null
It's producing enumerable sequence. What it does is actually creating local IEnumerable sequence and returning it as a method result
null
CC BY-SA 2.5
null
2008-09-02T13:18:25.493
2008-09-02T13:18:25.493
null
null
1,196
null
39,481
2
null
39,447
8
null
These foreach samples are fine, though you can make them much more terse if you're using .NET 3.5 and LINQ: ``` return FullList.Where(i => IsItemInPartialList(i)).ToList(); ```
null
CC BY-SA 2.5
null
2008-09-02T13:17:10.303
2008-09-02T13:17:10.303
null
null
1,554
null
39,480
2
null
39,374
0
null
From being a developer with several years under the belt, this used to be a real question for me. I couldn't even say how many hours I passed thinking about this and trying different things in my code. The above answers are very nice too. I just want to add a thing or two. - We each have different things that make our...
null
CC BY-SA 3.0
null
2008-09-02T13:17:09.053
2014-02-03T12:58:03.250
2014-02-03T12:58:03.250
759,866
4,225
null
39,478
2
null
39,468
4
null
By using `__declspec` for export, the function name will get exported , i.e. contain type information to help the C++ compiler resolve overloads. VB6 cannot handle mangled names. As a workaround, you have to de-mangle the names. The easiest solution is to link the DLL file using an [export definition](http://msdn.micr...
null
CC BY-SA 2.5
null
2008-09-02T13:16:15.530
2008-09-02T13:16:15.530
null
null
1,968
null
39,485
1
41,887
null
7
18,691
Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? I need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing usable. Even a trip to the University li...
Software Phase Locked Loop example code needed
CC BY-SA 2.5
0
2008-09-02T13:18:19.410
2012-02-02T19:25:58.727
null
null
3,875
[ "signal-processing" ]
39,489
2
null
38,766
1
null
I prefer to use Server Aliases in the SQL Client Configuration. That way, when you decide to point the package to another SQL Server it is as simple as editing the alias to point to the new server, no editing necessary in the SSIS package. When moving the package to a live server, you need to add the aliases, and it ...
null
CC BY-SA 2.5
null
2008-09-02T13:19:11.420
2008-09-02T13:19:11.420
null
null
2,012
null
39,483
2
null
39,476
12
null
It is a very simple and easy way to create an enumerable for your object. The compiler creates a class that wraps your method and that implements, in this case, IEnumerable<object>. Without the yield keyword, you'd have to create an object that implements IEnumerable<object>.
null
CC BY-SA 2.5
null
2008-09-02T13:17:36.340
2008-09-02T13:17:36.340
null
null
null
null
39,487
2
null
39,371
5
null
There is one killer-reason to validate on both the client-side and on the database-side, and that is . Especially when you start using AJAX-stuff, hackable URLs and other things that make your site (in this case) more friendly to users hackers. Validate on the client to provide a smooth experience to early tell the u...
null
CC BY-SA 2.5
null
2008-09-02T13:18:55.120
2008-09-02T13:18:55.120
null
null
2,429
null
39,497
2
null
39,395
-6
null
``` public double PI = 22.0 / 7.0; ```
null
CC BY-SA 3.0
null
2008-09-02T13:24:04.450
2012-07-03T13:13:38.907
2012-07-03T13:13:38.907
142,162
2,131
null
39,500
2
null
39,365
6
null
You'll have to add both trunk and test versions as different applications and test them using [test accounts](http://developers.facebook.com/news.php?blog=1&story=35). You may also use a single application and switch its target URL between cycles.
null
CC BY-SA 2.5
null
2008-09-02T13:25:15.760
2008-09-02T13:25:15.760
null
null
3,583
null
39,498
2
null
39,454
2
null
Have you tried this (from your thread on MSDN forums)? > Well, it seems the reference in the MSDN link above incorrectly specify the affected registry root key. In MSDN it is specified as HKEY_CURRENT_USER, while the correct root key should be HKEY_LOCAL_MACHINE. I've tried setting up the HKEY_LOCAL_MACHINE\Software\M...
null
CC BY-SA 2.5
null
2008-09-02T13:24:31.890
2008-09-02T13:24:31.890
null
null
null
null
39,488
2
null
39,476
34
null
Intuitively, the keyword returns a value from the function without leaving it, i.e. in your code example it returns the current `item` value and then resumes the loop. More formally, it is used by the compiler to generate code for an . Iterators are functions that return `IEnumerable` objects. The [MSDN](http://msdn.mi...
null
CC BY-SA 2.5
null
2008-09-02T13:19:09.533
2008-09-02T13:19:09.533
null
null
1,968
null
39,502
2
null
39,233
2
null
Your best bet will probably be to use the Windows32 API for this. See [this MSDN article](http://msdn.microsoft.com/en-us/library/aa155724(office.10).aspx) for sample VBA code on how to interact with the API. The article outlines a few different techniques, but I'd suggest searching the article for "COMDLG32.dll" and ...
null
CC BY-SA 3.0
null
2008-09-02T13:26:36.690
2012-07-20T13:30:22.197
2012-07-20T13:30:22.197
698,590
2,833
null
39,501
2
null
39,374
1
null
Since everyone else said pretty much what I'm thinking when I read this question, I'll just share two books related to this subject that you might be interested in reading. These books use open source code examples to explain how to read and write high quality code. In addition to Code Complete, I think they are valuab...
null
CC BY-SA 2.5
null
2008-09-02T13:26:18.750
2008-09-02T13:26:18.750
null
null
572
null
39,496
2
null
39,476
914
null
The `yield` contextual keyword actually does quite a lot here. The function returns an object that implements the `IEnumerable<object>` interface. If a calling function starts `foreach`ing over this object, the function is called again until it "yields". This is syntactic sugar introduced in . In earlier versions you h...
null
CC BY-SA 4.0
null
2008-09-02T13:23:16.200
2021-03-25T11:45:03.707
2021-03-25T11:45:03.707
2,063,755
3,320
null
39,514
2
null
14,872
4
null
Generally the user that you are using to run the SQL Server service will not have access to your personal user folders, that is why you're getting the error. You either need to change the credentials used for the service, or move the database to another folder, which did the trick in your case.
null
CC BY-SA 2.5
null
2008-09-02T13:29:56.573
2008-09-02T13:29:56.573
null
null
2,012
null
39,507
2
null
39,476
151
null
Recently Raymond Chen also ran an interesting series of articles on the yield keyword. - [The implementation of iterators in C# and its consequences (part 1)](https://devblogs.microsoft.com/oldnewthing/20080812-00/?p=21273)- [The implementation of iterators in C# and its consequences (part 2)](https://devblogs.microso...
null
CC BY-SA 4.0
null
2008-09-02T13:27:46.767
2019-03-29T11:37:30.447
2019-03-29T11:37:30.447
6,499,326
2,491
null
39,510
2
null
38,901
1
null
I'm using a slightly modified version of that plugin so I'm not 100% sure that this will be the same for you, but for me the default is to redirect to the root path, or the page you were trying to get to if there is one. (check your lib/authenticated_system.rb to see your default) If you don't have map.root defined i...
null
CC BY-SA 2.5
null
2008-09-02T13:28:17.263
2008-09-02T13:28:17.263
null
null
3,230
null
39,515
2
null
38,589
1
null
The problem is your connection string. When using SQLExpress you can set it to run user instances so that each application has its own instance of SQL Server. Just set the option to false on your connections string and the problem should dissappear.
null
CC BY-SA 2.5
null
2008-09-02T13:31:39.237
2008-09-02T13:31:39.237
null
null
2,012
null
39,491
2
null
39,395
4
null
Good overview of different algorithms: - [Computing pi](http://en.wikipedia.org/wiki/Computing_%CF%80)- [Gauss-Legendre-Salamin](http://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm) I'm not sure about the complexity claimed for the Gauss-Legendre-Salamin algorithm in the first link (I'd say O(N log^2(N) log...
null
CC BY-SA 2.5
null
2008-09-02T13:20:01.700
2008-09-02T19:57:55.457
2008-09-02T19:57:55.457
2,638
2,638
null
39,512
2
null
19
126
null
I really like this program, because it approximates π by looking at its own area. IOCCC 1988 : [westley.c](http://www0.us.ioccc.org/1988/westley.c) > ``` #define _ -F<00||--F-OO--; int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() { _-_-_-_ _-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-...
null
CC BY-SA 4.0
null
2008-09-02T13:28:51.537
2018-09-03T05:27:55.980
2018-09-03T05:27:55.980
10,221,765
238
null
39,513
2
null
39,053
1
null
Not sure if this is the same issue? [JBoss DataSource config](http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Connectors_on_JBoss-Configuring_JDBC_DataSources.html) > DataSource wrappers are not usable outside of the server VM
null
CC BY-SA 2.5
null
2008-09-02T13:29:15.937
2008-09-02T13:29:15.937
null
null
3,295
null
39,516
2
null
36,742
0
null
@Motti: Combining the `grep`s isn't working, it's having no effect. I understand that without the trailing `$` something else may folow the checksum & still match, but it didn't work at all with it so I had no choice... GNU grep 2.5.3 and GNU bash 3.2.39(1) if that makes any difference. And it looks like the log fil...
null
CC BY-SA 2.5
null
2008-09-02T13:32:52.013
2008-09-02T13:32:52.013
null
null
3,715
null
39,519
2
null
39,454
0
null
Does your video card support Shader 2.0? You can refer [to this wiki page](http://en.wikipedia.org/wiki/Pixel_shader) to see if it does...
null
CC BY-SA 2.5
null
2008-09-02T13:33:22.150
2008-09-02T13:33:22.150
null
null
null
null
39,522
2
null
38,589
0
null
@baldy Thanks. I'll look at as well. Oddly enough though I didn't change the connection string at all. And when I created a new project and tried to drag-n-drop a DB into the LINQ to SQL diagram that error was raised then as well.
null
CC BY-SA 2.5
null
2008-09-02T13:34:50.417
2008-09-02T13:34:50.417
null
null
3,747
null
39,517
1
39,634
null
6
1,470
I've been using PostgreSQL a little bit lately, and one of the things that I think is cool is that you can use languages other than SQL for scripting functions and whatnot. But when is this actually useful? For example, the documentation says that the main use for PL/Perl is that it's pretty good at text manipulation...
Languages other than SQL in postgres
CC BY-SA 2.5
0
2008-09-02T13:32:54.447
2012-07-24T15:20:47.963
2008-09-02T16:02:36.597
619
2,147
[ "sql", "database", "postgresql", "trusted-vs-untrusted" ]
39,503
1
null
null
7
16,184
I need to modify the MBR of Windows, and I would really like to do this from Windows. Here are my questions. I know that I can get a handle on a physical device with a call to CreateFile. Will the MBR always be on \\.\PHYSICALDRIVE0? Also, I'm still learning the Windows API to read directly from the disk. Is readabsol...
Modifying the MBR of Windows
CC BY-SA 2.5
0
2008-09-02T13:26:43.197
2014-12-20T18:16:26.647
2009-02-27T16:49:42.897
5,640
2,171
[ "windows", "mbr" ]
39,518
2
null
39,474
32
null
Native C++ intellisense does not work reliably in any version of Visual Studio. I find there are two common problems: 1) Header file paths are not set-up correctly. When you find a type where intellisense is not working, use the IDE to click through each header file to find the one containing the type. (Right click o...
null
CC BY-SA 2.5
null
2008-09-02T13:33:01.607
2008-09-02T14:30:39.580
2017-05-23T12:34:21.850
-1
887
null
39,521
2
null
38,661
1
null
You can also create an ISAPI filter that re-writes urls. The user enters a url with no extension, but the filter will interpret the request so that it does. Note that in IIS it's real easy to screw this up, so you might want to find a pre-written one. I haven't used any myself so I can't recommend a specific product...
null
CC BY-SA 2.5
null
2008-09-02T13:34:49.417
2008-09-02T13:34:49.417
null
null
3,043
null
39,529
2
null
13,540
1
null
Your logic seems sound, but you might want to consider adding some code to prevent the insert if you had passed in a specific primary key. Otherwise, if you're always doing an insert if the update didn't affect any records, what happens when someone deletes the record before you "UPSERT" runs? Now the record you were...
null
CC BY-SA 3.0
null
2008-09-02T13:37:56.477
2012-05-16T20:31:28.577
2012-05-16T20:31:28.577
12,971
3,743
null
39,533
1
39,619
null
37
45,080
Is there a way to identify, from within a VM, that your code is running inside a VM? I guess there are more or less easy ways to identify specific VM systems, especially if the VM has the provider's extensions installed (such as for VirtualBox or VMWare). But is there a general way to identify that you are not running...
How to identify that you're running under a VM?
CC BY-SA 2.5
0
2008-09-02T13:39:47.610
2018-06-27T05:39:46.787
null
null
107
[ "virtualization" ]
39,526
2
null
39,474
2
null
> I don't use VS2008 for C++, only VB & C#, but I find that when intellisense stops working (true for VS2003/2005/2008) it's because something in the project/file is broken - usually a bad reference or code. VB and C# have much better intellisense support due to the ability to reflect on the referenced assemblies to b...
null
CC BY-SA 2.5
null
2008-09-02T13:36:33.547
2008-09-02T13:36:33.547
null
null
1,965
null
39,525
1
null
null
4
2,010
I've encountered the following problem pattern frequently over the years: - I'm writing complex code for a package comprised of a standalone application and also a library version of the core that people can use from inside other apps.- Both our own app and presumably ones that users create with the core library are l...
Error handling / error logging in C++ for library/app combo
CC BY-SA 2.5
null
2008-09-02T13:36:26.543
2008-09-04T18:55:32.623
null
null
3,832
[ "c++", "api", "error-handling", "error-logging", "api-design" ]
39,535
2
null
38,661
1
null
You can set the IIS6 to handle all requests, but the key to handle files without extensions is to tell the IIS not to look for the file. [http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx](http://weblogs.asp.net/scottgu/archive/2007/03/0...
null
CC BY-SA 2.5
null
2008-09-02T13:42:09.337
2008-09-02T13:42:09.337
null
null
2,429
null
39,534
2
null
39,474
1
null
@[John Richardson](https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39518) / @[Jonathan Holland](https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39526) My includes are setup correctly, no problems there. I'...
null
CC BY-SA 2.5
null
2008-09-02T13:41:26.873
2008-09-02T13:41:26.873
2017-05-23T12:17:57.273
-1
986
null
39,544
2
null
39,541
0
null
Make an array of controls. ``` TextBox[] textboxes = new TextBox[] { textBox1, textBox2, textBox3 }; ```
null
CC BY-SA 2.5
null
2008-09-02T13:45:55.617
2008-09-02T13:45:55.617
null
null
267
null
39,542
2
null
39,533
5
null
In most cases, you shouldn't try to. You shouldn't care if someone is running your code in a VM, except in a few specific cases. If you need to, in Linux the most common way is to look at `/sys/devices/virtual/dmi/id/product_name`, which will list the name of the laptop/mainboard on most real systems, and the hypervis...
null
CC BY-SA 3.0
null
2008-09-02T13:45:10.203
2014-02-18T15:47:25.817
2014-02-18T15:47:25.817
2,018
2,018
null
39,543
2
null
39,392
7
null
I can see the main benefit of employing XSLT to transform your data and display it to the user would be the following: - - - If this is to be the only output for your data, and it is not in XML format, then XSLT might not be the best solution. Likewise if user interaction is required (such as editing of the data) t...
null
CC BY-SA 2.5
null
2008-09-02T13:45:10.470
2008-09-02T13:45:10.470
null
null
1,908
null
39,548
2
null
39,541
4
null
Another nice thing that VB .NET does is having a single event handler that handles multiple controls: ``` Private Sub TextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles TextBox1.TextChanged, _ TextBox2.TextChanged, _ TextBox3.TextChanged End Sub ```
null
CC BY-SA 2.5
null
2008-09-02T13:49:00.710
2008-09-02T13:49:00.710
null
null
305
null
39,551
2
null
39,533
0
null
If it VM does the job well, it should be invisible to the client that it's being virtualized. However, one can look at other clues. I would imagine that looking for known drivers or software specific to the VM environment would be the best possible way. For example, on a VMWare client running Windows, vmxnet.sys woul...
null
CC BY-SA 2.5
null
2008-09-02T13:50:17.087
2008-09-02T13:50:17.087
null
null
4,185
null
39,556
2
null
39,541
5
null
Make a generic list of textboxes: ``` var textBoxes = new List<TextBox>(); // Create 10 textboxes in the collection for (int i = 0; i < 10; i++) { var textBox = new TextBox(); textBox.Text = "Textbox " + i; textBoxes.Add(textBox); } // Loop through and set new values on textboxes in collection for (int i...
null
CC BY-SA 3.0
null
2008-09-02T13:51:33.183
2016-09-15T10:37:21.080
2016-09-15T10:37:21.080
2,429
2,429
null
39,536
1
39,672
null
8
2,648
I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doing ...
How to download a live MySQL db into a local test db on demand, without SSH?
CC BY-SA 3.0
0
2008-09-02T13:42:16.530
2016-01-16T14:04:02.260
2015-06-06T12:12:46.153
1,944
1,944
[ "php", "mysql", "ruby", "database", "mysql-management" ]
39,541
1
39,556
null
10
11,980
Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()): ``` Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Ti...
What's the simplest .NET equivalent of a VB6 control array?
CC BY-SA 2.5
0
2008-09-02T13:44:13.997
2021-02-13T20:55:52.467
2009-03-26T12:35:44.883
15,639
4,228
[ ".net", "vb6", "vb6-migration", "control-array" ]
39,552
2
null
39,541
1
null
VisualBasic .NET's compatibility library contains strong typed control arrays. This is what the upgrade wizard uses to replace the current VB6 control arrays. However, A control array in VB6 is just a collection of objects with VB6 doing some syntax magic on the surface. In the .NET world, by removing this, they are f...
null
CC BY-SA 2.5
null
2008-09-02T13:50:48.490
2008-09-02T13:58:33.650
2008-09-02T13:58:33.650
1,965
1,965
null
39,559
2
null
18,172
2
null
I agree with Robocopy as a solution...thats why the utility is called > I've used Robocopy for this with excellent results. By default, it will retry every 30 seconds until the file gets across. And by default, a million retries. That should be plenty for your intermittent connection. It also does restartable tran...
null
CC BY-SA 2.5
null
2008-09-02T13:51:57.083
2008-09-02T13:51:57.083
null
null
2,418
null
39,555
2
null
39,536
0
null
I would create a (Ruby) script to do a `SELECT * FROM ...` on all the databases on the server and then do a `DROP DATABASE ...` followed by a series of new `INSERT`s on the local copy. You can do a `SHOW DATABASES` query to list the databases dynamically. Now, this assumes that the table structure doesn't change, but i...
null
CC BY-SA 2.5
null
2008-09-02T13:51:29.673
2008-09-02T13:51:29.673
null
null
1,709
null
39,560
2
null
39,533
0
null
One good example is that apparently doing a WMI query for the motherboard manufacturer, and if it returns "Microsoft" you're in a VM. Thought I believe this is only for VMWare. There are likely different ways to tell for each VM host software. This article here [http://blogs.technet.com/jhoward/archive/2005/07/26/40...
null
CC BY-SA 2.5
null
2008-09-02T13:52:26.147
2008-09-02T13:52:26.147
null
null
194
null
39,553
2
null
39,541
2
null
There are two aspects. .NET readily supports arrays of controls, VB6 just had to use a workaround because otherwise, wiring up events was really hard. In .NET, wiring up events dynamically is easy. However, the .NET form designer does not support control arrays for a simple reason: arrays of controls are created/exte...
null
CC BY-SA 2.5
null
2008-09-02T13:50:54.917
2008-09-02T13:50:54.917
null
null
1,968
null
39,545
2
null
39,536
1
null
Is MySQL replication an option? You could even turn it on and off if you didn't want it constantly replicating. This was a [good article](http://www.howtoforge.com/mysql_database_replication) on replication.
null
CC BY-SA 2.5
null
2008-09-02T13:46:02.557
2008-09-02T13:46:02.557
null
null
305
null
39,563
2
null
39,533
7
null
A more empirical approach is to check for known VM device drivers. You could write WMI queries to locate, say, the VMware display adapter, disk drive, network adapter, etc. This would be suitable if you knew you only had to worry about known VM host types in your environment. Here's [an example of doing this in Perl...
null
CC BY-SA 2.5
null
2008-09-02T13:53:12.900
2008-09-02T13:53:12.900
null
null
3,347
null
39,565
2
null
39,533
0
null
You might be able to identify whether you're in a virtual machine by looking at the MAC address of your network connection. Xen for example typically recommends using a specific range of addresses 00:16:3e:xx:xx:xx. This isn't guaranteed as it's up to the administrator of the system to specify what MAC address they li...
null
CC BY-SA 2.5
null
2008-09-02T13:53:27.517
2008-09-02T13:53:27.517
null
null
4,071
null
39,561
1
39,574
null
142
69,472
Trying to get my css / C# functions to look like this: ``` body { color:#222; } ``` instead of this: ``` body { color:#222; } ``` when I auto-format the code.
Visual Studio 2005/2012: How to keep first curly brace on same line?
CC BY-SA 3.0
0
2008-09-02T13:52:48.050
2021-05-18T10:36:32.670
2013-10-03T21:02:10.553
1,599,191
26
[ "visual-studio" ]
39,564
1
null
null
4
2,892
In my host, I currently have installed 2 wordpress applications, 1 phpBB forum and one MediaWiki. Is there a way to merge the login so that all applications share the same credentials? For instance, I want to register only in my phpBB and then I want to access all other applications with the given username and passwo...
Login Integration in PHP
CC BY-SA 2.5
0
2008-09-02T13:53:15.550
2015-04-06T11:36:35.657
2015-04-06T11:36:35.657
1,333,493
2,644
[ "php", "authentication", "integration", "mediawiki-extensions" ]
39,566
2
null
39,395
0
null
Regarding... > ... how to go about it from a learning point of view. Are you trying to learning to program scientific methods? or to produce production software? I hope the community sees this as a valid question and not a nitpick. In either case, I think writing your own Pi is a solved problem. Dmitry showed the 'M...
null
CC BY-SA 2.5
null
2008-09-02T13:53:47.577
2008-09-02T13:53:47.577
null
null
3,619
null
39,573
2
null
39,561
30
null
Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines -> New Line Options for braces -> Uncheck all boxes.
null
CC BY-SA 2.5
null
2008-09-02T13:55:19.960
2008-09-02T13:55:19.960
null
null
1,965
null
39,562
1
39,587
null
6
12,592
A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages. I was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages, something like: ``` welcome.english = "...
How do you build a multi-language web site?
CC BY-SA 2.5
0
2008-09-02T13:52:56.083
2016-09-29T09:17:18.243
2016-09-29T09:17:18.243
6,700,857
1,679
[ "database", "jakarta-ee", "web-applications", "multilingual" ]
39,569
2
null
39,533
3
null
I once ran across an assembly code snippet that told you if you were in a VM....I googled but couldn't find the original article. I did find this though: [Detect if your program is running inside a Virtual Machine](http://www.codeproject.com/KB/system/VmDetect.aspx). Hope it helps.
null
CC BY-SA 2.5
null
2008-09-02T13:54:44.050
2008-09-02T13:54:44.050
null
null
4,050
null
39,567
1
9,571,767
null
135
154,411
In Ruby, given an array in one of the following forms... ``` [apple, 1, banana, 2] [[apple, 1], [banana, 2]] ``` ...what is the best way to convert this into a hash in the form of... ``` {apple => 1, banana => 2} ```
What is the best way to convert an array to a hash in Ruby
CC BY-SA 2.5
0
2008-09-02T13:53:55.143
2021-08-11T15:41:13.090
2014-09-30T14:42:41.557
503,402
4,142
[ "ruby", "arrays", "hashmap" ]