Id
int64
4
8.51M
PostTypeId
int64
1
7
AcceptedAnswerId
int64
7
75.5M
ParentId
int64
4
41.8M
Score
int64
-208
27.7k
ViewCount
int64
11
12.4M
Body
stringlengths
0
45k
Title
stringlengths
2
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
225
CreationDate
stringdate
2008-07-31 21:42:52
2011-12-14 18:48:47
LastActivityDate
stringdate
2008-08-01 12:19:17
2023-03-05 04:40:26
LastEditDate
stringdate
2008-08-01 13:54:25
2023-03-05 03:12:45
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
-1
21.1M
Tags
listlengths
1
6
36,885
2
null
36,877
104
null
- - `PHPSESSID`[@richie's answer](https://stackoverflow.com/a/8726269/1820) The [setcookie()](http://php.net/manual/en/function.setcookie.php) and [setrawcookie()](http://php.net/manual/en/function.setrawcookie.php) functions, introduced the boolean `httponly` parameter, back in the dark ages of PHP 5.2.0, making this ...
null
CC BY-SA 4.0
null
2008-08-31T14:38:41.730
2021-06-21T09:14:37.820
2021-06-21T09:14:37.820
1,820
1,820
null
36,898
2
null
36,014
1
null
The best option sounds like setting Visual Studio to break on all unhandled exceptions (Debug -> Exceptions dialog, check the box for "Common Language Runtime Exceptions" and possibly the others as well). Then run your program in debug mode. When the ANTLR parser code throws an exception it should be caught by Visual S...
null
CC BY-SA 2.5
null
2008-08-31T14:58:10.733
2008-08-31T14:58:10.733
null
null
1,559
null
36,901
1
36,908
null
3,238
1,222,261
What do `*args` and `**kwargs` mean in these function definitions? ``` def foo(x, y, *args): pass def bar(x, y, **kwargs): pass ``` --- [What do ** (double star/asterisk) and * (star/asterisk) mean in a function call?](https://stackoverflow.com/questions/2921847)
What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
CC BY-SA 4.0
0
2008-08-31T15:04:35.350
2023-02-27T07:29:27.870
2023-02-27T07:29:27.870
523,612
2,572
[ "python", "syntax", "parameter-passing", "variadic-functions", "argument-unpacking" ]
36,902
2
null
36,901
21
null
From the Python documentation: > If there are more positional arguments than there are formal parameter slots, a TypeError exception is raised, unless a formal parameter using the syntax "*identifier" is present; in this case, that formal parameter receives a tuple containing the excess positional arguments (or an emp...
null
CC BY-SA 2.5
null
2008-08-31T15:07:48.977
2008-08-31T15:07:48.977
null
null
2,600
null
36,899
2
null
402
7
null
sasb's and michaelpryor's answer appears to be correct, but if it's not working for you, try this alternative: ``` - (void)applicationDidFinishLaunchingUIApplication *)application { application.statusBarOrientation = UIInterfaceOrientationLandscapeRight; } ``` Or this one: ``` [[UIDevice currentDevice] setOrien...
null
CC BY-SA 3.0
null
2008-08-31T15:01:21.957
2016-12-19T03:42:35.210
2017-05-23T10:30:52.777
-1
1,600
null
36,905
2
null
36,862
3
null
,I haven't tried nesting git repositories yet because I haven't run into a situation where I need to. As I've read on the [#git channel](http://irc://irc.freenode.net/git) git seems to get confused by nesting the repositories, i.e. you're trying to git-init inside a git repository. The only way to manage a nested git s...
null
CC BY-SA 3.0
null
2008-08-31T15:11:54.320
2012-03-27T23:37:03.817
2012-03-27T23:37:03.817
249,445
3,713
null
36,892
2
null
36,605
6
null
Regarding your request -- -- the easiest way is to specify `cursor:pointer` in your css. I think you will find that works in IE 6. Try this to verify (where `div` can be any element): ``` <div style="background:orange; cursor:pointer; height:100px; width:100px;"> Hover </div> ```
null
CC BY-SA 2.5
null
2008-08-31T14:45:35.973
2008-08-31T14:45:35.973
null
null
3,741
null
36,906
1
36,942
null
74
63,107
I want to swap two integers, and I want to know which of these two implementations will be faster: The obvious way with a temp variable: ``` void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } ``` Or the xor version that I'm sure most people have seen: ``` void swap(int* a, int* b) { *a...
What is the fastest way to swap values in C?
CC BY-SA 2.5
0
2008-08-31T15:12:35.503
2020-01-14T13:30:46.050
null
null
3,869
[ "c", "performance" ]
36,907
2
null
20,850
2
null
The following entry in `/etc/fstab` will do what you want, even on 10.5 (Leopard): ``` LABEL=VolumeName none ntfs noauto ``` If the file is not already there, just create it. Do not use `/etc/fstab.hd`! No reloading of `diskarbitrationd` needed. If this still doesn't work for you, maybe you can find a hint i...
null
CC BY-SA 2.5
null
2008-08-31T15:17:14.290
2008-08-31T15:17:14.290
null
null
null
null
36,832
1
75,654
null
12
3,860
In C++ when a virtual function is called from within a constructor it doesn't behave like a virtual function. I think everyone who encountered this behavior for the first time was surprised but on second thought it made sense: As long as the derived constructor has not been executed the object is yet a instance. S...
Virtual functions in constructors, why do languages differ?
CC BY-SA 4.0
0
2008-08-31T12:37:24.067
2018-05-19T05:47:48.497
2018-05-19T05:47:48.497
5,321,363
3,848
[ "java", ".net", "c++", "language-agnostic" ]
36,910
2
null
36,906
111
null
Number 2 is often quoted as being the "clever" way of doing it. It is in fact most likely slower as it obscures the explicit aim of the programmer - swapping two variables. This means that a compiler can't optimize it to use the actual assembler ops to swap. It also assumes the ability to do a bitwise xor on the object...
null
CC BY-SA 2.5
null
2008-08-31T15:19:54.190
2011-01-07T23:35:25.807
2011-01-07T23:35:25.807
51,170
3,877
null
36,914
2
null
36,778
9
null
I agree with Pat. At this point in the game, writing your own code to deal with cross-browser compatibility given the available Javascript frameworks doesn't make a lot of sense. There's a framework for nearly any taste (some really quite tiny) and they've focused on really abstracting out all of the differences betwee...
null
CC BY-SA 2.5
null
2008-08-31T15:28:15.027
2008-08-31T15:28:15.027
null
null
1,124
null
36,915
1
36,917
null
1
1,770
We have been working with CVS for years, and frequently find it useful to "sticky" a single file here and there. Is there any way to do this in subversion, specifically from TortoiseSVN?
Is there any way to "sticky" a file in subversion?
CC BY-SA 3.0
null
2008-08-31T15:29:34.137
2015-08-08T00:16:39.233
2015-08-08T00:16:39.233
1,832,942
3,798
[ "svn" ]
36,918
2
null
36,916
0
null
ASP.NET is "stateless" but it maintains state using Sessions. You can use them by default just using the Session[] keyword. Look at [ASP.NET Session State](http://msdn.microsoft.com/en-us/library/ms972429.aspx) for some details from Microsoft.
null
CC BY-SA 3.0
null
2008-08-31T15:35:48.910
2013-05-27T17:03:37.803
2013-05-27T17:03:37.803
1,012,641
2,305
null
36,919
2
null
26,903
1
null
Call a RegisterType method with the type, and constrain it using generics. Then, instead of walking assemblies to find ITest implementors, just store them and create from there. ``` void RegisterType<T>() where T:ITest, new() { } ```
null
CC BY-SA 2.5
null
2008-08-31T15:36:30.967
2008-08-31T15:36:30.967
null
null
2,199
null
36,916
1
36,931
null
1
741
I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?
Communication between pages
CC BY-SA 3.0
null
2008-08-31T15:31:39.857
2017-12-14T10:03:20.100
2017-12-14T10:03:20.100
3,817,004
1,013
[ "asp.net" ]
36,922
2
null
36,906
14
null
The first is faster because bitwise operations such as xor are usually very hard to visualize for the reader. Faster to understand of course, which is the most important part ;)
null
CC BY-SA 2.5
null
2008-08-31T15:39:07.933
2008-08-31T15:39:07.933
null
null
2,928
null
36,923
2
null
36,916
0
null
Could do a messaging solution in Java Servlets using the application context. Objects stored as attributes in the application context are visible from anywhere in your webapp. Update: Chat like functionality... I guess that would be AJAX polling your message structure stored in the app context unless you want to use s...
null
CC BY-SA 2.5
null
2008-08-31T15:39:21.663
2008-08-31T15:44:30.480
2008-08-31T15:44:30.480
2,362
2,362
null
36,917
2
null
36,915
2
null
no. Working copies are sticky to a branch by definition, as changing to a different branch means changing the base-Subversion-URL used to access the repository. However sticky-revision files... that's not a concept that Subversion has. See: - [Subversion update command reference](http://svnbook.red-bean.com/en/1.1...
null
CC BY-SA 2.5
null
2008-08-31T15:33:49.430
2008-08-31T15:55:15.230
2008-08-31T15:55:15.230
1,820
1,820
null
36,925
2
null
36,916
1
null
You probably don't want to use sessions for things like chat messages but you probably could use some type of implementation of queueing using [MSMQ](http://msdn.microsoft.com/en-us/library/ms711472.aspx). The approach to chat could be done in many different ways, this is just a suggesting off the top of my head.
null
CC BY-SA 2.5
null
2008-08-31T15:47:10.770
2008-08-31T15:47:10.770
null
null
2,305
null
36,927
2
null
36,813
1
null
Gathering stats should be done whenever there has been large changes to the data content, for example a large number of deletes or inserts. If the table structure has changed you should gather stats also. It is advisable to use the 'ESTIMATE' option. Do this as an automated process out of business hours if possible,...
null
CC BY-SA 2.5
null
2008-08-31T15:48:19.910
2008-08-31T15:48:19.910
null
null
2,981
null
36,929
2
null
36,916
0
null
Don't know if it's any good, but there's a chat servlet [here](http://coldjava.hypermart.net/servlets/chatfaq.htm) that might be useful to use or learn from if you decide to go the Java route...
null
CC BY-SA 2.5
null
2008-08-31T15:50:13.463
2008-08-31T15:50:13.463
null
null
2,362
null
36,928
2
null
36,915
2
null
You can technically "branch" as little as a single file if you'd like... you can use 'svn switch' on any level directory or file. SVN tracks resources on a per-file basis just as CVS does, so it can do 'sticky' to the same effect. Committing a working copy containing mixed paths has very different effects though. See:...
null
CC BY-SA 2.5
null
2008-08-31T15:49:54.803
2008-08-31T15:49:54.803
null
null
758
null
36,930
2
null
35,670
3
null
Jeff posted a good "getting started" article for Windows, including how to setup : [Setting up Subversion on Windows](https://blog.codinghorror.com/setting-up-subversion-on-windows/)
null
CC BY-SA 4.0
null
2008-08-31T15:51:02.680
2018-10-21T12:52:22.963
2018-10-21T12:52:22.963
1,033,581
3,187
null
36,932
1
1,695,250
null
1,141
1,226,279
I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python?
How can I represent an 'Enum' in Python?
CC BY-SA 3.0
0
2008-08-31T15:55:47.910
2022-01-24T15:43:14.697
2014-09-22T16:03:16.493
2,174,742
3,880
[ "python", "python-3.x", "enums" ]
36,926
2
null
36,901
799
null
It's also worth noting that you can use `*` and `**` when calling functions as well. This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary. For example, if you have the following function: ``` def foo(x,y,z): print("x=" + str(x)) print("y...
null
CC BY-SA 3.0
null
2008-08-31T15:47:25.527
2018-03-07T01:53:17.533
2018-03-07T01:53:17.533
2,601,671
742
null
36,911
2
null
36,901
215
null
The single * means that there can be any number of extra positional arguments. `foo()` can be invoked like `foo(1,2,3,4,5)`. In the body of foo() param2 is a sequence containing 2-5. The double ** means there can be any number of extra named parameters. `bar()` can be invoked like `bar(1, a=2, b=3)`. In the body of ba...
null
CC BY-SA 4.0
null
2008-08-31T15:20:21.037
2018-12-01T05:59:46.733
2018-12-01T05:59:46.733
-1
2,373
null
36,933
2
null
36,906
5
null
The only way to really know is to test it, and the answer may even vary depending on what compiler and platform you are on. Modern compilers are good at optimizing code these days, and you should never try to outsmart the compiler unless you can prove that your way is really faster. With that said, you'd better have...
null
CC BY-SA 2.5
null
2008-08-31T15:58:03.023
2008-08-31T15:58:03.023
null
null
2,284
null
36,934
2
null
13,698
1
null
OK my verdict :-): I have used successfully zend without mod_rewrite and it's as you've all said site/index.php/controller/action. I knew that before posting this. I've also found out around the net a technique that "pushes" 404 pages to index.php therefore what is not a resource (eg. CSS, image, etc) get there, with o...
null
CC BY-SA 4.0
null
2008-08-31T15:58:47.513
2021-07-07T14:06:19.787
2021-07-07T14:06:19.787
13,176,802
1,622
null
36,931
2
null
36,916
2
null
I don't think you need to set up Java just to use a servlet for this. I would use AJAX and the database. I don't know ASP.NET but I PHP is similar in this case, being also basically "stateless". If you want to display some kind of asynchronous communication between two different users, say, from two different sessions,...
null
CC BY-SA 2.5
null
2008-08-31T15:52:32.863
2008-08-31T15:52:32.863
null
null
577
null
36,908
2
null
36,901
3,080
null
The `*args` and `**kwargs` is a common idiom to allow arbitrary number of arguments to functions as described in the section [more on defining functions](http://docs.python.org/3/tutorial/controlflow.html#more-on-defining-functions) in the Python documentation. The `*args` will give you all function parameters [as a tu...
null
CC BY-SA 4.0
null
2008-08-31T15:17:31.137
2022-05-12T20:32:27.863
2022-05-12T20:32:27.863
497,719
720
null
36,942
2
null
36,906
93
null
The XOR method fails if a and b point to the same address. The first XOR will clear all of the bits at the memory address pointed to by both variables, so once the function returns (*a == *b == 0), regardless of the initial value. More info on the Wiki page: [XOR swap algorithm](http://en.wikipedia.org/wiki/XOR_swap_...
null
CC BY-SA 2.5
null
2008-08-31T16:17:17.577
2008-08-31T16:17:17.577
null
null
2,289
null
36,940
2
null
36,932
25
null
Hmmm... I suppose the closest thing to an enum would be a dictionary, defined either like this: ``` months = { 'January': 1, 'February': 2, ... } ``` or ``` months = dict( January=1, February=2, ... ) ``` Then, you can use the symbolic name for the constants like this: ``` mymonth = month...
null
CC BY-SA 2.5
null
2008-08-31T16:09:53.633
2008-08-31T16:09:53.633
null
null
2,384
null
36,935
2
null
36,812
7
null
You will want to wire your URL to the Django [create_object generic view](https://docs.djangoproject.com/en/1.4/ref/generic-views/#django-views-generic-create-update-create-object), and pass it either "model" (the model you want to create) or "form_class" (a customized [ModelForm](https://docs.djangoproject.com/en/1.1/...
null
CC BY-SA 3.0
null
2008-08-31T15:59:11.473
2012-06-09T09:03:38.030
2012-06-09T09:03:38.030
785,541
3,207
null
36,948
2
null
36,906
0
null
If you can use some inline assembler and do the following (psuedo assembler): ``` PUSH A A=B POP B ``` You will save a lot of parameter passing and stack fix up code etc.
null
CC BY-SA 3.0
null
2008-08-31T16:34:17.490
2013-10-10T11:27:31.623
2013-10-10T11:27:31.623
486,504
3,685
null
36,949
1
36,990
null
3
244
I writing a web site that uses Active Directory to validate users. I don't have access to an Active Directory instance that I can edit in any way. I've heard that some people are using Active Directory Application Mode (ADAM) to create AD data to be used in Unit and Integration Testing. Has anyone else done this? Are...
How do I use ADAM to run unit tests?
CC BY-SA 2.5
null
2008-08-31T16:41:54.367
2009-03-10T03:46:53.543
2009-03-10T03:46:53.543
5,640
3,819
[ "testing", "active-directory", "adam" ]
36,943
2
null
36,106
1
null
Thanks for the answers. This is what I'm going to try for dynamically choosing the right method: I'll collect all of the first hits in a conventional bit array, and choose one of three methods, based on the symmetry of this sample. - - - [suggested by InSciTekJeff](https://stackoverflow.com/questions/36106/what-are-...
null
CC BY-SA 2.5
null
2008-08-31T16:23:31.197
2008-08-31T16:23:31.197
2017-05-23T12:19:34.457
-1
3,474
null
36,937
2
null
36,932
956
null
Before PEP 435, Python didn't have an equivalent but you could implement your own. Myself, I like keeping it simple (I've seen some horribly complex examples on the net), something like this ... ``` class Animal: DOG = 1 CAT = 2 x = Animal.DOG ``` --- In Python 3.4 ([PEP 435](http://www.python.org/dev/peps...
null
CC BY-SA 4.0
null
2008-08-31T16:06:14.360
2021-06-04T16:47:43.233
2021-06-04T16:47:43.233
2,117,367
3,280
null
36,944
2
null
36,701
8
null
Re: aku, izb, John Topley... Watch out for mutability issues... It may seem sensible to omit getters/setters. It actually may be ok in some cases. The real problem with the proposed pattern shown here is mutability. The problem is once you pass an object reference out containing non-final, public fields. Anything el...
null
CC BY-SA 2.5
null
2008-08-31T16:27:29.707
2008-08-31T16:27:29.707
null
null
758
null
36,955
2
null
19,893
2
null
You can also [Uuencode](http://en.wikipedia.org/wiki/Uuencode) you original binary data. This format is a bit older but it does the same thing as base63 encoding.
null
CC BY-SA 2.5
null
2008-08-31T16:52:05.217
2008-08-31T16:52:05.217
null
null
3,885
null
36,801
2
null
215,718
19
null
Note, however, that `git checkout ./foo` and `git checkout HEAD ./foo` are not the same thing; case in point: ``` $ echo A > foo $ git add foo $ git commit -m 'A' foo Created commit a1f085f: A 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo $ echo B >> foo $ git add foo $ echo C >> foo $ cat f...
null
CC BY-SA 3.0
null
2008-08-31T11:54:16.977
2014-04-29T12:21:11.453
2014-04-29T12:21:11.453
16,587
3,844
null
36,953
1
null
null
65
41,576
Can people point me to resources on lexing, parsing and tokenising with Python? I'm doing a little hacking on an open source project ([hotwire](http://www.hotwire-shell.org/)) and wanted to do a few changes to the code that [lexes](http://code.google.com/p/hotwire-shell/source/browse/trunk/hotwire/externals/shlex.py),...
Resources for lexing, tokenising and parsing in python
CC BY-SA 2.5
0
2008-08-31T16:50:35.453
2020-05-22T08:05:20.127
2008-10-07T20:19:09.473
3,189
3,189
[ "python", "parsing", "resources", "lex" ]
36,959
1
3,588,796
null
181
311,179
In MS SQL Server, I create my scripts to use customizable variables: ``` DECLARE @somevariable int SELECT @somevariable = -1 INSERT INTO foo VALUES ( @somevariable ) ``` I'll then change the value of `@somevariable` at runtime, depending on the value that I want in the particular situation. Since it's at the top ...
How do you use script variables in psql?
CC BY-SA 4.0
0
2008-08-31T16:54:33.183
2019-01-24T19:26:55.683
2018-07-23T22:05:36.240
124,486
3,488
[ "sql", "postgresql", "variables", "psql" ]
36,964
2
null
9,455
2
null
@dragonmantank In Xinc's case, I hope you used PEAR to install it. ``` pear list-files xinc/Xinc ``` This should do it, and show you where your Xinc install put its files. So even though Xinc is "just" one big PHP script, it's still spread out into rc scripts and all those other things which are necessary to make a...
null
CC BY-SA 2.5
null
2008-08-31T17:04:16.047
2008-08-31T17:04:16.047
null
null
2,859
null
36,966
2
null
36,605
0
null
If your willing to use JQuery, I would use [Set Hover Class for Anything](http://www.learningjquery.com/2007/02/quick-tip-set-hover-class-for-anything) technique.
null
CC BY-SA 2.5
null
2008-08-31T17:05:21.363
2008-08-31T17:05:21.363
null
null
383
null
36,970
2
null
36,968
1
null
You could just write the code by hand!
null
CC BY-SA 2.5
null
2008-08-31T17:09:35.767
2008-08-31T17:09:35.767
null
null
2,598
null
36,968
1
36,976
null
1
138
Are there any tools or plugins to design a Panel independently of a Form (Windows, not Web Form) within Visual Studio? I've been using the designer and manually extracting the bits I want from the source, but surely there is a nicer way.
Designing Panels without a parent Form in VS?
CC BY-SA 3.0
null
2008-08-31T17:07:39.533
2015-08-07T23:15:59.190
2015-08-07T23:15:59.190
1,832,942
3,716
[ "visual-studio" ]
36,945
2
null
36,636
23
null
To help facilitate understanding of closures it might be useful to examine how they might be implemented in a procedural language. This explanation will follow a simplistic implementation of closures in Scheme. To start, I must introduce the concept of a namespace. When you enter a command into a Scheme interpreter, i...
null
CC BY-SA 2.5
null
2008-08-31T16:30:30.853
2011-01-23T00:21:29.957
2011-01-23T00:21:29.957
658
658
null
36,974
2
null
36,605
3
null
Another alternative that will fix many more issues in one go is to use [IE7.js](http://code.google.com/p/ie7-js/).
null
CC BY-SA 2.5
null
2008-08-31T17:12:45.557
2008-08-31T17:12:45.557
null
null
1,600
null
36,976
2
null
36,968
1
null
You could do all the design work inside of a UserControl. If you go that route, instead of just copying the bits out of the user control, simply use the user control itself.
null
CC BY-SA 2.5
null
2008-08-31T17:13:33.620
2008-08-31T17:13:33.620
null
null
2,773
null
36,977
2
null
36,968
0
null
As Chris Karcher said, you should probably use a user control. This will allow easy, VS-supported/-integrated reuse without having to manually fiddle with designer code.
null
CC BY-SA 2.5
null
2008-08-31T17:13:41.123
2008-08-31T17:13:41.123
null
null
1,600
null
36,973
2
null
30,062
5
null
Either 1/0 or Y/N with a check constraint on it. ether way is fine. I personally prefer 1/0 as I do alot of work in perl, and it makes it really easy to do perl Boolean operations on database fields. If you want a really in depth discussion of this question with one of Oracles head honchos, check out what Tom Kyte has...
null
CC BY-SA 2.5
null
2008-08-31T17:11:47.073
2008-08-31T17:11:47.073
null
null
3,839
null
36,957
2
null
18,450
21
null
The recommendations for the accepted answer are a little out of date now. - [Paint-Mono](http://code.google.com/p/paint-mono/)- -
null
CC BY-SA 2.5
null
2008-08-31T16:53:49.893
2008-08-31T16:53:49.893
null
null
3,798
null
36,777
2
null
36,733
5
null
I would store the referring URL using the [ViewState](http://msdn.microsoft.com/en-us/library/system.web.ui.control.viewstate.aspx). Storing this outside the scope of the page (i.e. in the Session state or cookie) may cause problems if more than one browser window is open. The example below validates that the page was...
null
CC BY-SA 2.5
null
2008-08-31T11:21:17.603
2008-08-31T22:43:59.240
2008-08-31T22:43:59.240
3,139
3,139
null
36,972
2
null
27,568
11
null
> I've found a few bits of software that suggest they might do this - but they either refuse to compile, or don't seem to work properly. Has anyone got any suggestions? Write one. You're best off picking a nice, simple instruction set (Z80 should be perfect). I remember doing this as a first-year undergraduate exerc...
null
CC BY-SA 2.5
null
2008-08-31T17:11:41.253
2008-08-31T17:11:41.253
null
null
3,653
null
36,978
2
null
36,953
5
null
Have a look at the standard module [shlex](http://docs.python.org/lib/module-shlex.html) and modify one copy of it to match the syntax you use for your shell, it is a good starting point If you want all the power of a complete solution for lexing/parsing, [ANTLR](https://github.com/antlr/antlr4/blob/master/doc/python-...
null
CC BY-SA 4.0
null
2008-08-31T17:14:06.990
2020-05-22T08:05:20.127
2020-05-22T08:05:20.127
927
927
null
36,986
2
null
36,984
0
null
I've always done it exactly the way you're describing. I'm curious to see if there's a more accepted approach.
null
CC BY-SA 2.5
null
2008-08-31T17:29:29.713
2008-08-31T17:29:29.713
null
null
305
null
36,988
2
null
36,984
3
null
> No, it sounds like you're using the right approach. If the dialog returns DialogResult.OK, assume that all the necessary properties in the dialog are valid.
null
CC BY-SA 2.5
null
2008-08-31T17:36:44.080
2008-08-31T17:36:44.080
null
null
2,773
null
36,983
2
null
20,811
1
null
I don't think there is really anything that is going to do this. If you could setup a local Oracle database, then most likely you could as oracle has various means of keeping two databases "in sync", provided they are both Oracle. If you must use mysql, then likely you are going to just have to write something to sync...
null
CC BY-SA 2.5
null
2008-08-31T17:24:19.227
2008-09-16T00:15:08.737
2008-09-16T00:15:08.737
3,839
3,839
null
36,979
2
null
36,959
15
null
FWIW, the real problem was that I had included a semicolon at the end of my \set command: > \set owner_password 'thepassword'; The semicolon was interpreted as an actual character in the variable: > \echo :owner_password thepassword; So when I tried to use it: > CREATE ROLE myrole LOGIN UNENCRYPTED PASSWORD :own...
null
CC BY-SA 2.5
null
2008-08-31T17:14:56.817
2008-08-31T17:14:56.817
null
null
3,488
null
36,990
2
null
36,949
4
null
I don't think this is a good idea just like reading files or accessing the database in unit tests isn't a good idea. Your tests will become dependent on the state of an external piece of software. Or you will have a lot of setup and teardown code. If you write tests this way you can expect you'll spend a lot of extra t...
null
CC BY-SA 2.5
null
2008-08-31T17:38:43.357
2008-08-31T17:38:43.357
null
null
3,320
null
36,993
2
null
36,984
9
null
I would say exposing properties on your custom dialog is the idiomatic way to go because that is how standard dialogs (like the Select/OpenFileDialog) do it. Someone could argue it is more explicit and intention revealing to have a ShowBirthdayDialog() method that returns the result you're looking for, but following th...
null
CC BY-SA 2.5
null
2008-08-31T17:50:56.620
2008-08-31T17:50:56.620
null
null
470
null
36,984
1
36,993
null
6
342
So right now my project has a few custom dialogs that do things like prompt the user for his birthday, or whatever. Right now they're just doing things like setting a `this.Birthday` property once they get an answer (which is of type `DateTime?`, with the null indicating a "Cancel"). Then the caller inspects the `Birth...
Is there a standard way to return values from custom dialogs in Windows Forms?
CC BY-SA 2.5
null
2008-08-31T17:28:11.497
2008-09-25T11:20:42.997
2008-09-25T11:20:43.013
615
3,191
[ ".net", "winforms", "user-interface" ]
36,989
2
null
36,959
72
null
One final word on PSQL variables: 1. They don't expand if you enclose them in single quotes in the SQL statement. Thus this doesn't work: SELECT * FROM foo WHERE bar = ':myvariable' 2. To expand to a string literal in a SQL statement, you have to include the quotes in the variable set. However, the variable value alr...
null
CC BY-SA 3.0
null
2008-08-31T17:36:49.853
2014-05-07T17:57:11.883
2014-05-07T17:57:11.883
238,814
3,488
null
36,994
2
null
3,748
31
null
The trick here is to not become a zealot. One thing to note here is that no one in the pro file system camp has listed a particular file system. Does this mean that everything from FAT16 to ZFS handily beats every database? No. The truth is that many databases beat many files systems, even when we're only talking ...
null
CC BY-SA 2.5
null
2008-08-31T17:54:01.417
2008-08-31T17:54:01.417
null
null
3,886
null
36,995
2
null
36,144
3
null
The answer to this was found by [shog9](https://stackoverflow.com/questions/36958/stackoverflow-ubiquity-command#36962). The postData parameter needs to be a `nsIMIMEInputStream` object as detailed in [here](http://developer.mozilla.org/index.php?title=En/Code_snippets/Post_data_to_window).
null
CC BY-SA 3.0
null
2008-08-31T17:54:40.777
2015-07-14T02:49:01.290
2017-05-23T12:13:34.533
-1
3,288
null
36,956
1
null
null
0
480
A Windows Forms application of ours pulls records from a view on SQL Server through ADO.NET and a SOAP web service, displaying them in a data grid. We have had several cases with ~25,000 rows, which works relatively smoothly, but a potential customer needs to have many times that much in a single list. To figure out h...
Simulating queries of large views for benchmarking purposes
CC BY-SA 2.5
null
2008-08-31T16:53:02.453
2008-10-26T21:29:47.897
2008-10-26T21:29:47.897
1,600
1,600
[ "sql-server-2005", "ado.net", "benchmarking" ]
36,996
2
null
36,956
0
null
If you want results you can rely on you need to make the testing scenario as realistic as possible, which makes option 1 by far your best bet. As you point out if you get results that aren't good enough with the other options you won't be sure that it wasn't due to the different database behaviour. How you generate t...
null
CC BY-SA 2.5
null
2008-08-31T17:57:43.780
2008-08-31T17:57:43.780
null
null
3,631
null
36,999
1
37,012
null
26
11,395
I'm starting to work with my model almost exclusively in WCF and wanted to get some practical approaches to versioning these services over time. Can anyone point me in the right direction?
Best practices for versioning your services with WCF?
CC BY-SA 2.5
0
2008-08-31T18:05:49.207
2018-06-26T05:26:31.207
2011-03-07T12:52:10.870
241,776
2,701
[ "wcf", "versioning", "backwards-compatibility" ]
36,991
1
37,001
null
1
1,638
So, I am a total beginner in any kind of `Windows` related programming. I have been playing around with the `Windows` `API` and came across a couple of examples on how to initialize create windows and such. One example creates a regular window (I abbreviated some of the code): ``` int WINAPI WinMain( [...] ) { ...
Do you have to register a Dialog Box?
CC BY-SA 3.0
null
2008-08-31T17:45:46.227
2015-12-14T12:37:43.987
2015-12-14T12:37:43.987
1,221,236
2,386
[ "c++", "winapi" ]
37,002
2
null
22,708
1
null
This does what you want in VBA ``` Function GetNthExcelColName(n As Integer) As String Dim s As String s = Cells(1, n).Address GetNthExcelColName = Mid(s, 2, InStr(2, s, "$") - 2) End Function ```
null
CC BY-SA 2.5
null
2008-08-31T18:12:13.213
2008-08-31T18:12:13.213
null
null
224
null
37,004
2
null
36,956
0
null
The data is typically CRM-like, i.e. contacts, projects, etc. It would be fine to simply duplicate the data (e.g., if I only have 20,000 rows, I'll copy them five times to get my desired 100,000 rows). Merging, on the other hand, would only work if we never deploy the benchmarking tool publicly, for obvious privacy rea...
null
CC BY-SA 2.5
null
2008-08-31T18:12:52.277
2008-08-31T18:12:52.277
null
null
1,600
null
37,005
2
null
31,584
15
null
@pek Chained invocation is one of proposals for Java 7. It says that if a method return type is void, it should implicitly return . If you're interested in this topic, there is a bunch of links and a simple example on [Alex Miller's Java 7 page](http://tech.puredanger.com/java7#chained).
null
CC BY-SA 2.5
null
2008-08-31T18:14:27.953
2008-08-31T18:14:27.953
null
null
3,666
null
37,000
2
null
36,932
55
null
Python doesn't have a built-in equivalent to `enum`, and other answers have ideas for implementing your own (you may also be interested in the [over the top version](http://code.activestate.com/recipes/67107/) in the Python cookbook). However, in situations where an `enum` would be called for in C, I usually end up : ...
null
CC BY-SA 2.5
null
2008-08-31T18:10:50.050
2008-09-01T13:26:06.700
2008-09-01T13:26:06.700
3,002
3,002
null
37,009
2
null
36,806
7
null
What happens if you remove the `Alias /` directive?
null
CC BY-SA 2.5
null
2008-08-31T18:20:51.103
2008-08-31T18:20:51.103
null
null
3,560
null
37,011
1
37,021
null
105
72,508
Should you ever use protected member variables? What are the the advantages and what issues can this cause?
Should you ever use protected member variables?
CC BY-SA 2.5
0
2008-08-31T18:22:46.230
2017-03-28T07:03:46.953
2009-10-09T23:03:43.750
1
3,305
[ "oop", "protected" ]
37,012
2
null
36,999
25
null
There is a good writeup on [Craig McMurtry's WebLog](http://blogs.msdn.com/craigmcmurtry/archive/2006/07/23/676104.aspx). Its from 2006, but most of it is still relevant. As well as a decision tree to walk through the choices, he shows how to implement those changes using Windows Communication Foundation
null
CC BY-SA 2.5
null
2008-08-31T18:23:22.237
2011-01-12T13:25:33.297
2011-01-12T13:25:33.297
2,257
2,257
null
36,997
2
null
23,445
2
null
I'd move to lists and solve it this way: 1. Sort both lists by id ascending using custom Comparator if objects in lists aren't Comparable 2. Iterate over elements in both lists like in merge phase in merge sort algorithm, but instead of merging lists, you check your logic. The code would be more or less like this:...
null
CC BY-SA 2.5
null
2008-08-31T17:58:00.300
2008-08-31T17:58:00.300
null
null
3,666
null
37,021
2
null
37,011
81
null
> Should you ever use protected member variables? Depends on how picky you are about hiding state. - - If a developer comes along and subclasses your class they may mess it up because they don't understand it fully. With private members, other than the public interface, they can't see the implementation specific...
null
CC BY-SA 2.5
null
2008-08-31T18:34:54.003
2010-11-29T13:19:10.767
2010-11-29T13:19:10.767
2,443
2,443
null
36,985
2
null
33,923
230
null
An important point is that tail recursion is essentially equivalent to looping. It's not just a matter of compiler optimization, but a fundamental fact about expressiveness. This goes both ways: you can take any loop of the form ``` while(E) { S }; return Q ``` where `E` and `Q` are expressions and `S` is a sequence...
null
CC BY-SA 3.0
null
2008-08-31T17:29:06.080
2014-08-12T23:28:32.180
2014-08-12T23:28:32.180
1,762,224
1,412
null
37,008
2
null
36,984
2
null
For me sticking with the Dialog returning the standard dialog responses and then accessing the results via properties is the way to go. Two good reasons from where I sit: 1. Consistency - you're always doing the same thing with a dialog and the very nature of the question suggests that patterns are good (-: Although...
null
CC BY-SA 2.5
null
2008-08-31T18:20:13.960
2008-08-31T18:20:13.960
null
null
1,070
null
37,001
2
null
36,991
2
null
You do not have to register a dialog box. Dialog boxes are predefined so (as you noted) there is no reference to a window class when you create a dialog. If you want more control of a dialog (like you get when you create your own window class) you would subclass the dialog which is a method by which you replace the di...
null
CC BY-SA 2.5
null
2008-08-31T18:12:07.443
2008-08-31T22:55:16.420
2008-08-31T22:55:16.420
2,415
2,415
null
37,023
2
null
36,999
6
null
While not an instant answer for you, I found the book [Learning WCF](https://rads.stackoverflow.com/amzn/click/com/0596101627) very useful; in it there's a small section on versioning (which is similar to Craig McMurtry's advice posted by Espo). If you're looking for a general intro book, it's very good. Her website ...
null
CC BY-SA 3.0
null
2008-08-31T18:39:04.117
2011-10-25T09:06:57.503
2011-10-25T09:06:57.503
2,258
2,258
null
37,025
2
null
37,011
33
null
The general feeling nowadays is that they cause undue coupling between derived classes and their bases. They have no particular advantage over protected methods/properties (once upon a time they might have a slight performance advantage), and they were also used more in an era when very deep inheritance was in fashion...
null
CC BY-SA 2.5
null
2008-08-31T18:42:08.337
2008-08-31T18:42:08.337
null
null
987
null
37,006
2
null
36,862
75
null
I would advise against putting unrelated data in a given Git repository. The overhead of creating new repositories is quite low, and that is a that makes it possible to keep different lineages completely separate. Fighting that idea means ending up with unnecessarily tangled history, which renders administration mo...
null
CC BY-SA 2.5
null
2008-08-31T18:17:07.027
2008-09-01T05:25:40.490
2008-09-01T05:25:40.490
3,844
3,844
null
37,028
2
null
22,697
5
null
Yes, Mockito is a great framework. I use it together with [hamcrest](http://code.google.com/p/hamcrest/) and [Google guice](http://code.google.com/p/google-guice/) to setup my tests.
null
CC BY-SA 2.5
null
2008-08-31T18:52:17.127
2008-08-31T18:52:17.127
null
null
3,666
null
37,031
2
null
37,030
2
null
If your application is written in .Net, you could try [ClickOnce](http://msdn.microsoft.com/en-us/library/142dbbz4.aspx). However, it's difficult to perform administrative or custom actions during install using this approach.
null
CC BY-SA 2.5
null
2008-08-31T19:02:19.257
2008-08-31T19:02:19.257
null
null
637
null
37,010
2
null
33,923
2,031
null
Consider a simple function that adds the first N natural numbers. (e.g. `sum(5) = 0 + 1 + 2 + 3 + 4 + 5 = 15`). Here is a simple JavaScript implementation that uses recursion: ``` function recsum(x) { if (x === 0) { return 0; } else { return x + recsum(x - 1); } } ``` If you called `recsum(...
null
CC BY-SA 4.0
null
2008-08-31T18:21:13.897
2021-08-28T18:08:34.823
2021-08-28T18:08:34.823
3,982,562
742
null
37,030
1
37,035
null
23
7,929
I want to implement an "automatic update" system for a windows application. Right now I'm semi-manually creating an ["appcast"](http://connectedflow.com/appcasting/) which my program checks, and notifies the user that a new version is available. (I'm using [NSIS](http://nsis.sourceforge.net/Main_Page) for my install...
How to best implement software updates on windows?
CC BY-SA 2.5
0
2008-08-31T18:57:29.050
2013-03-04T06:38:45.843
null
null
3,002
[ "windows", "installation" ]
37,024
2
null
37,011
2
null
For detailed info on .Net access modifiers [go here](https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1027680.html) There are no real advantages or disadvantages to protected member variables, it's a question of what you need in your specific situation. In general it is accepted pra...
null
CC BY-SA 2.5
null
2008-08-31T18:40:04.800
2008-08-31T18:40:04.800
2015-08-20T04:41:57.227
-1
2,133
null
37,034
2
null
36,991
2
null
It's been a while since I've done this, but IIRC, the first case is for creating a dialog dynamically, from an in-memory template. The second example is for the far more common case of creating a dialog using a resource. The dynamic dialog stuff in Win32 was fairly complex, but it allowed you to create a true data-driv...
null
CC BY-SA 2.5
null
2008-08-31T19:10:09.427
2008-08-31T19:10:09.427
null
null
3,114
null
37,037
2
null
36,984
1
null
For modal input dialogs, I typically overload ShowDialog and pass out params for the data I need. ``` DialogResult ShowDialog(out datetime birthday) ``` I generally find that it's easier to discover and understand vs mixing my properties with the 100+ that the Form class exposes. For forms, I normally have a Contro...
null
CC BY-SA 2.5
null
2008-08-31T19:14:18.900
2008-08-31T19:14:18.900
null
null
2,199
null
37,032
2
null
37,030
3
null
For .NET, a while back Microsoft Patterns + Practices published the [Application Updater Block](http://msdn.microsoft.com/en-us/library/ms978574.aspx). This was (to my mind) rather overblown and over-engineered, but did the job quite well. In essence it used a "stub loader" to check a manifest and a Web service to see...
null
CC BY-SA 2.5
null
2008-08-31T19:04:09.080
2008-08-31T19:04:09.080
null
null
3,546
null
37,038
2
null
37,026
4
null
`notify()` will wake up one thread while `notifyAll()` will wake up all. As far as I know there is no middle ground. But if you are not sure what `notify()` will do to your threads, use `notifyAll()`. Works like a charm everytime.
null
CC BY-SA 2.5
null
2008-08-31T19:19:21.713
2008-08-31T19:19:21.713
null
null
3,713
null
37,035
2
null
37,030
7
null
There is no solution quite as smooth as Sparkle (that I know of). If you need an easy means of deployment and updating applications, [ClickOnce](http://en.wikipedia.org/wiki/ClickOnce) is an option. Unfortunately, it's inflexible (e.g., no per-machine installation instead of per-user), opaque (you have very little inf...
null
CC BY-SA 2.5
null
2008-08-31T19:10:46.227
2008-08-31T19:10:46.227
null
null
1,600
null
37,043
1
37,566
null
33
17,942
I'm currently using and enjoying using the Flex MVC framework [PureMVC](http://www.puremvc.org). I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz. Has anyone tried two or three of these fr...
Flex MVC Frameworks
CC BY-SA 2.5
0
2008-08-31T19:24:55.270
2013-01-17T09:07:15.907
2008-09-10T14:13:48.770
-1
2,885
[ "apache-flex", "model-view-controller", "frameworks" ]
37,039
2
null
44,965
37
null
A monad is, effectively, a form of "type operator". It will do three things. First it will "wrap" (or otherwise convert) a value of one type into another type (typically called a "monadic type"). Secondly it will make all the operations (or functions) available on the underlying type available on the monadic type. Fina...
null
CC BY-SA 3.0
null
2008-08-31T19:19:50.603
2015-08-28T17:10:01.883
2015-08-28T17:10:01.883
63,550
1,737,192
null
37,045
2
null
37,026
19
null
I think it depends on how resources are produced and consumed. If 5 work objects are available at once and you have 5 consumer objects, it would make sense to wake up all threads using notifyAll() so each one can process 1 work object. If you have just one work object available, what is the point in waking up all cons...
null
CC BY-SA 2.5
null
2008-08-31T19:25:10.763
2008-08-31T19:25:10.763
null
null
2,108
null
37,042
2
null
1,005
309
null
`%` is replaced with the current file name, thus you can use: ``` :w !sudo tee % ``` (`vim` will detect that the file has been changed and ask whether you want to it to be reloaded. Say yes by choosing `[L]` rather than OK.) As a shortcut, you can define your own command. Put the following in your `.vimrc`: ``` co...
null
CC BY-SA 4.0
null
2008-08-31T19:23:48.347
2018-12-11T23:21:40.697
2018-12-11T23:21:40.697
1,681,480
null
null
37,029
1
38,434
null
9
44,849
It is generally accepted that the use of cursors in stored procedures should be avoided where possible (replaced with set based logic etc). If you take the cases where you need to iterate over some data, and can do in a read only manner, are fast forward (read only forward) cursor more or less inefficient than say whil...
SQL Server Fast Forward Cursors
CC BY-SA 4.0
0
2008-08-31T18:56:42.203
2023-01-12T11:47:23.510
2022-07-01T09:01:38.727
133
3,898
[ "sql", "sql-server", "stored-procedures" ]