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
759
2
null
609
9
null
No, there are many applications built with VS2005 that have to support Windows XP, 2000, NT, the whole stack. The issue is that (by default) VS2005 wants to use libraries/exports not present on NT. See [this thread](http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html) for some backgrou...
null
CC BY-SA 2.5
null
2008-08-03T16:54:12.277
2008-08-03T16:54:12.277
null
null
null
null
735
2
null
683
0
null
I think: ``` #!/bin/python bar in dict(Foo) ``` Is what you are thinking of. When trying to see if a certain key exists within a dictionary in python (python's version of a hash table) there are two ways to check. First is the `has_key()` method attached to the dictionary and second is the example given above. It...
null
CC BY-SA 2.5
null
2008-08-03T15:47:22.100
2008-08-03T15:47:22.100
null
null
145
null
754
2
null
746
5
null
If the language you are using has a supported method/function then just use that (as in the C# `ToTitleCase` method) If it does not, then you will want to do something like the following: 1. Read in the string 2. Take the first word 3. Capitalize the first letter of that word 1 4. Go forward and find the next word...
null
CC BY-SA 2.5
null
2008-08-03T16:33:51.193
2011-02-09T23:29:05.593
2011-02-09T23:29:05.593
309,308
142
null
762
2
null
761
2
null
Here is my current method. Any suggestions? ``` Regex singleMToDoubleRegex = new Regex("(?<!m)m(?!m)"); Regex singleDToDoubleRegex = new Regex("(?<!d)d(?!d)"); CultureInfo currentCulture = CultureInfo.CurrentUICulture; // If the culture is netural there is no date pattern to use, so use the default. if (currentCultur...
null
CC BY-SA 2.5
null
2008-08-03T17:31:31.313
2008-08-03T17:31:31.313
null
null
214
null
763
2
null
761
1
null
How about giving the format (mm/dd/yyyy or dd/mm/yyyy) followed by a printout of today's date in the user's culture. MSDN has an article on [formatting a DateTime for the person's culture](http://msdn.microsoft.com/en-us/library/5hh873ya(VS.71).aspx), using the CultureInfo object that might be helpful in doing this. A ...
null
CC BY-SA 2.5
null
2008-08-03T17:37:43.063
2008-08-03T17:37:43.063
null
null
51
null
764
2
null
742
1
null
Sounds to me like you're trying to combine things that shouldn't be combined. If you need to do different processing in your view depending on if it's a User or Group object you're trying to look at then you should use two different view functions. On the other hand there can be common idioms you'd want to extract ou...
null
CC BY-SA 2.5
null
2008-08-03T17:40:25.553
2008-08-03T17:40:25.553
null
null
null
null
755
2
null
752
1,029
null
The `Activator` class within the root `System` namespace is pretty powerful. There are a lot of overloads for passing parameters to the constructor and such. Check out the documentation at: > [http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx](http://msdn.microsoft.com/en-us/library/system...
null
CC BY-SA 3.0
null
2008-08-03T16:35:34.233
2017-11-08T15:40:10.767
2017-11-08T15:40:10.767
232,746
34
null
761
1
762
null
22
1,302
What is the best way to localise a date format descriptor? As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation support, so it's trivial to parse dates according to the users culture, but y...
Localising date format descriptors
CC BY-SA 3.0
null
2008-08-03T17:30:20.473
2016-03-27T03:05:27.637
2015-07-23T10:02:37.117
1,675,954
214
[ ".net", "internationalization", "date", "globalization" ]
766
1
1,619
null
45
4,364
I can get Python to work with Postgresql but I cannot get it to work with MySQL. The main problem is that on the shared hosting account I have I do not have the ability to install things such as Django or PySQL, I generally fail when installing them on my computer so maybe it's good I can't install on the host. I foun...
Python and MySQL
CC BY-SA 2.5
0
2008-08-03T17:44:07.450
2019-10-12T05:19:46.087
2012-05-31T16:57:58.230
487,855
1,384,652
[ "python", "mysql", "postgresql", "bpgsql" ]
770
2
null
761
7
null
[Just use ISO-8601](http://en.wikipedia.org/wiki/ISO_8601). It's an international standard. ``` Date and time (current at page generation) expressed according to ISO 8601: Date: 2014-07-05 Combined date and time in UTC: 2014-07-05T04:00:25+00:00 2014-07-05T04:...
null
CC BY-SA 3.0
null
2008-08-03T18:18:54.400
2014-07-10T22:04:25.780
2014-07-10T22:04:25.780
1,668,244
175
null
768
2
null
174
36
null
You can print from the command line using the following: > rundll32.exe %WINDIR%\System32\mshtml.dll,PrintHTML "%1" Where %1 is the file path of the HTML file to be printed. If you don't need to print from memory (or can afford to write to the disk in a temp file) you can use: ``` using (Process printProcess = ...
null
CC BY-SA 4.0
null
2008-08-03T18:06:30.913
2020-03-23T09:05:56.123
2020-03-23T09:05:56.123
1,442,180
214
null
769
1
781
null
48
43,686
I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++. Here's an example of the equations: ``` -44.3940 = a * 50.0 + b * 37.0 + tx -45.3049 = a * 43.0 + b * 39.0 + tx -44.9594 = a * 52.0 + b * 41.0 + tx ``` From this, I'd like to get the best approximation for `a`, `b`,...
Solving a linear equation
CC BY-SA 3.0
0
2008-08-03T18:14:24.267
2021-09-01T16:22:01.613
2015-12-17T13:25:49.293
5,550,041
79
[ "math", "linear-algebra", "system", "linear-equation" ]
777
2
null
766
7
null
I don't have any experience with [http://www.SiteGround.com](http://www.SiteGround.com) as a web host personally. This is just a guess, but it's common for a shared host to support Python and MySQL with the MySQLdb module (e.g., GoDaddy does this). Try the following CGI script to see if MySQLdb is installed. ``` #...
null
CC BY-SA 2.5
null
2008-08-03T18:32:27.693
2008-08-03T22:56:27.863
2008-08-03T22:56:27.863
150
150
null
774
2
null
769
3
null
Are you looking for a software package that'll do the work or actually doing the matrix operations and such and do each step? The the first, a coworker of mine just used [Ocaml GLPK](http://ocaml-glpk.sourceforge.net/). It is just a wrapper for the [GLPK](http://www.gnu.org/software/glpk/), but it removes a lot of the...
null
CC BY-SA 2.5
null
2008-08-03T18:27:13.180
2008-08-03T18:27:13.180
null
null
157
null
771
2
null
746
10
null
Here's a Perl solution [http://daringfireball.net/2008/05/title_case](http://daringfireball.net/2008/05/title_case) Here's a Ruby solution [http://frankschmitt.org/projects/title-case](http://frankschmitt.org/projects/title-case) Here's a Ruby one-liner solution: [http://snippets.dzone.com/posts/show/4702](http://sni...
null
CC BY-SA 2.5
null
2008-08-03T18:22:47.213
2008-10-12T12:20:29.097
2008-10-12T12:20:29.097
2,766,176
175
null
787
2
null
650
5
null
What source control system are you using? Almost all of them have some form of $ Id $ tag that gets expanded when the file is checked in. I usually use some form of hackery to display this as the version number. The other alternative is use to use the date as the build number: 080803-1448
null
CC BY-SA 2.5
null
2008-08-03T18:46:33.517
2008-08-03T18:46:33.517
null
null
175
null
773
1
7,286
null
664
421,308
I haven't been able to find an understandable explanation of how to actually use Python's `itertools.groupby()` function. What I'm trying to do is this: - `lxml`- - I've reviewed [the documentation](https://docs.python.org/3/library/itertools.html#itertools.groupby), but I've had trouble trying to apply them beyond a...
How do I use itertools.groupby()?
CC BY-SA 4.0
0
2008-08-03T18:27:09.687
2023-01-30T17:03:28.787
2020-07-29T19:19:49.903
1,079,075
207
[ "python", "python-itertools" ]
783
2
null
773
75
null
The example on the Python docs is quite straightforward: ``` groups = [] uniquekeys = [] for k, g in groupby(data, keyfunc): groups.append(list(g)) # Store group iterator as a list uniquekeys.append(k) ``` So in your case, data is a list of nodes, `keyfunc` is where the logic of your criteria function g...
null
CC BY-SA 4.0
null
2008-08-03T18:40:09.053
2020-01-24T13:41:47.133
2020-01-24T13:41:47.133
9,926,721
189
null
797
2
null
13
216
null
The most popular (==standard?) way of determining the time zone I've seen around is simply If your website requires subscription, this could be saved in the users' profile data. For anon users, the dates could be displayed as UTC or GMT or some such. I'm not trying to be a smart aleck. It's just that sometimes some p...
null
CC BY-SA 3.0
null
2008-08-03T19:30:55.720
2013-09-10T11:42:53.333
2013-09-10T11:42:53.333
227
227
null
795
2
null
746
13
null
I would be wary of automatically upcasing all whitespace-preceded-words in scenarios where I would run the risk of attracting the fury of nitpickers. I would at least consider implementing a dictionary for exception cases like articles and conjunctions. Behold: > "Beauty and the Beast" And when it comes to proper n...
null
CC BY-SA 2.5
null
2008-08-03T19:10:58.723
2008-08-03T19:14:31.993
2008-08-03T19:14:31.993
227
227
null
794
2
null
561
18
null
Absolutely, especially dealing with lots of these permutations/combinations I can definitely see that the first pass would be an issue. Interesting implementation in python, though I wrote a nice one in C and Ocaml based on "Algorithm 515" (see below). He wrote his in Fortran as it was common back then for all the "Al...
null
CC BY-SA 2.5
null
2008-08-03T19:06:00.327
2008-08-03T19:06:00.327
null
null
157
null
799
2
null
717
15
null
Have you tried changing the target CPU to `x86` instead of `"Any CPU"` in the advanced compiler options? I know that this solves some problems with other `OLEDB` providers by forcing the use of the 32-bit version.
null
CC BY-SA 3.0
null
2008-08-03T19:42:03.687
2013-02-07T11:14:46.003
2013-02-07T11:14:46.003
395,659
162
null
798
2
null
709
4
null
[MbUnit](https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#.NET_programming_languages) is worth a look. It has a set of features comparable to NUnit. It has its own GUI, or can be integrated into Visual Studio if you have [ReSharper](https://en.wikipedia.org/wiki/JetBrains#ReSharper_Ultimate). I would also ...
null
CC BY-SA 4.0
null
2008-08-03T19:36:48.470
2020-07-30T10:38:34.317
2020-07-30T10:38:34.317
63,550
230
null
781
2
null
769
20
null
[Cramer's Rule](http://en.wikipedia.org/wiki/Cramers_rule) and [Gaussian Elimination](http://en.wikipedia.org/wiki/Gaussian_elimination) are two good, general-purpose algorithms (also see [Simultaneous Linear Equations](http://en.wikipedia.org/wiki/Simultaneous_linear_equations)). If you're looking for code, check out ...
null
CC BY-SA 2.5
null
2008-08-03T18:37:24.003
2008-08-03T18:42:54.820
2008-08-03T18:42:54.820
229
229
null
805
1
894
null
17
2,748
This is ASP classic, not .Net. We have to get a way to SFTP into a server to upload and download a couple of files, kicked off by a user. What have other people used to do SFTP in ASP classic? Not necessarily opposed to purchasing a control.
ASP, need to use SFTP
CC BY-SA 2.5
0
2008-08-03T20:11:26.043
2022-09-06T12:00:58.997
2011-11-21T03:51:00.390
3,043
232
[ "asp-classic", "sftp" ]
802
2
null
766
6
null
I uploaded it and got an internal error ``` Premature end of script headers ``` After much playing around, I found that if I had ``` import cgi import cgitb; cgitb.enable() import MySQLdb ``` It would give me a much more useful answer and say that it was not installed, you can see it yourself -> [http://woarl.com...
null
CC BY-SA 2.5
null
2008-08-03T20:07:05.290
2008-08-04T21:46:00.797
2008-08-04T21:46:00.797
1,384,652
1,384,652
null
817
2
null
13
22
null
All the magic seems to be in ``` visitortime.getTimezoneOffset() ``` That's cool, I didn't know about that. Does it work in Internet Explorer etc? From there you should be able to use JavaScript to Ajax, set cookies whatever. I'd probably go the cookie route myself. You'll need to allow the user to change it though. W...
null
CC BY-SA 4.0
null
2008-08-03T20:40:33.707
2020-07-14T16:15:00.303
2020-07-14T16:15:00.303
10,325,630
234
null
791
2
null
622
7
null
Not efficient at all, but you can use a regular expression to test for prime numbers. ``` /^1?$|^(11+?)\1+$/ ``` This tests if, for a string consisting of “`1`”s, is (i.e. whether the string consists of one “`1`” or any number of “`1`”s that can be expressed as an -ary product).
null
CC BY-SA 2.5
null
2008-08-03T18:52:17.093
2010-02-02T13:57:30.347
2010-02-02T13:57:30.347
1,968
175
null
826
1
97,294
null
20
4,031
You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are irrelevant, you can remove them or avoid them if you like. To be clear, I'm interested in the algorithm. Feel free to ...
Efficiently get sorted sums of a sorted list
CC BY-SA 2.5
0
2008-08-03T21:08:54.977
2020-07-27T01:15:48.273
2008-08-03T21:38:52.623
101
101
[ "algorithm", "language-agnostic" ]
818
2
null
810
3
null
I'm partway to my solution with this entry on MSDN (don't know how I couldn't find it before). User/Machine Hive Subkeys and values entered under this hive will be installed under the HKEY_CURRENT_USER hive when a user chooses "Just Me" or the HKEY_USERS hive or when a user chooses "Everyone" during installation. [Re...
null
CC BY-SA 4.0
null
2008-08-03T20:45:27.350
2019-04-17T09:58:06.930
2019-04-17T09:58:06.930
8,320,555
233
null
834
2
null
826
-4
null
If you are looking for a truly language agnostic solution then you will be sorely disappointed in my opinion because you'll be stuck with a for loop and some conditionals. However if you opened it up to functional languages or functional language features (I'm looking at you LINQ) then my colleagues here can fill this ...
null
CC BY-SA 2.5
null
2008-08-03T21:24:56.160
2008-08-03T21:24:56.160
null
null
200
null
832
1
837
null
24
1,890
SQL: ``` SELECT u.id, u.name, isnull(MAX(h.dateCol), '1900-01-01') dateColWithDefault FROM universe u LEFT JOIN history h ON u.id=h.id AND h.dateCol<GETDATE()-1 GROUP BY u.Id, u.name ```
How do I most elegantly express left join with aggregate SQL as LINQ query
CC BY-SA 3.0
null
2008-08-03T21:22:52.717
2020-03-18T11:21:57.237
2015-04-07T12:52:29.133
2,771,704
224
[ "c#", "linq", "left-join" ]
810
1
820
null
21
7,572
I'm trying to maintain a Setup Project in `Visual Studio 2003` (yes, it's a legacy application). The problem we have at the moment is that we need to write registry entries to `HKCU` for every user on the computer. They need to be in the `HKCU` rather than `HKLM` because they are the default user settings, and they do ...
Visual Studio Setup Project - Per User Registry Settings
CC BY-SA 3.0
0
2008-08-03T20:35:01.987
2019-04-17T09:58:06.930
2012-10-08T21:33:14.307
902,217
233
[ "windows", "visual-studio", "registry", "installation" ]
820
2
null
810
6
null
First: Yes, this is something that belongs in the Application for the exact reson you specified: What happens after new user profiles are created? Sure, if you're using a domain it's possible to have some stuff put in the registry on creation, but this is not really a use case. The Application should check if there are...
null
CC BY-SA 2.5
null
2008-08-03T20:48:47.263
2008-08-03T20:48:47.263
null
null
91
null
836
2
null
696
2
null
Looks like a web service is going to be the answer for me. On a production box I'd rather not have to go through compiling and maintaining my own special installation of PHP since ODBC support needs to be compiled in, according to the PHP documentation.
null
CC BY-SA 3.0
null
2008-08-03T21:31:14.353
2013-01-09T05:46:43.607
2013-01-09T05:46:43.607
1,471,203
204
null
829
2
null
810
6
null
I'm guessing that because you want to set it for all users, that you're on some kind of shared computer, which is probably running under a domain? Let's say Joe and Jane regularly log onto the computer, then they will each have 'registries'. You'll then install your app, and the installer will employ giant hacks an...
null
CC BY-SA 2.5
null
2008-08-03T21:17:33.557
2008-08-03T21:37:53.577
2008-08-03T21:37:53.577
234
234
null
849
2
null
845
82
null
I've seen it done in a kind of iffy, but pretty reliable way. Basically, an element is set to use a specific font and a string is set to that element. If the font set for the element does not exist, it takes the font of the parent element. So, what they do is measure the width of the rendered string. If it matches w...
null
CC BY-SA 4.0
null
2008-08-03T21:51:44.360
2019-03-22T01:21:50.917
2019-03-22T01:21:50.917
10,221,765
93
null
837
2
null
832
10
null
A solution, albeit one that defers handling of the null value to the code, could be: > DateTime yesterday = DateTime.Now.Date.AddDays(-1); ``` var collection= from u in db.Universe select new { u.id, u.name, MaxDate =(DateTime?) ( from h in db.History w...
null
CC BY-SA 3.0
null
2008-08-03T21:31:17.863
2014-07-10T21:52:02.283
2014-07-10T21:52:02.283
1,668,244
224
null
833
1
838
null
34
27,470
I have designed database tables (normalised, on an MS SQL server) and created a standalone windows front end for an application that will be used by a handful of users to add and edit information. We will add a web interface to allow searching accross our production area at a later date. I am concerned that if two use...
Editing database records by multiple users
CC BY-SA 2.5
0
2008-08-03T21:23:41.077
2018-02-08T10:56:35.850
2008-10-08T22:49:01.773
15,401
186
[ "sql-server", "database" ]
855
1
858
null
21
3,466
Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output? I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was missing something...
.Net XML comment into API Documentation
CC BY-SA 3.0
0
2008-08-03T22:03:37.567
2014-06-25T19:54:59.043
2014-06-25T19:54:59.043
2,778,810
93
[ "visual-studio", "xslt", "documentation", "sandcastle", "xml-comments" ]
838
2
null
833
16
null
If you expect infrequent collisions, [Optimistic Concurrency](http://msdn.microsoft.com/en-us/library/aa0416cz.aspx) is probably your best bet. Scott Mitchell wrote a comprehensive tutorial on implementing that pattern: [Implementing Optimistic Concurrency](http://www.asp.net/Learn/data-access/tutorial-21-cs.aspx)
null
CC BY-SA 3.0
null
2008-08-03T21:31:40.187
2013-01-28T04:20:13.590
2013-01-28T04:20:13.590
null
60
null
859
2
null
855
5
null
Have a look at [Sandcastle](http://blogs.msdn.com/sandcastle/), which does exactly that. It's also one of the more simpler solutions out there, and it's more or less the tool of choice, so in the long run, maybe we could help you to set up Sandcastle if you specify what issues you encountered during setup?
null
CC BY-SA 2.5
null
2008-08-03T22:14:55.453
2008-08-03T22:24:57.820
2008-08-03T22:24:57.820
91
91
null
835
1
1,023
null
17
6,595
I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task. According to the [Documentation](http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task), it passes CCNetArtifactDirectory to MSBuild. But how do I use it? I tried this: ``` <buildArgs...
CruiseControl.net, msbuild, /p:OutputPath and CCNetArtifactDirectory
CC BY-SA 3.0
0
2008-08-03T21:25:09.763
2013-02-08T21:59:55.120
2013-02-07T11:24:54.143
395,659
91
[ "msbuild", "cruisecontrol.net" ]
858
2
null
855
12
null
You're looking for Sandcastle Project Page: [Sandcastle Releases](http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx) Blog: [Sandcastle Blog](http://blogs.msdn.com/sandcastle/default.aspx) [NDoc Code Documentation Generator for .NET](http://ndoc.sourceforge.net) used to be the tool of choice, but suppor...
null
CC BY-SA 3.0
null
2008-08-03T22:12:52.820
2013-01-28T03:56:05.070
2013-01-28T03:56:05.070
null
34
null
870
2
null
810
2
null
Despite what the [MSDN article](http://msdn.microsoft.com/en-us/library/x6kd89c5(VS.80).aspx) [Archive of MSDN Article](http://web.archive.org/web/20100112132447/http://msdn.microsoft.com/en-us/library/x6kd89c5(VS.80).aspx) says about User/Machine Hive, it doesn't write to HKEY_USERS. Rather it writes to HKCU if you s...
null
CC BY-SA 4.0
null
2008-08-03T22:34:06.380
2019-04-17T09:48:05.677
2019-04-17T09:48:05.677
8,320,555
233
null
873
2
null
871
54
null
Google Tech Talk: Linus Torvalds on git [http://www.youtube.com/watch?v=4XpnKHJAok8](http://www.youtube.com/watch?v=4XpnKHJAok8) The Git Wiki's comparison page [http://git.or.cz/gitwiki/GitSvnComparsion](http://git.or.cz/gitwiki/GitSvnComparsion)
null
CC BY-SA 2.5
null
2008-08-03T22:44:26.203
2008-08-03T22:44:26.203
null
null
150
null
871
1
875
null
393
920,829
I've been using [Subversion](http://en.wikipedia.org/wiki/Apache_Subversion) for a few years and after using [SourceSafe](http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe), I just love Subversion. Combined with [TortoiseSVN](http://en.wikipedia.org/wiki/TortoiseSVN), I can't really imagine how it could be any ...
Why is Git better than Subversion?
CC BY-SA 2.5
0
2008-08-03T22:38:29.040
2011-10-25T06:30:09.073
2010-07-23T10:24:35.053
63,550
203
[ "svn", "git" ]
845
1
849
null
156
53,931
Suppose I have the following CSS rule in my page: ``` body { font-family: Calibri, Trebuchet MS, Helvetica, sans-serif; } ``` How could I detect which one of the defined fonts were used in the user's browser? For people wondering why I want to do this is because the font I'm detecting contains glyphs that are ava...
How to detect which one of the defined font was used in a web page?
CC BY-SA 4.0
0
2008-08-03T21:42:37.903
2020-09-13T19:39:02.263
2020-09-13T19:39:02.263
7,134,134
238
[ "javascript", "html", "css", "fonts" ]
840
2
null
826
1
null
The best I could come up with is to produce a matrix of sums of each pair, and then merge the rows together, a-la merge sort. I feel like I'm missing some simple insight that will reveal a much more efficient solution. My algorithm, in Haskell: ``` matrixOfSums list = [[a+b | b <- list, b >= a] | a <- list] sortedS...
null
CC BY-SA 2.5
null
2008-08-03T21:36:25.890
2008-08-06T18:56:00.657
2008-08-06T18:56:00.657
101
101
null
880
2
null
879
-8
null
Depends on the version, 4 is by value, 5 is by reference.
null
CC BY-SA 2.5
null
2008-08-03T22:52:11.930
2008-08-03T22:52:11.930
null
null
34
null
879
1
885
null
304
213,997
Are PHP variables passed by value or by reference?
Are PHP Variables passed by value or by reference?
CC BY-SA 3.0
0
2008-08-03T22:51:41.447
2021-06-25T12:25:57.760
2014-05-25T01:52:44.717
2,581,872
58
[ "php", "variables", "pass-by-reference", "pass-by-value" ]
876
2
null
871
26
null
Well, it's distributed. Benchmarks indicate that it's considerably faster (given its distributed nature, operations like diffs and logs are all local so of course it's blazingly faster in this case), and working folders are smaller (which still blows my mind). When you're working on subversion, or any other client/ser...
null
CC BY-SA 2.5
null
2008-08-03T22:47:42.703
2008-10-13T19:13:34.283
2008-10-13T19:13:34.300
3,002
34
null
877
2
null
717
9
null
You'll need to compile with the target `CPU` set to `x86` to force your code to use the `32 bit` version of the `VFP OLE Db provider`. [Microsoft has stated](http://msdn.microsoft.com/en-us/vfoxpro/bb190293.aspx) that there are no plans on releasing a `64-bit` edition of the Visual FoxPro OLE Db provider. For what'...
null
CC BY-SA 3.0
null
2008-08-03T22:48:47.490
2013-02-07T11:20:02.040
2013-02-07T11:20:02.040
395,659
206
null
886
2
null
871
5
null
Git and DVCS in general is great for developers doing a lot of coding independently of each other because everyone has their own branch. If you need a change from someone else, though, she has to commit to her local repo and then she must push that changeset to you or you must pull it from her. My own reasoning also ...
null
CC BY-SA 2.5
null
2008-08-03T23:08:23.580
2008-08-03T23:08:23.580
null
null
153
null
888
1
890
null
402
356,010
How do you debug scripts? I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in is also quite useful. What is the (in terms of fast and easy) way to debug in phpStorm or any other IDE?
How do you debug PHP scripts?
CC BY-SA 3.0
0
2008-08-03T23:18:21.627
2016-08-04T08:15:23.767
2015-06-04T10:18:02.297
4,248,328
131
[ "php", "eclipse", "debugging", "phpstorm", "xdebug" ]
891
2
null
888
2
null
print_r( debug_backtrace() ); or something like that :-)
null
CC BY-SA 2.5
null
2008-08-03T23:32:13.020
2008-08-03T23:32:13.020
null
null
234
null
889
2
null
888
16
null
I've used the [Zend Studio (5.5)](http://www.zend.com/products/studio/), together with [Zend Platform](http://www.zend.com/en/products/platform/). That gives proper debugging, breakpoints/stepping over the code etc., although at a price.
null
CC BY-SA 2.5
null
2008-08-03T23:20:48.347
2008-08-03T23:20:48.347
null
null
91
null
885
2
null
879
374
null
It's by value according to the [PHP Documentation](http://php.net/manual/en/functions.arguments.php). > By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). To allow a function to modify its arguments,...
null
CC BY-SA 3.0
null
2008-08-03T23:06:56.423
2016-07-05T10:56:14.670
2016-07-05T10:56:14.670
2,515,142
91
null
890
2
null
888
145
null
Try [Eclipse PDT](https://eclipse.org/pdt/) to setup an Eclipse environment that has debugging features like you mentioned. The ability to step into the code is a much better way to debug then the old method of var_dump and print at various points to see where your flow goes wrong. When all else fails though and all I ...
null
CC BY-SA 3.0
null
2008-08-03T23:28:39.890
2016-03-02T05:37:24.947
2016-03-02T05:37:24.947
887,092
200
null
894
2
null
805
8
null
If you have the ability to use WScript.Shell then you can just execute pscp.exe from the [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/) package. Obviously this is less then ideal but it will get the job done and let you use SCP/SFTP in classic ASP.
null
CC BY-SA 2.5
null
2008-08-03T23:52:47.360
2008-08-03T23:52:47.360
null
null
200
null
895
2
null
194
3
null
I am by no means authoritative, but I believe the only supported path is from 6.5 to 7. Certainly that would be the most sane route, then I believe you can migrate from 7 directly to 2005 pretty painlessly. As for scripting out all the objects - I would advise against it as you will inevitably miss something (unless y...
null
CC BY-SA 3.0
null
2008-08-03T23:56:54.077
2016-12-20T05:40:09.683
2016-12-20T05:40:09.683
1,997,093
243
null
875
2
null
871
547
null
Git is not better than Subversion. But is also not worse. It's different. The key difference is that it is decentralized. Imagine you are a developer on the road, you develop on your laptop and you want to have source control so that you can go back 3 hours. With Subversion, you have a Problem: The SVN Repository may...
null
CC BY-SA 2.5
null
2008-08-03T22:45:44.533
2009-12-28T04:45:25.160
2009-12-28T04:45:25.160
91
91
null
881
2
null
879
33
null
PHP variables are assigned by value, passed to functions by value and when containing/representing objects are passed by reference. You can force variables to pass by reference using an '&'. Assigned by value/reference example: ``` $var1 = "test"; $var2 = $var1; $var2 = "new test"; $var3 = &$var2; $var3 = "final test";...
null
CC BY-SA 4.0
null
2008-08-03T22:52:17.593
2020-07-16T06:40:52.837
2020-07-16T06:40:52.837
10,325,630
58
null
893
2
null
871
6
null
It's all about the ease of use/steps required to do something. If I'm developing a single project on my PC/laptop, git is better, because it is far easier to set up and use. You don't need a server, and you don't need to keep typing repository URL's in when you do merges. If it were just 2 people, I'd say git is als...
null
CC BY-SA 2.5
null
2008-08-03T23:38:05.113
2008-08-03T23:38:05.113
null
null
234
null
897
2
null
879
5
null
Variables containing primitive types are passed by value in PHP5. Variables containing objects are passed by reference. There's quite an interesting article from Linux Journal from 2006 which mentions this and other OO differences between 4 and 5. [http://www.linuxjournal.com/article/9170](http://www.linuxjournal.com/...
null
CC BY-SA 2.5
null
2008-08-04T00:05:05.790
2008-08-04T00:05:05.790
null
null
137
null
884
2
null
826
4
null
Rather than coding this out, I figure I'll pseudo-code it in steps and explain my logic, so that better programmers can poke holes in my logic if necessary. On the first step we start out with a list of numbers length n. For each number we need to create a list of length n-1 becuase we aren't adding a number to itsel...
null
CC BY-SA 3.0
null
2008-08-03T23:06:15.443
2015-04-17T10:17:10.987
2015-04-17T10:17:10.987
155,077
159
null
896
2
null
879
37
null
[http://www.php.net/manual/en/migration5.oop.php](http://www.php.net/manual/en/migration5.oop.php) > In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (...
null
CC BY-SA 2.5
null
2008-08-03T23:57:46.820
2008-08-03T23:57:46.820
null
null
34
null
912
2
null
904
18
null
As part of CSS3, it is not yet fully supported, [but you can find information on word-wrapping here](http://www.css3.info/preview/word-wrap/). Another option is the [wbr tag, &shy;, and &#8203;](http://www.quirksmode.org/oddsandends/wbr.html) none of which are fully supported either.
null
CC BY-SA 3.0
null
2008-08-04T00:25:28.403
2014-07-10T21:33:00.213
2014-07-10T21:33:00.213
1,668,244
200
null
898
1
null
null
48
5,397
How have you implemented Internationalization (i18n) in actual projects you've worked on? I took an interest in making software cross-cultural after I read the famous post by Joel, [The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)](http://www...
Internationalization in your projects
CC BY-SA 3.0
0
2008-08-04T00:08:51.010
2016-04-24T01:15:28.727
2014-07-10T21:39:23.003
1,668,244
200
[ "language-agnostic", "unicode", "localization", "internationalization" ]
905
1
942
null
15
850
We're upgrading an existing program from `Win2k/SQL Server 2k` to `Windows 2003 and SQL Server 2005` as well as purchasing a new program that also uses `2k3/2k5`. The vendor says that for us to host both databases we need to get the Enterprise version because the softwares clients use different collation for the connec...
Client collation and SQL Server 2005
CC BY-SA 3.0
0
2008-08-04T00:17:55.767
2014-11-25T20:47:15.133
2014-11-25T20:47:15.133
2,641,576
204
[ "sql-server", "sql-server-2005", "windows-server-2003" ]
908
2
null
194
3
null
If you can find a professional or some other super-enterprise version of Visual Studio 6.0 - it came with a copy of [MSDE](http://en.wikipedia.org/wiki/MSDE) (Basically the predecessor to SQL Express). I believe MSDE 2000 is still available as a free download from Microsoft, but I don't know if you can migrate directly...
null
CC BY-SA 3.0
null
2008-08-04T00:23:55.690
2017-01-17T09:38:49.320
2017-01-17T09:38:49.320
1,087,469
243
null
904
1
911
null
79
21,824
Given a relatively simple CSS: ``` div { width: 150px; } ``` ``` <div> 12333-2333-233-23339392-332332323 </div> ``` > How do I make it so that the string stays constrained to the `width` of , and wraps to a new line on the ?
How to break word after special character like Hyphens (-)
CC BY-SA 4.0
0
2008-08-04T00:17:34.690
2020-06-02T21:56:12.130
2019-12-27T12:08:45.990
806,202
34
[ "html", "css", "text" ]
906
2
null
898
9
null
I worked on a project for my previous employer that used .NET, and there was a built in .resx format we used. We basically had a file that had all translations in the .resx file, and then multiple files with different translations. The consequence of this is that you have to be very diligent about ensuring that all s...
null
CC BY-SA 2.5
null
2008-08-04T00:23:00.123
2013-02-07T17:33:54.490
2013-02-07T17:33:54.490
237,838
122
null
911
2
null
904
76
null
Replace your hyphens with this: ``` &shy; ``` It's called a "soft" hyphen. ``` div { width: 150px; } ``` ``` <div> 12333&shy;2333&shy;233&shy;23339392&shy;332332323 </div> ```
null
CC BY-SA 3.0
null
2008-08-04T00:25:11.227
2016-11-30T09:06:55.887
2016-11-30T09:06:55.887
2,571,493
55
null
930
1
951
null
49
31,510
What's the simplest way to connect and query a database for a set of records in C#?
How do I connect to a database and loop over a recordset in C#?
CC BY-SA 2.5
0
2008-08-04T00:47:25.143
2019-12-18T12:28:49.403
2013-12-07T23:45:54.333
null
245
[ "c#", "database", "loops", "connection" ]
910
2
null
871
145
null
With Git, you can do practically anything offline, because everybody has their own repository. Making branches and merging between branches is really easy. Even if you don't have commit rights for a project, you can still have your own repository online, and publish "push requests" for your patches. Everybody who lik...
null
CC BY-SA 2.5
null
2008-08-04T00:24:15.940
2010-07-27T08:43:52.467
2010-07-27T08:43:52.467
63,550
136
null
935
1
938
null
137
342,894
Attempting to insert an escape character into a table results in a warning. For example: ``` create table EscapeTest (text varchar(50)); insert into EscapeTest (text) values ('This is the first part \n And this is the second'); ``` Produces the warning: ``` WARNING: nonstandard use of escape in a string literal...
String literals and escape characters in postgresql
CC BY-SA 3.0
0
2008-08-04T01:00:24.837
2021-02-19T18:23:55.443
2015-01-02T22:34:17.840
3,576,214
246
[ "string", "postgresql", "escaping" ]
938
2
null
935
155
null
Partially. The text is inserted, but the warning is still generated. I found a discussion that indicated the text needed to be preceded with 'E', as such: ``` insert into EscapeTest (text) values (E'This is the first part \n And this is the second'); ``` This suppressed the warning, but the text was still not being...
null
CC BY-SA 2.5
null
2008-08-04T01:07:03.233
2010-03-04T23:08:11.817
2010-03-04T23:08:11.817
246
246
null
939
2
null
123
8
null
There is nothing I know of that can do this without you at least writing a little bit of code... You will need 2 separate library: - - The CSV parser I would recommend (unless you want to have a little bit of fun to write your own CSV Parser) is OpenCSV (A SourceForge Project for parsing CSV Data) The XML Serializa...
null
CC BY-SA 3.0
null
2008-08-04T01:07:07.633
2013-11-26T00:02:54.033
2013-11-26T00:02:54.033
1,102,512
244
null
942
2
null
905
7
null
All editions of `SQL Server 2000/2005/2008` support having multiple databases, each using their own collation sequence. You don't need the Enterprise version. When you have a database that uses a collation sequence that is different from default collation for the database server, you will need to take some extra pr...
null
CC BY-SA 3.0
null
2008-08-04T01:13:06.247
2013-02-07T13:51:27.207
2013-02-07T13:51:27.207
395,659
206
null
940
2
null
930
17
null
Very roughly and from memory since I don't have code on this laptop: ``` using (OleDBConnection conn = new OleDbConnection()) { conn.ConnectionString = "Whatever connection string"; using (OleDbCommand cmd = new OleDbCommand()) { cmd.Connection = conn; cmd.CommandText = "Select * from CoolTable"; u...
null
CC BY-SA 3.0
null
2008-08-04T01:07:14.760
2016-02-07T00:44:04.573
2016-02-07T00:44:04.573
2,921,691
243
null
947
1
1,028
null
27
8,908
I have imported the `kernel32` library. So, I have the `createMutex` function available but I am not quite sure of the various parameters and return values. This is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.
How to use a mutex in Visual Basic
CC BY-SA 3.0
0
2008-08-04T01:22:49.830
2021-09-18T17:51:07.740
2021-09-18T17:51:07.740
16,587,746
243
[ "vb6", "mutex" ]
943
2
null
935
51
null
Cool. I also found the documentation regarding the E: [http://www.postgresql.org/docs/8.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS](http://www.postgresql.org/docs/8.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS) > PostgreSQL also accepts "escape" string constants, which are an extension to t...
null
CC BY-SA 2.5
null
2008-08-04T01:14:57.367
2008-08-04T01:14:57.367
null
null
91
null
950
2
null
194
6
null
You can upgrade 6.5 to SQL Server 2000. You may have an easier time getting a hold of SQL Server or the 2000 version of the MSDE. Microsoft has a page on [going from 6.5 to 2000](http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/sqlugrd.mspx#EQFAC). Once you have the database in 2000 format, SQL Server 20...
null
CC BY-SA 2.5
null
2008-08-04T01:29:18.307
2008-08-04T01:29:18.307
null
null
206
null
921
2
null
898
15
null
Some fun things: 1. Having a PHP and MySQL Application that works well with German and French, but now needs to support Russian and Chinese. I think I move this over to .net, as PHP's Unicode support is - in my opinion - not really good. Sure, juggling around with utf8_de/encode or the mbstring-functions is fun. Almo...
null
CC BY-SA 2.5
null
2008-08-04T00:35:14.110
2008-08-04T00:41:52.583
2017-05-23T11:45:36.177
-1
91
null
944
1
1,016
null
31
4,927
I'm maintaining a .NET 1.1 application and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications. I've added handlers to `Application.ThreadException` and `AppDomain.CurrentDomain.UnhandledException`, which do get called. My problem is that the standard CLR erro...
Unhandled Exception Handler in .NET 1.1
CC BY-SA 4.0
0
2008-08-04T01:15:38.067
2022-01-28T06:42:56.517
2019-01-20T13:46:09.923
567,854
233
[ "c#", ".net", "exception" ]
981
2
null
833
0
null
The database will do this for you. Look at "select ... for update", which is designed just for this kind of thing. It will give you a write lock on the selected rows, which you can then commit or roll back.
null
CC BY-SA 2.5
null
2008-08-04T02:30:09.227
2008-08-04T02:30:09.227
null
null
116
null
931
2
null
88
19
null
@Bernard: > I have to admit, most of your example went straight over my head. It does compile, and seems to work, though. Is this safe for SMP systems or SpeedStep? That's a good question... I think the code's ok. From a practical standpoint, we use it in my company every day, and we run on a pretty wide array of box...
null
CC BY-SA 3.0
null
2008-08-04T00:51:52.843
2011-06-15T06:44:06.390
2011-06-15T06:44:06.390
410,767
116
null
972
1
2,982
null
826
353,367
I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python. I understand that it's not always good to do so. But how might one do this?
Adding a method to an existing object instance in Python
CC BY-SA 4.0
0
2008-08-04T02:17:51.780
2023-02-06T13:43:19.353
2023-02-06T13:43:19.353
5,323,892
145
[ "python", "oop", "methods", "monkeypatching" ]
951
2
null
930
35
null
@Goyuix -- that's excellent for something written from memory. tested it here -- found the connection wasn't opened. Otherwise very nice. ``` using System.Data.OleDb; ... using (OleDbConnection conn = new OleDbConnection()) { conn.ConnectionString = "Provider=sqloledb;Data Source=yourServername\\yourInstance;Init...
null
CC BY-SA 3.0
null
2008-08-04T01:31:31.157
2016-02-07T00:43:54.210
2016-02-07T00:43:54.210
2,921,691
49
null
971
2
null
164
3
null
Encoding flash video is actually very easy with ffmpeg. You can use one command to convert from just about any video format, ffmpeg is smart enough to figure the rest out, and it'll use every processor on your machine. Invoking it is easy: ``` ffmpeg -i input.avi output.flv ``` ffmpeg will guess at the bitrate you...
null
CC BY-SA 2.5
null
2008-08-04T02:14:59.477
2008-08-04T02:14:59.477
null
null
101
null
982
2
null
972
32
null
In Python monkeypatching generally works by overwriting a class or function's signature with your own. Below is an example from the [Zope Wiki](http://web.archive.org/web/20130610034152/http://wiki.zope.org:80/zope2/MonkeyPatch): ``` from SomeOtherProduct.SomeModule import SomeClass def speak(self): return "ook ook ...
null
CC BY-SA 4.0
null
2008-08-04T02:31:13.250
2022-02-08T17:23:43.883
2022-02-08T17:23:43.883
4,720,018
200
null
990
2
null
944
1
null
It's a Windows Forms application. The exceptions that are caught by Application.ThreadException work fine, and I don't get the ugly .NET exception box ( to terminate, to debug? who came up with that??). I was getting some exceptions that weren't being caught by that and ended up going to the AppDomain.UnhandledExcept...
null
CC BY-SA 3.0
null
2008-08-04T02:54:15.683
2017-08-31T22:58:03.007
2017-08-31T22:58:03.007
63,550
233
null
986
2
null
944
3
null
Is this a console application or a Windows Forms application? If it's a .NET 1.1 console application this is, sadly, by design -- it's confirmed by an MSFT dev in the [second blog post you referenced](https://blog.codinghorror.com/improved-unhandled-exception-behavior-in-net-20/): > BTW, on my 1.1 machine the example ...
null
CC BY-SA 4.0
null
2008-08-04T02:45:07.717
2018-10-21T07:24:10.050
2018-10-21T07:24:10.050
1,033,581
1
null
1,005
1
37,042
null
253
81,165
Often while editing config files, I'll open one with vi and then when I go to save it realize that I didn't type ``` sudo vi filename ``` Is there any way to give vi sudo privileges to save the file? I seem to recall seeing something about this while looking up some stuff about vi a while ago, but now I can't find i...
How do you get sudo access for a file inside the vi text editor?
CC BY-SA 4.0
0
2008-08-04T03:34:02.860
2022-08-01T10:49:17.143
2022-08-01T10:49:17.143
18,133,699
85
[ "linux", "unix", "vi" ]
1,012
2
null
1,005
7
null
Ryan's advice is generally good, however, if following step 3, don't move the temporary file; it'll have the wrong ownership and permissions. Instead, `sudoedit` the correct file and read in the contents (using `:r` or the like) of the temporary file. If following step 2, use `:w!` to force the file to be written.
null
CC BY-SA 2.5
null
2008-08-04T04:04:52.110
2008-08-04T04:04:52.110
null
null
13
null
1,006
2
null
1,005
1
null
A quick Google seems to give this advice: 1. Don't try to edit if it's read-only. 2. You might be able to change the permissions on the file. (Whether or not it will let you save is up to experimentation.) 3. If you still edited anyway, save to a temporary file and then move it. [http://ubuntuforums.org/showthread...
null
CC BY-SA 2.5
null
2008-08-04T03:39:31.163
2008-08-04T03:39:31.163
null
null
55
null
1,016
2
null
944
13
null
Oh, in Windows Forms you definitely should be able to get it to work. The only thing you have to watch out for is things happening on different threads. I have an old Code Project article here which should help: [User Friendly Exception Handling](http://www.codeproject.com/KB/exception/ExceptionHandling.aspx)
null
CC BY-SA 3.0
null
2008-08-04T04:31:02.557
2017-08-31T22:55:35.110
2017-08-31T22:55:35.110
63,550
1
null
1,022
2
null
930
12
null
That's definitely a good way to do it. But you if you happen to be using a database that supports LINQ to SQL, it can be a lot more fun. It can look something like this: ``` MyDB db = new MyDB("Data Source=..."); var q = from db.MyTable select c; foreach (var c in q) Console.WriteLine(c.MyField.ToString())...
null
CC BY-SA 2.5
null
2008-08-04T04:45:05.367
2008-08-04T04:45:05.367
null
null
93
null
1,010
1
1,074
null
31
2,560
I need to grab the `base64-encoded` representation of the `ViewState`. Obviously, this would not be available until fairly late in the request lifecycle, which is OK. For example, if the output of the page includes: ``` <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODU0Njc5MD...==" /> ```...
How to get the value of built, encoded ViewState?
CC BY-SA 4.0
null
2008-08-04T03:59:42.557
2022-01-20T14:57:11.620
2022-01-20T14:57:11.620
17,700,155
67
[ "c#", "asp.net", "viewstate" ]