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
165
2
null
145
10
null
You can use a [3rd-party library such as SharpZip](http://sharpdevelop.net/OpenSource/SharpZipLib/) as Tom pointed out. Another way (without going 3rd-party) is to use the Windows Shell API. You'll need to set a reference to the Microsoft Shell Controls and Automation COM library in your C# project. Gerald Gibson has ...
null
CC BY-SA 4.0
null
2008-08-01T18:04:25.023
2019-04-06T14:03:51.080
2019-04-06T14:03:51.080
1,721,793
null
null
166
2
null
163
25
null
You can do it by adding the following anywhere in your code ``` $Id:$ ``` So for example @Jeff did: ``` <div id="svnrevision">svn revision: $Id:$</div> ``` and when checked in the server replaced $Id:$ with the current revision number. I also [found this reference](http://www.compuphase.com/svnrev.htm). There ...
null
CC BY-SA 3.0
null
2008-08-01T18:08:16.590
2015-12-29T06:29:47.283
2015-12-29T06:29:47.283
3,787,519
17
null
167
2
null
164
5
null
You could use conditional comments to get IE and Firefox to do different things ``` <![if !IE]> <p> Firefox only code</p> <![endif]> <!--[if IE]> <p>Internet Explorer only code</p> <![endif]--> ``` The browsers themselves will ignore code that isn't meant for them to read.
null
CC BY-SA 2.5
null
2008-08-01T18:08:53.080
2008-08-01T18:14:56.093
2008-08-01T18:14:56.093
30
30
null
170
2
null
163
32
null
Looks like Jeff is using [CruiseControl.NET](https://web.archive.org/web/20090130045625/http://confluence.public.thoughtworks.org/display/CCNET/What+is+CruiseControl.NET) based on some leafing through the podcast transcripts. This seems to have automated deployment capabilities from source control to production. Might ...
null
CC BY-SA 4.0
null
2008-08-01T18:24:30.550
2020-05-25T03:59:07.680
2020-05-25T03:59:07.680
11,262,648
59
null
159
2
null
104
35
null
Strictly speaking, a memory leak is consuming memory that is "no longer used" by the program. "No longer used" has more than one meaning, it could mean "no more reference to it", that is, totally unrecoverable, or it could mean, referenced, recoverable, unused but the program keeps the references anyway. Only the late...
null
CC BY-SA 2.5
null
2008-08-01T17:52:46.293
2008-08-01T17:52:46.293
null
null
42
null
161
2
null
104
18
null
I would define memory leaks as an object not freeing up all the memory allocated after it has completed. I have found this can happen in your application if you are using Windows API and COM (i.e. unmanaged code that has a bug in it or is not being managed correctly), in the framework and in third party components. I h...
null
CC BY-SA 2.5
null
2008-08-01T17:57:14.117
2008-08-01T17:57:14.117
null
null
33
null
169
2
null
126
44
null
Personally, I feel like it's important to remain consistent. If you have getters and setters, use them. The only time I would access a field directly is when the accessor has a lot of overhead. It may feel like you're bloating your code unnecessarily, but it can certainly save a whole lot of headache in the future. ...
null
CC BY-SA 2.5
null
2008-08-01T18:23:59.040
2008-08-01T18:23:59.040
null
null
93
null
164
1
699
null
64
176,425
This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format [supported by your browsers](https://videojs.com/html5-video-support/) (That would be H.264 if Internet Explorer is nee...
Embedding Windows Media Player for all browsers
CC BY-SA 4.0
0
2008-08-01T18:02:22.797
2020-12-11T16:39:28.800
2020-12-11T16:39:28.800
91
91
[ "windows", "embed", "media" ]
173
1
516
null
337
114,312
I want to get my databases under version control. I'll always want to have at least data in there (as [alumb](https://stackoverflow.com/users/80/alumb) mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements. How would I apply version contro...
How to do version control for SQL Server database?
CC BY-SA 4.0
0
2008-08-01T18:33:08.333
2022-11-03T21:43:30.303
null
6,045,800
83
[ "sql-server", "database", "svn", "version-control" ]
183
2
null
123
70
null
Maybe this might help: [JSefa](http://jsefa.sourceforge.net/quick-tutorial.html) You can read CSV file with this tool and serialize it to XML.
null
CC BY-SA 3.0
null
2008-08-01T18:51:12.090
2013-02-07T10:36:04.283
2013-02-07T10:36:04.283
395,659
86
null
180
1
539
null
71
18,991
This is something I've pseudo-solved many times and have never quite found a solution for. The problem is to come up with a way to generate `N` colors, that are as distinguishable as possible where `N` is a parameter.
Function for creating color wheels
CC BY-SA 4.0
0
2008-08-01T18:42:19.343
2020-07-05T21:49:16.857
2018-05-30T13:53:46.533
5,321,363
2,089,740
[ "algorithm", "language-agnostic", "colors", "color-space" ]
176
1
207
null
124
115,044
On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php `error_log` between virtual hosts. Overriding this setting in the `<Location>` of the `httpd.conf` does not seem to do anything. Is there a way to have separate php `error_logs` for...
error_log per Virtual Host?
CC BY-SA 3.0
0
2008-08-01T18:37:40.150
2021-09-24T21:39:19.047
2018-01-30T17:47:19.737
3,919,949
91
[ "linux", "apache", "virtualhost" ]
190
2
null
123
16
null
I don't understand why you would want to do this. It sounds almost like cargo cult coding. Converting a CSV file to XML doesn't add any value. Your program is already reading the CSV file, so arguing that you need XML doesn't work. On the other hand, reading the CSV file, doing with the values, and then serializing ...
null
CC BY-SA 2.5
null
2008-08-01T19:21:57.517
2008-08-01T19:21:57.517
null
null
55
null
175
1
null
null
53
7,581
I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to generate ...
Annotating YouTube videos programmatically
CC BY-SA 3.0
0
2008-08-01T18:36:14.070
2019-05-23T23:54:08.903
2017-08-21T08:54:47.013
1,836,618
2,089,740
[ "youtube", "reverse-engineering" ]
206
2
null
134
13
null
You can try turning Check-constraints off on the DataSet (it's in its properties), or altering the properties of that relationship, and change the key to a simple reference - up to you.
null
CC BY-SA 3.0
null
2008-08-01T19:52:14.227
2015-12-29T06:30:38.617
2015-12-29T06:30:38.617
3,787,519
35
null
197
2
null
194
11
null
Hey, I'm still stuck in that camp too. The third party application we have to support is FINALLY going to 2K5, so we're almost out of the wood. But I feel your pain 8^D That said, from everything I heard from our DBA, the key is to convert the database to 8.0 format first, and then go to 2005. I believe they used the ...
null
CC BY-SA 2.5
null
2008-08-01T19:34:49.067
2008-08-01T19:34:49.067
null
null
71
null
174
1
null
null
86
17,297
I want to print HTML from a C# web service. The web browser control is overkill, and does not function well in a service environment, nor does it function well on a system with very tight security constraints. Is there any sort of free `.NET` library that will support the printing of a basic HTML page? Here is the c...
How do I print an HTML document from a web service?
CC BY-SA 4.0
0
2008-08-01T18:33:48.287
2020-03-23T09:05:56.123
2018-12-13T17:30:17.253
4,551,041
96
[ "c#", "html", "web-services", "printing" ]
195
2
null
173
40
null
This is one of the "hard problems" surrounding development. As far as I know there are no perfect solutions. If you only need to store the database structure and not the data you can export the database as SQL queries. (in Enterprise Manager: Right click on database -> Generate SQL script. I recommend setting the "cr...
null
CC BY-SA 2.5
null
2008-08-01T19:28:25.447
2008-08-01T19:28:25.447
null
null
80
null
192
1
258
null
72
3,525
One of the fun parts of multi-cultural programming is number formats. - - - My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decimal separator. There is an obvious flaw with that: 10.000 would be interpreted as 10. Another approach: if the string con...
Floating Point Number parsing: Is there a Catch All algorithm?
CC BY-SA 4.0
null
2008-08-01T19:23:13.117
2019-04-17T14:27:09.093
2019-01-20T13:48:20.567
567,854
91
[ "c#", ".net", "asp.net", "internationalization", "globalization" ]
210
2
null
192
28
null
I don't know the ASP.NET side of the problem but .NET has a pretty powerful class: [System.Globalization.CultureInfo](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo). You can use the following code to parse a string containing a double value: ``` double d = double.Parse("100.20", CultureInfo.C...
null
CC BY-SA 4.0
null
2008-08-01T20:02:08.357
2019-04-17T14:27:09.093
2019-04-17T14:27:09.093
8,320,555
39
null
207
2
null
176
89
null
To set the () log, the easiest way to do this would be to do: ``` <VirtualHost IP:Port> # Stuff, # More Stuff, ErrorLog /path/where/you/want/the/error.log </VirtualHost> ``` If there is no leading "/" it is assumed to be relative. [Apache Error Log Page](http://httpd.apache.org/docs/1.3/mod/core.html#erro...
null
CC BY-SA 2.5
null
2008-08-01T19:58:45.837
2011-03-31T09:31:50.077
2011-03-31T09:31:50.077
177,002
50
null
212
2
null
192
13
null
You can't please everyone. If I enter ten as 10.000, and someone enters ten thousand as 10.000, you cannot handle that without some knowledge of the culture of the input. Detect the culture somehow (browser, system setting - what is the use case? ASP? Internal app, or open to the world?), or provide an example of t...
null
CC BY-SA 2.5
null
2008-08-01T20:05:12.750
2008-08-01T20:05:12.750
null
null
96
null
227
1
2,943,318
null
80
9,377
I have the following arrays: ``` $artist = array("the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"); $count = array(5, 3, 9, 1, 1, 3); ``` I want to generate a tag cloud that will have artists with a higher number in `$count` enclosed in `h6` tags and the lowest enclosed `h1` tags.
What's the best way to generate a tag cloud from an array using h1 through h6 for sizing?
CC BY-SA 3.0
0
2008-08-01T21:40:55.833
2020-07-04T16:59:41.730
2019-11-23T20:43:24.447
213,269
146,637
[ "php", "arrays", "tag-cloud" ]
199
2
null
180
3
null
I've read somewhere the human eye can't distinguish between less than 4 values apart. so This is something to keep in mind. The following algorithm does not compensate for this. I'm not sure this is exactly what you want, but this is one way to randomly generate non-repeating color values: (beware, inconsistent pseud...
null
CC BY-SA 2.5
null
2008-08-01T19:36:46.067
2008-08-01T19:36:46.067
null
null
50
null
236
2
null
176
9
null
The default behaviour for error_log() is to output to the Apache error log. If this isn't happening check your php.ini settings for the error_log directive. Leave it unset to use the Apache log file for the current vhost.
null
CC BY-SA 4.0
null
2008-08-01T22:20:05.117
2020-07-25T09:30:48.260
2020-07-25T09:30:48.260
10,325,630
48
null
231
1
1,812
null
43
30,865
How do I make it so `mailto:` links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for users of my program if they click a button, such as "set as default emai...
Register Windows program with the mailto protocol programmatically
CC BY-SA 4.0
0
2008-08-01T22:08:14.453
2022-01-22T21:49:54.237
2022-01-22T21:49:54.237
298,423
62
[ "windows", "mailto" ]
229
2
null
9
93
null
Another function, not by me but found on the web and refined it a bit: ``` public static int GetAge(DateTime birthDate) { DateTime n = DateTime.Now; // To avoid a race condition around midnight int age = n.Year - birthDate.Year; if (n.Month < birthDate.Month || (n.Month == birthDate.Month && n.Day < birth...
null
CC BY-SA 4.0
null
2008-08-01T21:46:12.313
2020-02-29T01:31:03.617
2020-02-29T01:31:03.617
63,550
91
null
246
1
176,741
null
45
3,100
Does anybody know if there is a way to create an SQLite database based on an XSD `DataSet`? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my `.NET` development if possible.
Create a SQLite database based on an XSD Data Set
CC BY-SA 4.0
null
2008-08-01T22:34:42.853
2020-12-11T13:35:48.497
2020-02-24T11:07:22.580
7,014,431
71
[ ".net", "database", "sqlite" ]
258
2
null
192
32
null
I think the best you can do in this case is to take their input and then show them what you think they meant. If they disagree, show them the format you're expecting and get them to enter it again.
null
CC BY-SA 2.5
null
2008-08-01T23:17:53.657
2008-08-01T23:17:53.657
null
null
55
null
238
2
null
234
20
null
The functionality you're looking for is traditionally called an UPSERT. Atleast knowing what it's called might help you find what you're looking for. I don't think SQL Server 2005 has any great ways of doing this. 2008 introduces the MERGE statement that can be used to accomplish this as shown in: [http://www.database...
null
CC BY-SA 2.5
null
2008-08-01T22:22:37.823
2008-08-01T22:22:37.823
null
null
34
null
243
2
null
234
17
null
What the upsert/merge is doing is something to the effect of... ``` IF EXISTS (SELECT * FROM [Table] WHERE Id = X) UPDATE [Table] SET... ELSE INSERT INTO [Table] ``` So hopefully the combination of those articles and this pseudo code can get things moving.
null
CC BY-SA 2.5
null
2008-08-01T22:31:36.137
2008-08-01T22:31:36.137
null
null
71
null
234
1
12,202
null
89
49,495
MySQL has this incredibly useful yet proprietary `REPLACE INTO` SQL Command. Can this easily be emulated in SQL Server 2005? Starting a new Transaction, doing a `Select()` and then either `UPDATE` or `INSERT` and `COMMIT` is always a little bit of a pain, especially when doing it in the application and therefore alw...
SQL Server 2005 implementation of MySQL REPLACE INTO?
CC BY-SA 4.0
0
2008-08-01T22:13:34.100
2020-07-27T01:42:16.993
2020-02-24T11:06:06.070
7,014,431
91
[ "mysql", "sql-server", "sql-server-2005" ]
233
2
null
231
13
null
From what I've seen, there are a few registry keys that set the default mail client. One of them is: System Key: `[HKEY_CLASSES_ROOT\mailto\shell\open\command]` Value Name: `(Default)` Data Type: `REG_SZ` (String Value) Value Data: `Mail program command-line`. I'm not familiar with `Delphi 7`, but I'm sure there are s...
null
CC BY-SA 4.0
null
2008-08-01T22:12:30.170
2020-07-19T18:55:35.700
2020-07-19T18:55:35.700
10,325,630
71
null
253
2
null
227
34
null
Off the top of my head... ``` $artist = array("the roots","michael jackson","billy idol","more","and more","and_YET_MORE"); $count = array(5,3,9,1,1,3); $highest = max($count); for (int $x = 0; $x < count($artist); $x++) { $normalized = $count[$x] / $highest; $heading = ceil($normalized * 6); // 6 heading type...
null
CC BY-SA 4.0
null
2008-08-01T23:10:56.510
2018-10-06T13:31:08.213
2018-10-06T13:31:08.213
2,071,697
55
null
265
1
266
null
38
3,255
What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories? I develop a lot of DotNetNuke sites and it seems that in a multi-developer environment, it's always...
Best Practice: Collaborative Environment, Bin Directory, SVN
CC BY-SA 2.5
0
2008-08-01T23:29:32.853
2008-11-08T15:41:49.307
2008-11-08T15:41:49.323
4,337
105
[ "svn", "collaboration" ]
268
2
null
265
4
null
Is this a .Net specific question? Generally the best practice is to not check in anything which is built automatically from files that are already in SCM. All of that is ideally created as part of your automatic build process. If the `bin` directory you're referring to contains third-party binaries, rather than a bu...
null
CC BY-SA 2.5
null
2008-08-01T23:44:05.883
2008-08-01T23:44:05.883
null
null
101
null
266
2
null
265
19
null
Any assemblies that are expected to be in the GAC should stay in the GAC. This includes System.web.dll or any other 3rd party dll that you'll deploy to the GAC in production. This means a new developer would have to install these assemblies. All other 3rd party assemblies should be references through a relative path. ...
null
CC BY-SA 2.5
null
2008-08-01T23:40:28.463
2008-08-01T23:40:28.463
null
null
34
null
274
2
null
227
8
null
@Ryan That's correct but it actually makes the tags with the least number, larger. This code has been tested: ``` $artist = array("the roots","michael jackson","billy idol","more","and more","and_YET_MORE"); $count = array(5,3,9,1,1,3); $highest = max($count); for ($x = 0; $x < count($artist); $x++) { $normalize...
null
CC BY-SA 2.5
null
2008-08-01T23:58:35.650
2008-08-01T23:58:35.650
null
null
40
null
290
2
null
174
8
null
I know that Visual Studio itself (at least in 2003 version) references the IE dll directly to render the "Design View". It may be worth looking into that. Otherwise, I can't think of anything beyond the Web Browser control.
null
CC BY-SA 2.5
null
2008-08-02T00:42:35.310
2008-08-02T00:42:35.310
null
null
106
null
260
1
307
null
83
21,890
I have a little game written in C#. It uses a database as back-end. It's a [trading card game](http://en.wikipedia.org/wiki/Collectible_card_game), and I wanted to implement the function of the cards as a script. What I mean is that I essentially have an interface, `ICard`, which a card class implements (`public clas...
Adding scripting functionality to .NET applications
CC BY-SA 4.0
0
2008-08-01T23:22:08.983
2021-05-09T11:05:44.630
2020-02-24T11:07:04.697
7,014,431
91
[ "c#", ".net", "scripting", "compiler-construction" ]
269
2
null
260
4
null
Yes, I thought about that, but I soon figured out that another Domain-Specific-Language (DSL) would be a bit too much. Essentially, they need to interact with my gamestate in possibly unpredictable ways. For example, a card could have a rule "When this cards enter play, all your undead minions gain +3 attack against f...
null
CC BY-SA 2.5
null
2008-08-01T23:49:57.103
2010-11-26T15:39:08.390
2010-11-26T15:39:08.390
63,550
91
null
264
1
null
null
38
2,840
- - I've read the manual and know how to set the number of locks, lockers, database page size, etc. but I'd just like some advice from someone who has real-world experience with BDB concurrency. My application is pretty simple, I'll be doing gets and puts of records that are about 1KB each. No cursors, no deleting.
BerkeleyDB Concurrency
CC BY-SA 3.0
0
2008-08-01T23:28:51.577
2017-08-24T09:07:21.703
2017-08-24T09:07:21.703
1,836,618
104
[ "c++", "berkeley-db" ]
194
1
197
null
40
4,661
Yes, I know. The existence of a running copy of `SQL Server 6.5` in 2008 is absurd. That stipulated, what is the best way to migrate from `6.5` to `2005`? Is there any direct path? Most of the documentation I've found deals with upgrading `6.5` to `7`. Should I forget about the native `SQL Server` upgrade utilitie...
Upgrading SQL Server 6.5
CC BY-SA 3.0
0
2008-08-01T19:26:37.883
2017-01-17T09:38:49.320
2012-06-12T05:35:46.927
165,216
60
[ "sql-server", "migration" ]
289
1
298
null
929
774,121
I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency. There is a `SortedList` which is good for a single value (say frequency), that I want to map back to the word. [SortedDictionary](http://msdn.micros...
How do you sort a dictionary by value?
CC BY-SA 4.0
0
2008-08-02T00:40:58.200
2023-01-06T08:47:58.973
2022-02-20T04:27:56.023
17,142,802
109
[ "c#", ".net", "sorting", "dictionary" ]
291
2
null
289
178
null
Looking around, and using some C# 3.0 features we can do this: ``` foreach (KeyValuePair<string,int> item in keywordCounts.OrderBy(key=> key.Value)) { // do something with item.Key and item.Value } ``` This is the cleanest way I've seen and is similar to the Ruby way of handling hashes.
null
CC BY-SA 3.0
null
2008-08-02T00:43:38.837
2013-01-29T17:11:28.363
2013-01-29T17:11:28.363
1,796,930
109
null
263
1
607
null
42
11,249
I have been trying to implement Win32's `MessageBox` using GTK. The app uses SDL/OpenGL, so this isn't a GTK app. I handle the initialization (`gtk_init`) sort of stuff inside the `MessageBox` function as follows: ``` int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type) { GtkWidget *window = ...
GTK implementation of MessageBox
CC BY-SA 4.0
0
2008-08-01T23:27:24.993
2020-07-08T14:45:18.700
2020-07-04T15:57:23.873
10,325,630
61
[ "c", "linux", "gtk", "x11" ]
292
2
null
289
66
null
On a high level, you have no other choice than to walk through the whole Dictionary and look at each value. Maybe this helps: [http://bytes.com/forum/thread563638.html](http://bytes.com/forum/thread563638.html) Copy/Pasting from John Timney: ``` Dictionary<string, string> s = new Dictionary<string, string>(); s.Add("...
null
CC BY-SA 4.0
null
2008-08-02T00:47:48.797
2019-10-17T07:24:37.820
2019-10-17T07:24:37.820
5,516,339
91
null
298
2
null
289
565
null
Use: ``` using System.Linq.Enumerable; ... List<KeyValuePair<string, string>> myList = aDictionary.ToList(); myList.Sort( delegate(KeyValuePair<string, string> pair1, KeyValuePair<string, string> pair2) { return pair1.Value.CompareTo(pair2.Value); } ); ``` Since you're targeting .NET 2.0 or ...
null
CC BY-SA 3.0
null
2008-08-02T01:15:42.123
2017-08-31T23:01:42.820
2017-08-31T23:01:42.820
63,550
49
null
310
2
null
308
10
null
Most database engines should support dumping your database into a file. I know MySQL does, anyway. This will just be a text file, so you could submit that to Subversion, or whatever you use. It'd be easy to run a diff on the files too.
null
CC BY-SA 2.5
null
2008-08-02T01:56:51.573
2008-08-02T01:56:51.573
null
null
55
null
297
2
null
176
15
null
I usually just specify this in an `.htaccess` file the `vhost.conf` on the domain I'm working on. Add this to one of these files: ``` php_admin_value error_log "/var/www/vhosts/example.com/error_log" ```
null
CC BY-SA 3.0
null
2008-08-02T01:10:41.027
2015-12-03T10:00:31.413
2015-12-03T10:00:31.413
1,306,684
40
null
308
1
360
null
130
36,810
I often run into the following problem. I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always remember what ...
Is there a version control system for database structure changes?
CC BY-SA 3.0
0
2008-08-02T01:52:54.653
2017-04-13T05:50:35.627
2016-09-30T04:32:25.543
116
106
[ "sql", "database", "oracle", "version-control" ]
328
1
7,488
null
125
85,246
What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place!
PHP Session Security
CC BY-SA 3.0
0
2008-08-02T02:41:34.493
2012-07-18T17:21:23.430
2012-05-04T09:39:26.510
1,039,608
59
[ "security", "php" ]
329
2
null
328
15
null
One guideline is to call [session_regenerate_id](http://www.php.net/session_regenerate_id) every time a session's security level changes. This helps prevent session hijacking.
null
CC BY-SA 2.5
null
2008-08-02T02:43:42.790
2008-08-02T02:43:42.790
null
null
59
null
304
2
null
109
8
null
Try removing the `0x` first and then call `Encoding.UTF8.GetString`. I think that may work. Essentially: 0x44004500 Remove the 0x, and then always two bytes are one character: ``` 44 00 = D 45 00 = E 6F 00 = o 72 00 = r ``` So it's definitely a Unicode/UTF format with two bytes/character.
null
CC BY-SA 3.0
null
2008-08-02T01:38:14.077
2015-01-08T17:01:20.193
2015-01-08T17:01:20.193
63,550
91
null
335
2
null
328
3
null
This is pretty trivial and obvious, but be sure to [session_destroy](http://www.php.net/session_destroy) after every use. This can be difficult to implement if the user does not log out explicitly, so a timer can be set to do this. Here is a good [tutorial](http://www.elated.com/articles/javascript-timers-with-settime...
null
CC BY-SA 2.5
null
2008-08-02T03:16:19.480
2008-08-02T03:24:12.787
2008-08-02T03:24:12.787
50
50
null
337
1
342
null
82
10,260
I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in Python. ...
XML Processing in Python
CC BY-SA 3.0
0
2008-08-02T03:35:55.697
2021-11-12T18:56:21.143
2016-12-30T12:56:21.493
2,336,654
111
[ "python", "xml" ]
332
2
null
330
30
null
I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a "multimedia driver" to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate medi...
null
CC BY-SA 3.0
null
2008-08-02T03:00:24.613
2013-02-17T00:10:18.417
2013-02-17T00:10:18.417
560,441
59
null
330
1
332
null
58
4,889
I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like `play()`, `stop()`, `pause()`, `record()` etc... Then I have workhorse classes which do the video decoding and video encoding. I just learned about the existence...
Should I use nested classes in this case?
CC BY-SA 3.0
null
2008-08-02T02:51:36.470
2013-03-27T20:24:09.153
2012-09-03T08:53:51.277
204,623
63
[ "c++", "oop", "class", "nested-class" ]
336
1
339
null
89
26,935
When is it appropriate to use an unsigned variable over a signed one? What about in a `for` loop? I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. ``` for (unsigned int i = 0; i < someThing.length(); i++) { SomeThing var = someThing.at(i); // You get t...
When to use unsigned values over signed ones?
CC BY-SA 3.0
0
2008-08-02T03:34:44.763
2021-09-02T11:28:18.467
2013-07-07T15:23:23.477
63,550
61
[ "language-agnostic", "types" ]
339
2
null
336
78
null
I was glad to find [a good conversation](https://web.archive.org/web/20170323034837/http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2004-02/1382.html) on this subject, as I hadn't really given it much thought before. In summary, signed is a good general choice - even when you're dead sure all the numbers are posi...
null
CC BY-SA 4.0
null
2008-08-02T03:49:21.987
2021-09-02T11:28:18.467
2021-09-02T11:28:18.467
1,593,077
59
null
331
2
null
328
11
null
I think one of the major problems (which is being addressed in PHP 6) is register_globals. Right now one of the standard methods used to avoid `register_globals` is to use the `$_REQUEST`, `$_GET` or `$_POST` arrays. The "correct" way to do it (as of 5.2, although it's a little buggy there, but stable as of 6, which i...
null
CC BY-SA 3.0
null
2008-08-02T02:55:07.743
2012-05-04T09:41:40.143
2012-05-04T09:41:40.143
1,039,608
58
null
344
2
null
260
8
null
You might be able to use IronRuby for that. Otherwise I'd suggest you have a directory where you place precompiled assemblies. Then you could have a reference in the DB to the assembly and class, and use reflection to load the proper assemblies at runtime. If you really want to compile at run-time you could use the ...
null
CC BY-SA 4.0
null
2008-08-02T04:18:15.517
2019-04-10T12:12:30.857
2019-04-10T12:12:30.857
8,320,555
100
null
354
2
null
336
6
null
`size_t` is often a good choice for this, or `size_type` if you're using an STL class.
null
CC BY-SA 3.0
null
2008-08-02T05:51:57.247
2012-08-23T17:27:58.057
2012-08-23T17:27:58.057
148,195
116
null
307
2
null
260
43
null
[Oleg Shilo's C# Script solution (at The Code Project](https://www.codeproject.com/Articles/8656/C-Script-The-Missing-Puzzle-Piece)) really is a great introduction to providing script abilities in your application. A different approach would be to consider a language that is specifically built for scripting, such as [...
null
CC BY-SA 4.0
null
2008-08-02T01:49:46.220
2019-12-24T07:28:19.907
2019-12-24T07:28:19.907
5,407,188
49
null
359
2
null
260
6
null
You could use any of the DLR languages, which provide a way to really easily host your own scripting platform. However, you don't have to use a scripting language for this. You could use C# and compile it with the C# code provider. As long as you load it in its own AppDomain, you can load and unload it to your heart's ...
null
CC BY-SA 2.5
null
2008-08-02T06:16:23.967
2008-08-02T06:16:23.967
null
null
119
null
356
2
null
308
9
null
For Oracle, I use [Toad](http://www.toadsoft.com/), which can dump a schema to a number of discrete files (e.g., one file per table). I have some scripts that manage this collection in Perforce, but I think it should be easily doable in just about any revision control system.
null
CC BY-SA 2.5
null
2008-08-02T06:05:04.770
2009-01-21T16:07:11.617
2009-01-21T16:07:11.617
106
116
null
342
2
null
337
36
null
Personally, I've played with several of the built-in options on an XML-heavy project and have settled on [pulldom](http://docs.python.org/lib/module-xml.dom.pulldom.html) as the best choice for less complex documents. Especially for small simple stuff, I like the event-driven theory of parsing rather than setting up a...
null
CC BY-SA 2.5
null
2008-08-02T04:01:34.600
2008-08-02T04:01:34.600
null
null
59
null
347
2
null
336
10
null
In your example above, when 'i' will always be positive and a higher range would be beneficial, unsigned would be useful. Like if you're using 'declare' statements, such as: ``` #declare BIT1 (unsigned int 1) #declare BIT32 (unsigned int reallybignumber) ``` Especially when these values will never change. However,...
null
CC BY-SA 2.5
null
2008-08-02T04:31:54.803
2008-08-02T04:31:54.803
null
null
50
null
352
2
null
36
101
null
Take a look at the CHECKSUM command: ``` SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM sample_table WITH (NOLOCK); ``` That will return the same number each time it's run as long as the table contents haven't changed. See my post on this for more information: [CHECKSUM](http://msdn.microsoft.com/en-us/library/aa2582...
null
CC BY-SA 3.0
null
2008-08-02T05:20:22.397
2013-01-28T03:44:42.550
2013-01-28T03:44:42.550
null
5
null
361
1
362
null
164
212,115
How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work, but it should be portable.
Generate list of all possible permutations of a string
CC BY-SA 3.0
0
2008-08-02T06:57:57.957
2022-10-10T12:29:07.703
2022-10-10T12:29:07.703
8,404,453
115
[ "string", "language-agnostic", "cross-platform", "permutation", "combinatorics" ]
363
2
null
308
7
null
There's a PHP5 "database migration framework" called Ruckusing. I haven't used it, but the [examples](http://code.google.com/p/ruckusing/wiki/CompleteExamples) show the idea, if you use the language to create the database as and when needed, you only have to track source files.
null
CC BY-SA 2.5
null
2008-08-02T07:48:56.107
2008-08-02T07:48:56.107
null
null
117
null
360
2
null
308
64
null
In Ruby on Rails, there's a concept of a [migration](http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations) -- a quick script to change the database. You generate a migration file, which has rules to increase the db version (such as adding a column) and rules to downgrade the version (such as removing a colu...
null
CC BY-SA 2.5
null
2008-08-02T06:23:33.737
2008-08-03T04:44:07.057
2008-08-03T04:44:07.057
109
109
null
362
2
null
361
69
null
There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The basic idea is that you produce a list of all strings of length 1, then in each iteration, for all strings produced in the last iteration, add that string concatenated with each character in the string individually....
null
CC BY-SA 3.0
null
2008-08-02T07:48:07.607
2015-07-27T02:58:18.577
2015-07-27T02:58:18.577
503,969
80
null
364
2
null
361
8
null
I just whipped this up quick in Ruby: ``` def perms(x, y, possible_characters) all = [""] current_array = all.clone 1.upto(y) { |iteration| next_array = [] current_array.each { |string| possible_characters.each { |c| value = string + c next_array.insert next_array.length, value ...
null
CC BY-SA 2.5
null
2008-08-02T07:56:07.933
2008-08-02T07:56:07.933
null
null
122
null
375
2
null
371
25
null
You can tell your users to add your From address to their contacts when they complete their order, which, if they do so, will help a lot. Otherwise, I would try to get a log from some of your users. Sometimes they have details about why it was flagged as spam in the headers of the message, which you could use to tweak...
null
CC BY-SA 2.5
null
2008-08-02T08:32:04.287
2008-08-02T08:32:04.287
null
null
124
null
371
1
396
null
461
115,424
This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly terminology. Of late, some of the emails I send out programmatically have started being shuffled into people's spam folder automatically and I...
How do you make sure email you send programmatically is not automatically marked as spam?
CC BY-SA 3.0
0
2008-08-02T08:19:18.260
2022-06-18T17:44:18.143
2012-05-04T09:47:31.763
1,039,608
49
[ "email", "email-spam" ]
382
1
384
null
81
10,014
What is the meaning of the ? > Type safety: The cast from Object to List<Integer> is actually checking against the erased type List I get this warning when I try to cast an Object to a type with generic information, such as in the following code: ``` Object object = getMyList(); List<Integer> list = (List<Integer>) ...
What is the meaning of the type safety warning in certain Java generics casts?
CC BY-SA 4.0
0
2008-08-02T08:58:27.540
2021-11-02T07:46:01.727
2019-04-17T19:47:56.127
1,707,091
122
[ "java", "generics", "warnings", "casting", "type-safety" ]
388
2
null
361
5
null
I'm not sure why you would want to do this in the first place. The resulting set for any moderately large values of x and y will be huge, and will grow exponentially as x and/or y get bigger. Lets say your set of possible characters is the 26 lowercase letters of the alphabet, and you ask your application to generate...
null
CC BY-SA 2.5
null
2008-08-02T09:40:54.693
2008-08-02T09:40:54.693
null
null
118
null
384
2
null
382
53
null
This warning is there because Java is not actually storing type information at run-time in an object that uses generics. Thus, if `object` is actually a `List<String>`, there will be no `ClassCastException` at run-time except until an item is accessed from the list that doesn't match the generic type defined in the va...
null
CC BY-SA 3.0
null
2008-08-02T08:58:48.430
2015-12-29T06:32:32.877
2015-12-29T06:32:32.877
3,787,519
122
null
391
2
null
387
20
null
The [scoring](http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html) contains the Inverse Document Frequency(IDF). If the term "John Smith" is in one partition, 0, 100 times and in partition 1, once. The score for searching for John Smith would be higher search in partition 1 as the term ...
null
CC BY-SA 3.0
null
2008-08-02T09:51:00.883
2012-12-13T23:38:14.167
2012-12-13T23:38:14.167
1,628,375
134
null
367
2
null
88
44
null
If you're on Intel hardware, here's how to read the CPU real-time instruction counter. It will tell you the number of CPU cycles executed since the processor was booted. This is probably the finest-grained counter you can get for performance measurement. Note that this is the number of CPU cycles. On linux you ca...
null
CC BY-SA 2.5
null
2008-08-02T08:08:22.230
2010-08-23T16:53:06.797
2010-08-23T16:53:06.797
13,430
116
null
387
1
null
null
45
3,974
In Lucene if you had multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from different servers match exactly. i.e. if I searched for : - - would return a score of 0.345 would return a score of 0.337 Both match e...
Lucene Score results
CC BY-SA 3.0
null
2008-08-02T09:28:17.683
2016-12-20T10:38:13.847
2016-12-20T07:04:01.190
1,997,093
134
[ "search", "lucene" ]
392
2
null
387
13
null
Because the score is determined on the index if I am not completely mistaken. If you have different indexes (more/less or different data that was indexed), the score will differ: [http://lucene.apache.org/core/3_6_0/scoring.html](http://lucene.apache.org/core/3_6_0/scoring.html) (Warning: Contains Math :-))
null
CC BY-SA 3.0
null
2008-08-02T09:52:36.870
2016-12-20T10:38:13.847
2016-12-20T10:38:13.847
1,997,093
91
null
397
2
null
72
10
null
RDoc uses SimpleMarkup so it's fairly simple to create lists, etc. using *, - or a number. It also treats lines that are indented at the same column number as part of the same paragraph until there is an empty line which signifies a new paragraph. Do you have a few examples of comments you want RDoc'ed so we could show...
null
CC BY-SA 2.5
null
2008-08-02T10:22:41.567
2008-08-02T10:22:41.567
null
null
135
null
411
2
null
48
31
null
If the fact that the first button is used by default is consistent across browsers, put them the right way around in the source code, and then use CSS to switch their apparent positions. `float` them left and right to switch them around visually, for example.
null
CC BY-SA 4.0
null
2008-08-02T11:24:57.417
2019-07-14T14:29:07.010
2019-07-14T14:29:07.010
63,550
137
null
412
2
null
108
6
null
Tortoise SVN with Ankhsvn for VS 2005 ![](https://i.stack.imgur.com/7pzo0.jpg)
null
CC BY-SA 3.0
null
2008-08-02T11:30:47.920
2012-04-04T00:55:18.347
2012-04-04T00:55:18.347
1,114
123
null
402
1
2,530,953
null
100
67,540
Please note that this question is from 2008 and now is of only historic interest. --- What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device? Both programmatically and using the Interface Builder.
iPhone app in landscape mode, 2008 systems
CC BY-SA 4.0
0
2008-08-02T10:47:08.460
2019-06-19T11:32:27.650
2019-06-19T02:01:51.950
10,221,765
136
[ "ios", "objective-c", "landscape" ]
427
1
null
null
29
1,351
Is there any way to launch IE Mobile's "Favorites" screen directly by specifying any command line parameter?
Programmatically launch IE Mobile favorites screen
CC BY-SA 3.0
null
2008-08-02T12:12:02.363
2016-12-22T03:55:28.643
2016-12-22T03:55:28.643
1,997,093
123
[ "internet-explorer", "windows-mobile", "pocketpc" ]
430
2
null
192
10
null
The difference between 12.345 in French and English is a factor of 1000. If you supply an expected range where max < 1000*min, you can easily guess. Take for example the height of a person (including babies and children) in mm. By using a range of 200-3000, an input of 1.800 or 1,800 can unambiguously be interpreted...
null
CC BY-SA 2.5
null
2008-08-02T12:28:12.517
2008-08-02T12:28:12.517
null
null
136
null
470
1
473
null
24
775
I've been writing a few web services for a `.net` app, now I'm ready to consume them. I've seen numerous examples where there is homegrown code for consuming the service as opposed to using the auto generated methods that Visual Studio creates when adding the web reference. Is there some advantages to this?
Homegrown consumption of web services
CC BY-SA 3.0
0
2008-08-02T15:11:47.523
2016-12-22T03:52:58.240
2016-12-22T03:52:58.240
1,997,093
71
[ ".net", "web-services" ]
407
2
null
164
5
null
EDIT - March 20 2013. Interesting how these old questions resurface from time to time! How different the world is today and how dated this all seems. I would not recommend a Flash only route today by any means - best practice these days would probably be to use HTML 5 to embed H264 encoded video, with a Flash fallba...
null
CC BY-SA 3.0
null
2008-08-02T11:05:55.460
2013-03-20T17:59:17.450
2013-03-20T17:59:17.450
137
137
null
467
2
null
17
23
null
While you haven't said what you're storing, and you may have a great reason for doing so, often the answer is 'as a filesystem reference' and the actual data is on the filesystem somewhere. [http://www.onlamp.com/pub/a/onlamp/2002/07/11/MySQLtips.html](http://www.onlamp.com/pub/a/onlamp/2002/07/11/MySQLtips.html)
null
CC BY-SA 2.5
null
2008-08-02T14:57:13.043
2008-08-02T14:57:13.043
null
null
144
null
469
1
3,040
null
48
4,610
I am using the Photoshop's javascript API to find the fonts in a given PSD. Given a font name returned by the API, I want to find the actual physical font file that font name corresponds to on the disc. This is all happening in a python program running on OSX so I guess I'm looking for one of: - - -
How can I find the full path to a font from its display name on a Mac?
CC BY-SA 3.0
null
2008-08-02T15:11:16.430
2022-12-15T07:51:30.287
2016-12-22T03:53:45.467
1,997,093
147
[ "python", "macos", "fonts", "photoshop" ]
451
2
null
371
14
null
Yahoo uses a method called Sender ID, which can be configured at [The SPF Setup Wizard](http://old.openspf.org/wizard.html?mydomain=stackoverflow.com) and entered in to your DNS. Also one of the important ones for Exchange, Hotmail, AOL, Yahoo, and others is to have a Reverse DNS for your domain. Those will knock out...
null
CC BY-SA 2.5
null
2008-08-02T13:45:57.197
2017-04-20T16:17:40.470
2017-04-20T16:17:40.470
246,246
17
null
419
1
17,396
null
37
3,007
Part of my everyday work is maintaining and extending legacy VB6 applications. A common engine is written in C/C++ and VB6 uses these functions in order to improve performance. When it comes to asynchronous programming, a C interface is not enough and we rely on COM controls to fire events to VB6. My problem is that...
Unload a COM control when working in VB6 IDE
CC BY-SA 3.0
0
2008-08-02T11:52:01.543
2017-11-11T02:39:28.627
2016-12-22T03:56:15.020
1,997,093
268
[ "com", "vb6" ]
438
1
77,397
null
57
11,952
My Rails-app has a sign in box with a "remember me" checkbox. Users who check that box should remain logged in even after closing their browser. I'm keeping track of whether users are logged in by storing their id in the user's session. But sessions are implemented in Rails as session cookies, which are not persisten...
Implementation of "Remember me" in a Rails application
CC BY-SA 3.0
0
2008-08-02T12:56:58.590
2016-12-22T03:54:36.970
2016-12-22T03:54:36.970
1,997,093
136
[ "ruby-on-rails", "ruby", "http" ]
473
2
null
470
11
null
No, what you're doing is fine. Don't let those people confuse you. If you've written the web services with .net then the reference proxies generated by .net are going to be quite suitable. The situation you describe (where you are both producer and consumer) is the ideal situation. If you need to connect to a web ser...
null
CC BY-SA 2.5
null
2008-08-02T15:33:13.390
2008-08-02T15:33:13.390
null
null
49
null
497
2
null
469
7
null
open up a terminal (Applications->Utilities->Terminal) and type this in: ``` locate InsertFontHere ``` This will spit out every file that has the name you want. Warning: there may be alot to wade through.
null
CC BY-SA 2.5
null
2008-08-02T16:56:53.893
2008-08-02T16:56:53.893
null
null
50
null
502
1
7,090
null
59
17,464
I have a cross-platform (Python) application which needs to generate a JPEG preview of the first page of a PDF. On the Mac I am spawning [sips](http://web.archive.org/web/20090309234215/http://developer.apple.com:80/documentation/Darwin/Reference/ManPages/man1/sips.1.html). Is there something similarly simple I can d...
Get a preview JPEG of a PDF on Windows?
CC BY-SA 4.0
0
2008-08-02T17:01:58.500
2020-06-17T20:47:48.287
2020-06-17T20:47:48.287
9,780,149
147
[ "python", "windows", "image", "pdf" ]
396
2
null
371
352
null
Use email authentication methods, such as [SPF](http://en.wikipedia.org/wiki/Sender_Policy_Framework), and [DKIM](https://help.ubuntu.com/community/Postfix/DKIM) to prove that your emails and your domain name belong together, and to prevent spoofing of your domain name. The SPF website includes a wizard to generate the...
null
CC BY-SA 4.0
null
2008-08-02T10:21:54.300
2022-06-18T17:44:18.143
2022-06-18T17:44:18.143
1,145,388
136
null