qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
91,699
<p>Python's convention is that variables are created by first assignment, and trying to read their value before one has been assigned raises an exception. PHP by contrast implicitly creates a variable when it is read, with a null value. This means it is easy to do this in PHP:</p> <pre><code>function mymodule_important_calculation() { $result = /* ... long and complex calculation ... */; return $resukt; } </code></pre> <p>This function always returns null, and if null is a valid value for the functuion then the bug might go undetected for some time. The Python equivalent would complain that the variable <code>resukt</code> is being used before it is assigned.</p> <p>So... is there a way to configure PHP to be stricter with variable assignments?</p>
[ { "answer_id": 91776, "author": "e-satis", "author_id": 9951, "author_profile": "https://Stackoverflow.com/users/9951", "pm_score": 0, "selected": false, "text": "error_reporting = E_ALL\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/91699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8925/" ]
91,715
<p>I've not used C++ very much in the past, and have recently been doing a lot of C#, and I'm really struggling to get back into the basics of C++ again. This is particularly tricky as work mandates that none of the most handy C++ constructs can be used, so all strings must be char *'s, and there is no provision for STL lists.</p> <p>What I'm currently trying to do is to create a list of strings, something which would take me no time at all using STL or in C#. Basically I want to have a function such as:</p> <pre><code>char **registeredNames = new char*[numberOfNames]; </code></pre> <p>Then,</p> <pre><code>RegisterName(const * char const name, const int length) { //loop to see if name already registered snipped if(notFound) { registeredNames[lastIndex++] = name; } } </code></pre> <p>or, if it was C#...</p> <pre><code>if(!registeredNames.Contains(name)) { registeredNames.Add(name); } </code></pre> <p>and I realize that it doesn't work. I know the const nature of the passed variables (a const pointer and a const string) makes it rather difficult, but my basic problem is that I've always avoided this situation in the past by using STL lists etc. so I've never had to work around it!</p>
[ { "answer_id": 91749, "author": "Maximilian", "author_id": 1733, "author_profile": "https://Stackoverflow.com/users/1733", "pm_score": 1, "selected": false, "text": "static int lastIndex = 0;\nstatic char **registeredNames = new char*[numberOfNames];\n\nvoid RegisterName(const * char con...
2008/09/18
[ "https://Stackoverflow.com/questions/91715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15667/" ]
91,731
<p>How do you update a summary field's value from post function in JIRA?</p>
[ { "answer_id": 92157, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "public class SomePostFunction implements FunctionProvider {\n\n public void execute(Map transientVars, Map args, PropertySet...
2008/09/18
[ "https://Stackoverflow.com/questions/91731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
91,734
<p>I'm a little blockheaded right now…</p> <p>I have a date string in european format <strong>dd.mm.yyyy</strong> and need to transform it to <strong>mm.dd.yyyy</strong> with classic ASP. Any quick ideas?</p>
[ { "answer_id": 91780, "author": "Anheledir", "author_id": 5703, "author_profile": "https://Stackoverflow.com/users/5703", "pm_score": 2, "selected": false, "text": "payment_date = MID(payment_date,4,3) & LEFT(payment_date,3) & MID(payment_date,7)\n" }, { "answer_id": 91787, "...
2008/09/18
[ "https://Stackoverflow.com/questions/91734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5703/" ]
91,745
<p>I am building a table using the DataGridView where a user can select items from a dropdown in each cell. To simplify the problem, lets say i have 1 column. I am using the DataGridViewComboBoxColumn in the designer. I am trying to support having each row in that column have a different list of items to choose from.</p> <p>Is this possible?</p>
[ { "answer_id": 163247, "author": "WaterBoy", "author_id": 3270, "author_profile": "https://Stackoverflow.com/users/3270", "pm_score": 5, "selected": true, "text": "private void setCellComboBoxItems(DataGridView dataGrid, int rowIndex, int colIndex, object[] itemsToAdd)\n{\n DataGridVi...
2008/09/18
[ "https://Stackoverflow.com/questions/91745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
91,747
<p>How can I set the background color of a specific item in a <em>System.Windows.Forms.ListBox</em>?</p> <p>I would like to be able to set multiple ones if possible.</p>
[ { "answer_id": 91758, "author": "Grad van Horck", "author_id": 12569, "author_profile": "https://Stackoverflow.com/users/12569", "pm_score": 7, "selected": true, "text": "DrawMode" }, { "answer_id": 91770, "author": "Matthew Scharley", "author_id": 15537, "author_prof...
2008/09/18
[ "https://Stackoverflow.com/questions/91747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11137/" ]
91,766
<p>I have a DataGrid where each column has a SortExpression. I would like the sort expression to be the equivalent of "ORDER BY LEN(myField)".</p> <p>I have tried </p> <pre><code>SortExpression="LEN(myField)" </code></pre> <p>but this throws an exception as it is not valid syntax. Any ideas?</p>
[ { "answer_id": 91806, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 2, "selected": false, "text": "SELECT\n ColumnA as FieldA\n , ColumnB as FieldB\n , LEN(ColumnA) as FieldL\nFROM TableName\nORDER BY L\n" }, { ...
2008/09/18
[ "https://Stackoverflow.com/questions/91766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15393/" ]
91,778
<p>To create a new event handler on a control you can do this</p> <pre><code>c.Click += new EventHandler(mainFormButton_Click); </code></pre> <p>or this</p> <pre><code>c.Click += mainFormButton_Click; </code></pre> <p>and to remove an event handler you can do this</p> <pre><code>c.Click -= mainFormButton_Click; </code></pre> <p>But how do you remove all event handlers from an event?</p>
[ { "answer_id": 91803, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 6, "selected": false, "text": "List<EventHandler> delegates = new List<EventHandler>();\n\nprivate event EventHandler MyRealEvent;\n\npublic event Ev...
2008/09/18
[ "https://Stackoverflow.com/questions/91778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7297/" ]
91,784
<p>I have a table with say 3 columns. There's no primary key so there can be duplicate rows. I need to just keep one and delete the others. Any idea how to do this is Sql Server?</p>
[ { "answer_id": 91794, "author": "Manrico Corazzi", "author_id": 4690, "author_profile": "https://Stackoverflow.com/users/4690", "pm_score": 6, "selected": true, "text": "INSERT INTO TABLE_2 \nSELECT DISTINCT * FROM TABLE_1\nGO\nDELETE FROM TABLE_1\nGO\nINSERT INTO TABLE_1\nSELECT * FROM ...
2008/09/18
[ "https://Stackoverflow.com/questions/91784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688440/" ]
91,791
<p>When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with <code>grep</code> and <code>sed</code>. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?</p>
[ { "answer_id": 91801, "author": "Joseph Holsten", "author_id": 16981, "author_profile": "https://Stackoverflow.com/users/16981", "pm_score": 5, "selected": false, "text": "sggrep" }, { "answer_id": 609667, "author": "bortzmeyer", "author_id": 15625, "author_profile": ...
2008/09/18
[ "https://Stackoverflow.com/questions/91791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16981/" ]
91,800
<p>I'm using a FullTextSqlQuery in SharePoint 2007 (MOSS) and need to order the results by two columns:</p> <pre><code>SELECT WorkId FROM SCOPE() ORDER BY Author ASC, Rank DESC </code></pre> <p>However it seems that only the first column from ORDER BY is taken into account when returning results. In this case the results are ordered correctly by Author, but not by Rank. If I change the order the results will be ordered by Rank, but not by Author.</p> <p>I had to resort to my own sorting of the results, which I don't like very much. Has anybody a solution to this?</p> <p><strong>Edit</strong>: Unfortunately it also doesn't accept expressions in the ORDER BY clause (SharePoint throws an exception). My guess is that even if the query looks like legitimate SQL it is parsed somehow before being served to the SQL server.</p> <p>I tried to catch the query with SQL Profiler, but to no avail.</p> <p><strong>Edit 2</strong>: In the end I used ordering by a single column (Author in my case, since it's the most important) and did the second ordering in code on the TOP N of the results. Works good enough for the project, but leaves a bad feeling of kludgy code.</p>
[ { "answer_id": 93524, "author": "Adam Hawkes", "author_id": 6703, "author_profile": "https://Stackoverflow.com/users/6703", "pm_score": 0, "selected": false, "text": "SELECT WorkId FROM SCOPE() ORDER BY AUTHOR + (10 - Rank) ASC\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/91800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15682/" ]
91,810
<p>Working with python interactively, it's sometimes necessary to display a result which is some arbitrarily complex data structure (like lists with embedded lists, etc.) The default way to display them is just one massive linear dump which just wraps over and over and you have to parse carefully to read it.</p> <p>Is there something that will take any python object and display it in a more rational manner. e.g.</p> <pre><code>[0, 1, [a, b, c], 2, 3, 4] </code></pre> <p>instead of:</p> <pre><code>[0, 1, [a, b, c], 2, 3, 4] </code></pre> <p>I know that's not a very good example, but I think you get the idea.</p>
[ { "answer_id": 91818, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": true, "text": "from pprint import pprint\na = [0, 1, ['a', 'b', 'c'], 2, 3, 4]\npprint(a)\n" }, { "answer_id": 92260, "author"...
2008/09/18
[ "https://Stackoverflow.com/questions/91810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4086/" ]
91,817
<p>I discovered that you can start your variable name with a '@' character in C#. In my C# project I was using a web service (I added a web reference to my project) that was written in Java. One of the interface objects defined in the WSDL had a member variable with the name "params". Obviously this is a reserved word in C# so you can't have a class with a member variable with the name "params". The proxy object that was generated contained a property that looked like this:</p> <pre><code>public ArrayList @params { get { return this.paramsField; } set { this.paramsField = value; } } </code></pre> <p>I searched through the VS 2008 c# documentation but couldn't find anything about it. Also searching Google didn't give me any useful answers. So what is the exact meaning or use of the '@' character in a variable/property name?</p>
[ { "answer_id": 91829, "author": "Mark Embling", "author_id": 6844, "author_profile": "https://Stackoverflow.com/users/6844", "pm_score": 3, "selected": false, "text": "event" }, { "answer_id": 91888, "author": "Tomer Gabel", "author_id": 11558, "author_profile": "http...
2008/09/18
[ "https://Stackoverflow.com/questions/91817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13287/" ]
91,821
<p>I have a model class:</p> <pre><code>class Person(db.Model): first_name = db.StringProperty(required=True) last_name = db.StringProperty(required=True) </code></pre> <p>I have an instance of this class in <code>p</code>, and string <code>s</code> contains the value <code>'first_name'</code>. I would like to do something like:</p> <pre><code>print p[s] </code></pre> <p>and </p> <pre><code>p[s] = new_value </code></pre> <p>Both of which result in a <code>TypeError</code>.</p> <p>Does anybody know how I can achieve what I would like?</p>
[ { "answer_id": 91859, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 1, "selected": false, "text": "getattr(p, s)\nsetattr(p, s, new_value)\n" }, { "answer_id": 91911, "author": "Jim", "author_id": 8427, "auth...
2008/09/18
[ "https://Stackoverflow.com/questions/91821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3154/" ]
91,826
<p>Is there a version of FitNesse that works on Delphi 2006/2007/2009?</p> <p>If so where can I find It?</p> <p>Are there any other programs like FitNesse that work on Delphi 2006?</p>
[ { "answer_id": 91859, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 1, "selected": false, "text": "getattr(p, s)\nsetattr(p, s, new_value)\n" }, { "answer_id": 91911, "author": "Jim", "author_id": 8427, "auth...
2008/09/18
[ "https://Stackoverflow.com/questions/91826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
91,831
<p>Say I have the following web.config:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;authentication mode="Windows"&gt;&lt;/authentication&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>Using ASP.NET C#, how can I detect the Mode value of the Authentication tag?</p>
[ { "answer_id": 91836, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 3, "selected": true, "text": "Context.User.Identity.AuthenticationType" }, { "answer_id": 91842, "author": "Paul van Brenk", "author_id": ...
2008/09/18
[ "https://Stackoverflow.com/questions/91831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
91,840
<p>Could anyone explain me finally what is the best strategy to implement transparent and fluent support of multi-tenant functionality in NHibernate powered domain model?</p> <p>Im looking for the way, how to keep the domain logic as isolated as possible from the multi-tenant stuff like filtering by TenantID etc</p>
[ { "answer_id": 249727, "author": "Yuriy Ostapenko", "author_id": 32702, "author_profile": "https://Stackoverflow.com/users/32702", "pm_score": 1, "selected": false, "text": " public class ContextualConnectionProvider : DriverConnectionProvider\n {\n\n protected override stri...
2008/09/18
[ "https://Stackoverflow.com/questions/91840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9198/" ]
91,857
<p>Can I safely rename the cygdrive folder? Also, I would like to add other folders at root and map them to folders on windows in the same way as /cygdrive/c maps to my C drive. Is that possible?</p>
[ { "answer_id": 91865, "author": "Thomas Owens", "author_id": 572, "author_profile": "https://Stackoverflow.com/users/572", "pm_score": 1, "selected": false, "text": "mount" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/91857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45603/" ]
91,899
<p>I'm using grep to generate a list of files I need to move:</p> <pre><code>grep -L -r 'Subject: \[SPAM\]' . </code></pre> <p>How can I pass this list to the mv command and move the files somewhere else?</p>
[ { "answer_id": 91954, "author": "e-satis", "author_id": 9951, "author_profile": "https://Stackoverflow.com/users/9951", "pm_score": 1, "selected": false, "text": "IFS=$'\\n'; # set the field separator to line break\nfor $mail in $(grep -L -r 'Subject: \\[SPAM\\]' .); do mv \"$mail\" your...
2008/09/18
[ "https://Stackoverflow.com/questions/91899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17582/" ]
91,905
<p>I want to add a mailto link on our web page. I want to add a urgent priority to this mail.</p>
[ { "answer_id": 91921, "author": "Robit", "author_id": 17026, "author_profile": "https://Stackoverflow.com/users/17026", "pm_score": 4, "selected": true, "text": "<a href=\"mailto:webmaster@website.com?subject=Urgent\">Send a email</a> \n" }, { "answer_id": 91974, "author": "G...
2008/09/18
[ "https://Stackoverflow.com/questions/91905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17584/" ]
91,932
<p>How does it work, what is it used for and when should one use it?</p>
[ { "answer_id": 92108, "author": "e-satis", "author_id": 9951, "author_profile": "https://Stackoverflow.com/users/9951", "pm_score": 7, "selected": true, "text": "Car()" }, { "answer_id": 95008, "author": "Jorge Córdoba", "author_id": 2695, "author_profile": "https://S...
2008/09/18
[ "https://Stackoverflow.com/questions/91932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2695/" ]
91,933
<p>I've been working on a project where I need to iterate through a collection of data and remove entries where the "primary key" is duplicated. I have tried using a</p> <pre><code>List&lt;int&gt; </code></pre> <p>and </p> <pre><code>Dictionary&lt;int, bool&gt; </code></pre> <p>With the dictionary I found slightly better performance, even though I never need the Boolean tagged with each entry. My expectation is that this is because a List allows for indexed access and a Dictionary does not. What I was wondering is, is there a better solution to this problem. I do not need to access the entries again, I only need to track what "primary keys" I have seen and make sure I only perform addition work on entries that have a new primary key. I'm using C# and .NET 2.0. And I have no control over fixing the input data to remove the duplicates from the source (unfortunately!). And so you can have a feel for scaling, overall I'm checking for duplicates about 1,000,000 times in the application, but in subsets of no more than about 64,000 that need to be unique.</p>
[ { "answer_id": 91979, "author": "Jorge Córdoba", "author_id": 2695, "author_profile": "https://Stackoverflow.com/users/2695", "pm_score": 0, "selected": false, "text": "foreach (int key in keys)\n{\n if (!MyDataDict.ContainsKey(key))\n {\n if (!MyDuplicatesDict.ContainsKey(key))\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/91933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4660/" ]
91,957
<p>How do I use groovy to search+replace in XML?</p> <p>I need something as short/easy as possible, since I'll be giving this code to the testers for their SoapUI scripting.</p> <p>More specifically, how do I turn:</p> <pre><code>&lt;root&gt;&lt;data&gt;&lt;/data&gt;&lt;/root&gt; </code></pre> <p>into:</p> <pre><code>&lt;root&gt;&lt;data&gt;value&lt;/data&gt;&lt;/root&gt; </code></pre>
[ { "answer_id": 92419, "author": "s3v1", "author_id": 17554, "author_profile": "https://Stackoverflow.com/users/17554", "pm_score": 1, "selected": false, "text": "import org.custommonkey.xmlunit.Diff\nimport org.custommonkey.xmlunit.XMLUnit\n\ndef input = '''<root><data></data></root>'''\...
2008/09/18
[ "https://Stackoverflow.com/questions/91957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17554/" ]
91,981
<p>Is there a way to mock object construction using JMock in Java? </p> <p>For example, if I have a method as such:</p> <pre class="lang-java prettyprint-override"><code>public Object createObject(String objectType) { if(objectType.equals("Integer") { return new Integer(); } else if (objectType.equals("String") { return new String(); } } </code></pre> <p>...is there a way to mock out the expectation of the object construction in a test method? </p> <p>I'd like to be able to place expectations that certain constructors are being called, rather than having an extra bit of code to check the type (as it won't always be as convoluted and simple as my example).</p> <p>So instead of:</p> <pre class="lang-java prettyprint-override"><code>assertTrue(a.createObject() instanceof Integer); </code></pre> <p>I could have an expectation of the certain constructor being called. Just to make it a bit cleaner, and express what is actually being tested in a more readable way.</p> <p>Please excuse the simple example, the actual problem I'm working on is a bit more complicated, but having the expectation would simplify it.</p> <hr> <p>For a bit more background:</p> <p>I have a simple factory method, which creates wrapper objects. The objects being wrapped can require parameters which are difficult to obtain in a test class (it's pre-existing code), so it is difficult to construct them.</p> <p>Perhaps closer to what I'm actually looking for is: is there a way to mock an entire class (using CGLib) in one fell swoop, without specifying every method to stub out? </p> <p>So the mock is being wrapped in a constructor, so obviously methods can be called on it, is JMock capable of dynamically mocking out each method? </p> <p>My guess is no, as that would be pretty complicated. But knowing I'm barking up the wrong tree is valuable too :-)</p>
[ { "answer_id": 92718, "author": "Grundlefleck", "author_id": 4120, "author_profile": "https://Stackoverflow.com/users/4120", "pm_score": 1, "selected": false, "text": "public Wrapper wrapObject(Object toWrap) {\n if(toWrap instanceof ClassA) {\n return new Wrapper((ClassA) toWr...
2008/09/18
[ "https://Stackoverflow.com/questions/91981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4120/" ]
91,984
<p>When I use <kbd>CTRL</kbd>+<kbd>H</kbd> I end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible?</p> <p>See image here for what I'm talking about: <a href="https://i.stack.imgur.com/S3Qlf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/S3Qlf.png" alt="enter image description here"></a></p>
[ { "answer_id": 49437058, "author": "Gabriel Staples", "author_id": 4561887, "author_profile": "https://Stackoverflow.com/users/4561887", "pm_score": 0, "selected": false, "text": "rea" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/91984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86/" ]
91,986
<p>I've got the following SQL:</p> <pre><code>select * from transaction_log where stoptime like '%2008%' </code></pre> <p>How do I write this in LINQ to SQL syntax?</p>
[ { "answer_id": 92009, "author": "Nick Craver", "author_id": 13249, "author_profile": "https://Stackoverflow.com/users/13249", "pm_score": 6, "selected": true, "text": "var query = from l in transaction_log\n where SqlMethods.Like(l.stoptime, \"%2008%\")\n select l;\...
2008/09/18
[ "https://Stackoverflow.com/questions/91986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683/" ]
91,994
<p>This is probably a silly question, but curiosity has gotten the better of me. I've been seeing code lately that seems to "reverse" the order of expressions for relational operators e.g.:</p> <pre><code>if (0 == someVariable) </code></pre> <p>As opposed to what I normally see/write:</p> <pre><code>if (someVariable == 0) </code></pre> <p>To me, the second method seems more readable and intuitive, so I'm wondering if there's some reason I'm seeing the first method? Logically, both statements evaluate to the same result, so is it just a matter of personal preference how they're written?</p>
[ { "answer_id": 92003, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackoverflow.com/users/7116", "pm_score": 1, "selected": false, "text": "if (succeeded = TRUE)\n{\n // I could be in trouble here if 'succeeded' was FALSE\n}\n" }, { "answer_id": 92021, ...
2008/09/18
[ "https://Stackoverflow.com/questions/91994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9324/" ]
92,001
<p>AKA - What's this obsession with pointers?</p> <p>Having only really used modern, object oriented languages like ActionScript, Java and C#, I don't really understand the importance of pointers and what you use them for. What am I missing out on here?</p>
[ { "answer_id": 92054, "author": "Adam Wright", "author_id": 1200, "author_profile": "https://Stackoverflow.com/users/1200", "pm_score": 7, "selected": true, "text": "char* foo" }, { "answer_id": 92208, "author": "slim", "author_id": 7512, "author_profile": "https://St...
2008/09/18
[ "https://Stackoverflow.com/questions/92001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11911/" ]
92,004
<p>I'm trying to make a data bound column invisible after data binding, because it won't exist before data binding. However, the DataGrid.Columns collection indicates a count of 0, making it seem as if the automatically generated columns don't belong to the collection.</p> <p>How can I make a column that is automatically generated during binding invisible?</p>
[ { "answer_id": 92028, "author": "Nick Craver", "author_id": 13249, "author_profile": "https://Stackoverflow.com/users/13249", "pm_score": 0, "selected": false, "text": "protected void GridView_RowCreated(object sender, GridViewRowEventArgs e)\n{\n e.Row.Cells[1].Visible = false;\n}\n" ...
2008/09/18
[ "https://Stackoverflow.com/questions/92004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
92,006
<p>I have an algorithm that generates strings based on a list of input words. How do I separate only the strings that sounds like English words? ie. discard <strong>RDLO</strong> while keeping <strong>LORD</strong>.</p> <p><strong>EDIT:</strong> To clarify, they do not need to be actual words in the dictionary. They just need to sound like English. For example <strong>KEAL</strong> would be accepted.</p>
[ { "answer_id": 92083, "author": "Russ", "author_id": 6496, "author_profile": "https://Stackoverflow.com/users/6496", "pm_score": 2, "selected": false, "text": "def soundex(name, len=4):\n digits = '01230120022455012623010202'\n sndx = ''\n fc = ''\n\n for c in name.upper():\n...
2008/09/18
[ "https://Stackoverflow.com/questions/92006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/976/" ]
92,008
<p>How do I programmatically set the record pointer in a C# DataGridView? </p> <p>I've tried "DataGridView.Rows[DesiredRowIndex].Selected=true;", and that does not work. All it does is highlight that row within the grid; it doesn not move the record pointer to that row.</p>
[ { "answer_id": 92105, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 3, "selected": true, "text": "dataGridView1.CurrentCell = this.dataGridView1[YourColumn,YourRow];\n" }, { "answer_id": 12528343, "author": "A...
2008/09/18
[ "https://Stackoverflow.com/questions/92008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7148/" ]
92,027
<p>For a registration form I have something simple like:</p> <pre><code> &lt;tr:panelLabelAndMessage label="Zip/City" showRequired="true"&gt; &lt;tr:inputText id="zip" value="#{data['registration'].zipCode}" contentStyle="width:36px" simple="true" required="true" /&gt; &lt;tr:inputText id="city" value="#{data['registration'].city}" contentStyle="width:133px" simple="true" required="true" /&gt; &lt;/tr:panelLabelAndMessage&gt; &lt;tr:message for="zip" /&gt; &lt;tr:message for="city" /&gt; </code></pre> <p>When including the last two lines, I get two messages on validation error. When ommiting last to lines, a javascript alert shows up, which is not what I want. </p> <p>Is there a solution to show only one validation failed message somehow?</p> <p>Thanks a lot!</p>
[ { "answer_id": 107817, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "panelLabelAndMessage" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11705/" ]
92,035
<p>I have a datagridview with a DataGridViewComboboxColumn column with 3 values:</p> <p>"Small", "Medium", "Large"</p> <p>I get back the users default which in this case is "Medium"</p> <p>I want to show a dropdown cell in the datagridview but default the value to "Medium". i would do this in a regular combobox by doing selected index or just stting the Text property of a combo box.</p>
[ { "answer_id": 92186, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "[DataGridViewComboboxColumnName].DataPropertyName = \"PropertyNameToBindTo\";\n" }, { "answer_id": 712960, "author"...
2008/09/18
[ "https://Stackoverflow.com/questions/92035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
92,043
<p>I've tried the tools listed <a href="http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL" rel="noreferrer">here</a>, some with more success than others, but none gave me valid postgres syntax I could use (tinyint errors etc.)</p>
[ { "answer_id": 106760, "author": "vog", "author_id": 19163, "author_profile": "https://Stackoverflow.com/users/19163", "pm_score": 5, "selected": true, "text": "mysqldump" }, { "answer_id": 15670452, "author": "Linus Oleander", "author_id": 560073, "author_profile": "...
2008/09/18
[ "https://Stackoverflow.com/questions/92043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
92,076
<p>I'm writing some xlst file which I want to use under linux and Windows. In this file I use node-set function which declared in different namespaces for MSXML and xsltproc ("urn:schemas-microsoft-com:xslt" and "<a href="http://exslt.org/common" rel="nofollow noreferrer">http://exslt.org/common</a>" respectively). Is there any platform independent way of using node-set?</p>
[ { "answer_id": 92511, "author": "James Sulak", "author_id": 207, "author_profile": "https://Stackoverflow.com/users/207", "pm_score": 3, "selected": false, "text": "<xsl:choose>\n <xsl:when test=\"function-available('exslt:node-set')\">\n <xsl:apply-templates select=\"exslt:node-set(...
2008/09/18
[ "https://Stackoverflow.com/questions/92076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17569/" ]
92,079
<p>Why does C++ Builder 6 always compile all files? </p> <p>I make some changes on one file but BCB 6 compiles all files when I start the app. Any idea? I use Windows XP SP2.</p>
[ { "answer_id": 1080949, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "#include \"all.h\"\n#pragma hdrstop\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17465/" ]
92,082
<p>How can I add a column with a default value to an existing table in <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server#Genesis" rel="noreferrer">SQL Server 2000</a> / <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server#SQL_Server_2005" rel="noreferrer">SQL Server 2005</a>?</p>
[ { "answer_id": 92092, "author": "Benjamin Autin", "author_id": 1440933, "author_profile": "https://Stackoverflow.com/users/1440933", "pm_score": 6, "selected": false, "text": "ALTER TABLE ADD ColumnName {Column_Type} Constraint\n" }, { "answer_id": 92101, "author": "dbugger",...
2008/09/18
[ "https://Stackoverflow.com/questions/92082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7241/" ]
92,093
<p>I am working on a SQL query that reads from a SQLServer database to produce an extract file. One of the requirements to remove the leading zeroes from a particular field, which is a simple <code>VARCHAR(10)</code> field. So, for example, if the field contains '00001A', the SELECT statement needs to return the data as '1A'.</p> <p>Is there a way in SQL to easily remove the leading zeroes in this way? I know there is an <code>RTRIM</code> function, but this seems only to remove spaces. </p>
[ { "answer_id": 92363, "author": "Ian Horwill", "author_id": 5816, "author_profile": "https://Stackoverflow.com/users/5816", "pm_score": 8, "selected": true, "text": "select substring(ColumnName, patindex('%[^0]%',ColumnName), 10)\n" }, { "answer_id": 4504913, "author": "Kathr...
2008/09/18
[ "https://Stackoverflow.com/questions/92093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7585/" ]
92,100
<p>Is it possible to set code behind a resource dictionary in WPF. For example in a usercontrol for a button you declare it in XAML. The event handling code for the button click is done in the code file behind the control. If I was to create a data template with a button how can I write the event handler code for it's button click within the resource dictionary.</p>
[ { "answer_id": 98422, "author": "ageektrapped", "author_id": 631, "author_profile": "https://Stackoverflow.com/users/631", "pm_score": 9, "selected": true, "text": "<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http...
2008/09/18
[ "https://Stackoverflow.com/questions/92100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6204/" ]
92,114
<p>There is a limitation on Windows Server 2003 that prevents you from copying extremely large files, in proportion to the amount of RAM you have. The limitation is in the CopyFile and CopyFileEx functions, which are used by xcopy, Explorer, Robocopy, and the .NET FileInfo class.</p> <p>Here is the error that you get:</p> <blockquote> <p>Cannot copy [filename]: Insufficient system resources exist to complete the requested service.</p> </blockquote> <p>The is a <a href="http://support.microsoft.com/default.aspx/kb/259837" rel="noreferrer">knowledge base article</a> on the subject, but it pertains to NT4 and 2000.</p> <p>There is also a suggestion to <a href="http://blogs.technet.com/askperf/archive/2007/05/08/slow-large-file-copy-issues.aspx" rel="noreferrer">use ESEUTIL</a> from an Exchange installation, but I haven't had any luck getting that to work.</p> <p>Does anybody know of a quick, easy way to handle this? I'm talking about >50Gb on a machine with 2Gb of RAM. I plan to fire up Visual Studio and just write something to do it for me, but it would be nice to have something that was already out there, stable and well-tested.</p> <p><strong>[Edit]</strong> I provided working C# code to accompany the accepted answer.</p>
[ { "answer_id": 92165, "author": "jabial", "author_id": 16995, "author_profile": "https://Stackoverflow.com/users/16995", "pm_score": 5, "selected": true, "text": "f1 = open(filename1);\nf2 = open(filename2, \"w\");\nwhile( !f1.eof() ) {\n buffer = f1.read(buffersize);\n err = f2.write(...
2008/09/18
[ "https://Stackoverflow.com/questions/92114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219/" ]
92,239
<p>If you have several <code>div</code>s on a page, you can use CSS to size, float them and move them round a little... but I can't see a way to get past the fact that the first <code>div</code> will show near the top of the page and the last <code>div</code> will be near the bottom! I cannot completely override the order of the elements as they come from the source HTML, can you?</p> <p>I must be missing something because people say "we can change the look of the whole website by just editing one CSS file.", but that would depend on you still wanting the <code>div</code>s in the same order!</p> <p>(P.S. I am sure no one uses <code>position:absolute</code> on every element on a page.)</p>
[ { "answer_id": 92357, "author": "Jonathan Arkell", "author_id": 11052, "author_profile": "https://Stackoverflow.com/users/11052", "pm_score": 4, "selected": true, "text": "h1 {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n#content {\n margin-top: 100px;\n margin-right: 250px;\n}...
2008/09/18
[ "https://Stackoverflow.com/questions/92239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11461/" ]
92,258
<p>With my multiproject pom I get an error while running release:prepare. There is nothing fancy about the project setup and every release-step before runs fine. The error I get is:</p> <pre> [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Unable to tag SCM Provider message: The svn tag command failed. Command output: svn: Commit failed (details follow): svn: File '/repos/june/tags/foo-1.0.2/foo.bar.org/pom.xml' already exists </pre> <p>Any idea where it comes from and how to get around it?</p> <p>(sorry for duplicate post - first was closed because I didn't formulate it as a question that can be answered. I hope it's ok now.)</p> <p><b>EDIT</b><br> The maven release plugin takes care of the version handling itself. So when I check the path in the subversion repository the path does not yet exist.</p> <p><b>EDIT 2</b><br> @Ben: I don't know the server version, however the client is 1.5.2, too.</p>
[ { "answer_id": 751060, "author": "Dominic Mitchell", "author_id": 71343, "author_profile": "https://Stackoverflow.com/users/71343", "pm_score": 4, "selected": true, "text": "<build>\n <pluginManagement>\n <plugins>\n <plugin>\n <artifactId>maven-release-plugin</artifactId...
2008/09/18
[ "https://Stackoverflow.com/questions/92258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16515/" ]
92,287
<p>I am trying to write a C# client to a server that is written in Java. The server expects a 4 byte (DataInputStread readInt() in Java) message header followed by the actual message.</p> <p>I am absolutely new to C#, how can I send this message header over to the Java Server? I tried it several ways (mostly trial and error without getting too deep into the C# language), and nothing worked. The Java side ended up with the incorrect (very large) message length.</p>
[ { "answer_id": 92375, "author": "Craig Day", "author_id": 5193, "author_profile": "https://Stackoverflow.com/users/5193", "pm_score": 0, "selected": false, "text": "out.write((len >>> 24) & 0xFF);\nout.write((len >>> 16) & 0xFF);\nout.write((len >>> 8) & 0xFF);\nout.write((len >>> 0) &...
2008/09/18
[ "https://Stackoverflow.com/questions/92287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
92,328
<p>Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:</p> <pre><code>&lt;ListView x:Name="myList" ItemsSource="{Binding SomeList}"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;!-- Focus this! --&gt; &lt;TextBox x:Name="myBox"/&gt; </code></pre> <p>I've tried the following in the code behind:</p> <pre><code>(myList.FindName("myBox") as TextBox).Focus(); </code></pre> <p>but I seem to have misunderstood the <code>FindName()</code> docs, because it returns <code>null</code>.</p> <p>Also the <code>ListView.Items</code> doesn't help, because that (of course) contains my bound business objects and no ListViewItems.</p> <p>Neither does <code>myList.ItemContainerGenerator.ContainerFromItem(item)</code>, which also returns null.</p>
[ { "answer_id": 92765, "author": "Abe Heidebrecht", "author_id": 9268, "author_profile": "https://Stackoverflow.com/users/9268", "pm_score": 4, "selected": false, "text": "private void myList_SelectionChanged(object sender, SelectionChangedEventArgs e)\n{\n if (myList.SelectedItem != n...
2008/09/18
[ "https://Stackoverflow.com/questions/92328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4918/" ]
92,342
<p>Is there the way to apply "greedy" behavior to and keys in Visual Studio? By "greedy" I mean such behavior when all whitespace between cursor position and next word bound can be deleted using one keystroke.</p>
[ { "answer_id": 92388, "author": "hugoware", "author_id": 17091, "author_profile": "https://Stackoverflow.com/users/17091", "pm_score": 1, "selected": false, "text": " Public Sub RemoveWhiteSpace()\n DTE.ActiveDocument.Selection.WordRight(True)\n DTE.ActiveDocument.Select...
2008/09/18
[ "https://Stackoverflow.com/questions/92342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2313/" ]
92,362
<p><strong>Has anyone found a way to run Selenium RC / Selenium Grid tests, written in C# in parallel?</strong></p> <p>I've currently got a sizable test suite written using Selenium RC's C# driver. Running the entire test suite takes a little over an hour to complete. I normally don't have to run the entire suite so it hasn't been a concern up to now, but it's something that I'd like to be able to do more regularly (ie, as part of an automated build)</p> <p>I've been spending some time recently poking around with the Selenium Grid project whose purpose essentially is to allow those tests to run in parallel. Unfortunately, it seems that the TestDriven.net plugin that I'm using runs the tests serially (ie, one after another). I'm assuming that NUnit would execute the tests in a similar fashion, although I haven't actually tested this out. </p> <p>I've noticed that the NUnit 2.5 betas are starting to talk about running tests in parallel with pNUnit, but I haven't really familiarized myself enough with the project to know for sure whether this would work. </p> <p>Another option I'm considering is separating my test suite into different libraries which would let me run a test from each library concurrently, but I'd like to avoid that if possible since I'm not convinced this is a valid reason for splitting up the test suite.</p>
[ { "answer_id": 611452, "author": "Mark", "author_id": 18264, "author_profile": "https://Stackoverflow.com/users/18264", "pm_score": 3, "selected": false, "text": "TestSet" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6112/" ]
92,372
<p>Javascript code can be tough to maintain.<br> I am looking for tools that will help me ensure a reasonable quality level.<br> So far I have found <a href="https://github.com/pivotal/jsunit" rel="noreferrer">JsUNit</a>, a very nice unit test framework for javascript. Tests can be run automatically from ant on any browser available.<br> I have not found yet some javascript equivalent of PMD, checkstyle, Findbug...<br></p> <p>Do you know any static code analysis tool for javascript ? </p>
[ { "answer_id": 4018418, "author": "Gian Marco", "author_id": 66629, "author_profile": "https://Stackoverflow.com/users/66629", "pm_score": 4, "selected": false, "text": "<build>\n <plugins>\n <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifa...
2008/09/18
[ "https://Stackoverflow.com/questions/92372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11897/" ]
92,376
<p>Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?</p>
[ { "answer_id": 92397, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 8, "selected": true, "text": "using System.IO; \n\nstring path = @\"c:\\folders\\newfolder\"; // or whatever \nif (!Directory.Exists(path)) \n{ \nDirecto...
2008/09/18
[ "https://Stackoverflow.com/questions/92376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
92,396
<p>I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:</p> <pre><code>switch (val) { case VAL: // This won't work int newVal = 42; break; case ANOTHER_VAL: ... break; } </code></pre> <p>The above gives me the following error (MSC):</p> <blockquote> <p>initialization of 'newVal' is skipped by 'case' label</p> </blockquote> <p>This seems to be a limitation in other languages too. Why is this such a problem?</p>
[ { "answer_id": 92408, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 5, "selected": false, "text": "switch (val)\n{\n case VAL:\n {\n // This **will** work\n int newVal = 42;\n }\n break;\n\n ca...
2008/09/18
[ "https://Stackoverflow.com/questions/92396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
92,426
<p>There doesn't appear to be any Perl libraries that can open, manipulate, and re-save PDF documents that use the newer PDF version (1.5 and above I believe) that use a cross-reference stream rather than table. Does anyone know of any unix/linux-based utilities to convert a PDF to an older version? Or perhaps there's a Perl module in CPAN I missed that can handle this?</p>
[ { "answer_id": 92453, "author": "Roman Plášil", "author_id": 16590, "author_profile": "https://Stackoverflow.com/users/16590", "pm_score": 1, "selected": false, "text": "gs -dBATCH -dNOPAUSE -sDEVICE=pdfwriter -dCompatibilityLevel=1.2" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
92,427
<p>Based on a simple test I ran, I don't think it's possible to put an inline &lt;style&gt; tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this.</p> <p>Is it possible to do this? I can see it being useful for quick prototypes that just have 1 or 2 CSS classes to apply.</p>
[ { "answer_id": 92444, "author": "Vaibhav", "author_id": 380, "author_profile": "https://Stackoverflow.com/users/380", "pm_score": 1, "selected": false, "text": "ControlName.Attributes[\"style\"] = \"color:red\";\n" }, { "answer_id": 92506, "author": "NakedBrunch", "author...
2008/09/18
[ "https://Stackoverflow.com/questions/92427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2470/" ]
92,434
<p>I'm having a problem with an application hanging and giving me the default "Please tell Microsoft about this problem" popup, instead of the "unhandled exception" dialog in the application.</p> <p>In the application code, the Application.ThreadException and AppDomain.CurrentDomain.UnhandledException are both redirected to a method which writes an error log to disk, saves a screenshot to disk, and shows a friendly dialog box.</p> <p>But when this error occurs, none of those three things happen. All I get is this in the event viewer:</p> <p><em>EventType clr20e3, P1 myapp.exe, P2 4.0.0.0, P3 47d794d4, P4 mscorlib, P5 2.0.0.0, P6 471ebc5b, P7 15e5, P8 27, P9 system.argumentoutofrange, P10 NIL</em></p> <p>Given that the error only seems to happen after the application has been running for several hours, I wonder if it may be a memory-leak problem. I've searched a bit for "clr20e3" but only managed to find ASP.Net stuff. My application is Windows Forms (.Net 2.0) exe, using quite a few assemblies - in both C# and some unmanaged C++.</p> <p>I guess that it could also be an error in the error handling method - As some answers suggest, I may try logging at the start of error handler (but given that that is pretty much what I do anyway...).</p> <p>Any help solving this problem would be much appreciated - whether it is solutions, or suggestions in how to find out what the root cause of the problem is.</p> <p>UPDATE: The root cause of the original bug was accessing an array with a negative index (that was the system.argumentoutofrange). Why this was not trapped is a bit of a mystery to me, but given than both exceptions were sent to the same handling code, I wonder if there may not have been a condition where (for example) both were invoked and fought over a resource (the log file, for example)?</p> <p>I managed to prove this much by doing an EventLog.WriteEntry before anything else in the error handling code. Having now added a flag to prevent re-entry in the error handling, I no longer appear to have a problem...</p>
[ { "answer_id": 92495, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 1, "selected": false, "text": "ArgumentOutOfRangeException" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11410/" ]
92,438
<p>I use to run</p> <pre><code>$s =~ s/[^[:print:]]//g; </code></pre> <p>on Perl to get rid of non printable characters. </p> <p>In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. </p> <p>What would you do? </p> <p>EDIT: It has to support Unicode characters as well. The string.printable way will happily strip them out of the output. curses.ascii.isprint will return false for any unicode character.</p>
[ { "answer_id": 92441, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "def filter_non_printable(str):\n return ''.join([c for c in str if ord(c) > 31 or ord(c) == 9])\n" }, { "ans...
2008/09/18
[ "https://Stackoverflow.com/questions/92438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
92,452
<p>I've been working on this for a few days now, and I've found several solutions but none of them incredibly simple or lightweight. The problem is basically this: We have a cluster of 10 machines, each of which is running the same software on a multithreaded ESB platform. I can deal with concurrency issues between threads on the same machine fairly easily, but what about concurrency on the same data on different machines? </p> <p>Essentially the software receives requests to feed a customer's data from one business to another via web services. However, the customer may or may not exist yet on the other system. If it does not, we create it via a web service method. So it requires a sort of test-and-set, but I need a semaphore of some sort to lock out the other machines from causing race conditions. I've had situations before where a remote customer was created twice for a single local customer, which isn't really desirable.</p> <p>Solutions I've toyed with conceptually are:</p> <ol> <li><p>Using our fault-tolerant shared file system to create "lock" files which will be checked for by each machine depending on the customer</p></li> <li><p>Using a special table in our database, and locking the whole table in order to do a "test-and-set" for a lock record.</p></li> <li><p>Using Terracotta, an open source server software which assists in scaling, but uses a hub-and-spoke model.</p></li> <li><p>Using EHCache for synchronous replication of my in-memory "locks."</p></li> </ol> <p>I can't imagine that I'm the only person who's ever had this kind of problem. How did you solve it? Did you cook something up in-house or do you have a favorite 3rd-party product?</p>
[ { "answer_id": 97897, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "java.util.concurrent.locks.Lock lock = Hazelcast.getLock (\"mymonitor\");\nlock.lock ();\ntry {\n// do your stuff\n}finally {\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/92452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7567/" ]
92,465
<p>I've started a conversion of a project to Moose and the first thing I noticed was that my critic/tidy tests go to hell. Moose, Tidy and Critic don't seem to like each other as much as they used to.</p> <p>Are there docs anywhere on how to make critic/tidy be more appreciative of the Moose dialect? What do most Moose users do? Relax/ditch critic for the more heavy Moose modules? Custom policies?</p>
[ { "answer_id": 101658, "author": "jplindstrom", "author_id": 10155, "author_profile": "https://Stackoverflow.com/users/10155", "pm_score": 3, "selected": false, "text": "my $apple = Apple->new({\n color => \"red\",\n type => \"delicious\",\n});\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91911/" ]
92,471
<p>I have a Cocoa app that uses a WebView to display an HTML interface. How would I go about calling an Objective-C method from a Javascript function within the HTML interface?</p>
[ { "answer_id": 30467359, "author": "Michael Diedrick", "author_id": 4279586, "author_profile": "https://Stackoverflow.com/users/4279586", "pm_score": 2, "selected": false, "text": "[testWinWebView setFrameLoadDelegate:self];\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5168/" ]
92,475
<p>I've implemented a stopwatch that works fine without considering that bank holidays and weekends shouldn't be counted in the total duration. I was looking for some open-source library where I could get the elapsed time, passing a start instant, end instant and a set of bank holidays (weekends aren't counted in). The only library that makes me things easier is net.sf.jtemporal, but I have still to amplify the functionality. Could anyone tell me if there is some useful library to get the wanted functionality?</p>
[ { "answer_id": 92733, "author": "bastos.sergio", "author_id": 12772, "author_profile": "https://Stackoverflow.com/users/12772", "pm_score": 1, "selected": false, "text": "private long CalculateTimeSpan(DateTime BeginDate, DateTime EndDate, ArrayList<DateTime> BankHollidays)\n{\n long ...
2008/09/18
[ "https://Stackoverflow.com/questions/92475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
92,504
<p>I'm trying to create a self signed certificate for use with Apache Tomcat 6. Every certificate I can make always results in the browser connecting with AES-128. The customer would like me to demonstrate that I can create a connection at AES-256.</p> <p>I've tried java's keytool and openssl. I've tried with a variety of parameters, but can't seem to specify anything about the keysize, just the signature size.</p> <p>How can I get the browser-tomcat connection to use AES-256 with a self signed certificate?</p>
[ { "answer_id": 93696, "author": "delfuego", "author_id": 16414, "author_profile": "https://Stackoverflow.com/users/16414", "pm_score": 5, "selected": true, "text": "keytool -genkey -alias tomcat -keyalg RSA\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17583/" ]
92,514
<p>Is there any way to create a ODBC DSN with C#?</p> <p>Maybe a P/invoke?</p>
[ { "answer_id": 92645, "author": "Juanma", "author_id": 3730, "author_profile": "https://Stackoverflow.com/users/3730", "pm_score": 2, "selected": false, "text": "HKLM\\Software\\ODBC\\ODBC.INI\\ODBC Data Sources\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098074/" ]
92,522
<p>What is the best way to issue a http get in VB.net? I want to get the result of a request like <a href="http://api.hostip.info/?ip=68.180.206.184" rel="noreferrer">http://api.hostip.info/?ip=68.180.206.184</a> </p>
[ { "answer_id": 92544, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 7, "selected": true, "text": "Dim webClient As New System.Net.WebClient\nDim result As String = webClient.DownloadString(\"http://api.hostip.info/?ip=68.180...
2008/09/18
[ "https://Stackoverflow.com/questions/92522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4221/" ]
92,533
<p>Based on <a href="https://stackoverflow.com/questions/6209/split-a-string-ignoring-quoted-sections#6243">"Split a string by spaces in Python"</a>, which uses <em>shlex.split</em> to split a string with quotes smartly, I would be interested in hearing about other common tasks solved by non-obvious standard library functions. </p> <p>If this turns into <a href="http://www.doughellmann.com/projects/PyMOTW/" rel="nofollow noreferrer">Module of The Week</a>, that's fine too. </p>
[ { "answer_id": 95159, "author": "Gregg Lind", "author_id": 15842, "author_profile": "https://Stackoverflow.com/users/15842", "pm_score": 2, "selected": false, "text": "# in R, shorter iterables are automatically cycled\n# and all functions \"apply\" in a \"map\"-like way over lists\n> 0:...
2008/09/18
[ "https://Stackoverflow.com/questions/92533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842/" ]
92,537
<p>I have an AST derived from the ANTLR Parser Generator for Java. What I want to do is somehow construct a control flow graph of the source code, where each statement or expression is a unique Node. I understand there must be some recursiveness to this identification, I was wondering what you would suggest as the best option and if ANTLR has a toolset I can use for this job. Cheers, Chris</p> <hr> <p>EDIT - My main concern is to get a control flow graph(CFG) from the AST. This way I can get a tree representation of the source. To clarify, both the source code and the implementation language is Java.</p>
[ { "answer_id": 93598, "author": "EfForEffort", "author_id": 14113, "author_profile": "https://Stackoverflow.com/users/14113", "pm_score": 5, "selected": true, "text": "for" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5915/" ]
92,540
<p>In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application?</p> <p>Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a problem. But what if I want to create one at runtime?</p> <p>More details:</p> <p>My application is a conversion of an existing Visual FoxPro application. I've been trying to read as much as I can about application settings, user settings, etc. and get myself clear on the .Net way of doing things, but there are still several things I am confused on.</p> <p>In the Fox app, saved settings are stored in the registry. My forms are subclassed, and I have base class code that automatically saves the form position and size in the registry keyed on the form name. Whenever I create a new form, I don't have to do anything special to get this behavior; it's built in to the base class. My .Net forms are also subclassed, that part is working well.</p> <p>In .Net, I get the impression I'm supposed to use User scoped settings for things like user preferences. Size and location of a form definitely seem like a user preference. But, I can't see any way to automatically add these settings to the project. In other words, every time I add a new form to my project (and their are 100's of forms), I have to remember to ADD a User scoped application setting and be sure to give it the same name as the form, i.e., &quot;FormMySpecialSizePosition&quot; to hold the size and position. I'd rather not have to remember to do that. Is this just tough luck? Or am I totally barking up the wrong tree by trying to use User scoped settings? Do I need to create my own XML file to hold settings, so that I can do whatever I want (i.e, add a new setting at runtime)? Or something else?</p> <p>Surely this is very common and somebody can tell the &quot;right&quot; way to do it.</p>
[ { "answer_id": 93211, "author": "Stormenet", "author_id": 2090, "author_profile": "https://Stackoverflow.com/users/2090", "pm_score": 0, "selected": false, "text": "public class myForm : Form {\nprotected override void OnLoad(){\n //load the settings and apply them\n base.OnLoad();...
2008/09/18
[ "https://Stackoverflow.com/questions/92540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
92,546
<p>When refactoring away some <code>#defines</code> I came across declarations similar to the following in a C++ header file:</p> <pre><code>static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; </code></pre> <p>The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the classic <code>#ifndef HEADER</code> <code>#define HEADER</code> <code>#endif</code> trick (if that matters).</p> <p>Does the static mean only one copy of <code>VAL</code> is created, in case the header is included by more than one source file?</p>
[ { "answer_id": 92641, "author": "Justsalt", "author_id": 13693, "author_profile": "https://Stackoverflow.com/users/13693", "pm_score": 8, "selected": true, "text": "static" }, { "answer_id": 92693, "author": "slicedlime", "author_id": 11230, "author_profile": "https:/...
2008/09/18
[ "https://Stackoverflow.com/questions/92546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
92,561
<p>I am developing an application, and have URLs in the format <code>www.example.com/some_url/some_parameter/some_keyword</code>. I know by design that there is a maximum length that these URLs will have (and still be valid). Should I validate the URL length with every request in order to protect against buffer overflow/injection attacks? I believe this is an obvious yes but I'm not a security expert so perhaps I am missing something.</p>
[ { "answer_id": 31567280, "author": "thecoshman", "author_id": 300797, "author_profile": "https://Stackoverflow.com/users/300797", "pm_score": 0, "selected": false, "text": "@Path(\"/person/(.{0..100}\")" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4527/" ]
92,613
<p>I have some code which is supposed to display a short message. Here's the pertinent code:</p> <pre><code>DATA SEGMENT 'DATA' MSG DB 0AH, 0DH, 'Hello, Adam', '$' CHAR DB 00H DATA ENDS CODE SEGMENT 'CODE' PRINT_MSG: MOV AH, 09H ;Command to print string of characters MOV DX, OFFSET MSG ;Mov address of message into DX INT 21H ;DOS Interrupt JMP WAITING ;Loop back to waiting state CODE ENDS </code></pre> <p>And the output is:</p> <pre><code>E:\ece323\software\lab2&gt;MAIN.EXE ?F ^?¶ ? N? ? -!- Hello, Adam- </code></pre> <p>What is going on here?</p>
[ { "answer_id": 92708, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 2, "selected": false, "text": " MOV DX, offset MSG\n" }, { "answer_id": 92767, "author": "Community", "author_id": -1, "auth...
2008/09/18
[ "https://Stackoverflow.com/questions/92613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13790/" ]
92,620
<p>I came back today to an old script I had for logging into Gmail via SSL. The script worked fine last time I ran it (several months ago) but now it dies immediately with:</p> <pre><code>&lt;urlopen error The read operation timed out&gt; </code></pre> <p>If I set the timeout (no matter how long), it dies even more immediately with:</p> <pre><code>&lt;urlopen error The connect operation timed out&gt; </code></pre> <p>The latter is reproducible with:</p> <pre><code>import socket socket.setdefaulttimeout(30000) sock = socket.socket() sock.connect(('www.google.com', 443)) ssl = socket.ssl(sock) </code></pre> <p>returning:</p> <pre><code>socket.sslerror: The connect operation timed out </code></pre> <p>but I can't seem to reproduce the former and, after much stepping thru the code, I have no clue what's causing any of this.</p>
[ { "answer_id": 93404, "author": "defnull", "author_id": 407880, "author_profile": "https://Stackoverflow.com/users/407880", "pm_score": 2, "selected": false, "text": "import socket\nsocket.setdefaulttimeout(30000)\nsock = socket.socket()\nsock.connect(('www.google.com', 443))\nssl = sock...
2008/09/18
[ "https://Stackoverflow.com/questions/92620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300/" ]
92,679
<p>We are currently testing a Java Swing application for it's performance. I wonder if there is a good tool to automate this?</p>
[ { "answer_id": 1001001, "author": "Dema", "author_id": 407003, "author_profile": "https://Stackoverflow.com/users/407003", "pm_score": 0, "selected": false, "text": " Scenario: Dialog manipulation\n Given the frame \"SwingSet\" is visible\n And the frame \"SwingSet\" is the conta...
2008/09/18
[ "https://Stackoverflow.com/questions/92679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11962/" ]
92,689
<p>I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward.</p> <pre><code>&lt;asp:ListView runat="server" ID="ArticleList"&gt; &lt;LayoutTemplate&gt; &lt;div class="ContentContainer"&gt; &lt;div runat="server" id="itemPlaceholder" /&gt; &lt;/div&gt; &lt;/LayoutTemplate&gt; &lt;ItemTemplate&gt; &lt;div&gt; &lt;div&gt;&lt;%# Eval("Content") %&gt;&lt;/div&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:ListView&gt; </code></pre> <p>I assume it's something like:</p> <pre><code>ListView view = new ListView(); view.LayoutTemplate = ..... view.ItemTemplate = ..... // when do I call these? view.DataSource = myDataSource; view.DataBind(); </code></pre> <p><strong>Update:</strong> I created 2 templates by implementing the ITemplate interface:</p> <pre><code>private class LayoutTemplate : ITemplate { public void InstantiateIn(Control container) { var outer = new HtmlGenericControl("div"); var inner = new HtmlGenericControl("div") { ID = "itemPlaceholder" }; table.Rows.Add(row); container.Controls.Add(table); } } private class ItemTemplate : ITemplate { public void InstantiateIn(Control container) { var inner = new HtmlGenericControl("div"); container.Controls.Add(inner); } } </code></pre> <p>and I can add them using:</p> <pre><code>dataList.LayoutTemplate = new LayoutTemplate(); dataList.ItemTemplate = new ItemTemplate(); </code></pre> <p>But then I get stuck, since container.DataItem is null.</p>
[ { "answer_id": 94536, "author": "sontek", "author_id": 17176, "author_profile": "https://Stackoverflow.com/users/17176", "pm_score": -1, "selected": false, "text": "public delegate void InstantiateTemplateDelegate(Control container);\n\npublic class GenericTemplateImplementation : ITempl...
2008/09/18
[ "https://Stackoverflow.com/questions/92689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1837197/" ]
92,696
<p>I have a couple databases on a shared SQL Server 2005 cluster instance, that I would like performance metrics on. I have some processes that run for a very long time and suspect that code inefficiencies, rather than insufficient hardware are to blame.</p> <p>I would like some way to get these performance metrics so that I can rule out the database hardware as the culprit.</p>
[ { "answer_id": 94536, "author": "sontek", "author_id": 17176, "author_profile": "https://Stackoverflow.com/users/17176", "pm_score": -1, "selected": false, "text": "public delegate void InstantiateTemplateDelegate(Control container);\n\npublic class GenericTemplateImplementation : ITempl...
2008/09/18
[ "https://Stackoverflow.com/questions/92696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5885/" ]
92,698
<p>I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function.</p> <p>In SQL Server you could do something like:</p> <p><strong>Person</strong></p> <pre><code>John Steve Richard </code></pre> <p><strong>SQL</strong></p> <pre><code>DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList </code></pre> <p>Which produces: John, Steve, Richard</p> <p>I want to do the same but in Access 2007.</p> <p>Does anyone know how to combine rows like this in Access 2007?</p>
[ { "answer_id": 92878, "author": "Nick Craver", "author_id": 13249, "author_profile": "https://Stackoverflow.com/users/13249", "pm_score": 0, "selected": false, "text": "Nz(variant, [if null value])" }, { "answer_id": 93332, "author": "Dave DuPlantis", "author_id": 8174, ...
2008/09/18
[ "https://Stackoverflow.com/questions/92698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3742/" ]
92,699
<p>I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept.</p> <p>Is it possible to query when a product will be finished manufacturing without using stored procedures or loops?</p> <p>For example:</p> <ul> <li>OffDays has 2008-01-10, 2008-01-11, 2008-01-14.</li> <li>LeadTime has 5 for product 9.</li> <li>Order has 2008-01-09 for product 9.</li> </ul> <p>The calculation I'm looking for is this:</p> <ul> <li>2008-01-09 1</li> <li>2008-01-10 x</li> <li>2008-01-11 x</li> <li>2008-01-12 2</li> <li>2008-01-13 3</li> <li>2008-01-14 x</li> <li>2008-01-15 4</li> <li>2008-01-16 5</li> </ul> <p>I'm wondering if it's possible to have a query return 2008-01-16 without having to use a stored procedure, or calculate it in my application code.</p> <p><strong>Edit (why no stored procs / loops):</strong> The reason I can't use stored procedures is that they are not supported by the database. I can only add extra tables / data. The application is a third party reporting tool where I can only control the SQL query.</p> <p><strong>Edit (how i'm doing it now):</strong> My current method is that I have an extra column in the order table to hold the calculated date, then a scheduled task / cron job runs the calculation on all the orders every hour. This is less than ideal for several reasons.</p>
[ { "answer_id": 92736, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": 2, "selected": false, "text": "SELECT c.dt, l.*, o.*, c.*\n FROM [statistics].dbo.[calendar] c, \n [order] o JOIN\n lead l ON l.leadId = o.leadId\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/92699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
92,720
<p>I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.</p> <p>How do I use jQuery to get the set of images, filter it to broken images then replace the src?</p> <hr/> <p>--I thought it would be easier to do this with jQuery, but it turned out much easier to just use a pure JavaScript solution, that is, the one provided by Prestaul.</p>
[ { "answer_id": 92819, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 11, "selected": true, "text": "onError" }, { "answer_id": 92829, "author": "Nick Craver", "author_id": 13249, "author_profile": "https:...
2008/09/18
[ "https://Stackoverflow.com/questions/92720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17702/" ]
92,728
<p>Was looking for some approaches to incrementally converting an large existing ASP.NET VB.NET project to C# while still being able to deploy it as a single web application (currently deployed on a weekly basis). </p> <p>My thoughts were to just create a new C# ASP.NET project and slowly move pages over, but I've never attempted to do this and somehow merge it with another ASP.NET project during deployment.</p> <p>(Clarification: Large ASP.NET VB.NET projects are absolute dogs in the VS IDE...)</p> <p>Any thoughts?</p>
[ { "answer_id": 92840, "author": "SpoiledTechie.com", "author_id": 7644, "author_profile": "https://Stackoverflow.com/users/7644", "pm_score": 2, "selected": false, "text": "<compilation>\n<codeSubDirectories>\n <add directoryName=\"VB_Code\"/>\n <add directoryName=\"CS_Code\"/>\n</...
2008/09/18
[ "https://Stackoverflow.com/questions/92728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17691/" ]
92,742
<p>Has anyone else experienced (and possibly solved) unintentional pitch changes using MS SAPI TTS voices? </p> <p>I'm using the SpVoice automation interface with SAPI 5.1.</p> <p>Right now, my application (VB6 app) can get into a state where the TTS (Microsoft Anna) starts to sound like a chipmunk (proper rate, but high pitch) and even a reboot of Vista does not correct the issue. </p> <p>I'm passing in XML to the Voice.Speak() function. I've tried sending &lt; pitch absmiddle="0" /> before all other XML and it still does not correct the pitch issue. When I try the TTS voice preview in the Speech control panel, the voice has a normal pitch.</p> <p>The issue has occurred for me in XP in the past, however a reboot seemed to correct it.</p>
[ { "answer_id": 98837, "author": "Jason Stevenson", "author_id": 13368, "author_profile": "https://Stackoverflow.com/users/13368", "pm_score": 0, "selected": false, "text": "<pitch absmiddle=\"0\">" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17649/" ]
92,769
<p>I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line.</p> <p>Bad times!</p> <p>Anyone know how to stop this?</p>
[ { "answer_id": 2069859, "author": "Haacked", "author_id": 598, "author_profile": "https://Stackoverflow.com/users/598", "pm_score": 1, "selected": false, "text": "<BlogEntryEditor defaultProvider=\"FCKeditorBlogEntryEditorProvider\">\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5802/" ]
92,781
<p>I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?</p>
[ { "answer_id": 92805, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 3, "selected": false, "text": "public class JVertLabel extends JComponent{\n private String text;\n\n public JVertLabel(String s){\n text = s;\n }\n...
2008/09/18
[ "https://Stackoverflow.com/questions/92781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16538/" ]
92,792
<p>I have a user control which is loaded in the page dynamically using the following code in Init of the Page.</p> <pre><code>Dim oCtl As Object oCtl = LoadControl("~/Controls/UserControl1.ascx") oCtl.Id = "UserControl11" PlaceHolder1.Controls.Clear() PlaceHolder1.Controls.Add(oCtl) </code></pre> <p>The user control also contains a button and I am unable to capture the button click within the user control. </p>
[ { "answer_id": 93120, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "Partial Class DynamicLoad\n Inherits System.Web.UI.Page\n\n Protected Sub Page_Init(ByVal sender As Object, ByVal e As Sy...
2008/09/18
[ "https://Stackoverflow.com/questions/92792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
92,802
<p>I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the <code>pause</code> command. Is there a Linux equivalent I can use in my script?</p>
[ { "answer_id": 92813, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 10, "selected": true, "text": "read" }, { "answer_id": 92821, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackove...
2008/09/18
[ "https://Stackoverflow.com/questions/92802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4362/" ]
92,809
<p>With the plethora of communication methods available to co-workers, how do you manage to keep distractions at bay for a large enough block of time to accomplish some focused programming?</p> <p>Do you quit or close all communications, have you informed people that an away message really means you are a way, or something else?</p>
[ { "answer_id": 92899, "author": "Tony Pitale", "author_id": 1167846, "author_profile": "https://Stackoverflow.com/users/1167846", "pm_score": 1, "selected": false, "text": "open" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167846/" ]
92,820
<pre><code>class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } </code></pre> <p>Q1: Why is <code>arrayOfA</code> not an array of <code>IFoos</code>?</p> <p>Q2: Why can't I cast <code>arrayOfA</code> to <code>IFoo[]</code>?</p>
[ { "answer_id": 92856, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": -1, "selected": false, "text": "if (arrayofA[0] is IFoo) {.....}\n" }, { "answer_id": 92876, "author": "Ed Guiness", "author_id": 420...
2008/09/18
[ "https://Stackoverflow.com/questions/92820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7529/" ]
92,826
<p>Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn command for use.</p>
[ { "answer_id": 4998988, "author": "Fabio", "author_id": 518204, "author_profile": "https://Stackoverflow.com/users/518204", "pm_score": 2, "selected": false, "text": "~/.subversion/config" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5586/" ]
92,841
<p>I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the framework to validate and/or sterilize a class name.</p>
[ { "answer_id": 92958, "author": "Zach", "author_id": 8720, "author_profile": "https://Stackoverflow.com/users/8720", "pm_score": 2, "selected": false, "text": "CodeCompiler.ValidateIdentifiers(class1);\n" }, { "answer_id": 92978, "author": "Jason Diller", "author_id": 218...
2008/09/18
[ "https://Stackoverflow.com/questions/92841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8720/" ]
92,842
<p>I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble.</p> <p>I know that tables are supposed to be the epitome of evil for design layout, and really expensive to display for the browser, but I'm not exactly sure how to put my rounded corners in the correct location and make sure everything lines up.</p> <p>Does anyone have any suggestions, examples, hacks for the HTML/CSS required, or should I just stick with tables and hope for the best?</p>
[ { "answer_id": 92889, "author": "Doug Moore", "author_id": 13179, "author_profile": "https://Stackoverflow.com/users/13179", "pm_score": 0, "selected": false, "text": "<style>\n .start { background-image: url(\"topofbubble.png\"); height: <heightofimage>; }\n .end { background-image: u...
2008/09/18
[ "https://Stackoverflow.com/questions/92842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12096/" ]
92,847
<p>How do I make an array shorter in Perl? I read some webpages indicating that I can assign:</p> <pre><code>$#ARRAY = 42; </code></pre> <p>I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work:</p> <pre><code>$#$ARRAY[$i] = 42; </code></pre>
[ { "answer_id": 92883, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 0, "selected": false, "text": "splice @array, $length;\n#or\nsplice @{$arrays[$i]}, $length;\n" }, { "answer_id": 92935, "author": "Fros...
2008/09/18
[ "https://Stackoverflow.com/questions/92847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4454/" ]
92,848
<p>I have a Win-CGI application I am currently converting to ISAPI.</p> <p>The application uses the TDataset descendants for Extended Systems Advantage Database Server.</p> <p>As there can be only one instance of a TAdsSettings object, this must be in the main thread.</p> <p>TAdsQuery objects are needed in the request threads.</p> <p>Will this work - that is, will the AdsQueries in the request threads pick up the global settings from the AdsSettings object in the main thread, and will this be thread safe?</p>
[ { "answer_id": 94522, "author": "Francesca", "author_id": 9842, "author_profile": "https://Stackoverflow.com/users/9842", "pm_score": 0, "selected": false, "text": "System.MainThreadID <> Windows.GetCurrentThreadID" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11820/" ]
92,859
<p>This question was <a href="https://stackoverflow.com/questions/13049">already asked in the context of C#/.Net</a>.</p> <p>Now I'd like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design.</p> <p>I'll start with an obvious difference:</p> <ul> <li>If you don't specify <code>public:</code> or <code>private:</code>, members of a struct are public by default; members of a class are private by default.</li> </ul> <p>I'm sure there are other differences to be found in the obscure corners of the C++ specification.</p>
[ { "answer_id": 92914, "author": "crashmstr", "author_id": 1441, "author_profile": "https://Stackoverflow.com/users/1441", "pm_score": 5, "selected": false, "text": "struct" }, { "answer_id": 100899, "author": "Community", "author_id": -1, "author_profile": "https://St...
2008/09/18
[ "https://Stackoverflow.com/questions/92859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2686/" ]
92,860
<p>What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this:</p> <pre><code>MyPage.aspx: &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server"&gt; &lt;uc1:MyUserControl ID="MyUserControl1" runat="server" OnSomeEvent="MyUserControl_OnSomeEvent" /&gt; MyUserControl.ascx.cs: public partial class MyUserControl: UserControl { public event EventHandler SomeEvent; .... private void OnSomething() { if (SomeEvent!= null) SomeEvent(this, EventArgs.Empty); } </code></pre> <p>Question is what is best practise?</p>
[ { "answer_id": 92959, "author": "Doug Moore", "author_id": 13179, "author_profile": "https://Stackoverflow.com/users/13179", "pm_score": 4, "selected": true, "text": "<%@ Control Language=\"c#\" AutoEventWireup=\"false\" \n Codebehind=\"WebUserControl1.ascx.cs\" \n Inherits=\"aspne...
2008/09/18
[ "https://Stackoverflow.com/questions/92860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15555/" ]
92,862
<p>In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded.</p> <p>This list may be incomplete but, here are some of the operators that cannot be overloaded: </p> <pre><code>!, not, &amp;&amp;, and, ||, or </code></pre>
[ { "answer_id": 92931, "author": "Jordi Bunster", "author_id": 4272, "author_profile": "https://Stackoverflow.com/users/4272", "pm_score": 4, "selected": false, "text": "5 + 5" }, { "answer_id": 98232, "author": "Ryan Bigg", "author_id": 15245, "author_profile": "https...
2008/09/18
[ "https://Stackoverflow.com/questions/92862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167846/" ]
92,869
<p>I am going to be starting up a new project at work and want to get into unit testing. We will be using Visual Studio 2008, C#, and the ASP.NET MVC stuff. I am looking at using either NUnit or the built-in test projects that Visual Studio 2008 has, but I am open to researching other suggestions. Is one system better than the other or perhaps easier to use/understand than the other?</p> <p>I am looking to get this project set up as kind of the &quot;best practice&quot; for our development efforts going forward.</p>
[ { "answer_id": 547199, "author": "Tuomas Hietanen", "author_id": 17791, "author_profile": "https://Stackoverflow.com/users/17791", "pm_score": 3, "selected": false, "text": " #if !MSTEST\n using NUnit.Framework;\n #else\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/92869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13593/" ]
92,894
<p>I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function similarly to users, but do not need to the ability to be a first order user. </p> <p>Is it reasonable to create a second table, <code>people_tb</code>, that is the main relational table and data store, and only use the <code>users_tb</code> for authentication? Does separating <code>user_tb</code> from <code>people_tb</code> present any problems? If this is commonly done, what are some strategies and solutions as well as drawbacks? </p>
[ { "answer_id": 92965, "author": "ern", "author_id": 5609, "author_profile": "https://Stackoverflow.com/users/5609", "pm_score": 0, "selected": false, "text": "people" }, { "answer_id": 93090, "author": "Rick Glos", "author_id": 16008, "author_profile": "https://Stacko...
2008/09/18
[ "https://Stackoverflow.com/questions/92894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1227/" ]
92,928
<p>In Python for *nix, does <code>time.sleep()</code> block the thread or the process?</p>
[ { "answer_id": 92986, "author": "Zach Burlingame", "author_id": 2233, "author_profile": "https://Stackoverflow.com/users/2233", "pm_score": 6, "selected": false, "text": "sleep()" }, { "answer_id": 93179, "author": "Nick Bastin", "author_id": 1502059, "author_profile"...
2008/09/18
[ "https://Stackoverflow.com/questions/92928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17732/" ]
92,971
<p>I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my screen.</p> <p>I guess this is a <em>big</em> ask for the general case, so to narrow things down a bit I'm most interested in GNU Emacs 22 on Windows and (Debian) Linux.</p>
[ { "answer_id": 93005, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "(setq initial-frame-alist\n (append '((width . 263) (height . 112) (top . -5) (left . 5) (font . \"4.System VIO\"))\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/92971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6402/" ]
92,984
<p>A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of <code>Function.prototype.curry</code>, which was the basis of our discussion:</p> <pre><code>Function.prototype.curry = function() { if (!arguments.length) return this; var args = Array.prototype.slice.apply(arguments); var mmm_curry = this, args; return function() { var inner_args = Array.prototype.slice.apply(arguments); return mmm_curry.apply(this, args.concat(inner_args)); } } </code></pre> <p>Which is used as follows:</p> <pre><code>var vindaloo = function(a, b) { return (a + b); } var karahi = vindaloo.curry(1); var masala = karahi(2); var gulai = karahi(3); print(masala); print(other); </code></pre> <p>The output of which is as follows in Spidermonkey:</p> <pre><code>$ js curry.js 3 4 </code></pre> <p>His opinion was that since the Javascript <code>function</code> primitive does not natively support "partial function application", it's completely wrong to refer to the function bound to the variable <code>karahi</code> as partially applied. His argument was that when the <code>vindaloo</code> function is curried, the function itself is completely applied and a closure is returned, not a "partially applied function".</p> <p>Now, my opinion is that while Javascript itself does not provide support for partial application in its' <code>function</code> primitives (unlike say, ML or Haskell), that doesn't mean you can't create a higher order function of the language which is capable of encapsulating concept of a partially applied function. Also, despite being "applied", the scope of the function is still bound to the closure returned by it causing it to remain "partially applied".</p> <p>Which is correct?</p>
[ { "answer_id": 93243, "author": "Michael Johnson", "author_id": 17688, "author_profile": "https://Stackoverflow.com/users/17688", "pm_score": 3, "selected": true, "text": "vindaloo.curry = function(a) {\n return function(b) {\n return a + b;\n };\n};\n" }, { "answer_...
2008/09/18
[ "https://Stackoverflow.com/questions/92984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11109/" ]
92,985
<p>We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects. turns out that it is extremely slow. anybody else have any experience using Drools in a batch type processing application?</p>
[ { "answer_id": 4751644, "author": "Adam B", "author_id": 52465, "author_profile": "https://Stackoverflow.com/users/52465", "pm_score": 1, "selected": false, "text": "OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/92985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13143/" ]
93,039
<p>In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example:</p> <pre><code> foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static int bar = 20; foo++; foo++; bar++; bar++; printf("%d,%d", foo, bar); printf("%d, %d", foo, bar); } } </code></pre> <p>If I compile both files and link it to a main that calls fooTest() and barTest repeatedly, the printf statements increment independently. Makes sense since the foo and bar variables are local to the translation unit.</p> <p>But where is the storage allocated?</p> <p>To be clear, the assumption is that you have a toolchain that would output a file in ELF format. Thus, I <em>believe</em> that there <strong>has</strong> to be some space reserved in the executable file for those static variables.<br> For discussion purposes, lets assume we use the GCC toolchain.</p>
[ { "answer_id": 93103, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 4, "selected": false, "text": "DATA" }, { "answer_id": 93188, "author": "ugasoft", "author_id": 10120, "author_profile": "https://St...
2008/09/18
[ "https://Stackoverflow.com/questions/93039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703/" ]
93,056
<p>this should be simple...could someone provide me a simple code sample that has an aspx page hosting both a silverlight app (consisting of, say a button) and an iframe (pointing to, say stackoverflow.com). The silverlight app and iframe could be in separate div's, the same div, whatever. </p> <p>Everything I've tried so far leaves me with a page that has no silverlight control rendered on it.</p> <p>EDIT: At the request for what my xaml looks like (Plus I should point out that my controls render just fine if I comment out the iframe.)</p> <pre><code>&lt;UserControl x:Class="SilverlightApplication1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;Grid x:Name="LayoutRoot" Background="Pink"&gt; &lt;Button Content="Click Me!"/&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>Thats it. Just for good measure here is my aspx page...</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server"/&gt; &lt;div style="height:100%;"&gt; &lt;asp:Silverlight ID="Silverlight1" runat="server" Source="~/ClientBin/SilverlightApplication1.xap" MinimumVersion="2.0.30523" Width="400" Height="400" /&gt; &lt;/div&gt; &lt;iframe src ="http://www.google.com" width="400"/&gt; &lt;/form&gt; </code></pre>
[ { "answer_id": 93637, "author": "Ola Karlsson", "author_id": 10696, "author_profile": "https://Stackoverflow.com/users/10696", "pm_score": 2, "selected": false, "text": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" %>\n\n<%@ Register Assembly=\"System.Web.Silverlight\" Namespace=\"S...
2008/09/18
[ "https://Stackoverflow.com/questions/93056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6419/" ]
93,058
<p>I can switch between windows with "C-x o", but if I have opened multiple frames, can I move between them without the mouse as well? </p> <p>I just realized that the question probably sounds braindead without this detail: I'm on Mac OS X (Finnish keyboard) and switching between windows of the same application is difficult.</p>
[ { "answer_id": 2337484, "author": "Trey Jackson", "author_id": 6148, "author_profile": "https://Stackoverflow.com/users/6148", "pm_score": 3, "selected": false, "text": "framemove.el" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/93058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4110/" ]
93,063
<p>I'm wondering if there's an integrated solution to have a database with versioned records supported by rails (ala version_fu ar_versioned) and a differ thanks!</p>
[ { "answer_id": 736806, "author": "Brian Armstrong", "author_id": 76486, "author_profile": "https://Stackoverflow.com/users/76486", "pm_score": 0, "selected": false, "text": "acts_as_audited" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/93063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
93,073
<p>How do you implement an <strong>efficient and thread safe reference counting system</strong> on X86 CPUs in the C++ programming language? </p> <p>I always run into the problem that the <strong>critical operations not atomic</strong>, and the available X86 Interlock operations are not sufficient for implementing the ref counting system.</p> <p>The following article covers this topic, but requires special CPU instructions:</p> <p><a href="http://www.ddj.com/architect/184401888" rel="noreferrer">http://www.ddj.com/architect/184401888</a></p>
[ { "answer_id": 93130, "author": "moonshadow", "author_id": 11834, "author_profile": "https://Stackoverflow.com/users/11834", "pm_score": 3, "selected": false, "text": "do\n read the count\n perform mathematical operation\n interlockedcompareexchange( destination, updated count, old...
2008/09/18
[ "https://Stackoverflow.com/questions/93073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15288/" ]