qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
56,950
<p>We all know T-SQL's string manipulation capabilities sometimes leaves much to be desired...</p> <p>I have a numeric field that needs to be output in T-SQL as a right-aligned text column. Example:</p> <pre><code>Value ---------- 143.55 3532.13 1.75 </code></pre> <p>How would you go about that? A good solution ought to be clear and compact, but remember there is such a thing as "too clever".</p> <p>I agree this is the wrong place to do this, but sometimes we're stuck by forces outside our control.</p> <p>Thank you.</p>
[ { "answer_id": 56972, "author": "d91-jal", "author_id": 5085, "author_profile": "https://Stackoverflow.com/users/5085", "pm_score": 5, "selected": true, "text": "SELECT STR(123.45, 6, 1)\n\n------\n 123.5\n\n(1 row(s) affected)\n" }, { "answer_id": 56973, "author": "Espo", ...
2008/09/11
[ "https://Stackoverflow.com/questions/56950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2230/" ]
56,954
<p>The code</p> <pre><code>private SomeClass&lt;Integer&gt; someClass; someClass = EasyMock.createMock(SomeClass.class); </code></pre> <p>gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass&lt;Integer&gt;".</p>
[ { "answer_id": 56996, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 2, "selected": false, "text": "private static class SomeClass_Integer extends SomeClass<Integer>();\nprivate SomeClass<Integer> someClass;\n.....
2008/09/11
[ "https://Stackoverflow.com/questions/56954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4792/" ]
56,968
<p>I'm trying to attach an instance of UIScrollbar component to a dynamic text field inside of an instance of a class that is being made after some XML is loaded. The scroll bar component is getting properly attached, as the size of the slider varies depending on the amount of content in the text field, however, it won't scroll.</p> <p>Here's the code:</p> <pre><code>function xmlLoaded(evt:Event):void { //do some stuff for(var i:int = 0; i &lt; numProfiles; i++) { var thisProfile:profile = new profile(); thisProfile.alpha = 0; thisProfile.x = 0; thisProfile.y = 0; thisProfile.name = "profile" + i; profilecontainer.addChild(thisProfile); thisProfile.profiletextholder.profilename.htmlText = profiles[i].attribute("name"); thisProfile.profiletextholder.profiletext.htmlText = profiles[i].profiletext; //add scroll bar var vScrollBar:UIScrollBar = new UIScrollBar(); vScrollBar.direction = ScrollBarDirection.VERTICAL; vScrollBar.move(thisProfile.profiletextholder.profiletext.x + thisProfile.profiletextholder.profiletext.width, thisProfile.profiletextholder.profiletext.y); vScrollBar.height = thisProfile.profiletextholder.profiletext.height; vScrollBar.scrollTarget = thisProfile.profiletextholder.profiletext; vScrollBar.name = "scrollbar"; vScrollBar.update(); vScrollBar.visible = (thisProfile.profiletextholder.profiletext.maxScrollV &gt; 1); thisProfile.profiletextholder.addChild(vScrollBar); //do some more stuff } } </code></pre> <p>I've also tried it with a UIScrollBar component within the movieclip/class itself, and it still doesn't work. Any ideas?</p>
[ { "answer_id": 74302, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 0, "selected": false, "text": "vScrollBar.update();" }, { "answer_id": 74342, "author": "defmeta", "author_id": 10875, "author_profile...
2008/09/11
[ "https://Stackoverflow.com/questions/56968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
56,974
<p>In the following snippet:</p> <pre><code>public class a { public void otherMethod(){} public void doStuff(String str, InnerClass b){} public void method(a){ doStuff("asd", new InnerClass(){ public void innerMethod(){ otherMethod(); } } ); } } </code></pre> <p>Is there a keyword to refer to the outer class from the inner class? Basically what I want to do is <code>outer.otherMethod()</code>, or something of the like, but can't seem to find anything.</p>
[ { "answer_id": 56987, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 9, "selected": true, "text": "OuterClassName.this" }, { "answer_id": 56992, "author": "jjnguy", "author_id": 2598, "author_profi...
2008/09/11
[ "https://Stackoverflow.com/questions/56974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/292/" ]
57,002
<p>What CSS should I use to make a cell's border appear even if the cell is empty?</p> <p>IE 7 specifically.</p>
[ { "answer_id": 57006, "author": "Grant", "author_id": 30, "author_profile": "https://Stackoverflow.com/users/30", "pm_score": 7, "selected": true, "text": "&nbsp;" }, { "answer_id": 57023, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stack...
2008/09/11
[ "https://Stackoverflow.com/questions/57002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
57,004
<p>I want to create dynamic content based on this. I know it's somewhere, as web analytics engines can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don't know how to get at it myself.</p>
[ { "answer_id": 57015, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 4, "selected": true, "text": "Request.Referer" }, { "answer_id": 57050, "author": "Jared", "author_id": 3442, "author_profile": "https://St...
2008/09/11
[ "https://Stackoverflow.com/questions/57004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
57,010
<p>Please, now that I've re-written the question, and before it suffers from further <a href="https://stackoverflow.com/questions/56103/fastest-gun-in-the-west-problem">fast-gun answers</a> or premature closure by <a href="https://stackoverflow.com/users/905/keith">eager editors</a> let me point out that this is not a duplicate of <a href="https://stackoverflow.com/questions/9673/remove-duplicates-from-array">this question</a>. I know how to remove duplicates from an array.</p> <p>This question is about removing <strong>sequences</strong> from an array, not duplicates in the strict sense.</p> <p>Consider this sequence of elements in an array;</p> <pre><code>[0] a [1] a [2] b [3] c [4] c [5] a [6] c [7] d [8] c [9] d </code></pre> <p>In this example I want to obtain the following...</p> <pre><code>[0] a [1] b [2] c [3] a [4] c [5] d </code></pre> <p>Notice that duplicate elements are retained but that sequences of the same element have been reduced to a single instance of that element.</p> <p>Further, notice that when two lines repeat they should be reduced to one set (of two lines).</p> <pre><code>[0] c [1] d [2] c [3] d </code></pre> <p>...reduces to...</p> <pre><code>[0] c [1] d </code></pre> <p>I'm coding in C# but algorithms in any language appreciated.</p>
[ { "answer_id": 57181, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 2, "selected": false, "text": "REMOVE LENGTH 2: (no other length has other matches)\n//the lower case letters are the matches\nABCBAbabaBBCbcbcbVbvBCbcbcAB ...
2008/09/11
[ "https://Stackoverflow.com/questions/57010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4200/" ]
57,020
<p>Was considering the <code>System.Collections.ObjectModel ObservableCollection&lt;T&gt;</code> class. This one is strange because </p> <ul> <li>it has an Add Method which takes <strong>one</strong> item only. No AddRange or equivalent. </li> <li>the Notification event arguments has a NewItems property, which is a <strong>IList</strong> (of objects.. not T)</li> </ul> <p>My need here is to add a batch of objects to a collection and the listener also gets the batch as part of the notification. Am I missing something with ObservableCollection ? Is there another class that meets my spec?</p> <p><em>Update: Don't want to roll my own as far as feasible. I'd have to build in add/remove/change etc.. a whole lot of stuff.</em></p> <hr> <p>Related Q:<br> <a href="https://stackoverflow.com/questions/670577/observablecollection-doesnt-support-addrange-method-so-i-get-notified-for-each/670579#670579">https://stackoverflow.com/questions/670577/observablecollection-doesnt-support-addrange-method-so-i-get-notified-for-each</a></p>
[ { "answer_id": 57069, "author": "fryguybob", "author_id": 4592, "author_profile": "https://Stackoverflow.com/users/4592", "pm_score": 4, "selected": false, "text": "INotifyCollectionChanged" }, { "answer_id": 58255, "author": "Ryan Lundy", "author_id": 5486, "author_p...
2008/09/11
[ "https://Stackoverflow.com/questions/57020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1695/" ]
57,053
<p>I am writing some software to identify tracking numbers (in the same way that Google identifies FedEx or UPS numbers when you search for them). Most couriers use a system, such as a "weighted average mod system" which can be used to identify if a number is a valid tracking number. Does anyone know if TNT consignment numbers use such a system, and if so, what it is? I have asked TNT support, and the rep told me they do not... but I'd like to doublecheck.</p>
[ { "answer_id": 19512345, "author": "user2902405", "author_id": 2902405, "author_profile": "https://Stackoverflow.com/users/2902405", "pm_score": 0, "selected": false, "text": " Dim number As String = TextBox1.Text\n Dim A As Integer\n Dim B As Integer\n Dim C As Integer\n Di...
2008/09/11
[ "https://Stackoverflow.com/questions/57053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4939/" ]
57,054
<p>I've got a collection that implements an interface that extends both IList&lt;T> and List. </p> <pre><code>public Interface IMySpecialCollection : IList&lt;MyObject&gt;, IList { ... } </code></pre> <p>That means I have two versions of the indexer. </p> <p>I wish the generic implementation to be used, so I implement that one normally:</p> <pre><code>public MyObject this[int index] { .... } </code></pre> <p>I only need the IList version for serialization, so I implement it explicitly, to keep it hidden:</p> <pre><code>object IList.this[int index] { ... } </code></pre> <p>However, in my unit tests, the following</p> <pre><code>MyObject foo = target[0]; </code></pre> <p>results in a compiler error</p> <blockquote> <p>The call is ambiguous between the following methods or properties</p> </blockquote> <p>I'm a bit surprised at this; I believe I've done it before and it works fine. What am I missing here? How can I get IList&lt;T> and IList to coexist within the same interface?</p> <p><strong>Edit</strong> IList&lt;T> does <em>not</em> implement IList, and I <strong>must</strong> implement IList for serialization. I'm not interested in workarounds, I want to know what I'm missing.</p> <p><strong>Edit again</strong>: I've had to drop IList from the interface and move it on my class. I don't want to do this, as classes that implement the interface are eventually going to be serialized to Xaml, which requires collections to implement IDictionary or IList...</p>
[ { "answer_id": 57093, "author": "Jarrett Meyer", "author_id": 5834, "author_profile": "https://Stackoverflow.com/users/5834", "pm_score": -1, "selected": false, "text": "T IList<T>.this[int index] { get; set; }\n" }, { "answer_id": 57166, "author": "Darryl Braaten", "auth...
2008/09/11
[ "https://Stackoverflow.com/questions/57054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
57,091
<p>Let's say I have a parent DIV. Inside, there are three child DIVs: header, content and footer. Header is attached to the top of the parent and fills it horizontally. Footer is attached to the bottom of the parent and fills it horizontally too. Content is supposed to fill all the space between header and footer.</p> <p>The parent has to have a fixed width and height. The content DIV has to fill all available space between header and footer. When the content size of the content DIV exceeds the space between header and footer, <strong><em>the content DIV should display scrollbars and allow appropriate scrolling</em></strong> so that the footer contents should never be obscured nor the footer obscure content.</p> <p>Now comes the hard part: <strong><em>you don't know the height of the header nor footer beforehand</em></strong> (eg. header and footer are filled dynamically). How can content be positioned <strong><em>without using JavaScript</em></strong>?</p> <p>Example:</p> <pre><code>&lt;div style="position : relative; width : 200px; height : 200px; background-color : #e0e0ff; overflow : hidden;"&gt; &lt;div style="background-color: #80ff80; position : absolute; left : 0; right : 0; top : 0;"&gt; header &lt;/div&gt; &lt;div style="background-color: #8080ff; overflow : auto; position : absolute;"&gt; content (how to position it?) &lt;/div&gt; &lt;div style="background-color: #ff8080; position : absolute; bottom : 0px; left :0; right : 0;"&gt; footer &lt;/div&gt; &lt;/div&gt; </code></pre> <hr> <p><strong>To clarify this event further</strong> - the target layout that I'm trying to achieve will be used in a business web application. <strong><em>The parent DIV will have a fixed, but unknown size</em></strong> (for instance, it will be exactly the size of the browser viewport, sizing itself along with sizing the browser window by the user). Let's call the parent DIV a "screen".</p> <p>The header will contain a set of filtering controls (like textboxes, drop down lists and a "filter" button) that should wrap to the next line if there is insufficient horizontal space (so its height can change any time to accomodate line breaking). <strong><em>The header should always be visible and attached to the top</em></strong> of the "screen".</p> <p>The footer will contain a set of buttons, like on a dialog window. These too can wrap to next line if there is not enough space horizontally. <strong><em>The footer must be attached to the bottom</em></strong> of the "screen" to be accessible and visible at all times.</p> <p>The content will contain "screen" contents, like dialog fields etc. If there are too few fields, the rest of the content will be "blank" (in this case the footer should not begin right after the content, but still be attached to the bottom of the "screen" which is fixed size). If there are too many fields, <strong><em>the content DIV will provide scrollbar(s)</em></strong> to access the hidden controls (in this case the content DIV must not extend itself below the footer, as the scrollbar would be partially hidden). </p> <p>I hope this clarifies the question a little bit further, as I have too low rep to enter comments to your repsonses.</p>
[ { "answer_id": 57119, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 0, "selected": false, "text": "<div id=\"wrapper\">\n <div id=\"header\">\n header\n </div>\n <div id=\"content\">\n content\n </div>\n <div id=\"footer\...
2008/09/11
[ "https://Stackoverflow.com/questions/57091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5348/" ]
57,094
<p>I have ASP.NET web pages for which I want to build automated tests (using WatiN &amp; MBUnit). How do I start the ASP.Net Development Server from my code? I do not want to use IIS.</p>
[ { "answer_id": 57105, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 4, "selected": true, "text": "C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:[PORT NUMBER] /path: [PATH TO ROOT]\n" }, { ...
2008/09/11
[ "https://Stackoverflow.com/questions/57094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
57,104
<p>I'm going to be starting a project soon that requires support for large-ish binary files. I'd like to use Ruby on Rails for the webapp, but I'm concerned with the BLOB support. In my experience with other languages, frameworks, and databases, BLOBs are often overlooked and thus have poor, difficult, and/or buggy functionality.</p> <p>Does RoR spport BLOBs adequately? Are there any gotchas that creep up once you're already committed to Rails?</p> <p>BTW: I want to be using PostgreSQL and/or MySQL as the backend database. Obviously, BLOB support in the underlying database is important. For the moment, I want to avoid focusing on the DB's BLOB capabilities; I'm more interested in how Rails itself reacts. Ideally, Rails should be hiding the details of the database from me, and so I should be able to switch from one to the other. If this is <em>not</em> the case (ie: there's some problem with using Rails with a particular DB) then please do mention it. </p> <p>UPDATE: Also, I'm not just talking about ActiveRecord here. I'll need to handle binary files on the HTTP side (file upload effectively). That means getting access to the appropriate HTTP headers and streams via Rails. I've updated the question title and description to reflect this.</p>
[ { "answer_id": 57201, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 3, "selected": false, "text": ":binary" }, { "answer_id": 57608, "author": "Matt Rogish", "author_id": 2590, "author_profile": "http...
2008/09/11
[ "https://Stackoverflow.com/questions/57104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3488/" ]
57,124
<p>I know I can call the GetVersionEx Win32 API function to retrieve Windows version. In most cases returned value reflects the version of my Windows, but sometimes that is not so.</p> <p>If a user runs my application under the compatibility layer, then GetVersionEx won't be reporting the real version but the version enforced by the compatibility layer. For example, if I'm running Vista and execute my program in "Windows NT 4" compatibility mode, GetVersionEx won't return version 6.0 but 4.0.</p> <p>Is there a way to bypass this behaviour and get true Windows version?</p>
[ { "answer_id": 57128, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 5, "selected": false, "text": "\"Select * from Win32_OperatingSystem\"\n" }, { "answer_id": 57130, "author": "gabr", "author_id": 4997, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4997/" ]
57,137
<p>I recently upgraded to Subversion 1.5, and now I cannot commit my code to the repository. I get an error message: "403 Forbidden in response to MKACTIVITY". I know the upgrade worked because my fellow developers are not getting this issue. What's going on?</p>
[ { "answer_id": 29477185, "author": "Eve", "author_id": 713790, "author_profile": "https://Stackoverflow.com/users/713790", "pm_score": 0, "selected": false, "text": "subclipse 1.4" }, { "answer_id": 44561204, "author": "user55926", "author_id": 3000788, "author_profil...
2008/09/11
[ "https://Stackoverflow.com/questions/57137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5626/" ]
57,140
<p>Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can't really think of any disadvantages since you don't have to do anything with the return value (even store it).</p> <p>So suppose you're in a situation where you want to update an object and then return its current value. instead of saying </p> <pre><code>myObj.Update(); var val = myObj.GetCurrentValue(); </code></pre> <p>you will be able to combine the two lines to say</p> <pre><code>var val = myObj.Update().GetCurrentValue(); </code></pre> <hr> <p><strong>EDIT:</strong> I asked the below on a whim, in retrospect, I agree that its likely to be unnecessary and complicating, however my question regarding returning this rather than void stands.</p> <p>On a related note, what do you guys think of having the language include a new bit of syntactic sugar:</p> <pre><code>var val = myObj.Update()&lt;.GetCurrentValue(); </code></pre> <p>This operator would have a low order of precedence so myObj.Update() would execute first and then call GetCurrentValue() on myObj instead of the void return of Update.</p> <p>Essentially I'm imagining an operator that will say "call the method on the right-hand side of the operator on the first valid object on the left". Any thoughts?</p>
[ { "answer_id": 57176, "author": "John Calsbeek", "author_id": 5696, "author_profile": "https://Stackoverflow.com/users/5696", "pm_score": 2, "selected": false, "text": "self" }, { "answer_id": 57212, "author": "Tim Frey", "author_id": 1471, "author_profile": "https://...
2008/09/11
[ "https://Stackoverflow.com/questions/57140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
57,145
<p>While creating classes in Java I often find myself creating instance-level collections that I know ahead of time will be very small - less than 10 items in the collection. But I don't know the number of items ahead of time so I typically opt for a dynamic collection (ArrayList, Vector, etc).</p> <pre><code>class Foo { ArrayList&lt;Bar&gt; bars = new ArrayList&lt;Bar&gt;(10); } </code></pre> <p>A part of me keeps nagging at me that it's wasteful to use complex dynamic collections for something this small in size. Is there a better way of implementing something like this? Or is this the norm?</p> <p>Note, I'm not hit with any (noticeable) performance penalties or anything like that. This is just me wondering if there isn't a better way to do things.</p>
[ { "answer_id": 57185, "author": "John Calsbeek", "author_id": 5696, "author_profile": "https://Stackoverflow.com/users/5696", "pm_score": 4, "selected": true, "text": "ArrayList" }, { "answer_id": 57341, "author": "Cagatay", "author_id": 3071, "author_profile": "https...
2008/09/11
[ "https://Stackoverflow.com/questions/57145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881/" ]
57,152
<p>Let's say I've got Alpha things that may or may not <em>be</em> or be <em>related to</em> Bravo or Charlie things.</p> <p>These are one-to-one relationships: No Alpha will relate to more than one Bravo. And no Bravo will relate to more than one Alpha.</p> <p>I've got a few goals:</p> <ul> <li>a system that's easy to learn and maintain.</li> <li>data integrity enforced within my database.</li> <li>a schema that matches the real-world, logical organization of my data.</li> <li>classes/objects within my programming that map well to database tables (à la Linq to SQL)</li> <li>speedy read and write operations</li> <li>effective use of space (few null fields)</li> </ul> <p>I've got three ideas&hellip;</p> <pre><code>PK = primary key FK = foreign key NU = nullable </code></pre> <p>One table with many nullalbe fields (flat file)&hellip;</p> <pre><code> Alphas -------- PK AlphaId AlphaOne AlphaTwo AlphaThree NU BravoOne NU BravoTwo NU BravoThree NU CharlieOne NU CharlieTwo NU CharlieThree </code></pre> <p>Many tables with zero nullalbe fields&hellip;</p> <pre><code> Alphas -------- PK AlphaId AlphaOne AlphaTwo AlphaThree Bravos -------- FK PK AlphaId BravoOne BravoTwo BravoThree Charlies -------- FK PK AlphaId CharlieOne CharlieTwo CharlieThree </code></pre> <p>Best (or worst) of both: Lots of nullalbe foreign keys to many tables&hellip;</p> <pre><code> Alphas -------- PK AlphaId AlphaOne AlphaTwo AlphaThree NU FK BravoId NU FK CharlieId Bravos -------- PK BravoId BravoOne BravoTwo BravoThree Charlies -------- PK CharlieId CharlieOne CharlieTwo CharlieThree </code></pre> <p>What if an Alpha must be either Bravo or Charlie, but not both?</p> <p>What if instead of just Bravos and Charlies, Alphas could also be any of Deltas, Echos, Foxtrots, or Golfs, etc&hellip;?</p> <hr> <p><strong>EDIT:</strong> This is a portion of the question: <a href="https://stackoverflow.com/questions/56981/which-is-the-best-database-schema-for-my-navigation#57056">Which is the best database schema for my navigation?</a></p>
[ { "answer_id": 57209, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 3, "selected": false, "text": " Bravos\n --------\nFK PK AlphaId\n BravoOne\n BravoTwo\n BravoThree\n" }, { "answer_i...
2008/09/11
[ "https://Stackoverflow.com/questions/57152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
57,168
<p>I have two identical tables and need to copy rows from table to another. What is the best way to do that? (I need to programmatically copy just a few rows, I don't need to use the bulk copy utility).</p>
[ { "answer_id": 57172, "author": "Jarrett Meyer", "author_id": 5834, "author_profile": "https://Stackoverflow.com/users/5834", "pm_score": 3, "selected": false, "text": "SELECT * INTO < new_table > FROM < existing_table > WHERE < clause >\n" }, { "answer_id": 57188, "author": ...
2008/09/11
[ "https://Stackoverflow.com/questions/57168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2536/" ]
57,183
<p>How do I get the history of commits that have been made to the repository for a particular user? </p> <p>I am able to access CVS either through the command line or TortioseCVS, so a solution using either method is sufficient.</p>
[ { "answer_id": 57218, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 4, "selected": true, "text": "cvs history -u username\n" }, { "answer_id": 115301, "author": "Chris Noe", "author_id": 14749, "a...
2008/09/11
[ "https://Stackoverflow.com/questions/57183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498/" ]
57,202
<p>I would like to put a link to a webpage in an alert dialog box so that I can give a more detailed description of how to fix the error that makes the dialog box get created. </p> <p>How can I make the dialog box show something like this:</p> <pre><code>There was an error. Go to this page to fix it. wwww.TheWebPageToFix.com </code></pre> <p>Thanks.</p>
[ { "answer_id": 57214, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 2, "selected": false, "text": "alert()" }, { "answer_id": 57215, "author": "DrFloyd5", "author_id": 1736623, "author_profile": "https://Stac...
2008/09/11
[ "https://Stackoverflow.com/questions/57202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
57,238
<p>Say I have several JavaScript includes in a page:</p> <pre><code>&lt;script type="text/javascript" src="/js/script0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script3.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script4.js"&gt;&lt;/script&gt; </code></pre> <p>Is there a way i can tell if any of those weren't found (404) without having to manually check each one? I guess i'm looking for an online tool or something similar. Any ideas?</p>
[ { "answer_id": 57297, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "var script0Exists = true; // inside script0.js\nvar script1Exists = true; // inside script1.js\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]
57,243
<p>I am trying to do something I've done a million times and it's not working, can anyone tell me why?</p> <p>I have a table for people who sent in resumes, and it has their email address in it...</p> <p>I want to find out if any of these people have NOT signed up on the web site. The aspnet_Membership table has all the people who ARE signed up on the web site.</p> <p>There are 9472 job seekers, with unique email addresses.</p> <p>This query produces 1793 results:</p> <pre><code>select j.email from jobseeker j join aspnet_Membership m on j.email = m.email </code></pre> <p>This suggests that there should be 7679 (9472-1793) emails of people who are not signed up on the web site. Since 1793 of them DID match, I would expect the rest of them DON'T match... but when I do the query for that, I get nothing!</p> <p>Why is this query giving me nothing???</p> <pre><code>select j.email from jobseeker j where j.email not in (select email from aspnet_Membership) </code></pre> <p>I don't know how that could be not working - it basically says "show me all the emails which are IN the jobseeker table, but NOT IN the aspnet_Membership table... </p>
[ { "answer_id": 57251, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "SELECT j.email\nFROM jobseeker j\nLEFT JOIN aspnet_Membership m ON m.email = j.email\nWHERE m.email IS NULL\n" }, {...
2008/09/11
[ "https://Stackoverflow.com/questions/57243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5255/" ]
57,249
<p>I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of any C libraries or an alternative means of getting the data?</p>
[ { "answer_id": 42530646, "author": "mkrufky", "author_id": 5535550, "author_profile": "https://Stackoverflow.com/users/5535550", "pm_score": 0, "selected": false, "text": "dvbtee" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3796/" ]
57,287
<p>How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available?</p> <p>I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal.</p>
[ { "answer_id": 57309, "author": "Alex Duggleby", "author_id": 5790, "author_profile": "https://Stackoverflow.com/users/5790", "pm_score": 2, "selected": false, "text": "public void PageLoad()\n{\n\n// create channel\nRssChannel _soChannel = new RssChannel();\n\n// create item\nRssItem _s...
2008/09/11
[ "https://Stackoverflow.com/questions/57287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
57,291
<p>I have seen <a href="https://stackoverflow.com/questions/4046/can-someone-give-me-a-working-example-of-a-buildxml-for-an-ear-that-deploys-in">this question</a> about deploying to WebSphere using the WAS ant tasks.</p> <p>Is there a simpler way to do this? In the past I have deployed to Tomcat by dropping a war file into a directory. I was hoping there would be a similar mechanism for WebSphere that doesn't involve calling the IBM libraries or rely on RAD to be installed on your workstation.</p>
[ { "answer_id": 57310, "author": "Juha Pohjalainen", "author_id": 5240, "author_profile": "https://Stackoverflow.com/users/5240", "pm_score": 2, "selected": false, "text": "wsadminlib.py.zip" }, { "answer_id": 359520, "author": "Hans-Peter Störr", "author_id": 21499, "...
2008/09/11
[ "https://Stackoverflow.com/questions/57291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1958/" ]
57,314
<p>What could the best strategy for writing validation layer for mid-enterprise level business application built on Spring 2.5</p> <p>I know that Spring provides facility where we can implement Validator interface and write validation logic in validate method. But this will be restricted to only web requests coming through spring controller.</p> <p>I would like to develop the validation framework which can be utilized during web-services calls.</p> <p>In other words, the framework can remain and be called independently without the need of implementing Validator interface and then too it can be automatically integrated into Spring MVC flow.</p> <p>Hope you get my point.</p>
[ { "answer_id": 67287, "author": "MetroidFan2002", "author_id": 8026, "author_profile": "https://Stackoverflow.com/users/8026", "pm_score": 0, "selected": false, "text": "boolean supports(Class clazz)\nvoid validate(Object target, Errors errors)\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/959/" ]
57,350
<p>I want to point a file dialog at a particular folder in the current user's Local Settings folder on Windows. What is the shortcut to get this path?</p>
[ { "answer_id": 57363, "author": "Matthew Maravillas", "author_id": 2186, "author_profile": "https://Stackoverflow.com/users/2186", "pm_score": 6, "selected": true, "text": "String appData = \n Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);\n" }, { "...
2008/09/11
[ "https://Stackoverflow.com/questions/57350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327/" ]
57,355
<p>I'm having a little trouble figuring out exactly how const applies in a specific case. Here's the code I have:</p> <pre><code>struct Widget { Widget():x(0), y(0), z(0){} int x, y, z; }; struct WidgetHolder //Just a simple struct to hold four Widgets. { WidgetHolder(Widget a, Widget b, Widget c, Widget d): A(a), B(b), C(c), D(d){} Widget&amp; A; Widget&amp; B; Widget&amp; C; Widget&amp; D; }; class Test //This class uses four widgets internally, and must provide access to them externally. { public: const WidgetHolder AccessWidgets() const { //This should return our four widgets, but I don't want anyone messing with them. return WidgetHolder(A, B, C, D); } WidgetHolder AccessWidgets() { //This should return our four widgets, I don't care if they get changed. return WidgetHolder(A, B, C, D); } private: Widget A, B, C, D; }; int main() { const Test unchangeable; unchangeable.AccessWidgets().A.x = 1; //Why does this compile, shouldn't the Widget&amp; be const? } </code></pre> <p>Basically, I have a class called test. It uses four widgets internally, and I need it to return these, but if test was declared const, I want the widgets returned const also.</p> <p>Can someone explain to me why the code in main() compiles?</p> <p>Thank you very much.</p>
[ { "answer_id": 57370, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 2, "selected": false, "text": "WidgetHolder" }, { "answer_id": 57376, "author": "Greg Hewgill", "author_id": 893, "author_profile": ...
2008/09/11
[ "https://Stackoverflow.com/questions/57355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3175/" ]
57,380
<p>Will the code below work if the clock on the server is ahead of the clock on the client?</p> <pre><code>Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)) </code></pre> <p>EDIT: the reason I ask is on one of our web apps some users are claiming they are seeing the pages ( account numbers, etc ) from a user that previously used that machine. Yet we use the line above and others to 'prevent' this from happening.</p>
[ { "answer_id": 57413, "author": "Joseph Bui", "author_id": 3275, "author_profile": "https://Stackoverflow.com/users/3275", "pm_score": 0, "selected": false, "text": "<input autocomplete=\"off\">\n" }, { "answer_id": 57715, "author": "Andrew Johnson", "author_id": 5109, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2357/" ]
57,383
<p>I am calling, through reflection, a method which may cause an exception. How can I pass the exception to my caller without the wrapper reflection puts around it?<br> I am rethrowing the InnerException, but this destroys the stack trace.<br> Example code:</p> <pre><code>public void test1() { // Throw an exception for testing purposes throw new ArgumentException("test1"); } void test2() { try { MethodInfo mi = typeof(Program).GetMethod("test1"); mi.Invoke(this, null); } catch (TargetInvocationException tiex) { // Throw the new exception throw tiex.InnerException; } } </code></pre>
[ { "answer_id": 57387, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": 5, "selected": false, "text": "throw;\n" }, { "answer_id": 57389, "author": "skolima", "author_id": 3205, "author_profile": "https://Sta...
2008/09/11
[ "https://Stackoverflow.com/questions/57383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3205/" ]
57,421
<p>I would like to make an ajax call to a different server (same domain and box, just a different port.) e.g.</p> <p>My page is</p> <pre> http://localhost/index.html </pre> <p>I would like to make a ajax get request to:</p> <pre> http://localhost:7076/?word=foo </pre> <p>I am getting this error:</p> <pre> Access to restricted URI denied (NS_ERROR_DOM_BAD_URI) </pre> <p>I know that you can not make an ajax request to a different domain, but it seem this also included different ports? are there any workarounds?</p>
[ { "answer_id": 57435, "author": "Joseph Bui", "author_id": 3275, "author_profile": "https://Stackoverflow.com/users/3275", "pm_score": 3, "selected": true, "text": "http://localhost/proxy?port=7076&url=%2f%3fword%3dfoo\n" }, { "answer_id": 57442, "author": "sblundy", "aut...
2008/09/11
[ "https://Stackoverflow.com/questions/57421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
57,424
<p>I'd like to use the camera in my Macbook in a program. I'm fairly language agnostic - C, Java, Python etc are all fine. Could anyone suggest the best place to look for documents or "Hello world" type code?</p>
[ { "answer_id": 57461, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 4, "selected": true, "text": "IKPictureTaker" }, { "answer_id": 2195738, "author": "meduz", "author_id": 234547, "author_profile": "h...
2008/09/11
[ "https://Stackoverflow.com/questions/57424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5346/" ]
57,439
<p>No, this is not a question about generics.</p> <p>I have a Factory pattern with several classes with internal constructors (I don't want them being instantiated if not through the factory).</p> <p>My problem is that <code>CreateInstance</code> fails with a "No parameterless constructor defined for this object" error unless I pass "true" on the non-public parameter.</p> <p>Example</p> <pre><code>// Fails Activator.CreateInstance(type); // Works Activator.CreateInstance(type, true); </code></pre> <p>I wanted to make the factory generic to make it a little simpler, like this:</p> <pre><code>public class GenericFactory&lt;T&gt; where T : MyAbstractType { public static T GetInstance() { return Activator.CreateInstance&lt;T&gt;(); } } </code></pre> <p>However, I was unable to find how to pass that "true" parameter for it to accept non-public constructors (internal).</p> <p>Did I miss something or it isn't possible?</p>
[ { "answer_id": 57450, "author": "Kilhoffer", "author_id": 5469, "author_profile": "https://Stackoverflow.com/users/5469", "pm_score": 5, "selected": true, "text": "public class GenericFactory<T> where T : MyAbstractType\n{\n public static T GetInstance()\n {\n return Activat...
2008/09/11
[ "https://Stackoverflow.com/questions/57439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782/" ]
57,449
<p>I'm working on a big .NET 1.1 project, and there exists a wish to upgrade this, majorily to be able to use better tools like Visual Studio 2008, but also because of the new features and smaller amount of bugs in the .NET 2.0 framework.</p> <p>The project consist for the bigger part of VB.NET, but there are also parts in C#. It is a Windows Forms application, using various third party controls. Using .NET remoting the rich client talks to a server process which interfaces with a MSSQL 2000 database.</p> <p>What kind of issues can we expect in case we decide to perform the upgrade?</p>
[ { "answer_id": 74534, "author": "CindyH", "author_id": 12897, "author_profile": "https://Stackoverflow.com/users/12897", "pm_score": 1, "selected": false, "text": " Imports System.Web.Mail\n '\n Dim message As New MailMessage' this is a web.mail msg, not a net.mail msg\n Dim ...
2008/09/11
[ "https://Stackoverflow.com/questions/57449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5422/" ]
57,467
<p>Is there an equivalent of svn's blame for Perforce on the command line? <code>p4 annotate</code> doesn't display usernames -- only changeset numbers (without ancestor history!).</p> <p>I currently have to track code back through ancestors and compare against the filelog, and there just has to be an easier way -- maybe a F/OSS utility?</p>
[ { "answer_id": 57517, "author": "Mark", "author_id": 4405, "author_profile": "https://Stackoverflow.com/users/4405", "pm_score": 6, "selected": false, "text": "p4v.exe -cmd \"annotate //<path/to/file>\"\n" }, { "answer_id": 57661, "author": "cdleary", "author_id": 3594, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
57,479
<p>Help! I am using jQuery to make an AJAX call to fill in a drop-down dynamically given the user's previous input (from another drop-down, that is filled server-side). In all other browsers aside from Firefox (IE6/7, Opera, Safari), my append call actually appends the information below my existing option - "Select An ". But in Firefox, it automatically selects the last item given to the select control, regardless of whether I specify the JQuery action to .append or to replace (.html()). </p> <pre><code>&lt;select name="Products" id="Products" onchange="getHeadings(this.value);"&gt; &lt;option value=""&gt;Select Product&lt;/option&gt; &lt;/select&gt; function getProducts(Category) { $.ajax({ type: "GET", url: "getInfo.cfm", data: "Action=getProducts&amp;Category=" + Category, success: function(result){ $("#Products").html(result); } }); }; </code></pre> <p>Any thoughts? I have tried in the past to also transmit another blank first option, and then trigger a JavaScript option to re-select the first index, but this triggers the onChange event in my code, rather annoying for the user.</p> <hr> <p>Update:</p> <p>Here's an example of what the script would return</p> <pre><code>&lt;option value="3"&gt;Option 1&lt;/option&gt; &lt;option value="4"&gt;Option 2&lt;/option&gt; &lt;option value="6"&gt;Option 3&lt;/option&gt; </code></pre> <p>Optionally, if using the .html() method instead of the .append(), I would put another</p> <pre><code>&lt;option value=""&gt;Select a Product&lt;/option&gt; </code></pre> <p>at the top of the result.</p> <hr> <p>@Darryl Hein</p> <p>Here's an example of what the script would return</p> <pre><code>&lt;option value="3"&gt;Option 1&lt;/option&gt; &lt;option value="4"&gt;Option 2&lt;/option&gt; &lt;option value="6"&gt;Option 3&lt;/option&gt; </code></pre> <p>Optionally, if using the .html() method instead of the .append(), I would put another</p> <pre><code>&lt;option value=""&gt;Select a Product&lt;/option&gt; </code></pre> <p>at the top of the result.</p>
[ { "answer_id": 57514, "author": "Darryl Hein", "author_id": 5441, "author_profile": "https://Stackoverflow.com/users/5441", "pm_score": 0, "selected": false, "text": "<select name=\"Products\" id=\"Products\">\n<option value=\"\">Select Product</option>\n</select>\n\n<script type=\"text/...
2008/09/11
[ "https://Stackoverflow.com/questions/57479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5405/" ]
57,483
<p>What is the difference between a pointer variable and a reference variable?</p>
[ { "answer_id": 57490, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 7, "selected": false, "text": "const" }, { "answer_id": 57492, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://S...
2008/09/11
[ "https://Stackoverflow.com/questions/57483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123/" ]
57,484
<p>I'm trying to do a basic "OR" on three fields using a hibernate criteria query.</p> <p>Example</p> <pre><code>class Whatever{ string name; string address; string phoneNumber; } </code></pre> <p>I'd like to build a criteria query where my search string could match "name" or "address" or "phoneNumber".</p>
[ { "answer_id": 57526, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 8, "selected": true, "text": "Restrictions.disjuntion()" }, { "answer_id": 57541, "author": "Rob Oxspring", "author_id": 1867, "author_p...
2008/09/11
[ "https://Stackoverflow.com/questions/57484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1310/" ]
57,488
<p>Does anyone know of a way to declare a date constant that is compatible with international dates?</p> <p>I've tried:</p> <pre><code>' not international compatible public const ADate as Date = #12/31/04# ' breaking change if you have an optional parameter that defaults to this value ' because it isnt constant. public shared readonly ADate As New Date(12, 31, 04) </code></pre>
[ { "answer_id": 57511, "author": "Rob Cooper", "author_id": 832, "author_profile": "https://Stackoverflow.com/users/832", "pm_score": 0, "selected": false, "text": "public static DateTime SadDayForAll()\n{\n return new DateTime(2001, 09, 11);\n}\n" }, { "answer_id": 57695, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5966/" ]
57,493
<p>In my WPF application, I have a number of databound TextBoxes. The <code>UpdateSourceTrigger</code> for these bindings is <code>LostFocus</code>. The object is saved using the File menu. The problem I have is that it is possible to enter a new value into a TextBox, select Save from the File menu, and never persist the new value (the one visible in the TextBox) because accessing the menu does not remove focus from the TextBox. How can I fix this? Is there some way to force all the controls in a page to databind?</p> <p><em>@palehorse: Good point. Unfortunately, I need to use LostFocus as my UpdateSourceTrigger in order to support the type of validation I want.</em></p> <p><em>@dmo: I had thought of that. It seems, however, like a really inelegant solution for a relatively simple problem. Also, it requires that there be some control on the page which is is always visible to receive the focus. My application is tabbed, however, so no such control readily presents itself.</em></p> <p><em>@Nidonocu: The fact that using the menu did not move focus from the TextBox confused me as well. That is, however, the behavior I am seeing. The following simple example demonstrates my problem:</em></p> <pre class="lang-xml prettyprint-override"><code>&lt;Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"&gt; &lt;Window.Resources&gt; &lt;ObjectDataProvider x:Key="MyItemProvider" /&gt; &lt;/Window.Resources&gt; &lt;DockPanel LastChildFill="True"&gt; &lt;Menu DockPanel.Dock="Top"&gt; &lt;MenuItem Header="File"&gt; &lt;MenuItem Header="Save" Click="MenuItem_Click" /&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;StackPanel DataContext="{Binding Source={StaticResource MyItemProvider}}"&gt; &lt;Label Content="Enter some text and then File &gt; Save:" /&gt; &lt;TextBox Text="{Binding ValueA}" /&gt; &lt;TextBox Text="{Binding ValueB}" /&gt; &lt;/StackPanel&gt; &lt;/DockPanel&gt; &lt;/Window&gt; </code></pre> <pre><code>using System; using System.Text; using System.Windows; using System.Windows.Data; namespace WpfApplication2 { public partial class Window1 : Window { public MyItem Item { get { return (FindResource("MyItemProvider") as ObjectDataProvider).ObjectInstance as MyItem; } set { (FindResource("MyItemProvider") as ObjectDataProvider).ObjectInstance = value; } } public Window1() { InitializeComponent(); Item = new MyItem(); } private void MenuItem_Click(object sender, RoutedEventArgs e) { MessageBox.Show(string.Format("At the time of saving, the values in the TextBoxes are:\n'{0}'\nand\n'{1}'", Item.ValueA, Item.ValueB)); } } public class MyItem { public string ValueA { get; set; } public string ValueB { get; set; } } } </code></pre>
[ { "answer_id": 58451, "author": "rudigrobler", "author_id": 5147, "author_profile": "https://Stackoverflow.com/users/5147", "pm_score": 3, "selected": false, "text": "TextBox focusedTextBox = Keyboard.FocusedElement as TextBox;\nif (focusedTextBox != null)\n{\n focusedTextBox.GetBindi...
2008/09/11
[ "https://Stackoverflow.com/questions/57493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317/" ]
57,518
<p>Is it possible for <code>SelectNodes()</code> called on an <code>XmlDocument</code> to return null?</p> <p>My predicament is that I am trying to reach 100% unit test code coverage; ReSharper tells me that I need to guard against a null return from the <code>SelectNodes()</code> method, but I can see no way that an XmlDocument can return null (and therefore, no way to test my guard clause and reach 100% unit test coverage!)</p>
[ { "answer_id": 57532, "author": "Jeremy McGee", "author_id": 3546, "author_profile": "https://Stackoverflow.com/users/3546", "pm_score": 3, "selected": true, "text": "using {}" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975/" ]
57,522
<p>I can create the following and reference it using</p> <pre><code>area[0].states[0] area[0].cities[0] var area = [ { "State" : "Texas", "Cities" : ['Austin','Dallas','San Antonio'] }, { "State" :"Arkansas", "Cities" : ['Little Rock','Texarkana','Hot Springs'] } ] ; </code></pre> <p>How could I restructure "area" so that if I know the name of the state, I can use it in a reference to get the array of cities?</p> <p>Thanks</p> <p><strong>EDIT</strong> Attempting to implement with the answers I received (thanks @Eli Courtwright, @17 of 26, and @JasonBunting) I realize my question was incomplete. I need to loop through "area" the first time referencing "state" by index, then when I have the selection of the "state", I need to loop back through a structure using the value of "state" to get the associated "cities". I do want to start with the above structure (although I am free to build it how I want) and I don't mind a conversion similar to @eli's answer (although I was not able to get that conversion to work). Should have been more complete in first question. Trying to implement 2 select boxes where the selection from the first populates the second...I will load this array structure in a js file when the page loads.</p>
[ { "answer_id": 57531, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 2, "selected": true, "text": "area = {\n \"Texas\": ['Austin','Dallas','San Antonio']\n}\n" }, { "answer_id": 57535, "author": "17 of...
2008/09/11
[ "https://Stackoverflow.com/questions/57522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
57,537
<p>In my Servlet I would like to access the root of the context so that I can do some JavaScript minifying.</p> <p>It would be possible to do the minify as part of the install process but I would like to do it on Servlet startup to reduce the implementation cost.</p> <p>Does anyone know of a method for getting the context directory so that I can load and write files to disk?</p>
[ { "answer_id": 57563, "author": "Walter Rumsby", "author_id": 1654, "author_profile": "https://Stackoverflow.com/users/1654", "pm_score": -1, "selected": false, "text": "public class MyServlet extends HttpServlet {\n\n public void init(final ServletConfig config) {\n final Stri...
2008/09/11
[ "https://Stackoverflow.com/questions/57537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682/" ]
57,552
<p>Ok, so I got my extender working on a default.aspx page on my website and it looks good. I basically copied and pasted the code for it into a user control control.ascx page. When I do this I completely loose the functionality (just shows the target control label and no dropdown, even upon hover). Is there any reason why it doesn't work in a custom user control inside a masterpage setup?</p> <p>Edit: Didn't quite do the trick. Any other suggestions? Its in a master page setup, using eo web tabs (I tried it inside the tabs and outside the tabs but on the same page as the tabs, to no avail), and its in a custom user control. Think there are dependency issues?</p>
[ { "answer_id": 57572, "author": "Craig", "author_id": 2894, "author_profile": "https://Stackoverflow.com/users/2894", "pm_score": 0, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\" >\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491425/" ]
57,560
<p>What's the best way in c# to determine is a given QFE/patch has been installed?</p>
[ { "answer_id": 57626, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 1, "selected": false, "text": "System.Diagnostics.FileVersionInfo.GetVersionInfo(path)" }, { "answer_id": 205258, "author": "Bob King", "au...
2008/09/11
[ "https://Stackoverflow.com/questions/57560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2564/" ]
57,567
<p>Is there an advantage to dynamically attaching/detaching event handlers?</p> <p>Would manually detaching handlers help ensure that there isn't a reference remaining to a disposed object?</p>
[ { "answer_id": 57605, "author": "OwenP", "author_id": 2547, "author_profile": "https://Stackoverflow.com/users/2547", "pm_score": 2, "selected": false, "text": "Handles" }, { "answer_id": 19306349, "author": "supercat", "author_id": 363751, "author_profile": "https://...
2008/09/11
[ "https://Stackoverflow.com/questions/57567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4770/" ]
57,584
<p>I've found some examples using the Win32 api or simulating the ^+ button combination (<kbd>ctrl</kbd>-<kbd>+</kbd>) <a href="http://www.codeproject.com/KB/list/AutoResize.aspx" rel="nofollow noreferrer">using SendKeys</a>, but at least with the SendKeys method the listview grabs the cursor and sets it to an hourglass until I hit the start button on my keyboard. What is the cleanest way to do this?</p>
[ { "answer_id": 58102, "author": "Matt Nelson", "author_id": 788, "author_profile": "https://Stackoverflow.com/users/788", "pm_score": 5, "selected": true, "text": "myListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)" }, { "answer_id": 54192601, "author": "...
2008/09/11
[ "https://Stackoverflow.com/questions/57584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327/" ]
57,586
<p>I get this error on an update panel within a popupControlExtender which is within a dragPanelExtender.</p> <p>I see that a lot of other people have this issue and have various fixes none of which have worked for me.</p> <p>I would love to hear a logical explanation for why this is occurring and a foolproof way to avoid such issues in the future.</p> <p>I have found that like others maintain this error does not occur when the trigger is a LinkButton rather than an ImageButton, still wondering if anyone has an explanation.</p>
[ { "answer_id": 5105155, "author": "Gorgsenegger", "author_id": 412036, "author_profile": "https://Stackoverflow.com/users/412036", "pm_score": 2, "selected": false, "text": "var script = @\"\nif (Sys &&\n Sys.WebForms && Sys.WebForms.PageRequestManager &&\n Sys.WebForms.PageRequest...
2008/09/11
[ "https://Stackoverflow.com/questions/57586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3821/" ]
57,599
<p>What would be the best way to calculate someone's age in years, months, and days in T-SQL (SQL Server 2000)?</p> <p>The <code>datediff</code> function doesn't handle year boundaries well, plus getting the months and days separate will be a bear. I know I can do it on the client side relatively easily, but I'd like to have it done in my <a href="http://en.wikipedia.org/wiki/Stored_procedure" rel="noreferrer">stored procedure</a>.</p>
[ { "answer_id": 57642, "author": "Michael Runyon", "author_id": 5405, "author_profile": "https://Stackoverflow.com/users/5405", "pm_score": 0, "selected": false, "text": "Select DateDiff(d,'1984-07-12','2008-09-11')\n\nSelect DateDiff(m,'1984-07-12','2008-09-11')\n\nSelect DateDiff(yyyy,'...
2008/09/11
[ "https://Stackoverflow.com/questions/57599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/845/" ]
57,600
<p>Should developers avoid using <a href="http://msdn.microsoft.com/en-us/library/923ahwt1.aspx" rel="nofollow noreferrer">continue</a> in C# or its equivalent in other languages to force the next iteration of a loop? Would arguments for or against overlap with arguments about <a href="https://stackoverflow.com/questions/46586/goto-still-considered-harmful">Goto</a>? </p>
[ { "answer_id": 57611, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 7, "selected": true, "text": "for (...)\n{\n if (!cond1)\n {\n if (!cond2)\n {\n ... highly indented lines ...\n }\n }\n}\n...
2008/09/11
[ "https://Stackoverflow.com/questions/57600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2831/" ]
57,609
<p>I'm working on a WinCE 6.0 system with a touchscreen that stores its calibration data (x-y location, offset, etc.) in the system registry (HKLM\HARDWARE\TOUCH). Right now, I'm placing the cal values into registry keys that get put into the OS image at build time. That works fine for the monitor that I get the original cal values from, but when I load this image into another system with a different monitor, the touchscreen pointer location is (understandably) off, because the two monitors do not have the same cal values.</p> <p>My problem is that I don't know how to properly store values into the registry so that they persist after a power cycle. See, I can recalibrate the screen on the second system, but the new values only exist in volatile memory. I suggested to my boss that we could just tell our customer to leave the power on the unit at all times -- that didn't go over well.</p> <p>I need advice on how to save the new constants into the registry, so that we can calibrate the monitors once before shipping them out to our customer, and not have to make separate OS images for each unit we build.</p> <p>A C# method that is known to work in CE6.0 would be helpful. Thanks.</p> <p>-Odbasta</p>
[ { "answer_id": 59995, "author": "odbasta", "author_id": 2488, "author_profile": "https://Stackoverflow.com/users/2488", "pm_score": 3, "selected": false, "text": "[HKEY_LOCAL_MACHINE\\init\\BootVars]\n\"SystemHive\"=\"\\\\Hard Disk\\\\system.hv\"\n\"ProfileDir\"=\"\\\\Documents and Setti...
2008/09/11
[ "https://Stackoverflow.com/questions/57609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2488/" ]
57,615
<p>I have a console app in which I want to give the user <em>x</em> seconds to respond to the prompt. If no input is made after a certain period of time, program logic should continue. We assume a timeout means empty response.</p> <p>What is the most straightforward way of approaching this?</p>
[ { "answer_id": 57655, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 5, "selected": false, "text": "class Sample \n{\n public static void Main() \n {\n ConsoleKeyInfo cki = new ConsoleKeyInfo();\n\n do {\n ...
2008/09/11
[ "https://Stackoverflow.com/questions/57615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
57,622
<p>I have a start of a webapp that I wrote without using the Object Oriented features of PHP.</p> <p>I don't really know if it is worth it to go back and rewrite the parts I have finished. Is object oriented PHP worth rewriting all or part of a decent working app?</p>
[ { "answer_id": 7279484, "author": "diyism", "author_id": 264181, "author_profile": "https://Stackoverflow.com/users/264181", "pm_score": 0, "selected": false, "text": "<?php\n$array1->array_flip(this);\n?>\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/673/" ]
57,625
<p>This one will take some explaining. What I've done is create a specific custom message queue in SQL Server 2005. I have a table with messages that contain timestamps for both acknowledgment and completion. The stored procedure that callers execute to obtain the next message in their queue also acknowledges the message. So far so good. Well, if the system is experiencing a massive amount of transactions (thousands per minute), isn't it possible for a message to be acknowledged by another execution of the stored procedure while another is prepared to so itself? Let me help by showing my SQL code in the stored proc:</p> <pre><code>--Grab the next message id declare @MessageId uniqueidentifier set @MessageId = (select top(1) ActionMessageId from UnacknowledgedDemands); --Acknowledge the message update ActionMessages set AcknowledgedTime = getdate() where ActionMessageId = @MessageId --Select the entire message ... ... </code></pre> <p>In the above code, couldn't another stored procedure running at the same time obtain the same id and attempt to acknowledge it at the same time? Could I (or should I) implement some sort of locking to prevent another stored proc from acknowledging messages that another stored proc is querying? </p> <p>Wow, did any of this even make sense? It's a bit difficult to put to words...</p>
[ { "answer_id": 57637, "author": "Blorgbeard", "author_id": 369, "author_profile": "https://Stackoverflow.com/users/369", "pm_score": -1, "selected": false, "text": "begin transaction\n\n--Grab the next message id\ndeclare @MessageId uniqueidentifier\nset @MessageId = (select top(1) Actio...
2008/09/11
[ "https://Stackoverflow.com/questions/57625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5469/" ]
57,652
<p>Scenario:</p> <ol> <li>The user has two monitors.</li> <li>Their browser is open on the secondary monitor.</li> <li>They click a link in the browser which calls window.open() with a specific top and left window offset.</li> <li>The popup window always opens on their primary monitor.</li> </ol> <p>Is there any way in JavaScript to get the popup window to open on the same monitor as the initial browser window (the opener)?</p>
[ { "answer_id": 57680, "author": "Jared", "author_id": 1980, "author_profile": "https://Stackoverflow.com/users/1980", "pm_score": -1, "selected": false, "text": "var x = 0;\nvar y = 0;\nvar myWin = window.open(''+self.location,'mywin','left='+x+',top='+y+',width=500,height=500,toolbar=1,...
2008/09/11
[ "https://Stackoverflow.com/questions/57652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436/" ]
57,665
<p>Is there an easy way to return data to web service clients in JSON using Rails?</p>
[ { "answer_id": 57761, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 2, "selected": false, "text": "#to_json" }, { "answer_id": 245486, "author": "JasonOng", "author_id": 6048, "author_profile": "https...
2008/09/11
[ "https://Stackoverflow.com/questions/57665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5988/" ]
57,679
<p>I'm trying to determine, based on the result of this call, if it was successful. The <code>successFunction</code> doesn't get called, so I'm assuming it was not. How do I know what went wrong?</p> <pre><code>xmlRequest = $.post("/url/file/", { 'id' : object.id }, successFunction, 'json'); </code></pre> <p>Do I use the xmlRequest object?</p>
[ { "answer_id": 57997, "author": "defrex", "author_id": 6007, "author_profile": "https://Stackoverflow.com/users/6007", "pm_score": 4, "selected": true, "text": "$.ajax({\n url:\"/url/file/\",\n dataType:\"json\"\n data:{ 'id' : object.id }\n error:function(request){alert(requ...
2008/09/11
[ "https://Stackoverflow.com/questions/57679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]
57,689
<p>Is there an easy way to return data to web service clients in JSON using java? I'm fine with servlets, spring, etc.</p>
[ { "answer_id": 57737, "author": "Stu Thompson", "author_id": 2961, "author_profile": "https://Stackoverflow.com/users/2961", "pm_score": 2, "selected": false, "text": "private String getJsonDocumenent(Object myObj) (\n String result = \"oops\";\n try {\n JSONArray jsonArray ...
2008/09/11
[ "https://Stackoverflow.com/questions/57689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5988/" ]
57,701
<p>It's <a href="http://www.codeproject.com/KB/cs/csharpcasts.aspx" rel="noreferrer">shown</a> that 'as' casting is much faster than prefix casting, but what about 'is' reflection? How bad is it? As you can imagine, searching for 'is' on Google isn't terribly effective.</p>
[ { "answer_id": 57713, "author": "swilliams", "author_id": 736, "author_profile": "https://Stackoverflow.com/users/736", "pm_score": 3, "selected": false, "text": "if (obj is Foo) {\n Foo f = (Foo)obj;\n f.doSomething();\n}\n" }, { "answer_id": 57828, "author": "Daniel Fortu...
2008/09/11
[ "https://Stackoverflow.com/questions/57701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3279/" ]
57,708
<p>I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type?</p> <p>For example:</p> <p>I get back:</p> <pre><code>&amp;#x01ce; </code></pre> <p>which represents an "ǎ" with a tone mark. In binary, this is represented as the 16 bit 01ce. I want to convert the html entity into the value <code>u'\u01ce'</code></p>
[ { "answer_id": 57745, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 3, "selected": false, "text": "BeautifulSoup" }, { "answer_id": 57877, "author": "chryss", "author_id": 5169, "author_profile": "https://Sta...
2008/09/11
[ "https://Stackoverflow.com/questions/57708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680/" ]
57,718
<p>Has anyone actually shipped an Entity Framework project that does O/R mapping into conceptual classes that are quite different from the tables in the datastore?</p> <p>I mean collapse junction (M:M) tables into other entities to form <strong>Conceptual</strong> classes that exist in the business domain but are organized as <strong>multiple tables</strong> in the datastore. All the examples that I see on the MSDN have little use of inheritance, collapsing junction tables into other entities, or collapsing lookup tables into entities.</p> <p>I'd love to hear of or see examples of the below which support all the CRUD operations you would typically expect to do on a business object.:</p> <ol> <li><p>Vehicle table and a Color table. A Color can appear in many Vehicles (1:M). They form the conceptual class UsedCar which has the property Color. </p></li> <li><p>Doctor, DoctorPatients, and Patients tables (form a many to many). Doctors have many Patients, Patients can have many Doctors (M:M). Map out the two conceptual classes Doctor (which has a Patients collection) and Patients (which has a Doctors collection).</p></li> </ol> <p><strong>Anyone seen/done this with CSDL AND SSDL in the Entity Framework? The CSDL is no good if it doesn't actaully map to anything!</strong></p>
[ { "answer_id": 58181, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": "<edmx:ConceptualModels>\n <Schema xmlns=\"http://schemas.microsoft.com/ado/2006/04/edm\" Namespace=\"Model1\" Alias=\"Se...
2008/09/11
[ "https://Stackoverflow.com/questions/57718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5642/" ]
57,725
<p>Let's say I want a way to display just the the center 50x50px of an image that's 250x250px in HTML. How can I do that. Also, is there a way to do this for css:url() references? <p> I'm aware of <em>clip</em> in CSS, but that seems to only work when used with absolute positioning.</p>
[ { "answer_id": 4639862, "author": "David Thomas", "author_id": 82548, "author_profile": "https://Stackoverflow.com/users/82548", "pm_score": 8, "selected": false, "text": "clip" }, { "answer_id": 23220895, "author": "Vincent", "author_id": 859631, "author_profile": "h...
2008/09/11
[ "https://Stackoverflow.com/questions/57725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4489/" ]
57,751
<p>I want to find any text in a file that matches a regexp of the form <em>t</em><code>[A-Z]</code><em>u</em> (i.e., a match <em>t</em> followed by a capital letter and another match <em>u</em>, and transform the matched text so that the capital letter is lowercase. For example, for the regexp <code>x[A-Z]y</code></p> <pre><code>xAy </code></pre> <p>becomes</p> <pre><code>xay </code></pre> <p>and</p> <pre><code>xZy </code></pre> <p>becomes</p> <pre><code>xzy </code></pre> <p>Emacs' <code>query-replace</code> function allows back-references, but AFAIK not the transformation of the matched text. Is there a built-in function that does this? Does anybody have a short Elisp function I could use?</p> <p><strong>UPDATE</strong></p> <p>@Marcel Levy has it: <code>\,</code> in a replacement expression introduces an (arbitrary?) Elisp expression. E.g., the solution to the above is</p> <pre><code>M-x replace-regexp &lt;RET&gt; x\([A-Z]\)z &lt;RET&gt; x\,(downcase \1)z </code></pre>
[ { "answer_id": 57794, "author": "Marcel Levy", "author_id": 676, "author_profile": "https://Stackoverflow.com/users/676", "pm_score": 5, "selected": true, "text": "replace-regexp" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
57,766
<p>I am getting the below error and call stack at the same time everyday after several hours of application use. Can anyone shed some light on what is happening?</p> <pre><code>System.InvalidOperationException: BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress. at System.Drawing.BufferedGraphicsContext.Dispose(Boolean disposing) at System.Drawing.BufferedGraphicsContext.Dispose() at System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) at System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle) at System.Windows.Forms.Control.WmPaint(Message&amp; m) at System.Windows.Forms.Control.WndProc(Message&amp; m) at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m) at System.Windows.Forms.ToolStrip.WndProc(Message&amp; m) at System.Windows.Forms.MenuStrip.WndProc(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) </code></pre>
[ { "answer_id": 21282876, "author": "TheQaa", "author_id": 2028568, "author_profile": "https://Stackoverflow.com/users/2028568", "pm_score": 0, "selected": false, "text": "BufferedGraphicsContext _BackbufferContext = BufferedGraphicsManager.Current;\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4770/" ]
57,776
<p>I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure.</p> <p>I want to add them in that format to a different directory in an ASP.NET web application I am working on; while retaining the same structure. So, I copied the folder into the target location of my project and I tried to “add existing item” only to lose the previous folder hierarchy.</p> <p>Usually I have re-created the directories by hand, copied across on a one-to-one basis, and then added existing items. There are simply too many directories/items in this case.</p> <p>So how do you add existing directories and files in Visual Studio 2008?</p>
[ { "answer_id": 13624351, "author": "Boris_P_", "author_id": 1395598, "author_profile": "https://Stackoverflow.com/users/1395598", "pm_score": 0, "selected": false, "text": "*.cs" }, { "answer_id": 30772845, "author": "Bjego", "author_id": 3337035, "author_profile": "h...
2008/09/11
[ "https://Stackoverflow.com/questions/57776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2213/" ]
57,791
<p>I have a page which does quite a bit of work and I don't want the user to be able to navigate away from that page (close browser, hit back button, etc.) without getting a warning. I found that the onbeforeunload event (which I think is IE-specific, which works fine for me as the project uses lots of ActiveX) works great.</p> <p>Problem is, I want the user to be able to click on a little "help" icon in the upper-right corner and pop up a help window at any time. This causes onbeforeunload to fire, even though the main window never goes anywhere and the page never unloads. </p> <p>The JavaScript function that runs when the onbeforeunload event runs just puts text into event.returnValue. If I could ascertain, somehow, that the help icon is the one that was clicked then I could just not put text into event.returnValue in that situation. But how could I have the page figure that out?</p>
[ { "answer_id": 57827, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 4, "selected": true, "text": "javascript:" }, { "answer_id": 221423, "author": "Kevin Dark", "author_id": 26151, "author_profile": "https://...
2008/09/11
[ "https://Stackoverflow.com/questions/57791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
57,803
<p>How do you convert decimal values to their hexadecimal equivalent in JavaScript?</p>
[ { "answer_id": 57805, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 13, "selected": true, "text": "hexString = yourNumber.toString(16);\n" }, { "answer_id": 57807, "author": "Luke Smith", "author_id": 5556, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5556/" ]
57,804
<p>Now, before you say it: I <strong>did</strong> Google and my <code>hbm.xml</code> file <strong>is</strong> an Embedded Resource. </p> <p>Here is the code I am calling:</p> <pre><code>ISession session = GetCurrentSession(); var returnObject = session.Get&lt;T&gt;(Id); </code></pre> <p>Here is my mapping file for the class:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"&gt; &lt;class name="HQData.Objects.SubCategory, HQData" table="SubCategory" lazy="true"&gt; &lt;id name="ID" column="ID" unsaved-value="0"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Name" column="Name" /&gt; &lt;property name="NumberOfBuckets" column="NumberOfBuckets" /&gt; &lt;property name="SearchCriteriaOne" column="SearchCriteriaOne" /&gt; &lt;bag name="_Businesses" cascade="all"&gt; &lt;key column="SubCategoryId"/&gt; &lt;one-to-many class="HQData.Objects.Business, HQData"/&gt; &lt;/bag&gt; &lt;bag name="_Buckets" cascade="all"&gt; &lt;key column="SubCategoryId"/&gt; &lt;one-to-many class="HQData.Objects.Bucket, HQData"/&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>Has anyone run to this issue before?</p> <p>Here is the full error message:</p> <blockquote> <pre>MappingException: No persister for: HQData.Objects.SubCategory]NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName, Boolean throwIfNotFound) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionFactoryImpl.cs:766 NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionFactoryImpl.cs:752 NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Event\Default\DefaultLoadEventListener.cs:37 NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionImpl.cs:2054 NHibernate.Impl.SessionImpl.Get(String entityName, Object id) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionImpl.cs:1029 NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionImpl.cs:1020 NHibernate.Impl.SessionImpl.Get(Object id) in c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionImpl.cs:985 HQData.DataAccessUtils.NHibernateObjectHelper.LoadDataObject(Int32 Id) in C:\Development\HQChannelRepo\HQ Channel Application\HQChannel\HQData\DataAccessUtils\NHibernateObjectHelper.cs:42 HQWebsite.LocalSearch.get_subCategory() in C:\Development\HQChannelRepo\HQ Channel Application\HQChannel\HQWebsite\LocalSearch.aspx.cs:17 HQWebsite.LocalSearch.Page_Load(Object sender, EventArgs e) in C:\Development\HQChannelRepo\HQ Channel Application\HQChannel\HQWebsite\LocalSearch.aspx.cs:27 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436</pre> </blockquote> <p><strong>Update</strong>, here's what the solution for <em>my</em> scenario was: I had changed some code and I wasn't adding the Assembly to the config file during runtime. </p>
[ { "answer_id": 57860, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 2, "selected": false, "text": "name=\"Id\"" }, { "answer_id": 57995, "author": "Andy S", "author_id": 3759, "author_profile": "https:...
2008/09/11
[ "https://Stackoverflow.com/questions/57804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4140/" ]
57,812
<p>I have a div with <code>id="a"</code> that may have any number of classes attached to it, from several groups. Each group has a specific prefix. In the javascript, I don't know which class from the group is on the div. I want to be able to clear all classes with a given prefix and then add a new one. If I want to remove all of the classes that begin with "bg", how do I do that? Something like this, but that actually works:</p> <pre><code>$("#a").removeClass("bg*"); </code></pre>
[ { "answer_id": 57819, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 4, "selected": false, "text": "$(\"#a\").className = $(\"#a\").className.replace(/\\bbg.*?\\b/g, '');\n" }, { "answer_id": 58097, "author": "Br...
2008/09/11
[ "https://Stackoverflow.com/questions/57812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5464/" ]
57,840
<p>I have a wrapper around a C++ function call which I call from C# code. How do I attach a debugger in Visual Studio to step into the native C++ code?</p> <p>This is the wrapper that I have which calls GetData() defined in a C++ file:</p> <pre><code> [DllImport("Unmanaged.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint = "GetData", BestFitMapping = false)] public static extern String GetData(String url); </code></pre> <p>The code is crashing and I want to investigate the root cause.</p> <p>Thanks, Nikhil</p>
[ { "answer_id": 58954, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": ".sympath\n.sympath+ \n.symfix\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5734/" ]
57,845
<p>Is it possible to use BackGroundWorker thread in <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?</p> <h2>Scenario</h2> <ol> <li>The browser requests a page, say SendEmails.aspx</li> <li>SendEmails.aspx page creates a BackgroundWorker thread, and supplies the thread with enough context to create and send emails.</li> <li>The browser receives the response from the ComposeAndSendEmails.aspx, saying that emails are being sent.</li> <li>Meanwhile, the background thread is engaged in a process of creating and sending emails which could take some considerable time to complete.</li> </ol> <p>My main concern is about keeping the BackgroundWorker thread running, trying to send, say 50 emails while the ASP.NET workerprocess threadpool thread is long gone.</p>
[ { "answer_id": 57847, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 3, "selected": false, "text": "ThreadPool.QueueUserWorkItem(delegateThatSendsEmails)\n" }, { "answer_id": 431015, "author": "Community", "au...
2008/09/11
[ "https://Stackoverflow.com/questions/57845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1647/" ]
57,849
<p>There doesn't seem to be a way to change the padding (or row height) for all rows in a .NET ListView. Does anybody have an elegant hack-around?</p>
[ { "answer_id": 13072438, "author": "Quinn Johns", "author_id": 1539718, "author_profile": "https://Stackoverflow.com/users/1539718", "pm_score": 4, "selected": false, "text": "using System.Runtime.InteropServices;\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
57,854
<p>How can I close a browser window without receiving the <em>Do you want to close this window</em> prompt?</p> <p>The prompt occurs when I use the <code>window.close();</code> function.</p>
[ { "answer_id": 57857, "author": "Derek", "author_id": 5440, "author_profile": "https://Stackoverflow.com/users/5440", "pm_score": -1, "selected": false, "text": "this.focus();\nself.opener=this;\nself.close();\n" }, { "answer_id": 57868, "author": "Harley Holcombe", "auth...
2008/09/11
[ "https://Stackoverflow.com/questions/57854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5440/" ]
57,855
<p>I'm troubleshooting a problem with creating Vista shortcuts.</p> <p>I want to make sure that our Installer is reading the Programs folder from the right registry key.</p> <p>It's reading it from:</p> <pre><code>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Programs </code></pre> <p>And it's showing this directory for Programs:</p> <pre><code>C:\Users\NonAdmin2 UAC OFF\AppData\Roaming\Microsoft\Windows\Start Menu\Programs </code></pre> <p>From what I've read, this seems correct, but I wanted to double check.</p>
[ { "answer_id": 58261, "author": "Clay Nichols", "author_id": 4906, "author_profile": "https://Stackoverflow.com/users/4906", "pm_score": 0, "selected": false, "text": "public class Utilities\n{\n\n public enum FolderPaths\n {\n CSIDL_DESKTOP = 0x0000, ...
2008/09/11
[ "https://Stackoverflow.com/questions/57855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4906/" ]
57,859
<p>The ReSharper reformat code feature is very handy and flexible, particularly with the new code layout templating flexibility JetBrains have added in version 3.0.</p> <p>Is there a standard set of code style settings for ReSharper which match the rules enforced by <a href="http://code.msdn.microsoft.com/sourceanalysis" rel="noreferrer">Microsoft StyleCop</a>, so that StyleCop compliance can be as easy as running the ReSharper "reformat code" feature?</p>
[ { "answer_id": 271495, "author": "KeesDijk", "author_id": 6434, "author_profile": "https://Stackoverflow.com/users/6434", "pm_score": 2, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Patterns xmlns=\"urn:shemas-jetbrains-com:member-reordering-patterns\">\n\n <...
2008/09/11
[ "https://Stackoverflow.com/questions/57859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975/" ]
57,878
<p>If I create an index on columns (A, B, C), in that order, my understanding is that the database will be able to use it even if I search only on (A), or (A and B), or (A and B and C), but not if I search only on (B), or (C), or (B and C). Is this correct?</p>
[ { "answer_id": 59370, "author": "Ethan Post", "author_id": 4527, "author_profile": "https://Stackoverflow.com/users/4527", "pm_score": 3, "selected": false, "text": "create table mytab nologging as (\nselect mod(rownum, 3) x, rownum y, mod(rownum, 3) z from all_objects, (select 'x' from...
2008/09/11
[ "https://Stackoverflow.com/questions/57878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295/" ]
57,910
<p>Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?</p>
[ { "answer_id": 58239, "author": "codeLes", "author_id": 3030, "author_profile": "https://Stackoverflow.com/users/3030", "pm_score": 1, "selected": false, "text": "class PersonController {\n def scaffold = true\n\n def list = {\n if(!params.max) params.max = 20\n [ personList: Per...
2008/09/11
[ "https://Stackoverflow.com/questions/57910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
57,918
<p>We have a whole bunch of queries that "search" for clients, customers, etc. You can search by first name, email, etc. We're using LIKE statements in the following manner: </p> <pre><code>SELECT * FROM customer WHERE fname LIKE '%someName%' </code></pre> <p>Does full-text indexing help in the scenario? We're using SQL Server 2005.</p>
[ { "answer_id": 58176, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 5, "selected": false, "text": "LIKE" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/781/" ]
57,919
<p>I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception handler to catch any (heaven forbid) exceptions that may arise. I'd like the exception handler to be able to prompt the user to click a <kbd>Send Error Report</kbd> button, which would then cause the app to send an email to my FogBugz email address.</p> <p>What's the best way to do this, and are there any "gotchas" to watch out for?</p>
[ { "answer_id": 58023, "author": "Dr8k", "author_id": 6014, "author_profile": "https://Stackoverflow.com/users/6014", "pm_score": 3, "selected": false, "text": "<system.net>\n <mailSettings>\n <smtp deliveryMethod=\"Network\" from=\"stuff@somewhere.com.au\">\n <network host...
2008/09/11
[ "https://Stackoverflow.com/questions/57919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473/" ]
57,923
<p>I've been writing C / C++ code for almost twenty years, and I know Perl, Python, PHP, and some Java as well, and I'm teaching myself JavaScript. But I've never done any .NET, VB, or C# stuff. What exactly does <strong>managed</strong> code mean?</p> <p>Wikipedia <a href="http://en.wikipedia.org/wiki/Managed_code" rel="noreferrer">describes it</a> simply as</p> <blockquote> <p>Code that executes under the management of a virtual machine</p> </blockquote> <p>and it specifically says that Java is (usually) managed code, so</p> <ul> <li><strong>why does the term only seem to apply to C# / .NET?</strong></li> <li><strong>Can you compile C# into a .exe that contains the VM as well, or do you have to package it up and give it to another .exe (a la java)?</strong></li> </ul> <p>In a similar vein,</p> <ul> <li><strong>is .NET a <em>language</em> or a <em>framework</em>, and what exactly does "framework" mean here?</strong></li> </ul> <p>OK, so that's more than one question, but for someone who's been in the industry as long as I have, I'm feeling rather N00B-ish right now...</p>
[ { "answer_id": 108137, "author": "Josh Smeaton", "author_id": 10583, "author_profile": "https://Stackoverflow.com/users/10583", "pm_score": 3, "selected": false, "text": "class Bar : public Foo {\n private:\n int fubar;\n public:\n Bar(int i) : fubar(i) {}\n ...
2008/09/11
[ "https://Stackoverflow.com/questions/57923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1821/" ]
57,927
<p>I have an excel spreadsheet in a format similar to the following...</p> <pre><code>| NAME | CLUB | STATUS | SCORE | | Fred | a | Gent | 145 | | Bert | a | Gent | 150 | | Harry | a | Gent | 195 | | Jim | a | Gent | 150 | | Clare | a | Lady | 99 | | Simon | a | Junior | 130 | | John | b | Junior | 130 | : : | Henry | z | Gent | 200 | </code></pre> <p>I need to convert this table into a list of the "Top Ten" teams. The rules are</p> <ul> <li>Each team score is taken from the sum of four members of that club.</li> <li>These totals should be of the best four scores except... <ul> <li>Each team must consist of at least one Junior or Lady</li> </ul></li> </ul> <p>For example in the table above the team score for club A would be 625 <strong>not</strong> 640 as you would take the scores for Harry(190), Bert(150), Jim(150), and Simon(130). You could not take Fred's(145) score as that would give you only Gents.</p> <p>My question is, can this be done easily as a series of Excel formula, or will I need to resort to using something more procedural?</p> <p>Ideally the solution needs to be automatic in the team selections, I don't want to have to create separate hand crafted formula for each team. I also will not necessarily have a neatly ordered list of each clubs members. Although I could probably generate the list via an extra calculation sheet.</p>
[ { "answer_id": 60187, "author": "Dick Kusleika", "author_id": 4280, "author_profile": "https://Stackoverflow.com/users/4280", "pm_score": 3, "selected": true, "text": "Public Function TopTen(Club As String, Scores As Range)\n\n Dim i As Long\n Dim vaScores As Variant\n Dim bLady...
2008/09/11
[ "https://Stackoverflow.com/questions/57927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3720/" ]
57,947
<p>I'm really confused by the various configuration options for .Net configuration of dll's, ASP.net websites etc in .Net v2 - especially when considering the impact of a config file at the UI / end-user end of the chain.</p> <p>So, for example, some of the applications I work with use settings which we access with:</p> <pre><code>string blah = AppLib.Properties.Settings.Default.TemplatePath; </code></pre> <p>Now, this option seems cool because the members are stongly typed, and I won't be able to type in a property name that doesn't exist in the Visual Studio 2005 IDE. We end up with lines like this in the App.Config of a command-line executable project:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="AppConnectionString" connectionString="XXXX" /&gt; &lt;add name="AppLib.Properties.Settings.AppConnectionString" connectionString="XXXX" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>(If we don't have the second setting, someone releasing a debug dll to the live box could have built with the debug connection string embedded in it - eek)</p> <p>We also have settings accessed like this:</p> <pre><code>string blah = System.Configuration.ConfigurationManager.AppSettings["TemplatePath_PDF"]; </code></pre> <p>Now, these seem cool because we can access the setting from the dll code, or the exe / aspx code, and all we need in the Web or App.config is:</p> <pre><code>&lt;appSettings&gt; &lt;add key="TemplatePath_PDF" value="xxx"/&gt; &lt;/appSettings&gt; </code></pre> <p>However, the value of course may not be set in the config files, or the string name may be mistyped, and so we have a different set of problems.</p> <p>So... if my understanding is correct, the former methods give strong typing but bad sharing of values between the dll and other projects. The latter provides better sharing, but weaker typing.</p> <p>I feel like I must be missing something. For the moment, I'm not even concerned with the application being able to write-back values to the configuration files, encryption or anything like that. Also, I had decided that the best way to store any non-connection strings was in the DB... and then the very next thing that I have to do is store phone numbers to text people in case of DB connection issues, so they must be stored outside the DB!</p>
[ { "answer_id": 57980, "author": "Rob Gray", "author_id": 5691, "author_profile": "https://Stackoverflow.com/users/5691", "pm_score": 2, "selected": false, "text": "string phoneNum = Properties.Settings.Default.EmergencyPhoneNumber;\n" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/57947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6004/" ]
57,958
<p>I like HtmlControls because there is no HTML magic going on... the asp source looks similar to what the client sees. </p> <p>I can't argue with the utility of GridView, Repeater, CheckBoxLists, etc, so I use them when I need that functionality. </p> <p>Also, it looks weird to have code that mixes and matches:</p> <pre><code>&lt;asp:Button id='btnOK' runat='server' Text='OK' /&gt; &lt;input id='btnCancel' runat='server' type='button' value='Cancel' /&gt; </code></pre> <p>(The above case in the event you wanted to bind a server-side event listener to OK but Cancel just runs a javascript that hides the current div)</p> <p>Is there some definitive style guide out there? Should HtmlControls just be avoided? </p>
[ { "answer_id": 57961, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 1, "selected": false, "text": "<input id='btnCancel' type='button' value='Cancel' />\n" }, { "answer_id": 57986, "author": "Tyler", "author_...
2008/09/11
[ "https://Stackoverflow.com/questions/57958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
57,987
<p>Does anyone know how to write to an excel file (.xls) via OLEDB in C#? I'm doing the following:</p> <pre><code> OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection); dbCmd.CommandTimeout = mTimeout; results = dbCmd.ExecuteNonQuery(); </code></pre> <p>But I get an OleDbException thrown with message:</p> <blockquote> <p>"Cannot modify the design of table 'test$'. It is in a read-only database."</p> </blockquote> <p>My connection seems fine and I can select data fine but I can't seem to insert data into the excel file, does anyone know how I get read/write access to the excel file via OLEDB?</p>
[ { "answer_id": 184213, "author": "Zorantula", "author_id": 18108, "author_profile": "https://Stackoverflow.com/users/18108", "pm_score": 4, "selected": true, "text": "ReadOnly=False;" }, { "answer_id": 184271, "author": "Duncan Smart", "author_id": 1278, "author_profi...
2008/09/12
[ "https://Stackoverflow.com/questions/57987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39040/" ]
57,990
<p>After attending a recent Alt.NET group on IoC, I got to thinking about the tools available and how they might work. <code>StructureMap</code> in particular uses both attributes and bootstrapper concepts to map requests for <code>IThing</code> to <code>ConcreteThing</code>. Attributes automatically throw up flags for me that either reflection or IL injection is going on. Does anyone know exactly how this works (for <code>StructureMap</code> or other IoC tools) and what the associated overhead might be either at run-time or compile-time?</p>
[ { "answer_id": 184830, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "IRepository _repository = ObjectFactory.BuildFactory<IRepository>();\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/57990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
57,999
<p>I'm just looking for a simple, concise explanation of the difference between these two. MSDN doesn't go into a hell of a lot of detail here.</p>
[ { "answer_id": 58026, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 7, "selected": true, "text": "__declspec(dllexport)" }, { "answer_id": 58031, "author": "Shog9", "author_id": 811, "author_profile": "h...
2008/09/12
[ "https://Stackoverflow.com/questions/57999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
58,000
<p>We have a recurring problem at my company with build breaks in our Flex projects. The problem primarily occurs because the build that the developers do on their local machines is fundamentally different from the build that occurs on the build machine. The devs are building the projects using <code>FlexBuilder/eclipse</code> and the build machine is using the command line compilers. Inevitably, the <code>{projectname}-config.xml</code> and/or the batch file that runs the build get out of sync with the project files used by eclipse, so the the build succeeds on the dev's machine, but fails on the build machine.</p> <p>We started down the path of writing a utility program to convert FlexBuilder's project files into a <code>{projectname}-config.xml</code> file, but it's a) undocumented and b) a horrible hack.</p> <p>I've looked into the -dump-config switch to get the config files, but this has a couple of problems: 1) The generated config file has absolute paths which doesn't work in our environment (some developers use macs, some windows machines), and 2) only works right when run from the IDE, so can't be build into the build process.</p> <p>Tomorrow, we are going to discuss a couple of options, neither of which I'm terribly fond of:</p> <p><strong>a)</strong> Add a post check-in event to Subversion to remove these absolute references, or <br> <strong>b)</strong> add a pre-build process that removes the absolute reference.</p> <p>I can't believe that we are the first group of developers to run across this issue, but I can't find any good solutions on Google. How have other groups dealt with this problem?</p>
[ { "answer_id": 58026, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 7, "selected": true, "text": "__declspec(dllexport)" }, { "answer_id": 58031, "author": "Shog9", "author_id": 811, "author_profile": "h...
2008/09/12
[ "https://Stackoverflow.com/questions/58000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946325/" ]
58,024
<p>I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser.</p> <p>What is the best way to open a URL in the user's default browser from a Windows Forms application?</p>
[ { "answer_id": 58032, "author": "Aaron Wagner", "author_id": 3909, "author_profile": "https://Stackoverflow.com/users/3909", "pm_score": 5, "selected": false, "text": "using System.Diagnostics;\n\nProcess.Start(\"http://www.google.com/\");\n" }, { "answer_id": 58033, "author"...
2008/09/12
[ "https://Stackoverflow.com/questions/58024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148/" ]
58,054
<p>I have a list of bean objects passed into my JSP page, and one of them is a comment field. This field may contain newlines, and I want to replace them with semicolons using JSTL, so that the field can be displayed in a text input. I have found one solution, but it's not very elegant. I'll post below as a possibility.</p>
[ { "answer_id": 58060, "author": "parkerfath", "author_id": 6027, "author_profile": "https://Stackoverflow.com/users/6027", "pm_score": 7, "selected": true, "text": "<%@ taglib prefix=\"fn\" uri=\"http://java.sun.com/jsp/jstl/functions\" %>\n<% pageContext.setAttribute(\"newLineChar\", \"...
2008/09/12
[ "https://Stackoverflow.com/questions/58054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6027/" ]
58,058
<p>I'm trying to write a small class library for a C++ course.</p> <p>I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really programming) that C++ classes only worked with MFC .dlls and not plain ones, but that's just the windows side.</p>
[ { "answer_id": 58061, "author": "Kristopher Johnson", "author_id": 1175, "author_profile": "https://Stackoverflow.com/users/1175", "pm_score": 5, "selected": true, "text": "-fPIC" }, { "answer_id": 58171, "author": "Flame", "author_id": 5387, "author_profile": "https:...
2008/09/12
[ "https://Stackoverflow.com/questions/58058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5387/" ]
58,119
<p>I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Python library call may throw exception(s) and what those are? </p>
[ { "answer_id": 58129, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 5, "selected": true, "text": "re.compile" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1892/" ]
58,123
<p>This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object?</p> <p>And the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface:</p> <pre><code>private IWebBase FindWebBase() { if (HttpContext.Current as IWebBase != null) { return (IWebBase)HttpContext.Current.; } throw new NotImplementedException("Crawling for IWebBase not implemented yet"); } </code></pre> <p>The general context is that some controls need to know whether they are executing as a SharePoint webpart, or as part of an Asp.Net framework.</p> <p>I have solved the problem by requiring the control to pass a reference to itself, and checking the Page property of the control, but I'm still curious why the above does not work.</p> <p>The compiler error is: Cannot convert System.Web.HttpContext to ...IWebBase via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion or null type conversion.</p>
[ { "answer_id": 58128, "author": "Kilhoffer", "author_id": 5469, "author_profile": "https://Stackoverflow.com/users/5469", "pm_score": 5, "selected": false, "text": "HttpContext.Handler" }, { "answer_id": 58131, "author": "Ash", "author_id": 5023, "author_profile": "ht...
2008/09/12
[ "https://Stackoverflow.com/questions/58123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1685/" ]
58,141
<p>I knew of some performance reasons back in the SQL 7 days, but do the same issues still exist in SQL Server 2005? If I have a resultset in a stored procedure that I want to act upon individually, are cursors still a bad choice? If so, why?</p>
[ { "answer_id": 6052778, "author": "Gayan", "author_id": 760195, "author_profile": "https://Stackoverflow.com/users/760195", "pm_score": 2, "selected": false, "text": "DECLARE @commandname NVARCHAR(1000) = '';\n\nSELECT @commandname += 'truncate table ' + tablename + '; ';\nFROM tableName...
2008/09/12
[ "https://Stackoverflow.com/questions/58141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5469/" ]
58,146
<p>I am trying to come up with the best way to render some hierarchical data in to a nested unordered list using ASP.NET MVC. Does anyone have any tips on how to do this?</p>
[ { "answer_id": 282066, "author": "Paco", "author_id": 13376, "author_profile": "https://Stackoverflow.com/users/13376", "pm_score": 1, "selected": false, "text": "/// This is the model class\npublic class MyTreeNode<T>\n{\n public ICollection<MyTreeNode> ChildNodes {get;}\n public ...
2008/09/12
[ "https://Stackoverflow.com/questions/58146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5360/" ]
58,184
<p>Is there something special about Safari for Windows and AJAX?<br> In other words: Are there some common pitfalls I should keep in mind?</p>
[ { "answer_id": 58287, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 2, "selected": false, "text": "return false" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6024/" ]
58,190
<p>My current view is no, prefer Transact SQL stored procedures because they are a lighter weight and (possibly) higher performing option, while CLR procedures allow developers to get up to all sorts of mischief.</p> <p>However recently I have needed to debug some very poorly written TSQL stored procs. As usual I found many of the problems due to the original developer developer having no real TSQL experience, they were ASP.NET / C# focused.</p> <p>So, using CLR procedures would firstly provide a much more familiar toolset to this type of developer, and secondly, the debugging and testing facilities are more powerful (ie Visual Studio instead of SQL Management Studio). </p> <p>I'd be very interested in hearing your experience as it's seems it is not a simple choice. </p>
[ { "answer_id": 24812630, "author": "Solomon Rutzky", "author_id": 577765, "author_profile": "https://Stackoverflow.com/users/577765", "pm_score": 0, "selected": false, "text": "OPENQUERY" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5023/" ]
58,207
<p>To create a playlist for all of the music in a folder, I am using the following command in bash:</p> <pre><code>ls &gt; list.txt </code></pre> <p>I would like to use the result of the <code>pwd</code> command for the name of the playlist.</p> <p>Something like:</p> <pre><code>ls &gt; ${pwd}.txt </code></pre> <p>That doesn't work though - can anyone tell me what syntax I need to use to do something like this?</p> <p><strong>Edit:</strong> As mentioned in the comments pwd will end up giving an absolute path, so my playlist will end up being named .txt in some directory - d'oh! So I'll have to trim the path. Thanks for spotting that - I would probably have spent ages wondering where my files went!</p>
[ { "answer_id": 58212, "author": "John Calsbeek", "author_id": 5696, "author_profile": "https://Stackoverflow.com/users/5696", "pm_score": 8, "selected": true, "text": "\"$(command substitution)\"" }, { "answer_id": 58214, "author": "John Meagher", "author_id": 3535, "...
2008/09/12
[ "https://Stackoverflow.com/questions/58207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/840/" ]
58,230
<p>Is there another way to render graphics in C# beyond <a href="https://en.wikipedia.org/wiki/Graphics_Device_Interface#Windows_XP" rel="nofollow noreferrer">GDI+</a> and <a href="http://en.wikipedia.org/wiki/Microsoft_XNA" rel="nofollow noreferrer">XNA</a>? </p> <p>(For the development of a tile map editor.)</p>
[ { "answer_id": 58242, "author": "Ash", "author_id": 5023, "author_profile": "https://Stackoverflow.com/users/5023", "pm_score": 2, "selected": false, "text": "Lock" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568/" ]
58,245
<p>I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like "C:\Progra...\foo.txt"</p> <p>I'd like to pop a tooltip with the full path when the user hovers over the item, but this doesn't seem possible with the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.aspx" rel="noreferrer">Tooltip</a> class in .NET 2.0.</p> <p>Am I missing something obvious?</p>
[ { "answer_id": 58253, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 1, "selected": false, "text": "Tooltip" }, { "answer_id": 58258, "author": "andynil", "author_id": 446, "author_profile": "https://Stackover...
2008/09/12
[ "https://Stackoverflow.com/questions/58245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2773/" ]