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
34,828
2
null
34,809
2
null
GetHashCode() should always be in sync with Equals(), and Equals() isn't necessarily guaranteed to check for of the fields in your object (there's certain situations where you want that to not be the case). Furthermore, GetHashCode() isn't guaranteed to return unique values for all possible object states. It's concei...
null
CC BY-SA 2.5
null
2008-08-29T17:39:46.303
2008-08-29T17:39:46.303
null
null
3,488
null
34,790
1
34,855
null
15
9,357
The `datepicker` function only works on the first input box that is created. I'm trying to duplicate a datepicker by cloning the `div` that is containing it. ``` <a href="#" id="dupMe">click</a> <div id="template"> input-text <input type="text" value="text1" id="txt" /> date time picker <input type="text" id="exa...
duplicating jQuery datepicker
CC BY-SA 3.0
0
2008-08-29T17:19:25.823
2017-09-19T16:39:26.597
2017-09-19T16:39:26.597
7,079,025
1,842,864
[ "javascript", "jquery" ]
34,831
2
null
34,818
3
null
For the fourth bullet: No you can't specify where you want to add the column. Here is the syntax for ALTER TABLE: [https://msdn.microsoft.com/en-us/library/ms190273.aspx](https://msdn.microsoft.com/en-us/library/ms190273.aspx) In MySQL they offer an ALTER TABLE ADD ... AFTER ... but this doesn't appear in T-SQL. If y...
null
CC BY-SA 3.0
null
2008-08-29T17:40:47.207
2015-08-06T18:17:51.307
2015-08-06T18:17:51.307
10,245
3,641
null
34,811
2
null
26,455
3
null
[Frank Krueger](https://stackoverflow.com/users/338/frank-krueger) writes: > Gaius: A Null Pointer exception gets thrown for you automatically by the runtime, there is no benefit to testing that stuff in the function prologue. I have two responses to this: 1. Null was just an example. For square(x), I'd want to tes...
null
CC BY-SA 2.5
null
2008-08-29T17:30:30.930
2008-08-29T17:30:30.930
2017-05-23T12:26:29.837
-1
1,190
null
34,842
2
null
34,664
1
null
I hadn't realised that you can't call Parent.DesignMode (and I have learned something about 'protected' in C# too...) Here's a reflective version: (I suspect there might be a performance advantage to making designModeProperty a static field) ``` static bool IsDesignMode(Control control) { PropertyInfo designMode...
null
CC BY-SA 2.5
null
2008-08-29T17:43:57.027
2008-08-29T17:43:57.027
null
null
987
null
34,846
2
null
33,559
2
null
The [Ars Technica tutorial](http://arstechnica.com/guides/other/msh.ars/2) is a bit dated, but very good to get you up-and-running with PowerShell. I would also second the suggestion to check out [PowerGUI](http://powergui.org/index.jspa).
null
CC BY-SA 2.5
null
2008-08-29T17:46:04.510
2008-08-29T17:54:59.000
2008-08-29T17:54:59.000
1,108
1,108
null
34,832
2
null
34,806
1
null
I feel the best combination of DRYness and forcing the contract is as follows (in pseudocode): ``` class Base { public final constructor(name) { constructor(name, null) end public abstract constructor(name, description); } ``` or, alternatively: ``` class Base { public abstract constructor(name); pu...
null
CC BY-SA 2.5
null
2008-08-29T17:41:16.940
2008-08-29T17:41:16.940
null
null
1,190
null
34,837
2
null
34,314
36
null
It depends on how comprehensive your web site is and how much you want to do yourself. If you are running a a without further possibilities to add a custom search, let google do the work (maybe add a [sitemap](https://www.google.com/webmasters/tools/docs/en/protocol.html)) and use the [google custom search](http://ww...
null
CC BY-SA 2.5
null
2008-08-29T17:42:18.437
2008-08-29T18:02:57.090
2008-08-29T18:02:57.090
720
720
null
34,849
2
null
33,949
1
null
If you want to upgrade every site on a server you could probably make changes to the machine.config
null
CC BY-SA 2.5
null
2008-08-29T17:47:52.417
2008-08-29T17:47:52.417
null
null
3,543
null
34,854
2
null
34,728
1
null
[http://blah.winsmarts.com/2008-4-SharePoint_limits.aspx](http://blah.winsmarts.com/2008-4-SharePoint_limits.aspx) for #3: you can index specific columns in a list, but you should still keep the sizes down.
null
CC BY-SA 2.5
null
2008-08-29T17:50:33.783
2008-08-29T17:50:33.783
null
null
3,381
null
34,858
1
34,865
null
8
6,788
I'd like to know the standard way to benchmark a SQL Sever Query, preferably I'd like to know about the tools that come with SQL Server rather than 3rd Party tools.
How to benchmark a SQL Server Query?
CC BY-SA 3.0
0
2008-08-29T17:52:23.060
2017-04-30T12:23:38.337
2017-04-30T12:23:38.337
1,033,581
1,736
[ "sql-server", "database", "benchmarking" ]
34,855
2
null
34,790
7
null
I'd recommend just using a common class name as well. However, if you're against this for some reason, you could also write a function to create date pickers for all text boxes in your template `div` (to be called after each duplication). Something like: ``` function makeDatePickers() { $("#template input[type=text...
null
CC BY-SA 3.0
null
2008-08-29T17:51:03.890
2017-09-19T16:37:50.050
2017-09-19T16:37:50.050
7,079,025
2,696
null
34,853
2
null
34,581
1
null
I don't like this hack but it seems to do the job both in Firefox and IE6: ``` span.right { vertical-align:top; display:inline-block; text-align:right; height:80px; width:50%; *width:100%; background-color:red; } ``` Note the `*width: 100%` which seems to satisfy IE6's requirement and is ignored by Fi...
null
CC BY-SA 3.0
null
2008-08-29T17:50:18.900
2016-01-14T19:39:32.703
2016-01-14T19:39:32.703
2,678,454
3,635
null
34,859
2
null
34,818
9
null
In SQL Server 2005, placement of nullable variable length columns has a space impact - placing nullable variable size columns at the end of the definition can result in less space consumption. SQL Server 2008 adds the "SPARSE" column feature which negates this difference. See [here](https://web.archive.org/web/20210119...
null
CC BY-SA 4.0
null
2008-08-29T17:52:40.703
2022-06-13T14:30:14.860
2022-06-13T14:30:14.860
1,043,380
1,042
null
34,857
2
null
34,506
1
null
I agree with Hershi's suggestion to use a template as the "base class". From what you're describing, it sounds more like a use for templates rather then subclassing. You could create a template as follows ( have not tried to compile this ): ``` template <typename T> class Object { public: Object( const T& newObje...
null
CC BY-SA 2.5
null
2008-08-29T17:52:17.523
2008-08-29T17:52:17.523
null
null
3,467
null
34,856
2
null
34,669
0
null
One possibility I can think of is to store the count in a member variable of the class. This of course assumes that the public `doIt` method is only called by a single thread. Another option is to refactor the public method to call a private helper method. The private method takes the list as a parameter and returns...
null
CC BY-SA 2.5
null
2008-08-29T17:51:32.767
2008-08-29T17:51:32.767
null
null
737
null
34,866
2
null
30,947
0
null
The source code for [Spelly](http://www.wndtabs.com/) is available, it would be pretty easy to update it for vs2008.
null
CC BY-SA 2.5
null
2008-08-29T17:56:38.387
2008-08-29T17:56:38.387
null
null
1,414
null
34,865
2
null
34,858
11
null
set showplan_text on will show you the execution plan (to see it graphically use + (sql 2000) or + (sql 2005 +) set statistics IO on will show you the reads set statistics time on will show you the elapsed time
null
CC BY-SA 3.0
null
2008-08-29T17:55:25.860
2013-02-06T10:02:02.930
2013-02-06T10:02:02.930
938,024
740
null
34,862
2
null
34,848
1
null
Change the [error message](http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.validation.errors).
null
CC BY-SA 2.5
null
2008-08-29T17:54:26.970
2008-08-29T17:54:26.970
null
null
1,797
null
34,867
2
null
4,661
0
null
Doesn't using multiple open-id providers sort of undermine the point of open id?
null
CC BY-SA 2.5
null
2008-08-29T17:57:14.873
2008-08-29T17:57:14.873
null
null
1,565
null
34,864
2
null
34,858
1
null
Use SQL Profiler. For .NET applications, filter that Application name by '.NET%' and you'll omit other extraneous queries.
null
CC BY-SA 2.5
null
2008-08-29T17:55:18.123
2008-08-29T17:55:18.123
null
null
3,381
null
34,816
2
null
33,559
50
null
For learning PowerShell, there are a number of great resources 1. Technet Virtual Labs (Introduction to Windows PowerShell) 2. PowerShellCommunity.org - Forums, blogs, script repository 3. powershell on irc.freenode.net 4. PowerShell podcasts - PowerScripting.net and Get-Scripting.blogspot.com For IDE style environm...
null
CC BY-SA 3.0
null
2008-08-29T17:34:28.750
2012-06-13T14:05:03.060
2020-06-20T09:12:55.060
-1
1,233
null
34,869
2
null
34,868
278
null
Much like the manual, use an equals (`=`) sign in your definition of the parameters: ``` function dosomething($var1, $var2, $var3 = 'somevalue'){ // Rest of function here... } ```
null
CC BY-SA 3.0
null
2008-08-29T17:58:50.113
2014-07-03T15:46:59.700
2014-07-03T15:46:59.700
704,944
1,306
null
34,877
2
null
34,868
15
null
Give the optional argument a default value. ``` function date ($format, $timestamp='') { } ```
null
CC BY-SA 2.5
null
2008-08-29T17:59:42.950
2008-08-29T17:59:42.950
null
null
1,797
null
34,875
2
null
34,798
2
null
do you have ChildrenAsTriggers="false" on the UpdatePanel? Are there any javascript errors on the page?
null
CC BY-SA 2.5
null
2008-08-29T17:59:36.383
2008-08-29T17:59:36.383
null
null
3,381
null
34,876
2
null
34,726
2
null
[Jrun development has pretty much stopped](http://www.adobe.com/products/jrun/productinfo/faq/eod/). You should look into running another application server. [Jboss](http://www.jboss.org/) or [Glassfish](http://glassfish.java.net/) are good alternatives.
null
CC BY-SA 2.5
null
2008-08-29T17:59:38.083
2008-08-29T17:59:38.083
null
null
1,310
null
34,881
2
null
8,472
1
null
Perhaps the community can come up with some good text-based CAPTCHAs? We can then come up with a good list based on those with the most votes.
null
CC BY-SA 2.5
null
2008-08-29T18:01:21.930
2008-08-29T18:14:06.690
2008-08-29T18:14:06.690
2,108
2,108
null
34,868
1
34,869
null
206
181,594
In the PHP manual, to show the syntax for functions with optional parameters, they use brackets around each set of dependent optional parameter. For example, for the [date()](https://php.net/date) function, the manual reads: ``` string date ( string $format [, int $timestamp = time() ] ) ``` Where `$timestamp` is an o...
How do you create optional arguments in php?
CC BY-SA 4.0
0
2008-08-29T17:57:50.847
2023-01-04T14:16:21.230
2023-01-04T14:16:21.230
9,193,372
2,687
[ "php" ]
34,848
1
35,894
null
4
8,047
When using a `Zend_Form`, the only way to validate that an input is not left blank is to do ``` $element->setRequired(true); ``` If this is not set and the element is blank, it appears to me that validation is not run on the element. If I do use `setRequired()`, the element is automatically given the standard NotEm...
Zend Framework: setting a Zend_Form_Element form field to be required, how do I change the validator used to ensure that the element is not blank
CC BY-SA 4.0
null
2008-08-29T17:47:46.893
2019-01-18T11:04:50.230
2019-01-18T11:04:50.230
567,854
1,349,865
[ "php", "zend-framework", "validation" ]
34,884
2
null
34,879
22
null
``` foreach(string key in hashTable.Keys) { Console.WriteLine(String.Format("{0}: {1}", key, hashTable[key])); } ```
null
CC BY-SA 2.5
null
2008-08-29T18:03:37.120
2008-08-29T18:03:37.120
null
null
3,381
null
34,890
2
null
34,669
1
null
You could just use a static int class variable that gets incremented each time your doIt method is called.
null
CC BY-SA 2.5
null
2008-08-29T18:05:34.933
2008-08-29T18:05:34.933
null
null
1,288
null
34,887
2
null
34,879
3
null
``` public static void PrintKeysAndValues( Hashtable myList ) { IDictionaryEnumerator myEnumerator = myList.GetEnumerator(); Console.WriteLine( "\t-KEY-\t-VALUE-" ); while ( myEnumerator.MoveNext() ) Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value); Console.WriteL...
null
CC BY-SA 2.5
null
2008-08-29T18:04:37.073
2008-08-29T18:04:37.073
null
null
356
null
34,879
1
34,884
null
10
38,195
I need debug some old code that uses a Hashtable to store response from various threads. I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable. How can this be done?
Print out the keys and Data of a Hashtable in C# .NET 1.1
CC BY-SA 2.5
0
2008-08-29T18:01:15.240
2010-09-22T12:27:03.867
2008-08-31T00:39:59.687
305
2,469
[ "c#", "hashtable", ".net-1.1" ]
34,882
2
null
34,809
1
null
At the end of the object's constructor you could serialize the object to a base 64 string just like the cookie stores it, and store this in a member variable. When you want to check if the cookie needs recreating, re - serialize the object and compare this new base 64 string against the one stored in a member variabl...
null
CC BY-SA 2.5
null
2008-08-29T18:02:04.160
2008-08-29T18:02:04.160
null
null
1,349,865
null
34,894
2
null
34,879
1
null
This should work for pretty much every version of the framework... ``` foreach (string HashKey in TargetHash.Keys) { Console.WriteLine("Key: " + HashKey + " Value: " + TargetHash[HashKey]); } ``` The trick is that you can get a list/collection of the keys (or the values) of a given hash to iterate through. EDIT:...
null
CC BY-SA 2.5
null
2008-08-29T18:06:40.063
2008-08-29T18:06:40.063
null
null
71
null
34,893
2
null
5,071
1
null
First add all directories to CVS ``` find . -type d -print0| xargs -0 cvs add ``` Then add all the files in the directories to CVS ``` find . -type f -print0| xargs -0 cvs add ```
null
CC BY-SA 2.5
null
2008-08-29T18:06:37.067
2008-08-29T18:06:37.067
null
null
3,535
null
34,901
2
null
34,896
-1
null
I find that cleaning it immediately has two advantages. One, you can validate against it and provide feedback to the user. Two, you do not have to worry about consuming the data in other places.
null
CC BY-SA 2.5
null
2008-08-29T18:09:19.633
2008-08-29T18:09:19.633
null
null
2,894
null
34,899
2
null
24,528
1
null
I recommend [TortoiseSVN](http://tortoisesvn.tigris.org/). It adds SVN capabilities into Windows Explorer. In addition TortoiseSVN check to see if the IDE you are using has support for SVN.
null
CC BY-SA 2.5
null
2008-08-29T18:09:07.093
2008-08-29T18:09:07.093
null
null
3,535
null
34,852
1
34,965
null
34
10,431
I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: ``` public IList<Customer> GetCustomerByFirstName(string customerFirstName) { return _session.CreateCriteria(typeof(Customer)) .Add(new NHibernate.Expression.EqExpression("FirstName", custom...
NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred
CC BY-SA 3.0
0
2008-08-29T17:49:31.197
2013-02-14T06:25:35.373
2013-02-14T06:25:35.373
396,458
1,284
[ "c#", ".net", "nhibernate" ]
34,885
2
null
34,802
2
null
First, I'd create a simple DependencyObject class to hold your collection: ``` class YourCollectionType : DependencyObject { [PROPERTY DEPENDENCY OF ObservableCollection<YourType> NAMED: BoundList] } ``` Then, on your ValidationRule-derived class, create a property: ``` YourCollectionType ListToCheck { get; ...
null
CC BY-SA 2.5
null
2008-08-29T18:03:51.427
2008-08-29T18:03:51.427
null
null
3,641
null
34,902
2
null
34,896
14
null
I like to sanitize it as early as possible, which means the sanitizing happens when the user tries to enter in invalid data. If there's a TextBox for their age, and they type in anything other that a number, I don't let the keypress for the letter go through. Then, whatever is reading the data (often a server) I do a ...
null
CC BY-SA 2.5
null
2008-08-29T18:09:27.140
2008-08-29T18:09:27.140
null
null
3,641
null
34,903
2
null
34,896
0
null
User input should always be treated as malicious before making it down into lower layers of your application. Always handle sanitizing input as soon as possible and should not for any reason be stored in your database before checking for malicious intent.
null
CC BY-SA 2.5
null
2008-08-29T18:09:46.187
2008-08-29T18:09:46.187
null
null
2,993
null
34,892
2
null
34,345
0
null
I think since no communication is possible, the best strategy would involve > distributing the probability of each prisoners as evenly as possible Am I on the right path or not? > - - > 1. Draw a table of numbers with 2 columns, the first column contains the box number (from box #1 to box#100). Each prisoner ...
null
CC BY-SA 2.5
null
2008-08-29T18:06:15.977
2008-08-29T18:24:26.820
2008-08-29T18:24:26.820
3,055
3,055
null
34,891
2
null
34,717
1
null
@Martin That works for local forms that open in InfoPath. Nathan was asking about web-enabled forms. ActiveX controls are disabled for web forms, as evidenced by the informational label at the bottom of the design controls when the form compatability has been set to the web. Now, I will admit that I know nothing ab...
null
CC BY-SA 2.5
null
2008-08-29T18:06:13.947
2008-08-29T18:19:45.413
2008-08-29T18:19:45.413
2,470
2,470
null
34,906
2
null
34,896
1
null
Users are evil! Well perhaps not always, but my approach is to always sanatize immediately to ensure nothing risky goes anywhere near my backend. The added benefit is that you can provide feed back to the user if you sanitize at point of input.
null
CC BY-SA 2.5
null
2008-08-29T18:10:15.000
2008-08-29T18:10:15.000
null
null
770
null
34,909
2
null
34,879
1
null
I also found that this will work too. ``` System.Collections.IDictionaryEnumerator enumerator = hashTable.GetEnumerator(); while (enumerator.MoveNext()) { string key = enumerator.Key.ToString(); string value = enumerator.Value.ToString(); Console.WriteLine(("Key = '{0}'; Value = '{0}'", key, value); } ``...
null
CC BY-SA 2.5
null
2008-08-29T18:10:55.420
2008-08-29T18:10:55.420
null
null
2,469
null
34,905
2
null
34,896
1
null
Clean the data before you store it. Generally you shouldn't be preforming SQL actions without first cleaning up input. You don't want to subject yourself to a SQL injection attack. I sort of follow these basic rules. 1. Only do modifying SQL actions, such as, INSERT, UPDATE, DELETE through POST. Never GET. 2. Esca...
null
CC BY-SA 2.5
null
2008-08-29T18:10:12.283
2008-08-29T18:10:12.283
null
null
1,797
null
34,916
1
1,056,092
null
10
1,779
Is there anything similar to rails' scaffolding for pylons? I've been poking around google, but only found this thing called dbsprockets, which is fine, although probably way too much for my needs. What I really need is a basic CRUD that is based on the SQLAlchemy model.
Scaffolding in pylons
CC BY-SA 4.0
0
2008-08-29T18:12:30.517
2021-11-07T10:21:42.680
2021-11-07T10:21:42.680
15,368,978
985
[ "python", "pylons" ]
34,896
1
34,902
null
65
23,169
User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediately and then store this "cleaned" version? ...
When is it best to sanitize user input?
CC BY-SA 4.0
0
2008-08-29T18:07:04.960
2022-07-11T08:21:19.267
2019-03-25T13:39:04.460
2,263,631
2,628
[ "xss", "sql-injection", "user-input", "sanitization" ]
34,908
2
null
34,345
0
null
Same concept. > 1. Write down a list of the first 100 binary numbers which has fifty 1s and fifty 0s. 2. Sort them from lowest to highest. 3. Prisoner #1 gets the first number, prisoner #2 gets the second, prisoner #3 gets the third and so on... 4. Each prisoner remembers his/her binary number. 5. When any prisoner...
null
CC BY-SA 2.5
null
2008-08-29T18:10:32.800
2008-08-29T18:44:34.713
2008-08-29T18:44:34.713
3,055
3,055
null
34,920
1
34,933
null
29
30,026
What is the best way to create a lock on a file in Perl? Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock file?
How do I lock a file in Perl?
CC BY-SA 2.5
0
2008-08-29T18:13:21.420
2020-03-29T21:12:47.937
2008-10-23T01:58:39.237
2,766,176
1,539
[ "perl", "file", "locking" ]
34,917
2
null
34,638
6
null
Hibernate has a [filter mechanism](http://in.relation.to/Bloggers/Hibernate3Filters) that may work for you. The filters will rewrite the queries hibernate generates to include an additional clause to limit the rows returned. I'm not aware of anything in hibernate to mask/hide columns. Your database may also have sup...
null
CC BY-SA 2.5
null
2008-08-29T18:12:36.350
2008-08-29T18:12:36.350
null
null
1,299
null
34,919
2
null
34,896
1
null
Assume all users are malicious. Sanitize all input as soon as possible. Full stop.
null
CC BY-SA 2.5
null
2008-08-29T18:13:01.483
2008-08-29T18:13:01.483
null
null
1,484
null
34,911
2
null
34,687
56
null
Do you actually have the single quotes in your command? I don't think they are necessary. Plus, I think you also need `--no-auth-cache` and `--non-interactive` Here is what I use (no single quotes) See the [Client Credentials Caching documentation in the svnbook](http://svnbook.red-bean.com/en/1.4/svn.serverconfig....
null
CC BY-SA 2.5
null
2008-08-29T18:11:00.053
2008-08-29T18:11:00.053
null
null
1,441
null
34,914
1
35,467
null
3
3,582
The manual page for `XML::Parser::Style::Objects` is horrible. A simple hello world style program would really be helpful. I really wanted to do something like this: (not real code of course) ``` use XML::Parser; my $p = XML::Parser->new(Style => 'Objects', Pkg => 'MyNode'); my $tree = $p->parsefile('foo.xml'); $tre...
How do you use XML::Parser with Style => 'Objects'
CC BY-SA 3.0
0
2008-08-29T18:12:01.453
2013-12-02T12:54:19.937
2013-12-02T12:54:19.937
2,432,317
3,657
[ "xml", "perl" ]
34,921
2
null
34,848
0
null
As far as I can see [Changing the error message](http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.validation.errors/) has no way of changing the message of a specific error. Plus the manual makes it look like like this is a function belonging to Zend_Form, but I get method not found when using i...
null
CC BY-SA 2.5
null
2008-08-29T18:13:46.473
2008-08-29T18:13:46.473
null
null
1,349,865
null
34,924
1
34,971
null
2
2,166
Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). I haven't done any high-tech audio stuff using Flash, so I was ...
3.1 or 5.1 audio in Flash
CC BY-SA 2.5
0
2008-08-29T18:14:44.740
2012-02-06T12:01:12.613
2008-09-18T17:02:41.963
322
1,226
[ "flash", "audio" ]
34,928
2
null
34,920
0
null
Use the [flock](http://perldoc.perl.org/functions/flock.html) Luke. [This](http://www.perlmonks.org/?node_id=7058) is a good explanation.
null
CC BY-SA 2.5
null
2008-08-29T18:16:35.827
2008-08-29T18:16:35.827
null
null
1,797
null
34,923
2
null
34,896
1
null
I sanitize my data right before I do any processing on it. I may need to take the First and Last name fields and concatenate them into a third field that gets inserted to the database. I'm going to sanitize the input before I even do the concatenation so I don't get any kind of processing or insertion errors. The soone...
null
CC BY-SA 2.5
null
2008-08-29T18:14:27.500
2008-08-29T18:14:27.500
null
null
71
null
34,926
1
35,012
null
11
11,020
my returns a field with HTML, e.g. ``` <b>blah blah </b><i> blah </i>. ``` how do i strip all the HTML tags? has to be done with VB.NET Changing the data in the table is not an option. ... = System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","")
Strip HTML from string in SSRS 2005 (VB.NET)
CC BY-SA 3.0
0
2008-08-29T18:16:14.250
2015-07-14T07:58:51.180
2015-07-14T07:58:51.180
3,218,692
3,661
[ "vb.net", "reporting-services" ]
34,929
2
null
34,920
0
null
flock creates Unix-style file locks, and is available on most OS's Perl runs on. However flock's locks are advisory only. edit: emphasized that flock is portable
null
CC BY-SA 2.5
null
2008-08-29T18:16:47.743
2008-08-29T18:16:47.743
null
null
1,879
null
34,913
1
36,678
null
18
18,764
I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through several tutorials but for some reason can't figure this out. As an example, say I have a table (SiteStats) with multiple website IDs that stores a count of how many visitors by type have accessed each site in total and for the p...
C# Linq Grouping
CC BY-SA 3.0
0
2008-08-29T18:11:45.400
2013-06-10T22:16:05.560
2013-06-10T22:16:05.560
2,034
2,034
[ "c#", "linq" ]
34,934
2
null
24,528
0
null
Running SVN under apache really isn't that hard. And you can use [mod_auth_sspi](http://www.deadbeef.com/index.php/mod_auth_sspi) to integrate with active directory.
null
CC BY-SA 2.5
null
2008-08-29T18:18:55.900
2008-08-29T18:18:55.900
null
null
3,657
null
34,935
2
null
34,926
3
null
Here's a good example using Regular Expressions: [https://web.archive.org/web/20210619174622/https://www.4guysfromrolla.com/webtech/042501-1.shtml](https://web.archive.org/web/20210619174622/https://www.4guysfromrolla.com/webtech/042501-1.shtml)
null
CC BY-SA 2.5
null
2008-08-29T18:19:47.410
2008-08-29T18:19:47.410
null
null
3,641
null
34,930
2
null
31,673
1
null
Thanks for the feedback Nick. I've pretty much gotten the profile and connection management working. The trick is figuring out which parts of the Native Wifi API are supported on XP. Fortunately, the [Managed Wifi API](http://www.codeplex.com/managedwifi) has connect/disconnect notification events that do work on XP ...
null
CC BY-SA 2.5
null
2008-08-29T18:17:28.103
2008-08-29T18:17:28.103
null
null
2,514
null
34,936
2
null
34,708
0
null
You could load your list of words as chakrit suggested into a data table or xml file with a unique sequential key. When getting your random word, use a random number generator to determine what words to fetch by their key. If you concatenate 2 of them, I don't think you need to include the numbers in the string unles...
null
CC BY-SA 2.5
null
2008-08-29T18:20:03.853
2008-08-29T18:20:03.853
null
null
1,865
null
34,941
2
null
34,938
0
null
Since this is tagged language agnostic I'll chime in. For Perl at least, the first option is sufficient, I'm not familiar with PHP. It evaluates left to right and drops out as soon as the condition is met.
null
CC BY-SA 2.5
null
2008-08-29T18:22:35.890
2008-08-29T18:22:35.890
null
null
171
null
34,942
2
null
34,926
1
null
If you know the HTML is well-formed enough, you could, if you make sure it has a root node, convert the data in that field into a System.Xml.XmlDocument and then get the InnerText value from it. Again, you will have to make sure the text has a root node, which you can add yourself if needs be, since it will not matter...
null
CC BY-SA 2.5
null
2008-08-29T18:23:18.713
2008-08-29T18:23:18.713
null
null
1,790
null
34,949
2
null
34,938
0
null
In most languages with decent optimization the former will work just fine.
null
CC BY-SA 2.5
null
2008-08-29T18:26:30.000
2008-08-29T18:26:30.000
null
null
3,044
null
34,945
2
null
34,938
3
null
Pretty much every language does a short circuit evaluation. Meaning the second condition is only evaluated if it's aboslutely necessary to. For this to work, most languages use the double pipe, ||, not the single one, |. See [http://en.wikipedia.org/wiki/Short-circuit_evaluation](http://en.wikipedia.org/wiki/Short-c...
null
CC BY-SA 2.5
null
2008-08-29T18:24:25.310
2008-08-29T18:24:25.310
null
null
2,424
null
34,947
2
null
14,893
1
null
One thing I would suggest ensure your build script (and installer project, if relevant in your case) is in source control. I tend to have a very simple script that just checks out\gets latest the "main" build script then launches it. I say this b/c I see teams just running the latest version of the build script on ...
null
CC BY-SA 2.5
null
2008-08-29T18:26:25.133
2008-08-29T18:26:25.133
null
null
2,786
null
34,938
1
34,954
null
5
9,189
I have an if statement with two conditions (separated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed I only want the second condition to be processed if the first condition evaluates to false. if I o...
if statement condition optimisation
CC BY-SA 4.0
null
2008-08-29T18:21:17.593
2019-01-18T11:04:39.403
2019-01-18T11:04:39.403
567,854
2,083
[ "php", "language-agnostic", "conditional-statements" ]
34,956
2
null
34,345
0
null
If all prisoners are killed when someone fails to find their number then you either save 100 or 0. There is no way to save 30 people.
null
CC BY-SA 2.5
null
2008-08-29T18:29:02.817
2008-08-29T18:29:02.817
null
null
3,657
null
34,955
1
41,043
null
51
26,315
When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors?
Best practices for debugging linking errors
CC BY-SA 2.5
0
2008-08-29T18:27:44.147
2016-02-07T08:16:34.657
2008-08-31T06:06:15.347
305
3,575
[ "c++", "visual-studio", "gcc", "linker", "compilation" ]
34,933
2
null
34,920
32
null
If you end up using flock, here's some code to do it: ``` use Fcntl ':flock'; # Import LOCK_* constants # We will use this file path in error messages and function calls. # Don't type it out more than once in your code. Use a variable. my $file = '/path/to/some/file'; # Open the file for appending. Note the file p...
null
CC BY-SA 2.5
null
2008-08-29T18:18:40.487
2008-10-08T17:29:54.290
2008-10-08T17:29:54.307
164
422
null
34,951
2
null
34,913
4
null
Easiest way for me to illustrate is using in-memory objects so it's clear what's happening. LINQ to SQL should be able to take that same LINQ query and translate it into appropriate SQL. ``` public class Site { static void Main() { List<Site> sites = new List<Site>() { new Site() { ...
null
CC BY-SA 2.5
null
2008-08-29T18:27:29.060
2008-08-29T18:27:29.060
null
null
2,314
null
34,953
2
null
28,817
7
null
To determine what tags apply to a particular file use: ``` cvs log <filename> ``` This will output all the versions of the file and what tags have been applied to the version. To determine what files are included in a single tag, the only thing I can think of is to check out using the tag and see what files come ba...
null
CC BY-SA 2.5
null
2008-08-29T18:27:33.553
2008-08-29T18:27:33.553
null
null
3,535
null
34,960
2
null
34,938
2
null
I've seen a lot of these types of questions lately--optimization to the nth degree. I think it makes sense in certain circumstances: 1. Computing condition 2 is not a constant time operation 2. You are asking strictly for educational purposes--you want to know how the language works, not to save 3us. In other cas...
null
CC BY-SA 2.5
null
2008-08-29T18:32:30.280
2008-08-29T18:32:30.280
null
null
29
null
34,962
2
null
32,803
3
null
It should just fine. However some spam filters will do a reverse lookup on the originating IP address and see if it's assigned to the domain name the email claims to be from, and some may check to see if the IP is an actual MX for the domain. So the downside is that some recipients may never get the email, and you may...
null
CC BY-SA 2.5
null
2008-08-29T18:34:04.910
2008-08-29T18:34:04.910
null
null
3,660
null
34,925
1
35,223
null
5
4,813
I've seen quite a few posts on changes in .NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running .NET 3.5 RTM). ``` [XmlRoot("foo")] public class Foo { s...
XmlSerializer changes in .NET 3.5 SP1
CC BY-SA 2.5
0
2008-08-29T18:15:04.567
2008-11-13T21:34:49.570
2008-11-13T21:34:49.570
2,660
2,314
[ "xml", "serialization", ".net-3.5" ]
34,965
2
null
34,852
16
null
I have seen this once before when one of my models was not mapped correctly (wasn't using nullable types correctly). May you please paste your model and mapping?
null
CC BY-SA 2.5
null
2008-08-29T18:35:23.207
2008-08-29T18:35:23.207
null
null
2,696
null
34,954
2
null
34,938
9
null
For C, C++, C#, Java and other .NET languages boolean expressions are optimised so that as soon as enough is known nothing else is evaluated. An old trick for doing obfuscated code was to use this to create if statements, such as: ``` a || b(); ``` if "a" is true, "b()" would never be evaluated, so we can rewrite i...
null
CC BY-SA 2.5
null
2008-08-29T18:27:35.003
2008-08-29T18:52:12.840
2008-08-29T18:52:12.840
2,973
2,973
null
34,967
2
null
34,955
4
null
One of the common linking errors I've run into is when a function is used differently from how it's defined. If you see such an error you should make sure that every function you use is properly declared in some .h file. You should also make sure that all the relevant source files are compiled into the same lib file. ...
null
CC BY-SA 3.0
null
2008-08-29T18:35:29.090
2013-01-25T11:24:08.347
2013-01-25T11:24:08.347
1,084
1,084
null
34,961
2
null
34,938
2
null
According to [this article](http://www.kekh.com/chapter-6/short-circuit-evaluation/) PHP does short circuit evaluation, which means that if the first condition is met the second is not even evaluated. It's quite easy to test also (from the article): ``` <?php /* ch06ex07 – shows no output because of short circuit eval...
null
CC BY-SA 2.5
null
2008-08-29T18:32:45.273
2008-08-29T18:32:45.273
null
null
2,841
null
34,963
2
null
34,938
3
null
In C, C++ and Java, the statement: ````` if (condition1 | condition2) { ... } ``` will evaluate both conditions every time and only be true if the entire expression is true. The statement: ``` if (condition1 || condition2) { ... } ``` will evaluate `condition2` only if `condition1` is false. The difference i...
null
CC BY-SA 2.5
null
2008-08-29T18:34:25.410
2008-08-29T18:34:25.410
null
null
1,709
null
34,966
2
null
34,345
7
null
This puzzle is explained at [http://www.math.princeton.edu/~wwong/blog/blog200608191813.shtml](https://web.archive.org/web/20090616153244/http://www.math.princeton.edu/~wwong/blog/blog200608191813.shtml) and that person does a much better job of explaining the problem. The "all prisoners are killed" statement is wrong...
null
CC BY-SA 3.0
null
2008-08-29T18:35:28.947
2017-08-08T04:06:14.977
2017-08-08T04:06:14.977
366,904
3,657
null
34,975
1
null
null
73
45,266
The company I work for is starting to have issues with their current branching model and I was wondering what different kinds of branching strategies the community has been exposed to? Are there any good ones for different situations? What does your company use? What are the advantages and disadvantages of them??
Branching Strategies
CC BY-SA 3.0
0
2008-08-29T18:38:05.667
2014-12-02T13:45:30.597
2014-12-02T13:45:30.597
72,178
2,328
[ "version-control", "branch", "branching-strategy" ]
34,971
2
null
34,924
2
null
A quick google search gave me this forum [http://board.flashkit.com/board/showthread.php?t=715062](http://board.flashkit.com/board/showthread.php?t=715062) where they state that Flash is unable to handle 5.1 audio and the alternative is to use another application that can communicate with Flash to handle the audio side...
null
CC BY-SA 2.5
null
2008-08-29T18:36:45.530
2008-08-29T18:36:45.530
null
null
1,945
null
34,973
1
35,176
null
2
1,627
I have a .NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call to free() when cleaning up after compression. Are th...
Tools for finding memory corruption in managed C++ code
CC BY-SA 4.0
null
2008-08-29T18:37:02.080
2020-12-20T18:26:39.983
2020-12-20T18:23:28.557
63,550
3,429
[ ".net", "managed-c++" ]
34,982
2
null
34,973
0
null
[Rational Purify for Windows](http://www-01.ibm.com/software/awdtools/purifyplus/win/) supports .NET, so I guess that could be used.
null
CC BY-SA 4.0
null
2008-08-29T18:40:03.600
2020-12-20T18:24:14.387
2020-12-20T18:24:14.387
63,550
1,709
null
34,969
2
null
16,501
80
null
The name "lambda" is just a historical artifact. All we're talking about is an expression whose value is a function. A simple example (using Scala for the next line) is: ``` args.foreach(arg => println(arg)) ``` where the argument to the `foreach` method is an expression for an anonymous function. The above line is...
null
CC BY-SA 2.5
null
2008-08-29T18:36:45.140
2008-08-29T18:36:45.140
null
null
3,525
null
34,984
2
null
34,896
3
null
Early is good, definitely before you try to parse it. Anything you're going to output later, or especially pass to other components (i.e., shell, SQL, etc) must be sanitized. But don't go overboard - for instance, passwords are hashed before you store them (right?). Hash functions can accept arbitrary binary data. ...
null
CC BY-SA 2.5
null
2008-08-29T18:40:14.973
2008-08-29T18:40:14.973
null
null
1,806
null
34,985
2
null
34,973
1
null
On [*nix](https://en.wikipedia.org/wiki/Unix), there's a tool called [Valgrind](http://valgrind.org/) that I use for dealing with memory issues, like memory leaks and memory corruption.
null
CC BY-SA 4.0
null
2008-08-29T18:40:35.020
2020-12-20T18:26:39.983
2020-12-20T18:26:39.983
63,550
3,467
null
34,981
1
34,998
null
7
1,726
I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company. ;) Since I've been here (a few months now), I've brought on board my boss, my product manager and several oth...
Scrum: Resistance is (not) futile
CC BY-SA 3.0
0
2008-08-29T18:39:24.320
2011-06-22T06:01:31.243
2011-06-22T06:01:31.243
18,804
3,622
[ "agile", "scrum" ]
34,977
1
41,051
null
2
729
I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet. The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The problem is that the code will only...
Byte level length description
CC BY-SA 3.0
null
2008-08-29T18:38:42.357
2011-11-18T01:16:00.487
2011-11-18T01:16:00.487
827,263
3,663
[ "c", "protocols" ]
34,988
1
219,897
null
5
251
We have some really old code that calls WebServices using behaviours (webservice.htc), and we are having some strange problems... since they've been deprecated a long time ago, I want to change the call. What's the correct way of doing it? It's ASP.NET 1.1
How to transform a WebService call that is using behaviours?
CC BY-SA 3.0
null
2008-08-29T18:41:42.630
2013-03-01T16:00:05.603
2013-03-01T16:00:05.603
1,782
1,782
[ "c#", "javascript", "web-services", "asp.net-1.1", "behavior" ]
34,990
2
null
34,806
0
null
To answer the first part of your post, check out AzMan (Authorization Manager), which, incidentally, is built into windows. It has the capability to specify operations which can be recombined into roles or assigned directly to users. [Check out](http://msdn.microsoft.com/en-us/magazine/cc300469.aspx) To answer the s...
null
CC BY-SA 3.0
null
2008-08-29T18:42:31.490
2017-06-09T10:24:50.897
2017-06-09T10:24:50.897
1,055,241
2,424
null
34,993
2
null
34,955
3
null
The C-runtime libraries are often the biggest culprit. Making sure all your projects have the same settings wrt single vs multi-threading and static vs dll. The MSDN documentation is good for pointing out which lib a particular Win32 API call requires if it comes up as missing. Other than that it usually comes down ...
null
CC BY-SA 2.5
null
2008-08-29T18:43:18.023
2008-08-29T18:43:18.023
null
null
3,631
null
34,991
2
null
34,975
2
null
We currently have one branch for ongoing maintenance, one branch for "new initiatives" which just means "stuff that will come out sometime in the future; we're not sure when." We have also occasionally had two maintenance branches going on: one to provide fixes for what is currently in production and one that is still ...
null
CC BY-SA 2.5
null
2008-08-29T18:42:37.293
2008-08-29T18:42:37.293
null
null
633
null
34,997
2
null
34,938
0
null
The `|` is a bitwise operator in PHP. It does not mean `$a OR $b`, exactly. You'll want to use the double-pipe. And yes, as mentioned, PHP does short-circuit evaluation. In similar fashion, if the first condition of an `&&` clause evaluates to false, PHP does not evaluate the rest of the clause, either.
null
CC BY-SA 2.5
null
2008-08-29T18:45:18.737
2008-08-29T18:45:18.737
null
null
1,344
null