qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
401,896
<p>I wrote this piece of code to merge two .NET configuration files: Add non existent nodes and override values on existing ones. I avoided to use the much faster reader/writer way because the app I'm using it for is not performance critical. What do you think of this?</p> <pre><code>using System; using System.Xml; ...
[ { "answer_id": 401918, "author": "Daniel M", "author_id": 36559, "author_profile": "https://Stackoverflow.com/users/36559", "pm_score": 0, "selected": false, "text": "<p>If it works for you...</p>\n\n<p>You should take a look at Linq to XML. It's much better than System.XML: Cleaner code...
2008/12/31
[ "https://Stackoverflow.com/questions/401896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12679/" ]
I wrote this piece of code to merge two .NET configuration files: Add non existent nodes and override values on existing ones. I avoided to use the much faster reader/writer way because the app I'm using it for is not performance critical. What do you think of this? ``` using System; using System.Xml; namespace devc...
You can also take a look on XmlMassUpdate task of the <http://msbuildtasks.tigris.org/> it do the same thing...
401,905
<p>I'm trying to capture the id of an element that will be randomly generated. I can successfully capture the value of my element id like this...</p> <pre><code>| storeAttribute | //div[1]@id | variableName | </code></pre> <p>Now my variable will be something like...</p> <pre><code>divElement-12345 </code></pre> <p...
[ { "answer_id": 432816, "author": "Tirno", "author_id": 9886, "author_profile": "https://Stackoverflow.com/users/9886", "pm_score": 1, "selected": false, "text": "<p>There are many functions in XPATH which should solve your problem. Assuming \"divElement-\" is a constant that will not cha...
2008/12/31
[ "https://Stackoverflow.com/questions/401905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48523/" ]
I'm trying to capture the id of an element that will be randomly generated. I can successfully capture the value of my element id like this... ``` | storeAttribute | //div[1]@id | variableName | ``` Now my variable will be something like... ``` divElement-12345 ``` I want to remove 'divElement-' so that the varia...
You have two options in Selenium, XPath and CSS Selector. I have read that CSS Selector is better for doing tests in both FireFox and IE. Using the latest version of Selenium IDE (3/5/2009) I've had success with using storeEval which evaluates Javascript expressions, giving you access to javascript string functions. X...
401,908
<p>I've run into an odd problem and I'm not sure how to fix it. I have several classes that are all PHP implementations of JSON objects. Here' an illustration of the issue</p> <pre><code>class A { protected $a; public function __construct() { $this-&gt;a = array( new B, new B ); } publi...
[ { "answer_id": 402005, "author": "Rob Elsner", "author_id": 50360, "author_profile": "https://Stackoverflow.com/users/50360", "pm_score": 2, "selected": false, "text": "<p>Isn't your answer in the <a href=\"http://us2.php.net/manual/en/function.json-encode.php#84997\" rel=\"nofollow nore...
2008/12/31
[ "https://Stackoverflow.com/questions/401908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8815/" ]
I've run into an odd problem and I'm not sure how to fix it. I have several classes that are all PHP implementations of JSON objects. Here' an illustration of the issue ``` class A { protected $a; public function __construct() { $this->a = array( new B, new B ); } public function __toStri...
A late answers but might be useful for others with the same problem. In *PHP < 5.4.0* **`json_encode`** doesn't call any method from the object. That is valid for getIterator, \_\_serialize, etc... In PHP > v5.4.0, however, a new interface was introduced, called [**JsonSerializable**](http://php.net/manual/en/class.j...
401,910
<p>Im a little confused over how to use the .NET Trace and Debug classes.</p> <p>Why would you bother using Trace instead of Debug?</p> <pre><code>Trace.TraceError() Trace.TraceInformation() Trace.Assert() Debug.WriteLine() Debug.Assert() </code></pre> <p>Also, I understand that Debug statements are ignored when yo...
[ { "answer_id": 401920, "author": "Tim Jarvis", "author_id": 10387, "author_profile": "https://Stackoverflow.com/users/10387", "pm_score": 2, "selected": false, "text": "<p>You can turn both on and off independantly with a compiler switch, if you go to the build page of your project prope...
2008/12/31
[ "https://Stackoverflow.com/questions/401910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
Im a little confused over how to use the .NET Trace and Debug classes. Why would you bother using Trace instead of Debug? ``` Trace.TraceError() Trace.TraceInformation() Trace.Assert() Debug.WriteLine() Debug.Assert() ``` Also, I understand that Debug statements are ignored when your in Release config mode, but If...
At the simplest level, they have different compilation switches - i.e. `Debug.WriteLine` etc is only toggled if you have the `DEBUG` compilation symbol (not common for release builds), where-as `Trace.WriteLine` will usually be included even in release builds. The `Trace` route has customizable trace-listeners, that c...
401,919
<p>The code base I'm currently working on is littered with hard-coded values.</p> <p>I view all hard coded values as a code smell and I try to eliminate them where possible...however there are some cases that I am unsure about.</p> <p>Here are two examples that I can think of that make me wonder what the best practic...
[ { "answer_id": 401926, "author": "Colen", "author_id": 13500, "author_profile": "https://Stackoverflow.com/users/13500", "pm_score": 2, "selected": false, "text": "<p>The better way for your second example would be to define an inline function:</p>\n\n<pre><code>double getpercentage(doub...
2008/12/31
[ "https://Stackoverflow.com/questions/401919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39532/" ]
The code base I'm currently working on is littered with hard-coded values. I view all hard coded values as a code smell and I try to eliminate them where possible...however there are some cases that I am unsure about. Here are two examples that I can think of that make me wonder what the best practice is: ``` 1. MyT...
> > *And can anyone think of any places where hard coding is an acceptable practice?* > > > * Small apps * Single man projects * Throw aways * Short living projects For short anything that won't be maintained by others. *Gee I've just realized how much being maintainer coder hurt me in the past :)*
401,935
<p>I have IQueryable list of objects of type T which I want to transform into objects of type K</p> <pre><code>List&lt;K&gt; tranformedList = originalList.Select(x =&gt; transform(x)).ToList(); </code></pre> <p>the transform function returns null if it cannot tranform the objects.If I want to filter out null elements...
[ { "answer_id": 401957, "author": "Nathan W", "author_id": 6335, "author_profile": "https://Stackoverflow.com/users/6335", "pm_score": 8, "selected": true, "text": "<p>Can't you just do something like this:</p>\n\n<pre><code>List&lt;K&gt; tranformedList = originalList.Select(x =&gt; tranf...
2008/12/31
[ "https://Stackoverflow.com/questions/401935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28034/" ]
I have IQueryable list of objects of type T which I want to transform into objects of type K ``` List<K> tranformedList = originalList.Select(x => transform(x)).ToList(); ``` the transform function returns null if it cannot tranform the objects.If I want to filter out null elements can I call ``` List<K> tranformed...
Can't you just do something like this: ``` List<K> tranformedList = originalList.Select(x => tranform(x)) .Where(y => y != null) //Check for nulls .ToList(); ```
401,941
<p>What is the worst SQL query you've ever seen? What made it bad?</p>
[ { "answer_id": 401943, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 2, "selected": false, "text": "<p>select * from *</p>\n\n<p>Real bad.</p>\n" }, { "answer_id": 401946, "author": "Doug T.", "author_...
2008/12/31
[ "https://Stackoverflow.com/questions/401941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50276/" ]
What is the worst SQL query you've ever seen? What made it bad?
``` DELETE FROM table ``` Seen right after I typed and executed it, I had forgotten the WHERE clause. Now I always run a SELECT statement first and change the SELECT to DELETE after I am satisfied that the proper rows will be affected.
401,971
<p>I'm using a mac and looking to batch convert a large amount of eps files and create jpg previews of each. I'm looking for preferably a command-line utility, or some type of workflow to easily batch a large number of files. </p> <p>Thanks for any ideas or input</p>
[ { "answer_id": 402007, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://www.imagemagick.org\" rel=\"noreferrer\">ImageMagick</a> should be exactly what you're looking f...
2008/12/31
[ "https://Stackoverflow.com/questions/401971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49684/" ]
I'm using a mac and looking to batch convert a large amount of eps files and create jpg previews of each. I'm looking for preferably a command-line utility, or some type of workflow to easily batch a large number of files. Thanks for any ideas or input
Like codelogic mentioned, `sips` is a good tool for this. However, it doesn't support EPS natively, so you need to convert to PDF first. If you're on Tiger or Leopard, something like the following should work: ``` mkdir pdf jpg cd pdf echo ../eps/*.eps | xargs -n1 pstopdf cd .. sips -s format jpeg *.pdf --out jpg/ ...
401,996
<p>Thanks for reading this.</p> <p>I have markup similar to what is below. Using the line-height works when there is only one line of text, but the comments data will frequently be multi-line. What is the best way to get the label and the data vertically centered?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&...
[ { "answer_id": 402000, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 1, "selected": false, "text": "<p>Probably what you want to use is a <code>&lt;table&gt;</code> construction for your data. Although there's a lot ...
2008/12/31
[ "https://Stackoverflow.com/questions/401996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
Thanks for reading this. I have markup similar to what is below. Using the line-height works when there is only one line of text, but the comments data will frequently be multi-line. What is the best way to get the label and the data vertically centered? ``` <html> <head> <style> body {margin:0; padding:0; font-s...
<http://www.jakpsatweb.cz/css/css-vertical-center-solution.html> and of course: <http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=vertically+align+text+div&spell=1> :) Tables have their place; but it is good to try and figure how to do something in a div before resorting back to tables. Th...
402,022
<p>I'm working on an application that runs on Windows Mobile 6 that needs to be able to retrieve all items from an item table that contain a given string (provided by the end user) within the item's description field. The problem is that there are approximately 170,000 items in the table. Since I need to return all ite...
[ { "answer_id": 402033, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 3, "selected": false, "text": "<p>How about pre-processing (once) the items table (and each new entry added to it would need to be processed), to cre...
2008/12/31
[ "https://Stackoverflow.com/questions/402022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9732/" ]
I'm working on an application that runs on Windows Mobile 6 that needs to be able to retrieve all items from an item table that contain a given string (provided by the end user) within the item's description field. The problem is that there are approximately 170,000 items in the table. Since I need to return all items ...
I voted for [Mitch Wheat's](https://stackoverflow.com/questions/402022/what-is-a-suitable-replacement-for-the-sql-like-operator-to-increase-performance#402033) answer, but there are a few tricks I would also test for effectiveness. My big worry about having a table full of [char],[int] is you may still find yourself ...
402,077
<p>A coworker asked me to look at indexing on some tables because his query was running very long. Over an hour.</p> <pre><code>select count(1) from databaseA.dbo.table1 inner join databaseA.dbo.table2 on (table1.key = table2.key) inner join databaseB.dbo.table3 on (table1.key = table3.key) </code></pre> <p>Note the...
[ { "answer_id": 402082, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 3, "selected": true, "text": "<p>I would suspect the statistics first.</p>\n\n<p>As you are no doubt aware, Join hints should be avoided in 99% of ca...
2008/12/31
[ "https://Stackoverflow.com/questions/402077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12424/" ]
A coworker asked me to look at indexing on some tables because his query was running very long. Over an hour. ``` select count(1) from databaseA.dbo.table1 inner join databaseA.dbo.table2 on (table1.key = table2.key) inner join databaseB.dbo.table3 on (table1.key = table3.key) ``` Note the different databases. This ...
I would suspect the statistics first. As you are no doubt aware, Join hints should be avoided in 99% of cases and used only when you have proof that they are absolutely required.
402,086
<p>I'm new to LaTeX and I must say that I am really struggling with it. I discovered the \newcommand command that is kind of like a function/method in regular programming languages. You can give it arguments and everything.</p> <p>I was wondering though, can I somehow iterate in LaTeX? Basically, what I would like to ...
[ { "answer_id": 402092, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": true, "text": "<p>Auntie Google says <a href=\"http://mathematics.nsetzer.com/latex/latex_for_loop.html\" rel=\"nofollow noreferrer\">yes</a>....
2008/12/31
[ "https://Stackoverflow.com/questions/402086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48648/" ]
I'm new to LaTeX and I must say that I am really struggling with it. I discovered the \newcommand command that is kind of like a function/method in regular programming languages. You can give it arguments and everything. I was wondering though, can I somehow iterate in LaTeX? Basically, what I would like to do is crea...
Auntie Google says [yes](http://mathematics.nsetzer.com/latex/latex_for_loop.html).
402,094
<p>I have a DropDownList and a TextBox on a Page. When the user chooses the "other" option in the DropDownList I want to display a TextBox just to the right of it. I do not want to use the traditional PostBack technique. I want this interaction to be client side.</p> <p>I am aware that I can get a get a reference to t...
[ { "answer_id": 402104, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "<p>jQuery <a href=\"http://www.hanselman.com/blog/jQuerytoshipwithASPNETMVCandVisualStudio.aspx\" rel=\"nofollow norefer...
2008/12/31
[ "https://Stackoverflow.com/questions/402094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30887/" ]
I have a DropDownList and a TextBox on a Page. When the user chooses the "other" option in the DropDownList I want to display a TextBox just to the right of it. I do not want to use the traditional PostBack technique. I want this interaction to be client side. I am aware that I can get a get a reference to the DOM ele...
jQuery [will be/is distributed with VisualStudio/ASP.NET MVC](http://www.hanselman.com/blog/jQuerytoshipwithASPNETMVCandVisualStudio.aspx), though I wouldn't call it part of the framework. I think that you can feel free to use it and trust that it will be supported. Note that Microsoft has said that they will be usin...
402,159
<p>I messed up on my SVN repository and now need to revert the entire repository from revision 28 to 24 and don't want to deal with diffs or conflicts. Is there a quick and simple way to do this? I've been able to revert back single files before fine with the merge command - but in this instance it wants to add all of ...
[ { "answer_id": 402172, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "<p>You can do a new checkout of a particular revision. <a href=\"http://svnbook.red-bean.com/en/1.1/re04.html\" rel=\"nofollow...
2008/12/31
[ "https://Stackoverflow.com/questions/402159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I messed up on my SVN repository and now need to revert the entire repository from revision 28 to 24 and don't want to deal with diffs or conflicts. Is there a quick and simple way to do this? I've been able to revert back single files before fine with the merge command - but in this instance it wants to add all of the...
Check out svnadmin dump/load. It creates a text file with every version of your files. It may be possible to delete everything above/below a certain point and re-import it. See for instance [Migrating Repository Data Elsewhere](http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.migra...
402,200
<p>Supposing I'm setting a background image for a web page in CSS like this:</p> <pre><code>body { font-size: 62.5%; /* Resets 1em to 10px */ font-family: Verdana, Arial, Sans-Serif; background-color: #9D5922; color: #000; margin-left: auto; margin-right: auto; margin: 0; padding: 0; background: url(images/desk.gi...
[ { "answer_id": 402212, "author": "Will Bickford", "author_id": 43012, "author_profile": "https://Stackoverflow.com/users/43012", "pm_score": 0, "selected": false, "text": "<p>The only way is to use another container. Each element may contain only one background image.</p>\n" }, { ...
2008/12/31
[ "https://Stackoverflow.com/questions/402200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Supposing I'm setting a background image for a web page in CSS like this: ``` body { font-size: 62.5%; /* Resets 1em to 10px */ font-family: Verdana, Arial, Sans-Serif; background-color: #9D5922; color: #000; margin-left: auto; margin-right: auto; margin: 0; padding: 0; background: url(images/desk.gif) repeat bott...
In short, it's not possible. You can do this, but you need to add a second HTML object to the page to get it to work. So for example, place a div block right below your body, and assign the second background to that object. Hope this helps!
402,215
<p>In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess truly readonly properties. For example, I can read the $nodeName property of a DOMNode, but I cannot write to it (if I do PHP throws a fatal error).</p> <p>How can I create readonly properties of my own in PHP?</p>
[ { "answer_id": 402227, "author": "too much php", "author_id": 28835, "author_profile": "https://Stackoverflow.com/users/28835", "pm_score": 7, "selected": true, "text": "<p>You can do it like this:</p>\n\n<pre><code>class Example {\n private $__readOnly = 'hello world';\n function ...
2008/12/31
[ "https://Stackoverflow.com/questions/402215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42523/" ]
In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess truly readonly properties. For example, I can read the $nodeName property of a DOMNode, but I cannot write to it (if I do PHP throws a fatal error). How can I create readonly properties of my own in PHP?
You can do it like this: ``` class Example { private $__readOnly = 'hello world'; function __get($name) { if($name === 'readOnly') return $this->__readOnly; user_error("Invalid property: " . __CLASS__ . "->$name"); } function __set($name, $value) { user_error("Can't ...
402,217
<p>I need to store some data in a Django model. These data are not equal to all instances of the model.</p> <p>At first I thought about subclassing the model, but I’m trying to keep the application flexible. If I use subclasses, I’ll need to create a whole class each time I need a new kind of object, and that’s no goo...
[ { "answer_id": 402248, "author": "Ned Batchelder", "author_id": 14343, "author_profile": "https://Stackoverflow.com/users/14343", "pm_score": 4, "selected": false, "text": "<p>If you don't need to query by any of this extra data, then you can store it as a <em>serialized dictionary</em>....
2008/12/31
[ "https://Stackoverflow.com/questions/402217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34479/" ]
I need to store some data in a Django model. These data are not equal to all instances of the model. At first I thought about subclassing the model, but I’m trying to keep the application flexible. If I use subclasses, I’ll need to create a whole class each time I need a new kind of object, and that’s no good. I’ll al...
If it's really dictionary like arbitrary data you're looking for you can probably use a two-level setup with one model that's a container and another model that's key-value pairs. You'd create an instance of the container, create each of the key-value instances, and associate the set of key-value instances with the con...
402,283
<p>I am not able to understand the differences between <code>std::string</code> and <code>std::wstring</code>. I know <code>wstring</code> supports wide characters such as Unicode characters. I have got the following questions:</p> <ol> <li>When should I use <code>std::wstring</code> over <code>std::string</code>?</li...
[ { "answer_id": 402291, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 3, "selected": false, "text": "<ol>\n<li>When you want to store 'wide' (Unicode) characters.</li>\n<li>Yes: 255 of them (excluding 0).</li>\n<li>Yes.</li>...
2008/12/31
[ "https://Stackoverflow.com/questions/402283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am not able to understand the differences between `std::string` and `std::wstring`. I know `wstring` supports wide characters such as Unicode characters. I have got the following questions: 1. When should I use `std::wstring` over `std::string`? 2. Can `std::string` hold the entire ASCII character set, including the...
`string`? `wstring`? -------------------- `std::string` is a [`basic_string`](//en.cppreference.com/w/cpp/string/basic_string) templated on a `char`, and `std::wstring` on a [`wchar_t`](//en.wikipedia.org/wiki/Wide_character#C/C++). `char` vs. `wchar_t` -------------------- `char` is supposed to hold a character, us...
402,299
<p>I'm relatively new to ASP.NET and was wondering if anyone could shed some light on when I should use relative references (e.g. ../images/banner_tinga.jpg) versus the tilde (e.g. ~/images/banner_tinga.jpg). Depending on the situation you can accomplish the same goal using either. What are the pros and cons of each me...
[ { "answer_id": 402475, "author": "StevenMcD", "author_id": 38595, "author_profile": "https://Stackoverflow.com/users/38595", "pm_score": 0, "selected": false, "text": "<p>Personally I only use relative references now and avoid the tilde. It may lead to problems further down the line. Alt...
2008/12/31
[ "https://Stackoverflow.com/questions/402299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21410/" ]
I'm relatively new to ASP.NET and was wondering if anyone could shed some light on when I should use relative references (e.g. ../images/banner\_tinga.jpg) versus the tilde (e.g. ~/images/banner\_tinga.jpg). Depending on the situation you can accomplish the same goal using either. What are the pros and cons of each mec...
The tilde will work only with controls that have runat="server" attribute, and will not work with standard HTML controls. So there's really no universal choice. If you wish to use use tilde with HTML controls you'll have to mark them runat="server", like this ``` <img src="~/images/myimage.png" runat="server"> ``` B...
402,302
<p>Here's the .jsp code:</p> <pre><code>&lt;table&gt; &lt;s:iterator value="allAgents"&gt; &lt;tr&gt; &lt;td&gt;&lt;s:property value="firstName" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="middleName" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property val...
[ { "answer_id": 402414, "author": "edeviant", "author_id": 50413, "author_profile": "https://Stackoverflow.com/users/50413", "pm_score": 2, "selected": false, "text": "<p>You need to look into the theme that is being used for your form tag rendering. Struts2 uses a template system (define...
2008/12/31
[ "https://Stackoverflow.com/questions/402302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15187/" ]
Here's the .jsp code: ``` <table> <s:iterator value="allAgents"> <tr> <td><s:property value="firstName" /></td> <td><s:property value="middleName" /></td> <td><s:property value="lastName" /></td> <td><s:checkbox name="ss"/></td> ...
Add the property theme="simple" like
402,307
<p>I was wondering what the best way to model a relationship where an object is associated with exactly n objects of another class. I want to extend the has_one relationship to a specific value of n. </p> <p>For example, a TopFiveMoviesList would belong to user and have exactly five movies. I would imagine that the un...
[ { "answer_id": 403195, "author": "Mark A Johnson", "author_id": 45720, "author_profile": "https://Stackoverflow.com/users/45720", "pm_score": 1, "selected": false, "text": "<p>I assume you mean \"implement\" rather than \"model\"? The modeling's pretty easy in UML, say, where you have a ...
2008/12/31
[ "https://Stackoverflow.com/questions/402307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1227001/" ]
I was wondering what the best way to model a relationship where an object is associated with exactly n objects of another class. I want to extend the has\_one relationship to a specific value of n. For example, a TopFiveMoviesList would belong to user and have exactly five movies. I would imagine that the underlying ...
My first instinct would be to use a join table, but if that's not desirable `User.movie[1-5]_id` columns would fit the bill. (I think `movie1_id` fits better with Rails convention than `movie_id_1`.) Since you tagged this Rails and ActiveRecord, I'll add some completely untested and probably somewhat wrong model code ...
402,313
<p>I recently upgraded a Web Application Project (as well as some dependent projects) from .net 2.0 to .net 3.5 using the built in conversion tool. Everything works well such as using MS AJAX 3.5 vs. the external MS AJAX libraries in 2.0.</p> <p>My problem occurs when I tried using the new Lambda Expression syntax. Th...
[ { "answer_id": 402325, "author": "Jonathan Rupp", "author_id": 12502, "author_profile": "https://Stackoverflow.com/users/12502", "pm_score": 0, "selected": false, "text": "<p>I don't have much experience with the VS 2008 conversion tool, but I know other project conversion tools have had...
2008/12/31
[ "https://Stackoverflow.com/questions/402313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22264/" ]
I recently upgraded a Web Application Project (as well as some dependent projects) from .net 2.0 to .net 3.5 using the built in conversion tool. Everything works well such as using MS AJAX 3.5 vs. the external MS AJAX libraries in 2.0. My problem occurs when I tried using the new Lambda Expression syntax. The compiler...
If any of the page is being compiled by ASP.NET (i.e. you aren't pre-compiling the WAP), then you'll need to ensure that ASP.NET knows about the C# 3.0 (.NET 3.5) compiler. Ensure the following is in the `web.config`: ``` <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".c...
402,314
<p>In a way following on from <a href="https://stackoverflow.com/questions/158534/reading-a-windows-dmp-file">reading a windows *.dmp file</a></p> <p>Having received a dump file from random customer, running the debug session to see the crash, you often find it is in a MS or other third party library. The next issue ...
[ { "answer_id": 403373, "author": "Aaron N. Tubbs", "author_id": 4810, "author_profile": "https://Stackoverflow.com/users/4810", "pm_score": 0, "selected": false, "text": "<p>Try following the instructions at <a href=\"http://support.microsoft.com/kb/311503\" rel=\"nofollow noreferrer\">t...
2008/12/31
[ "https://Stackoverflow.com/questions/402314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37558/" ]
In a way following on from [reading a windows \*.dmp file](https://stackoverflow.com/questions/158534/reading-a-windows-dmp-file) Having received a dump file from random customer, running the debug session to see the crash, you often find it is in a MS or other third party library. The next issue is that you may not h...
What are you using to debug the minidump? I.e., WinDBG or Visual Studio? And how was the minidump generated? There should be enough information in the minidump to resolve system dll symbols correctly. Are you using a local download of symbols or <http://msdl.microsoft.com/>? Update: You should be able to add the publ...
402,330
<pre><code>java -classpath ../classes;../jar;. parserTester </code></pre> <p>How can i get the functionality in the above command programmatically? Like, is it possible to run as:</p> <pre><code>java parserTester </code></pre> <p>and get the same result? I tried using URLClassLoader but it modifies the classpath and...
[ { "answer_id": 402335, "author": "Milhous", "author_id": 17712, "author_profile": "https://Stackoverflow.com/users/17712", "pm_score": 0, "selected": false, "text": "<p>You could implement your own <a href=\"http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html\" rel=\"nofol...
2008/12/31
[ "https://Stackoverflow.com/questions/402330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` java -classpath ../classes;../jar;. parserTester ``` How can i get the functionality in the above command programmatically? Like, is it possible to run as: ``` java parserTester ``` and get the same result? I tried using URLClassLoader but it modifies the classpath and does not add to it. Thanx! --- Thanks ...
You can use a java.net.URLClassLoader to load classes with any program defined list of URL's you wish: > > public class URLClassLoader > extends SecureClassLoader > > > This class loader is used to load > classes and resources from a search > path of URLs referring to both JAR > files and directories. Any URL t...
402,337
<p>Has anyone been able to succesfully use the IE CSS hack #IEroot? I stumbled upon it from <a href="http://www.positioniseverything.net/articles/cc-plus.html" rel="nofollow noreferrer">this article</a> but it doesn't seem to work for me.</p> <p>I'm trying to fix/hack the inline styling bug to produce li inline blocks...
[ { "answer_id": 402360, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": -1, "selected": false, "text": "<p>I'm using a beta of IE8, and the example on the page that you are referring to does not work. The live de...
2008/12/31
[ "https://Stackoverflow.com/questions/402337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48266/" ]
Has anyone been able to succesfully use the IE CSS hack #IEroot? I stumbled upon it from [this article](http://www.positioniseverything.net/articles/cc-plus.html) but it doesn't seem to work for me. I'm trying to fix/hack the inline styling bug to produce li inline blocks ``` #featured li { margin:0px; paddin...
**IT DOES WORK**, exactly as described, EVEN in IE8, and is actually a pretty smart CSS hack to get around IE specific bugs. You **MUST** swap out the DOCTYPE line for a REAL DOCTYPE though first. Here is the code from the link, tweaked to be a working sample. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transit...
402,339
<p>How do I get justified text with UTTextField. It does have an textAlignment property. But the UITextAlignment constant only has left, right, and center justification.</p> <p>What I am seeking is the Justified text common in word processing app with text flush with both left and right edges. This is a read only tex...
[ { "answer_id": 402360, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": -1, "selected": false, "text": "<p>I'm using a beta of IE8, and the example on the page that you are referring to does not work. The live de...
2008/12/31
[ "https://Stackoverflow.com/questions/402339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I get justified text with UTTextField. It does have an textAlignment property. But the UITextAlignment constant only has left, right, and center justification. What I am seeking is the Justified text common in word processing app with text flush with both left and right edges. This is a read only text field. I...
**IT DOES WORK**, exactly as described, EVEN in IE8, and is actually a pretty smart CSS hack to get around IE specific bugs. You **MUST** swap out the DOCTYPE line for a REAL DOCTYPE though first. Here is the code from the link, tweaked to be a working sample. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transit...
402,341
<p>I'd like to write a function in Javascript along the lines of:</p> <pre><code>in_subnet(ip, network, slash) { ... } in_subnet('1.2.3.4', '1.2.0.0', 16) # True, since it's in 1.2.0.0/16 in_subnet('1.2.3.4', '1.2.0.0', 24) # False, since it's not in 1.2.0.0/24 </code></pre> <p>Should I write it from scratch, or...
[ { "answer_id": 402351, "author": "Dustin", "author_id": 39975, "author_profile": "https://Stackoverflow.com/users/39975", "pm_score": 1, "selected": false, "text": "<p>Go ahead and learn it. :)</p>\n\n<p>The trick is to parse '1.2.3.4' into a single integer ( (1 &lt;&lt; 24 | 2 &lt;&lt;...
2008/12/31
[ "https://Stackoverflow.com/questions/402341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'd like to write a function in Javascript along the lines of: ``` in_subnet(ip, network, slash) { ... } in_subnet('1.2.3.4', '1.2.0.0', 16) # True, since it's in 1.2.0.0/16 in_subnet('1.2.3.4', '1.2.0.0', 24) # False, since it's not in 1.2.0.0/24 ``` Should I write it from scratch, or are there some good libra...
Pseudocode, building on dustin's answer: ``` addr_one = ip_addr_to_integer(ip); addr_two = ip_addr_to_integer(network); mask = ((1 << (32-slash)) - 1) ^ 0xFFFFFFFF; return (((addr_one ^ addr_two) & mask) == 0); ``` If you know that the IP address strings are valid, you can probably use string.split('.') to get the f...
402,348
<p>I need to set/get the cookies stored at <code>first.example</code> while browsing <code>second.example</code>, I have full access of <code>first.example</code> but I only have JavaScript access (can manipulate the DOM as I want) on <code>second.example</code>.</p> <p>My first approach was to create an iframe on <cod...
[ { "answer_id": 402354, "author": "Ryan Doherty", "author_id": 956, "author_profile": "https://Stackoverflow.com/users/956", "pm_score": 4, "selected": true, "text": "<p>You could inject a script element into HEAD of the document with a callback that passes the cookie you need to whatever...
2008/12/31
[ "https://Stackoverflow.com/questions/402348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50394/" ]
I need to set/get the cookies stored at `first.example` while browsing `second.example`, I have full access of `first.example` but I only have JavaScript access (can manipulate the DOM as I want) on `second.example`. My first approach was to create an iframe on `second.example` (with JS) that loaded a page like `first...
You could inject a script element into HEAD of the document with a callback that passes the cookie you need to whatever function needs it. Something like: ``` <script type="text/javascript"> var newfile=document.createElement('script'); newfile.setAttribute("type","text/javascript"); newfile.setAttribute("...
402,364
<p>My idea of program:</p> <p>I have a dictionary:</p> <pre><code>options = { 'string' : select_fun(function pointer), 'float' : select_fun(function pointer), 'double' : select_fun(function pointer) } </code></pre> <p>whatever type comes single function <code>select_fun(function pointer)</code> gets called. Inside <...
[ { "answer_id": 402369, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 4, "selected": false, "text": "<p>Could you be more specific on what you're trying to do? You don't have to do anything special to get function po...
2008/12/31
[ "https://Stackoverflow.com/questions/402364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
My idea of program: I have a dictionary: ``` options = { 'string' : select_fun(function pointer), 'float' : select_fun(function pointer), 'double' : select_fun(function pointer) } ``` whatever type comes single function `select_fun(function pointer)` gets called. Inside `select_fun(function pointer)`,I will have di...
Could you be more specific on what you're trying to do? You don't have to do anything special to get function pointers in Python -- you can pass around functions like regular objects: ``` def plus_1(x): return x + 1 def minus_1(x): return x - 1 func_map = {'+' : plus_1, '-' : minus_1} func_map['+'](3) # re...
402,377
<p>I wish to have long and short forms of command line options invoked using my shell script.</p> <p>I know that <code>getopts</code> can be used, but like in Perl, I have not been able to do the same with shell.</p> <p>Any ideas on how this can be done, so that I can use options like:</p> <pre><code>./shell.sh --co...
[ { "answer_id": 402410, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 9, "selected": true, "text": "<p>There are three implementations that may be considered:</p>\n\n<ul>\n<li><p>Bash builtin <code>getopts</code>. This ...
2008/12/31
[ "https://Stackoverflow.com/questions/402377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35416/" ]
I wish to have long and short forms of command line options invoked using my shell script. I know that `getopts` can be used, but like in Perl, I have not been able to do the same with shell. Any ideas on how this can be done, so that I can use options like: ``` ./shell.sh --copyfile abc.pl /tmp/ ./shell.sh -c abc.p...
There are three implementations that may be considered: * Bash builtin `getopts`. This does not support long option names with the double-dash prefix. It only supports single-character options. * BSD UNIX implementation of standalone `getopt` command (which is what MacOS uses). This does not support long options eithe...
402,391
<p>I need to be able to write a function that shows repeated words from a string and return a list of strings in order of its occurrence and ignore non-letters</p> <p>e.g at hugs prompt</p> <pre><code>repetitions :: String -&gt; [String] repetitions &gt; "My bag is is action packed packed." output&gt; ["is","packed"...
[ { "answer_id": 402409, "author": "Apocalisp", "author_id": 3434, "author_profile": "https://Stackoverflow.com/users/3434", "pm_score": 4, "selected": true, "text": "<p>To split a string into words, use the <code>words</code> function (in the Prelude).\nTo eliminate non-word characters, <...
2008/12/31
[ "https://Stackoverflow.com/questions/402391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50409/" ]
I need to be able to write a function that shows repeated words from a string and return a list of strings in order of its occurrence and ignore non-letters e.g at hugs prompt ``` repetitions :: String -> [String] repetitions > "My bag is is action packed packed." output> ["is","packed"] repetitions > "My name name...
To split a string into words, use the `words` function (in the Prelude). To eliminate non-word characters, `filter` with `Data.Char.isAlphaNum`. Zip the list together with its tail to get adjacent pairs `(x, y)`. Fold the list, consing a new list that contains all `x` where `x` == `y`. Someting like: ``` repetitions ...
402,427
<p>In a shoes application am trying to download stuff from some internal websites. I get this error</p> <pre><code>Error in /tmp/selfgz14214/ruby/lib/net/protocol.rb line 66 undefined method 'closed?' for #&lt;OpenSSL::SSL::SSLSocket:0xb6af94f0&gt; </code></pre> <p>I got the above error for this code. This give the a...
[ { "answer_id": 402429, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 5, "selected": true, "text": "<p>It is very useful. I can see 2 primary reasons to use JNI (there are likely more).</p>\n\n<ol>\n<li><p>Performance. I...
2008/12/31
[ "https://Stackoverflow.com/questions/402427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50418/" ]
In a shoes application am trying to download stuff from some internal websites. I get this error ``` Error in /tmp/selfgz14214/ruby/lib/net/protocol.rb line 66 undefined method 'closed?' for #<OpenSSL::SSL::SSLSocket:0xb6af94f0> ``` I got the above error for this code. This give the above error if used from Shoes. ...
It is very useful. I can see 2 primary reasons to use JNI (there are likely more). 1. Performance. If you have a piece of code in which the Java Runtime for whatever reason can't cut it performance wise. You can implement that function in native code and call it from Java. This allows you to hand tune the implementati...
402,432
<p>I am trying to return an array Data Member from one smaller 2D Array Object, and trying to insert the array into a larger 2D array object. But when attempting this, I came into two problems.</p> <p>First problem is that I want to return the name of the 2D array, but I do not know how to properly syntax to return 2D...
[ { "answer_id": 402442, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 0, "selected": false, "text": "<p>It seems like you need to read up more on pointers in C++ and on pass by reference vs. pass by value.</p>\n\n<p>Your return...
2008/12/31
[ "https://Stackoverflow.com/questions/402432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to return an array Data Member from one smaller 2D Array Object, and trying to insert the array into a larger 2D array object. But when attempting this, I came into two problems. First problem is that I want to return the name of the 2D array, but I do not know how to properly syntax to return 2D Array nam...
When passing your array around, you have to decide whether or not you want to make a copy of the array, or if you just want to return a pointer to the array. For returning arrays, you can't (easily) return a copy - you can only return a pointer (or reference in C++). For example: ``` // Piece::returnPiece is a functio...
402,448
<p>I have a Div Tag which contains 4 child Div Tags</p> <pre> <code> &lt;Div id="Parent"> &lt;div id="childOne">ChildOne &lt/div> &lt;div id="childOne">ChildTwo &lt/div> &lt;div id="childOne">ChildThree &lt/div> &lt;div id="childOne">ChildFour &lt/div> &lt/Div> </code> </pre> <p>Now I would ...
[ { "answer_id": 402450, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": -1, "selected": false, "text": "<p>What do you mean \"access them with arrow keys\"? There is text in each of the divs... they don't contain any i...
2008/12/31
[ "https://Stackoverflow.com/questions/402448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a Div Tag which contains 4 child Div Tags ``` <Div id="Parent"> <div id="childOne">ChildOne </div> <div id="childOne">ChildTwo </div> <div id="childOne">ChildThree </div> <div id="childOne">ChildFour </div> </Div> ``` Now I would like to access these Child Div's using up and Down Arr...
Are you looking for what is known as [auto-completion](http://www.javascript-examples.com/autocomplete-demo/) or suggestions?
402,455
<p>I need to find basic WYSIWYG HTML editor component for C++Builder 5 to let users to create some simple text that I will paste into existing HTML page template. Just a simple support to create links, add images, use headers/bold/italic.</p>
[ { "answer_id": 402482, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": 4, "selected": true, "text": "<p>You can drop a TWebBrowser on a form and enable designmode on it, like this:</p>\n\n<pre><code>// Delphi co...
2008/12/31
[ "https://Stackoverflow.com/questions/402455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44715/" ]
I need to find basic WYSIWYG HTML editor component for C++Builder 5 to let users to create some simple text that I will paste into existing HTML page template. Just a simple support to create links, add images, use headers/bold/italic.
You can drop a TWebBrowser on a form and enable designmode on it, like this: ``` // Delphi code.. (WebBrowser1.Document as IHTMLDocument2).designMode := 'on'; ``` After executing the above line, the page will be editable. You can type extra text, delete, etc. If you want to make selections bold or insert images, you...
402,481
<p>I have a web page where it will input an excel/CSV file from the user and read the data from it and import to DB.While inserting each record.I just want to show the details about the record being inserted to the user.(Ex : Client Details of A is adding...)</p>
[ { "answer_id": 402501, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 3, "selected": true, "text": "<p>Try this... Set the output to unbuffered (Response.BufferOutput), and include some javascript in your page that u...
2008/12/31
[ "https://Stackoverflow.com/questions/402481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40521/" ]
I have a web page where it will input an excel/CSV file from the user and read the data from it and import to DB.While inserting each record.I just want to show the details about the record being inserted to the user.(Ex : Client Details of A is adding...)
Try this... Set the output to unbuffered (Response.BufferOutput), and include some javascript in your page that updates the UI as you see appropriate. For example, it might update a SPAN with a percentage complete or the details of the record you are processing. Then in your server code, output <script> tags that call ...
402,483
<p>I currently have a unittest.TestCase that looks like..</p> <pre><code>class test_appletrailer(unittest.TestCase): def setup(self): self.all_trailers = Trailers(res = "720", verbose = True) def test_has_trailers(self): self.failUnless(len(self.all_trailers) &gt; 1) # ..more tests.. </co...
[ { "answer_id": 402492, "author": "cdleary", "author_id": 3594, "author_profile": "https://Stackoverflow.com/users/3594", "pm_score": 5, "selected": true, "text": "<p>How about using a class member that only gets initialized once?</p>\n\n<pre><code>class test_appletrailer(unittest.TestCas...
2008/12/31
[ "https://Stackoverflow.com/questions/402483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
I currently have a unittest.TestCase that looks like.. ``` class test_appletrailer(unittest.TestCase): def setup(self): self.all_trailers = Trailers(res = "720", verbose = True) def test_has_trailers(self): self.failUnless(len(self.all_trailers) > 1) # ..more tests.. ``` This works fine...
How about using a class member that only gets initialized once? ``` class test_appletrailer(unittest.TestCase): all_trailers = None def setup(self): # Only initialize all_trailers once. if self.all_trailers is None: self.__class__.all_trailers = Trailers(res = "720", verbose = Tru...
402,503
<p>I have developed code with Ajax and jQuery. I have got a response from my.php, and I have tried to extract the values of the response. Here the code (HTML):</p> <h3>My.php</h3> <pre><code>?php echo '&lt;div id=&quot;title&quot;&gt;My Title &lt;/div&gt;'; echo '&lt;div id=&quot;message&quot;&gt; My message &l...
[ { "answer_id": 402509, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": -1, "selected": false, "text": "<p>Try using this instead:</p>\n\n<pre><code>var oneval = $(\"#response #title\").text();\nvar subval = $(\"#respons...
2008/12/31
[ "https://Stackoverflow.com/questions/402503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I have developed code with Ajax and jQuery. I have got a response from my.php, and I have tried to extract the values of the response. Here the code (HTML): ### My.php ``` ?php echo '<div id="title">My Title </div>'; echo '<div id="message"> My message </div>'; ?> ``` I try to extract the title and message ...
OK, go to <http://jsbin.com/udige/> and you can see it working. The key is using `.filter`, not .find as the two divs are root elements in the response. My mistake. Basically do the following: ``` success: function(data){ $("#response").html(data); var $response = $(data); var oneval = $response.filter('...
402,504
<p>How do I see the type of a variable? (e.g. unsigned 32 bit)</p>
[ { "answer_id": 402507, "author": "Srikanth", "author_id": 7205, "author_profile": "https://Stackoverflow.com/users/7205", "pm_score": 9, "selected": false, "text": "<p>You may be looking for the <a href=\"https://docs.python.org/3/library/functions.html#type\" rel=\"noreferrer\"><code>ty...
2008/12/31
[ "https://Stackoverflow.com/questions/402504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
How do I see the type of a variable? (e.g. unsigned 32 bit)
Use the [`type()`](https://docs.python.org/library/functions.html#type) builtin function: ``` >>> i = 123 >>> type(i) <type 'int'> >>> type(i) is int True >>> i = 123.456 >>> type(i) <type 'float'> >>> type(i) is float True ``` To check if a variable is of a given type, use [`isinstance`](https://docs.python.org/lib...
402,514
<p>I was reading some Java recently and came across something (an idiom?) new to me: in the program, classes with multiple constructors would also always include a blank constructor. For example: </p> <pre><code>public class Genotype { private boolean bits[]; private int rating; private int length; private Ran...
[ { "answer_id": 402527, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 4, "selected": true, "text": "<p>I am not sure that the code you were reading was high quality (I've reviewed some bioinformatics code in the past and it is ...
2008/12/31
[ "https://Stackoverflow.com/questions/402514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29182/" ]
I was reading some Java recently and came across something (an idiom?) new to me: in the program, classes with multiple constructors would also always include a blank constructor. For example: ``` public class Genotype { private boolean bits[]; private int rating; private int length; private Random random; ...
I am not sure that the code you were reading was high quality (I've reviewed some bioinformatics code in the past and it is unfortunately often not written by professional developers). For example, that third constructor is not a copy constructor and generally there are problems in this code, so I wouldn't "read too mu...
402,522
<p>I use SVN as the source control system, and I wonder how to compare directories while ignoring any metadata differences. Is there a way to tell <code>svn diff</code> to compare only the actual content and ignore any metadata? </p> <p>I mean metadata like SVN properties, etc. that don't affect the file content. Assu...
[ { "answer_id": 402548, "author": "Rob Elsner", "author_id": 50360, "author_profile": "https://Stackoverflow.com/users/50360", "pm_score": -1, "selected": false, "text": "<p>I'm not sure, but a simple 'svn diff | grep -iv \"stuff to ignore\"' would be a workaround.</p>\n" }, { "an...
2008/12/31
[ "https://Stackoverflow.com/questions/402522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50430/" ]
I use SVN as the source control system, and I wonder how to compare directories while ignoring any metadata differences. Is there a way to tell `svn diff` to compare only the actual content and ignore any metadata? I mean metadata like SVN properties, etc. that don't affect the file content. Assume file X has an addi...
There seems to be no way to get this done using the svn built-in tools. How I solved it: Export both trees and diff them diretly on the filesystem using your favourite diff tool. That's somehow the only way to get this done :/
402,536
<p>I'm in the process of porting some ANSI C++ code to C#... and this is killing me right now.</p> <p>Both tests have <code>value = 6844268</code>.</p> <p>Test code:</p> <pre><code>value &gt;&gt; 12 value &amp; 0x00000FFF </code></pre> <p>C++ returns 18273 and 29497, whereas C# returns 1670 and 3948. I've tried eve...
[ { "answer_id": 402543, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 2, "selected": false, "text": "<p>I don't know what C++ is up to, but on my calculator the C# values are correct; is this possibly a sign extension pr...
2008/12/31
[ "https://Stackoverflow.com/questions/402536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40164/" ]
I'm in the process of porting some ANSI C++ code to C#... and this is killing me right now. Both tests have `value = 6844268`. Test code: ``` value >> 12 value & 0x00000FFF ``` C++ returns 18273 and 29497, whereas C# returns 1670 and 3948. I've tried every possible combination of types in C# (int, uint, long, ulon...
Check your C++ definitions for overridden `>>` operator code perhaps? C# is calculating the right values, are you absolutely 100% sure your values are what you say they are? Just to go through the motions: ``` 6844268 = 11010000110111101101100 >> 12 = 11010000110.111101101100 result = 1101...
402,538
<p>I see a lot of code like this:</p> <pre><code>function Base() {} function Sub() {} Sub.prototype = new Base(); </code></pre> <p>However, if you do:</p> <pre><code>s = new Sub(); print(s.constructor == Sub); </code></pre> <p>This is false. This seems confusing to me, since s's constructor is, indeed, Sub. Is it c...
[ { "answer_id": 402768, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 2, "selected": false, "text": "<p>If you want to test whether an object is exactly an instance of Sub use the <code>instanceof</code> operator:-</p...
2008/12/31
[ "https://Stackoverflow.com/questions/402538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
I see a lot of code like this: ``` function Base() {} function Sub() {} Sub.prototype = new Base(); ``` However, if you do: ``` s = new Sub(); print(s.constructor == Sub); ``` This is false. This seems confusing to me, since s's constructor is, indeed, Sub. Is it conventional/better to do this? ``` function Base...
'constructor' doesn't do what it looks like it does. This, in addition to its non-standardness, is a good reason to avoid using it - stick with instanceof and prototype. Technically: 'constructor' is not a property of the 's' instance, it is a property of the 'Sub' prototype object showing through. When you create the...
402,541
<p>How can I have that functionality in my game through which the players can change their hairstyle, look, style of clothes, etc., and so whenever they wear a different item of clothing their avatar is updated with it.</p> <p>Should I:</p> <ul> <li><p>Have my designer create all possible combinations of armor, hairs...
[ { "answer_id": 402554, "author": "mstrobl", "author_id": 25965, "author_profile": "https://Stackoverflow.com/users/25965", "pm_score": 2, "selected": true, "text": "<p>3D will not be necessary for this, but the painter algorithm that is common in the 3D world might IMHO save you some wor...
2008/12/31
[ "https://Stackoverflow.com/questions/402541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49153/" ]
How can I have that functionality in my game through which the players can change their hairstyle, look, style of clothes, etc., and so whenever they wear a different item of clothing their avatar is updated with it. Should I: * Have my designer create all possible combinations of armor, hairstyles, and faces as spri...
3D will not be necessary for this, but the painter algorithm that is common in the 3D world might IMHO save you some work: The painter algorithm works by drawing the most distant objects first, then overdrawing with objects closer to the camera. In your case, it would boild down to generating the buffer for your sprit...
402,605
<p>In an ASP.NET MVC view I'd like to include a link of the form:</p> <pre><code>&lt;a href="blah"&gt;Link text &lt;span&gt;with further descriptive text&lt;/span&gt;&lt;/a&gt; </code></pre> <p>Trying to include the <code>&lt;span&gt;</code> element in the <code>linkText</code> field of a call to <code>Html.ActionLin...
[ { "answer_id": 402782, "author": "Casper", "author_id": 18729, "author_profile": "https://Stackoverflow.com/users/18729", "pm_score": 7, "selected": true, "text": "<p>You could use Url.Action to build the link for you:</p>\n\n<pre><code>&lt;a href=\"&lt;% =Url.Action(\"Action\", \"Contro...
2008/12/31
[ "https://Stackoverflow.com/questions/402605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50136/" ]
In an ASP.NET MVC view I'd like to include a link of the form: ``` <a href="blah">Link text <span>with further descriptive text</span></a> ``` Trying to include the `<span>` element in the `linkText` field of a call to `Html.ActionLink()` ends up with it being encoded (as would be expected). Are there any recommend...
You could use Url.Action to build the link for you: ``` <a href="<% =Url.Action("Action", "Controller")%>">link text <span>with further blablah</span></a> ``` or use Html.BuildUrlFromExpression: ``` <a href="<% =Html.BuildUrlFromExpression<Controller>(c => c.Action()) %>">text <span>text</span></a> ```
402,615
<p>This is a idea for a security. Our employees shall have access to some commands on a linux server but not all. They shall e.g. have the possibility to access a log file (<code>less logfile</code>) or start different commands (<code>shutdown.sh</code> / <code>run.sh</code>).</p> <p>Background information:</p> <p>Al...
[ { "answer_id": 402638, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": false, "text": "<p>What you are looking for is called <a href=\"http://google.com/search?q=restricted+shell+linux\" rel=\"noreferrer...
2008/12/31
[ "https://Stackoverflow.com/questions/402615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2554/" ]
This is a idea for a security. Our employees shall have access to some commands on a linux server but not all. They shall e.g. have the possibility to access a log file (`less logfile`) or start different commands (`shutdown.sh` / `run.sh`). Background information: All employees access the server with the same user n...
You can also restrict keys to permissible commands (in the authorized\_keys file). I.e. the user would not log in via ssh and then have a restricted set of commands but rather would only be allowed to execute those commands via ssh (e.g. "ssh somehost bin/showlogfile")
402,616
<p>Given this field:</p> <pre><code>char lookup_ext[8192] = {0}; // Gets filled later </code></pre> <p>And this statement:</p> <pre><code>unsigned short *slt = (unsigned short*) lookup_ext; </code></pre> <p>What happens behind the scenes?</p> <p>lookup_ext[1669] returns 67 = 0100 0011 (C), lookup_ext[1670] returns...
[ { "answer_id": 402622, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 2, "selected": false, "text": "<p>If I understand correctly, the type conversion will be converting a char array of size 8192 to a short int array of...
2008/12/31
[ "https://Stackoverflow.com/questions/402616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40164/" ]
Given this field: ``` char lookup_ext[8192] = {0}; // Gets filled later ``` And this statement: ``` unsigned short *slt = (unsigned short*) lookup_ext; ``` What happens behind the scenes? lookup\_ext[1669] returns 67 = 0100 0011 (C), lookup\_ext[1670] returns 78 = 0100 1110 (N) and lookup\_ext[1671] returns 68 =...
The statement that you show doesn't cast a char to an unsigned short, it casts a *pointer* to a char to a *pointer* to an unsigned short. This means that the usual arithmetic conversions of the pointed-to-data are not going to happen and that the underlying char data will just be interpreted as unsigned shorts when acc...
402,648
<p>I actually have two questions regarding the same problem but I think it is better to separate them since I don't think they are related.</p> <p>Background: I am writing a Windows Mobile software in VB.NET which among its tasks needs to connect to a mail-server for sending and retrieving e-mails. As a result, I als...
[ { "answer_id": 402661, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 4, "selected": true, "text": "<p>CF .NET requires you to use the signature: Encoding.GetString Method (array[], Int32 index, Int32 count) so try usi...
2008/12/31
[ "https://Stackoverflow.com/questions/402648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45402/" ]
I actually have two questions regarding the same problem but I think it is better to separate them since I don't think they are related. Background: I am writing a Windows Mobile software in VB.NET which among its tasks needs to connect to a mail-server for sending and retrieving e-mails. As a result, I also need a M...
CF .NET requires you to use the signature: Encoding.GetString Method (array[], Int32 index, Int32 count) so try using: ``` ...GetString(b, 0, b.Length); ```
402,651
<p>I am sending messages in JSON format to an ActiveMQ server. I am trying to use JMS Transformation to transform the JSON encoded object into a true Java Object in hopes of being able to use selectors on the data inside.</p> <p><a href="http://activemq.apache.org/stomp.html#Stomp-Messagetransformations" rel="noreferr...
[ { "answer_id": 402821, "author": "Phillip Whelan", "author_id": 25305, "author_profile": "https://Stackoverflow.com/users/25305", "pm_score": 3, "selected": false, "text": "<p>The only format accepted by the transformation jms-map-json or jms-object-json is a simple Map format, which in ...
2008/12/31
[ "https://Stackoverflow.com/questions/402651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25305/" ]
I am sending messages in JSON format to an ActiveMQ server. I am trying to use JMS Transformation to transform the JSON encoded object into a true Java Object in hopes of being able to use selectors on the data inside. [Here](http://activemq.apache.org/stomp.html#Stomp-Messagetransformations) is a link to the document...
you can use any JSON notation for your jms-object-json transformations as long as XStream can handle it. You can take a look at test cases for some examples. There, we use SamplePojo class: <https://svn.apache.org/repos/asf/activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/SamplePojo.java...
402,674
<p>I'm trying to generate random permutations of an 80-character fixed string in C. Much to my dismay, the system I'm working on lacks strfry(). What's the best way for me to generate a random permutation of this string? Since this will be looped over approx. 100,000 times, performance is an issue.</p>
[ { "answer_id": 402676, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": true, "text": "<p>Just use the Open Source GLIBC implementation, as found by <a href=\"http://www.google.com/codesearch/p?hl=en#WbTnQ...
2008/12/31
[ "https://Stackoverflow.com/questions/402674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50023/" ]
I'm trying to generate random permutations of an 80-character fixed string in C. Much to my dismay, the system I'm working on lacks strfry(). What's the best way for me to generate a random permutation of this string? Since this will be looped over approx. 100,000 times, performance is an issue.
Just use the Open Source GLIBC implementation, as found by [Google Code](http://www.google.com/codesearch/p?hl=en#WbTnQ5DcqbM/glibc-2.1.3/string/strfry.c&q=strfry). ``` char * strfry (char *string) { static int init; static struct random_data rdata; size_t len, i; if (!init) { static int state[8] = ...
402,679
<p>I’ve run into a limitation in the cURL bindings for PHP. It appears there is no easy way to send the same multiple values for the same key for postfields. Most of the workarounds I have come across for this have involved creating the URL encoded post fields by hand tag=foo&amp;tag=bar&amp;tag=baz) instead of using t...
[ { "answer_id": 402743, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 2, "selected": false, "text": "<p>If you use <code>tag[]</code> rather than <code>tag</code> for the name, <a href=\"http://www.php.net/manual/en/faq.ht...
2008/12/31
[ "https://Stackoverflow.com/questions/402679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50453/" ]
I’ve run into a limitation in the cURL bindings for PHP. It appears there is no easy way to send the same multiple values for the same key for postfields. Most of the workarounds I have come across for this have involved creating the URL encoded post fields by hand tag=foo&tag=bar&tag=baz) instead of using the associat...
I ended up writing my own function to build a custom CURLOPT\_POSTFIELDS string with multipart/form-data. What a pain. ``` function curl_setopt_custom_postfields($ch, $postfields, $headers = null) { // $postfields is an assoc array. // Creates a boundary. // Reads each postfields, detects which are @files,...
402,683
<p>I get a jar file url at runtime as:</p> <pre><code>jar:file:///C:/proj/parser/jar/parser.jar!/test.xml </code></pre> <p>How can this be converted to a valid path as:</p> <pre><code>C:/proj/parser/jar/parser.jar. </code></pre> <p>I have already tried using <code>File(URI)</code>, <code>getPath()</code>, <code>get...
[ { "answer_id": 402753, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 2, "selected": false, "text": "<p>Not sure of any exact method that will give you what you want, but this should get you close:</p>\n\n<pre><code>import st...
2008/12/31
[ "https://Stackoverflow.com/questions/402683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I get a jar file url at runtime as: ``` jar:file:///C:/proj/parser/jar/parser.jar!/test.xml ``` How can this be converted to a valid path as: ``` C:/proj/parser/jar/parser.jar. ``` I have already tried using `File(URI)`, `getPath()`, `getFile()` in vain.
This might do it, if MS-Windows is not offended by a leading slash: ``` final URL jarUrl = new URL("jar:file:/C:/proj/parser/jar/parser.jar!/test.xml"); final JarURLConnection connection = (JarURLConnection) jarUrl.openConnection(); final URL url = connection.getJarFileURL(); System.ou...
402,736
<p>I see that Button object has a IsMouseOVer property.</p> <p>But how do create an effect for the mouse over of a grid or other element that does not have IsMouseOver??</p> <p>Thanks Malcolm</p> <p>Edit: i figured it out. I was using the wrong method for setting the trigger.</p>
[ { "answer_id": 4728875, "author": "CodeMouse92", "author_id": 472647, "author_profile": "https://Stackoverflow.com/users/472647", "pm_score": 0, "selected": false, "text": "<p>That would be the \"MouseEnter\" and \"MouseLeave\" actions on the WPF object.</p>\n" }, { "answer_id": ...
2008/12/31
[ "https://Stackoverflow.com/questions/402736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40568/" ]
I see that Button object has a IsMouseOVer property. But how do create an effect for the mouse over of a grid or other element that does not have IsMouseOver?? Thanks Malcolm Edit: i figured it out. I was using the wrong method for setting the trigger.
I realize that I am responding to a dead thread but since I came across it, and since the thread is not answered, I am going to answer it. The [WPF Grid](http://msdn.microsoft.com/en-us/library/system.windows.controls.grid.aspx) has an "IsMouseOver" property. I think this question was asked because the "IsMouseOver" ...
402,763
<p>Advance New Year Wishes to All.</p> <p>I have an error log file with the contents in a pattern parameter, result and stderr (stderr can be in multiple lines).</p> <pre><code>$cat error_log &lt;parameter&gt;:test_tot_count &lt;result&gt;:1 &lt;stderr&gt;:Expected "test_tot_count=2" and the actual value is 3 test_t...
[ { "answer_id": 402794, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 1, "selected": false, "text": "<p>Looks nice. =) An improvement is probably to anchor those tags at the beginning of the line:</p>\n\n<pre><code>if (/^&lt;pa...
2008/12/31
[ "https://Stackoverflow.com/questions/402763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18657/" ]
Advance New Year Wishes to All. I have an error log file with the contents in a pattern parameter, result and stderr (stderr can be in multiple lines). ``` $cat error_log <parameter>:test_tot_count <result>:1 <stderr>:Expected "test_tot_count=2" and the actual value is 3 test_tot_count = 3 <parameter>:test_one_count...
If you're using Perl 5.10, you can do something very similar to what you have now but with a much nicer layout by using the given/when structure: ``` use 5.010; while (<ERR_LOG>) { chomp; given ($_) { when ( m{^<parameter>: (.*)}x ) { push @parameter, $1 } when ( m{^<result>: (.*)}x ) ...
402,785
<p>we've got a list of search-result mappings, e.g. a simple url mapping might look like</p> <p>"stackoverflow" -> "www.stackoverflow.com" "joel" -> "www.joelonsoftware.com"</p> <p>so searching for the exact phrases is working fine. </p> <p>Now we're looking for an incremental search / typeahead, e.g. "stackover" wo...
[ { "answer_id": 402806, "author": "martinus", "author_id": 48181, "author_profile": "https://Stackoverflow.com/users/48181", "pm_score": 3, "selected": false, "text": "<p><strong>Simplest solution: Search in a List</strong></p>\n\n<p>You can also search on the fly, for example like this:<...
2008/12/31
[ "https://Stackoverflow.com/questions/402785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
we've got a list of search-result mappings, e.g. a simple url mapping might look like "stackoverflow" -> "www.stackoverflow.com" "joel" -> "www.joelonsoftware.com" so searching for the exact phrases is working fine. Now we're looking for an incremental search / typeahead, e.g. "stackover" would also return "www.sta...
**Simplest solution: Search in a List** You can also search on the fly, for example like this: ``` List<String> urls = Arrays.asList("this", "is", "a", "test"); // search for "is" List<String> reduced = new ArrayList<String>(); String searchWord = "is"; for (String s : urls) { if (s.contains(searchWord)) { ...
402,792
<p>is there an easy away to combine fields in awk? Specifically, I have lines like this:</p> <pre><code>1,2,some text 3,4,some text, but it has commas in it, annoyingly </code></pre> <p>I want to extract the two numbers as the first two fields, but then I want all of the text (commas and all) to be the third field. I...
[ { "answer_id": 402829, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 0, "selected": false, "text": "<p>You could use sed to do it.</p>\n\n<pre><code>cat file.txt | sed 's/\\(.?*\\),\\(.?*\\),/\\1|\\2|/'\n</code></pre>\...
2008/12/31
[ "https://Stackoverflow.com/questions/402792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
is there an easy away to combine fields in awk? Specifically, I have lines like this: ``` 1,2,some text 3,4,some text, but it has commas in it, annoyingly ``` I want to extract the two numbers as the first two fields, but then I want all of the text (commas and all) to be the third field. Is there a way to do that? ...
Maybe: ``` awk '{for (i=0;i<2;i++) sub(",", "|", $0); print}' file.txt ```
402,841
<p>I have set up a <a href="http://en.wikipedia.org/wiki/Django_%28web_framework%29" rel="noreferrer">Django</a> application that uses images. I think I have set up the media settings MEDIA_ROOT and MEDIA_URL correctly. However the images don't show up. Do you know what can be the problem?</p> <p>Let consider this exa...
[ { "answer_id": 402863, "author": "friol", "author_id": 23034, "author_profile": "https://Stackoverflow.com/users/23034", "pm_score": 5, "selected": true, "text": "<p>Serving static content from Django is <strong>discouraged</strong> from the developer themselves (if I'm not wrong, it onl...
2008/12/31
[ "https://Stackoverflow.com/questions/402841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1692070/" ]
I have set up a [Django](http://en.wikipedia.org/wiki/Django_%28web_framework%29) application that uses images. I think I have set up the media settings MEDIA\_ROOT and MEDIA\_URL correctly. However the images don't show up. Do you know what can be the problem? Let consider this example: The image files are under **/...
Serving static content from Django is **discouraged** from the developer themselves (if I'm not wrong, it only works when in debug mode). You should use a dedicated web server, instead. If you really need to do that, anyway, read the documentation on [how to serve static files](http://docs.djangoproject.com/en/dev/how...
402,846
<p>In a particular page i have a ascx control which contains a table.</p> <p>Now I want to set this control visible/invisible but the visible method is not detected by the intellisense.</p> <p>The only methods are 1)Equals and 2) ReferenceEquals</p> <p>Main Page</p> <pre><code>&lt;VPM:VotingPolls Runat="server"&gt;...
[ { "answer_id": 402852, "author": "Peanut", "author_id": 47036, "author_profile": "https://Stackoverflow.com/users/47036", "pm_score": 0, "selected": false, "text": "<p>Sometimes intellisense doesn't display available attributes. But the visible attribute will be available. So just type v...
2008/12/31
[ "https://Stackoverflow.com/questions/402846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
In a particular page i have a ascx control which contains a table. Now I want to set this control visible/invisible but the visible method is not detected by the intellisense. The only methods are 1)Equals and 2) ReferenceEquals Main Page ``` <VPM:VotingPolls Runat="server"></VPM:VotingPolls> ``` Thanks
Thanks it has been solved The problem was that no id was set. ``` <VPM:VotingPolls ID="VPS" Runat="server"></VPM:VotingPolls> ``` then ``` VPS.Visible=True/False ```
402,909
<p>I'm using asp.net mvc and I'm trying to create a new Employee, in my form I use the Html.DropDown(...) to display a list of Departments to select from. </p> <p>Ideally I would like MVC to just figure out which Department was selected (Id property is the value in dropdown), fetch it and set it in the incoming Employ...
[ { "answer_id": 634606, "author": "Mauricio Scheffer", "author_id": 21239, "author_profile": "https://Stackoverflow.com/users/21239", "pm_score": 0, "selected": false, "text": "<p>I <a href=\"http://bugsquash.blogspot.com/2009/02/arfetch-for-aspnet-mvc.html\" rel=\"nofollow noreferrer\">p...
2008/12/31
[ "https://Stackoverflow.com/questions/402909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36465/" ]
I'm using asp.net mvc and I'm trying to create a new Employee, in my form I use the Html.DropDown(...) to display a list of Departments to select from. Ideally I would like MVC to just figure out which Department was selected (Id property is the value in dropdown), fetch it and set it in the incoming Employee object....
ASP.NET MVC does not know how to translate the DepartmentId form value to a Department.Load(DepartmentId) call. To do this you need to implement a binder for your model. ``` [ActiveRecord("Employees")] [ModelBinder(EmployeeBinder] public class Employee : ActiveRecordBase<Employee> { [PrimaryKey] public int Emp...
402,917
<p>I'd like to map the following sql in NHibernate. Will I need to make a separate entity object i.e RoomTypeVO mapped to tb_tags to do this? Any help much appreciated.</p> <p>SELECT dbo.tb_rooms.id, dbo.tb_rooms.name, dbo.tb_tags.name AS 'roomType' FROM dbo.tb_rooms INNER JOIN dbo.tb_tags ON (dbo.tb_rooms...
[ { "answer_id": 403442, "author": "Arthur Thomas", "author_id": 14009, "author_profile": "https://Stackoverflow.com/users/14009", "pm_score": 2, "selected": true, "text": "<p>If you to a straight sql query you do not have to. If you want to use HQL you will have to work with an entity.</...
2008/12/31
[ "https://Stackoverflow.com/questions/402917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17510/" ]
I'd like to map the following sql in NHibernate. Will I need to make a separate entity object i.e RoomTypeVO mapped to tb\_tags to do this? Any help much appreciated. SELECT dbo.tb\_rooms.id, dbo.tb\_rooms.name, dbo.tb\_tags.name AS 'roomType' FROM dbo.tb\_rooms INNER JOIN dbo.tb\_tags ON (dbo.tb\_rooms.typeID ...
If you to a straight sql query you do not have to. If you want to use HQL you will have to work with an entity. But, you can always do sql queries directly. If you have a mapped entity then you could probably just do something like this: ``` FROM RoomType ```
402,964
<p>Is there a good tool to generate change reports from Subversion logs. </p> <p>We have big team and many commits every day. I'm looking for some tool to show changes in all files. We are using Subversion, so I'm looking some tool that can read Subversion logs.</p>
[ { "answer_id": 402972, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>one word: trac.\ntrac.edgewall.org</p>\n" }, { "answer_id": 403029, "author": "Stefan", "author_id": 48003,...
2008/12/31
[ "https://Stackoverflow.com/questions/402964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there a good tool to generate change reports from Subversion logs. We have big team and many commits every day. I'm looking for some tool to show changes in all files. We are using Subversion, so I'm looking some tool that can read Subversion logs.
svn2cl generates nice html pages from an svn log <http://ch.tudelft.nl/~arthur/svn2cl/> To create a html page instead of the default text output, run ``` svn log --xml -v > log.xml xsltproc.exe --nowrite --nomkdir --nonet -o changelog.html svn2html.xsl log.xml ```
402,980
<p>I'd like to use a single SQL query (in MySQL) to find the record which comes after one that I specify.</p> <p>I.e., if the table has:</p> <pre><code>id, fruit -- ----- 1 apples 2 pears 3 oranges </code></pre> <p>I'd like to be able to do a query like:</p> <pre><code>SELECT * FROM table where previous_reco...
[ { "answer_id": 402985, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 6, "selected": true, "text": "<p>After the question's edit and the simplification below, we can change it to</p>\n\n<pre><code>SELECT id FROM table...
2008/12/31
[ "https://Stackoverflow.com/questions/402980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I'd like to use a single SQL query (in MySQL) to find the record which comes after one that I specify. I.e., if the table has: ``` id, fruit -- ----- 1 apples 2 pears 3 oranges ``` I'd like to be able to do a query like: ``` SELECT * FROM table where previous_record has id=1 order by id; ``` (clearly that...
After the question's edit and the simplification below, we can change it to ``` SELECT id FROM table WHERE fruit > 'apples' ORDER BY fruit LIMIT 1 ```
402,992
<p>i want to do this simple piece of code work.</p> <pre><code>#include &lt;iostream&gt; #include &lt;windows.h&gt; void printSome (int i) { std::cout &lt;&lt; i &lt;&lt; std::endl; } void spawnThread (void (*threadName)(int i)) { CreateThread ( 0, ...
[ { "answer_id": 403007, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 1, "selected": false, "text": "<p>You can read how you do that here: <a href=\"http://www.newty.de/fpt/fpt.html\" rel=\"nofollow noreferrer\">http:/...
2008/12/31
[ "https://Stackoverflow.com/questions/402992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28954/" ]
i want to do this simple piece of code work. ``` #include <iostream> #include <windows.h> void printSome (int i) { std::cout << i << std::endl; } void spawnThread (void (*threadName)(int i)) { CreateThread ( 0, // default security attributes ...
Personally, I wouldn't consider passing in a function pointer like you are trying to do as very C++ like. That's coding C in C++ Instead, I'd wrap that thing in a class. The big advantage there is you can just override the class to have however many members you want, rather than having to perform greazy casting tricks...
402,996
<p>I am having trouble deserializing my JSON string. I have a class of type <code>person</code> with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ...
[ { "answer_id": 403377, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 5, "selected": false, "text": "<p>Could you show the JSON string you are trying to deserialize and the way you are using the <a href=\"http://www....
2008/12/31
[ "https://Stackoverflow.com/questions/402996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16891/" ]
I am having trouble deserializing my JSON string. I have a class of type `person` with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ASP.NET says som...
Could you show the JSON string you are trying to deserialize and the way you are using the [Deserialize](http://www.asp.net/Ajax/documentation/live/mref/M_System_Web_Script_Serialization_JavaScriptSerializer_Deserialize%60%601_1_72eac341.aspx) method? The following works fine: ``` using System; using System.Collection...
403,031
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1501577/change-css-dynamically">Change CSS Dynamically</a> </p> </blockquote> <p>I need to change the height of a div container(CSS Property Height) from ASP.NET code (VB).</p> <p>How can I do that?</p>
[ { "answer_id": 403036, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 6, "selected": true, "text": "<p>C#, because I don't want to typo the VB syntax.</p>\n\n<p>Markup:</p>\n\n<blockquote>\n<pre><code>&lt;div runat=\"serve...
2008/12/31
[ "https://Stackoverflow.com/questions/403031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
> > **Possible Duplicate:** > > [Change CSS Dynamically](https://stackoverflow.com/questions/1501577/change-css-dynamically) > > > I need to change the height of a div container(CSS Property Height) from ASP.NET code (VB). How can I do that?
C#, because I don't want to typo the VB syntax. Markup: > > > ``` > <div runat="server" id="divControl">...</div> > > ``` > > Class of the Page: > > > ``` > protected System.Web.UI.HtmlControls.HtmlGenericControl divControl; > > ``` > > OnLoad/Other function: > > > ``` > divControl.Style.Add("height",...
403,058
<p>Say you have these two methods: </p> <p>Number 1:</p> <pre><code>void AddPerson(Person person) { // Validate person if(person.Name != null &amp;&amp; IsValidDate(person.BirthDate) DB.AddPersonToDatabase(person); } </code></pre> <p>Number 2:</p> <pre><code>void AddPerson(string name, DateTime birthDate) {...
[ { "answer_id": 403069, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 2, "selected": false, "text": "<p>The first one has the advantage of allowing you to change the Person definition without breaking existing code, on...
2008/12/31
[ "https://Stackoverflow.com/questions/403058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29519/" ]
Say you have these two methods: Number 1: ``` void AddPerson(Person person) { // Validate person if(person.Name != null && IsValidDate(person.BirthDate) DB.AddPersonToDatabase(person); } ``` Number 2: ``` void AddPerson(string name, DateTime birthDate) { Person p = new Person(name, birthDate); DB.AddP...
The first shouldn't have to validate person.Name and person.BirthDate - they should be validated automatically by the `Person` constructor. In other words, if you're passed a Person, you should know that it's valid. On the other hand, you'd have to check that `person` isn't a null reference. It's sometimes worth havi...
403,112
<p>I have the following example class:</p> <p>Test.h:</p> <pre><code>@interface Test : UIButton { NSString *value; } - (id)initWithValue:(NSString *)newValue; @property(copy) NSString *value; </code></pre> <p>Test.m:</p> <pre><code>@implementation Test @synthesize value; - (id)initWithValue:(NSString *)newValue...
[ { "answer_id": 403169, "author": "Stefan Tannenbaum", "author_id": 50511, "author_profile": "https://Stackoverflow.com/users/50511", "pm_score": 4, "selected": false, "text": "<p>You are passing in a literal string. The compiler probably allocates it in static memory and sets the retain ...
2008/12/31
[ "https://Stackoverflow.com/questions/403112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following example class: Test.h: ``` @interface Test : UIButton { NSString *value; } - (id)initWithValue:(NSString *)newValue; @property(copy) NSString *value; ``` Test.m: ``` @implementation Test @synthesize value; - (id)initWithValue:(NSString *)newValue { [super init]; NSLog(@"before n...
You've got a reference to an immutable string. Assignment doesn't need to copy the value (the string data) since it's immutable. If you do a mutable operation, like value = [newValue uppercaseString] then it should copy the bits into value, and value's retain count incremented.
403,138
<p>I have a small tabbed navigation setup using CSS. When hovering over the tabs the colour changes, great. However when i click a tab and it navigates to the corresponding page, i would like that tab (the active tab?) to remain highlighted, indicating the current page.</p> <p>I am currently doing this by using a clas...
[ { "answer_id": 403160, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 4, "selected": true, "text": "<p>What you are doing is correct. The <a href=\"http://www.w3.org/TR/CSS2/selector.html#dynamic-pseudo-classes\" rel=...
2008/12/31
[ "https://Stackoverflow.com/questions/403138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50057/" ]
I have a small tabbed navigation setup using CSS. When hovering over the tabs the colour changes, great. However when i click a tab and it navigates to the corresponding page, i would like that tab (the active tab?) to remain highlighted, indicating the current page. I am currently doing this by using a class (.curren...
What you are doing is correct. The [:active](http://www.w3.org/TR/CSS2/selector.html#dynamic-pseudo-classes) pseudo selector means something else - the event of activating a control (ie, the time between a user presses the mouse button and releases it). Using a class to signify the selected item is the way to go.
403,165
<p>For some reason, onreadystatechange call back function is not being called in asynchronous mode. I tested the post in synchronous mode and confirmed that post itself is working fine (commented out testing code I used to check post in synchronous mode). The problem occurs both in safari and firefox latest version. Ca...
[ { "answer_id": 403231, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Correct me if I'm wrong, but for POST don't you need to do a setRequestHeader for Content-Length like so;</p>\n\n<pre><code...
2008/12/31
[ "https://Stackoverflow.com/questions/403165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50510/" ]
For some reason, onreadystatechange call back function is not being called in asynchronous mode. I tested the post in synchronous mode and confirmed that post itself is working fine (commented out testing code I used to check post in synchronous mode). The problem occurs both in safari and firefox latest version. Can s...
you have an error in the onreadystatechange function: ``` alert("entered call back function. readstate value is: "+xmlHttpreadyState+". Response Text is: "+xmlHttp.responseText); ``` `xmlHttpreadyState` should be `xmlHttp.readyState` After I fixed that, it worked for me in FF3
403,202
<p>I need to show a screen or something, saying 'Loading' or whatever while long process are working.</p> <p>I am creating a application with the Windows Media Encoder SDK and it takes awhile to initialize the encoder. I would like for a screen to pop up saying 'Loading' while it is starting the encoder, and then for...
[ { "answer_id": 403224, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 0, "selected": false, "text": "<p>There are many ways you could do this. The most simple might be to show a modal dialog, then kick off the othe...
2008/12/31
[ "https://Stackoverflow.com/questions/403202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48654/" ]
I need to show a screen or something, saying 'Loading' or whatever while long process are working. I am creating a application with the Windows Media Encoder SDK and it takes awhile to initialize the encoder. I would like for a screen to pop up saying 'Loading' while it is starting the encoder, and then for it to disa...
Create a Form that will serve as the "Loading" dialog. When you're ready to initialize the encoder, display this form using the `ShowDialog()` method. This causes it to stop the user from interacting with the form that is showing the loading dialog. The loading dialog should be coded in such a way that when it loads, ...
403,215
<p>I have code that looks like:</p> <pre><code> //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false); } catch (IndexOutOfRangeException) { } //swallow </code></pre> <p>I don't know if the consolidated column will be present in th...
[ { "answer_id": 403234, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 3, "selected": true, "text": "<p>Yes, you can use the GetSchemaTable() method of the datareader to get a list of columns, then you can see if tha...
2008/12/31
[ "https://Stackoverflow.com/questions/403215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
I have code that looks like: ``` //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false); } catch (IndexOutOfRangeException) { } //swallow ``` I don't know if the consolidated column will be present in the datareader, so I do that...
Yes, you can use the GetSchemaTable() method of the datareader to get a list of columns, then you can see if that column exists. You might find [this very similar question](https://stackoverflow.com/questions/373230/check-for-column-name-in-a-sqldatareader-object) helpful.
403,218
<hr> <h2>The Question</h2> <p>My question is: <strong>Does C# nativly support late-binding IDispatch?</strong></p> <hr> <p><em>Pretend</em> i'm trying to automate Office, while being compatible with whatever version the customer has installed. </p> <p>In the .NET world if you developed with Office 2000 installed, ...
[ { "answer_id": 403226, "author": "configurator", "author_id": 9536, "author_profile": "https://Stackoverflow.com/users/9536", "pm_score": 3, "selected": false, "text": "<p>C# 4's <code>dynamic</code> keyword supports IDispatch and late binding. You can read Sam Ng's <a href=\"http://blog...
2008/12/31
[ "https://Stackoverflow.com/questions/403218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
--- The Question ------------ My question is: **Does C# nativly support late-binding IDispatch?** --- *Pretend* i'm trying to automate Office, while being compatible with whatever version the customer has installed. In the .NET world if you developed with Office 2000 installed, every developer, and every customer...
You can, relativly, use late-binding IDispatch binding in C#. <http://support.microsoft.com/kb/302902> Here's some sample for using Excel. This way you don't need to add a needless dependancy on Microsoft's bloaty PIA: ``` //Create XL Object xl = Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application"));...
403,239
<p>I want to move a file with Ruby. How do I do that?</p>
[ { "answer_id": 403246, "author": "Željko Filipin", "author_id": 17469, "author_profile": "https://Stackoverflow.com/users/17469", "pm_score": 4, "selected": false, "text": "<p><a href=\"http://www.ruby-doc.org/stdlib-1.9.3/libdoc/fileutils/rdoc/FileUtils.html#method-c-mv\" rel=\"nofollow...
2008/12/31
[ "https://Stackoverflow.com/questions/403239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17469/" ]
I want to move a file with Ruby. How do I do that?
You can use FileUtils to do this. ``` #!/usr/bin/env ruby require 'fileutils' FileUtils.mv('/tmp/your_file', '/opt/new/location/your_file') ``` Remember; if you are moving across partitions, "mv" will copy the file to new destination and unlink the source path.
403,256
<p>I'm trying to access an XML file within a jar file, from a separate jar that's running as a desktop application. I can get the URL to the file I need, but when I pass that to a FileReader (as a String) I get a FileNotFoundException saying "The file name, directory name, or volume label syntax is incorrect."</p> <p...
[ { "answer_id": 403271, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 3, "selected": false, "text": "<p>You don't say if this is a desktop or web app. I would use the <code>getResourceAsStream()</code> method from an appro...
2008/12/31
[ "https://Stackoverflow.com/questions/403256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
I'm trying to access an XML file within a jar file, from a separate jar that's running as a desktop application. I can get the URL to the file I need, but when I pass that to a FileReader (as a String) I get a FileNotFoundException saying "The file name, directory name, or volume label syntax is incorrect." As a point...
The problem was that I was going a step too far in calling the parse method of XMLReader. The parse method accepts an InputSource, so there was no reason to even use a FileReader. Changing the last line of the code above to ``` xr.parse( new InputSource( filename )); ``` works just fine.
403,279
<p>I am not an experimented user of SCM tools, even though I am convinced of their usefulness, of course. I used some obscure commercial tool in a former job, Perforce in the current one, and played a bit with TortoiseSVN for my little personal projects, but I disliked having lot of .svn folders all over the place, mak...
[ { "answer_id": 403593, "author": "Ali Afshar", "author_id": 28380, "author_profile": "https://Stackoverflow.com/users/28380", "pm_score": 1, "selected": false, "text": "<p>Question 1:</p>\n\n<p><a href=\"http://pida.co.uk/\" rel=\"nofollow noreferrer\">PIDA IDE</a> has pretty good Mercur...
2008/12/31
[ "https://Stackoverflow.com/questions/403279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15459/" ]
I am not an experimented user of SCM tools, even though I am convinced of their usefulness, of course. I used some obscure commercial tool in a former job, Perforce in the current one, and played a bit with TortoiseSVN for my little personal projects, but I disliked having lot of .svn folders all over the place, making...
PhiLo: I'm new at this, but mercurial also has "internal branches" that you can use within a single repository instead of cloning it. Instead of ``` hg clone toto toto-bug-434 ``` you can do ``` cd toto hg branch bug-434 hg update bug-434 ... hg commit hg update default ``` to create a branch and switch back and...
403,291
<p>I have a table, with 2 important columns DocEntry, WebId</p> <p>Sample data is like</p> <pre><code>DocEntry WebId 1 S001 2 S002 3 S003 4 S005 </code></pre> <p>Now as we can notice here, in column WebId, S004 is missing. How can we locate such missing numbers, with a query.</p> <p...
[ { "answer_id": 403308, "author": "Brian", "author_id": 16457, "author_profile": "https://Stackoverflow.com/users/16457", "pm_score": 0, "selected": false, "text": "<p>You need to define what you mean by \"missing\". You can't expect your database server to understand this abstract conce...
2008/12/31
[ "https://Stackoverflow.com/questions/403291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49372/" ]
I have a table, with 2 important columns DocEntry, WebId Sample data is like ``` DocEntry WebId 1 S001 2 S002 3 S003 4 S005 ``` Now as we can notice here, in column WebId, S004 is missing. How can we locate such missing numbers, with a query. Further explanation: The web id should...
A very simple approach :) ``` mysql> select * from test; +----------+-------+ | DocEntry | WebId | +----------+-------+ | 1 | S001 | | 2 | S002 | | 3 | S003 | | 4 | S005 | | 5 | S006 | | 6 | S007 | | 7 | S008 | | 8 | S010 | +----------+-------+ 8 rows in ...
403,336
<p>I have: "image" 1:Many "imageToTag" Many:1 "tag"</p> <p>I want to issue a query that will return all images that have <em>at least</em> tags [a, b, c]. It's not clear to me how one can model this in JPQL. I could build the query string dynamically but that's bad for performance and security reasons. Any ideas?</p>
[ { "answer_id": 504243, "author": "Noah", "author_id": 12113, "author_profile": "https://Stackoverflow.com/users/12113", "pm_score": 3, "selected": true, "text": "<p>In <strong>PSEUDO CODE:</strong></p>\n\n<pre><code>SELECT * FROM IMAGES \n INNER JOIN IMAGETAGS A\n ON IMAGE.ID = A.IMA...
2008/12/31
[ "https://Stackoverflow.com/questions/403336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14731/" ]
I have: "image" 1:Many "imageToTag" Many:1 "tag" I want to issue a query that will return all images that have *at least* tags [a, b, c]. It's not clear to me how one can model this in JPQL. I could build the query string dynamically but that's bad for performance and security reasons. Any ideas?
In **PSEUDO CODE:** ``` SELECT * FROM IMAGES INNER JOIN IMAGETAGS A ON IMAGE.ID = A.IMAGEID AND A.TAGID = 'A' INNER JOIN IMAGETAGS B ON IMAGE.ID = B.IMAGEID AND B.TAGID = 'B' INNER JOIN IMAGETAGS C ON IMAGE.ID = C.IMAGEID AND C.TAGID = 'C' ``` Just guessing, but the equivalent in JPQL would be ``...
403,338
<p>When I add a reference to Office COM Library, I to go:</p> <ul> <li>References </li> <li>Add Reference </li> <li>Select the <strong>COM tab</strong> </li> <li>Select <strong>Microsoft Office 12.0 Object Library</strong> </li> </ul> <p>And magically named reference appears:</p> <p>Microsoft.Office.Core</p> <p>The...
[ { "answer_id": 403352, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 3, "selected": false, "text": "<p>Abstract your code so that ALL of the code that touches Office is in a separate project. Then you can have two pr...
2008/12/31
[ "https://Stackoverflow.com/questions/403338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
When I add a reference to Office COM Library, I to go: * References * Add Reference * Select the **COM tab** * Select **Microsoft Office 12.0 Object Library** And magically named reference appears: Microsoft.Office.Core The **Project.csproj** file shows the details of the reference: ``` <COMReference Include="Micr...
Abstract your code so that ALL of the code that touches Office is in a separate project. Then you can have two projects - one for Office 11 and one for Office 12. Then reference both projects from your application. If the classes both implement a common interface, then you can use a factory pattern to instantiate the a...
403,349
<p>Why does the following code NOT give an error, nor any type of a warning about an implicit conversion?</p> <pre><code>std::wstring str = L"hi"; if(str[0] == 'h') cout&lt;&lt;"strange"&lt;&lt;endl; </code></pre> <p>The proper normal code is:</p> <pre><code>std::wstring str = L"hi"; if(str[0] == L'h') c...
[ { "answer_id": 403366, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 4, "selected": true, "text": "<p>It doesn't give a warning because the comparison is valid. In general, you can always compare integral types, they just get...
2008/12/31
[ "https://Stackoverflow.com/questions/403349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
Why does the following code NOT give an error, nor any type of a warning about an implicit conversion? ``` std::wstring str = L"hi"; if(str[0] == 'h') cout<<"strange"<<endl; ``` The proper normal code is: ``` std::wstring str = L"hi"; if(str[0] == L'h') cout<<"strange"<<endl; ``` Compiler: visual stud...
It doesn't give a warning because the comparison is valid. In general, you can always compare integral types, they just get promoted to wider types as needed. And I'm pretty sure some compilers would issue a warning about this. Which one are you using? (In any case, warnings are compiler-specific, and they're not requ...
403,351
<p>I want to use firebug to debug and help be quickly finish some XSLT layout issues, but I cannot get the following code to perform and display the client side XSLT in Firefox (everything is fine in IE):</p> <pre><code>$().ready(function() { var oXMLHTTP var oXSLT if ($.browser.mozilla){ oXMLHTTP = do...
[ { "answer_id": 403366, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 4, "selected": true, "text": "<p>It doesn't give a warning because the comparison is valid. In general, you can always compare integral types, they just get...
2008/12/31
[ "https://Stackoverflow.com/questions/403351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to use firebug to debug and help be quickly finish some XSLT layout issues, but I cannot get the following code to perform and display the client side XSLT in Firefox (everything is fine in IE): ``` $().ready(function() { var oXMLHTTP var oXSLT if ($.browser.mozilla){ oXMLHTTP = document.impleme...
It doesn't give a warning because the comparison is valid. In general, you can always compare integral types, they just get promoted to wider types as needed. And I'm pretty sure some compilers would issue a warning about this. Which one are you using? (In any case, warnings are compiler-specific, and they're not requ...
403,365
<p>I am currently stuck in the design of this solution.</p> <p>The data layer design consists of the following:</p> <ul> <li>Recipe (parent high level object) <ul> <li>Language Detail (name, description by language) (many) <ul> <li>Headers (many)</li> <li>Steps (many) <ul> <li>Ingredients (many)</li> <li>Quantitie...
[ { "answer_id": 403385, "author": "Tad Donaghe", "author_id": 1572436, "author_profile": "https://Stackoverflow.com/users/1572436", "pm_score": 1, "selected": false, "text": "<p>I like this answer from Karl on the <a href=\"https://stackoverflow.com/questions/135339/linqtosql-and-wcf\">th...
2008/12/31
[ "https://Stackoverflow.com/questions/403365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13502/" ]
I am currently stuck in the design of this solution. The data layer design consists of the following: * Recipe (parent high level object) + Language Detail (name, description by language) (many) - Headers (many) - Steps (many) * Ingredients (many) * Quantities (many) * Procedures (many) - Notes (many)...
If you are trying to send stuff down the line with WCF I suggest you create a model of the data you want to move around your domain. As far as I've found you can't serialize IQueryable objects, but you can create a set of classes that Linq populates and then serialize that. For example: ``` [DataContract] public class...
403,378
<p>new to Java. I want to use the org.apache.commons.lang.WordUtils package. Tried importing it. Tried downloading it and adding it to my build path. When I use intellisense for the word <code>WordUtils</code> Eclipse auto puts the import statement at the top of the file.</p> <p>I get the following error when compilin...
[ { "answer_id": 403404, "author": "Steve B.", "author_id": 19479, "author_profile": "https://Stackoverflow.com/users/19479", "pm_score": 2, "selected": false, "text": "<p>That is correct java, and correct use of the WordUtils function. This is likely an eclipse issue. I'd check that the j...
2008/12/31
[ "https://Stackoverflow.com/questions/403378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
new to Java. I want to use the org.apache.commons.lang.WordUtils package. Tried importing it. Tried downloading it and adding it to my build path. When I use intellisense for the word `WordUtils` Eclipse auto puts the import statement at the top of the file. I get the following error when compiling: ``` ConvertToUrl...
That is correct java, and correct use of the WordUtils function. This is likely an eclipse issue. I'd check that the jar is imported and is on the compile path.
403,379
<p>I want to get an 'event' before tomcat stops my web application.<br> My application needs to "wrap up" stuff before it is being closed.</p>
[ { "answer_id": 403410, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 1, "selected": false, "text": "<p>You can write a ContextListener that responds to deploy/undeploy events. Maybe you can have it sends an email when the...
2008/12/31
[ "https://Stackoverflow.com/questions/403379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20065/" ]
I want to get an 'event' before tomcat stops my web application. My application needs to "wrap up" stuff before it is being closed.
I think I found it, I created a servlet and implemented the ``` public void destroy(); ``` I verified that this method is invoked when I stop the application from the tomcat admin page, and even when I shut-down tomcat server [JavaEE 6 doc on Servlets](http://docs.oracle.com/javaee/6/api/javax/servlet/Servlet.html...
403,398
<p>I'm trying to connect a C# application (using Visual C# 2008 Express Edition) to a remote MySQL server. I have the drivers for this, but when I followed the tutorials (including adding the pooling and connection reset properties), I get an error that: <em>Object reference not set to an instance of an object.</em> I'...
[ { "answer_id": 403566, "author": "Ricardo Villamil", "author_id": 19314, "author_profile": "https://Stackoverflow.com/users/19314", "pm_score": 3, "selected": true, "text": "<p>I'd try setting the connection string outside of the constructor to help narrow down the issue:</p>\n\n<pre><co...
2008/12/31
[ "https://Stackoverflow.com/questions/403398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23249/" ]
I'm trying to connect a C# application (using Visual C# 2008 Express Edition) to a remote MySQL server. I have the drivers for this, but when I followed the tutorials (including adding the pooling and connection reset properties), I get an error that: *Object reference not set to an instance of an object.* I've include...
I'd try setting the connection string outside of the constructor to help narrow down the issue: ``` MySqlConnection connect = new MySqlConnection(); //Do you get the null exception in this next line? connect.ConnectionString = "your conn string here"; connect.Open(); //-> If you get the exception here then the problem...
403,411
<p>When a Delphi 2009 project is closed with ShellTreeView/ShellListView on the mainform in the IDE Index out of bounds(0) exceptions are generated. Is there a fix for ShellTreeView/ShellListView so the exceptions can be eliminated?</p>
[ { "answer_id": 403471, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 2, "selected": false, "text": "<p>That's the first I've heard of this. If it's any consolation I can reproduce it here. </p>\n\n<p>The first thing you should...
2008/12/31
[ "https://Stackoverflow.com/questions/403411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
When a Delphi 2009 project is closed with ShellTreeView/ShellListView on the mainform in the IDE Index out of bounds(0) exceptions are generated. Is there a fix for ShellTreeView/ShellListView so the exceptions can be eliminated?
That's the first I've heard of this. If it's any consolation I can reproduce it here. The first thing you should do is probably file a bug report in [Quality Central](http://qc.codegear.com), and ask on the Codegear NNTP Newsgroups. Also, try changing TCustomShellListView.GetFolder to the code below, and see how you...
403,419
<p>I have dropdown list control in one of my application and when I add Items in it from database Its displaying the first Item into Dropdown list by default but I want to display someother text into this like "Select Item from the List" Is there any way I can do this .</p> <p>Also Can you please help me setting the...
[ { "answer_id": 403447, "author": "patridge", "author_id": 48700, "author_profile": "https://Stackoverflow.com/users/48700", "pm_score": 4, "selected": true, "text": "<p>On the ASP.NET side of things, you can create the DropDownList with AppendDataBoundItems=\"true\" and any items you bin...
2008/12/31
[ "https://Stackoverflow.com/questions/403419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
I have dropdown list control in one of my application and when I add Items in it from database Its displaying the first Item into Dropdown list by default but I want to display someother text into this like "Select Item from the List" Is there any way I can do this . Also Can you please help me setting the same value ...
On the ASP.NET side of things, you can create the DropDownList with AppendDataBoundItems="true" and any items you bind to it will come after the default: ``` <asp:DropDownList AppendDataBoundItems="true" ID="yourListId" runat="server"> <asp:ListItem Text="Select something" Value="-1" /> </asp:DropDownList> ``` A...
403,421
<p>I have a list of Python objects that I want to sort by a specific attribute of each object:</p> <pre><code>&gt;&gt;&gt; ut [Tag(name=&quot;toe&quot;, count=10), Tag(name=&quot;leg&quot;, count=2), ...] </code></pre> <p>How do I sort the list by <code>.count</code> in descending order?</p>
[ { "answer_id": 403426, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 12, "selected": true, "text": "<pre><code># To sort the list in place...\nut.sort(key=lambda x: x.count, reverse=True)\n\n# To return a new list, use...
2008/12/31
[ "https://Stackoverflow.com/questions/403421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22468/" ]
I have a list of Python objects that I want to sort by a specific attribute of each object: ``` >>> ut [Tag(name="toe", count=10), Tag(name="leg", count=2), ...] ``` How do I sort the list by `.count` in descending order?
``` # To sort the list in place... ut.sort(key=lambda x: x.count, reverse=True) # To return a new list, use the sorted() built-in function... newlist = sorted(ut, key=lambda x: x.count, reverse=True) ``` More on [sorting by keys](http://wiki.python.org/moin/HowTo/Sorting#Sortingbykeys).
403,433
<p>I have a small problem with a program that im writing. I have a table - stocks which contains information(products, barcodes etc.) about items stored in a fridge. I then have another table - shop which acts like a shop,containing loads of products and their barcodes.some of the products in the shop table are in the ...
[ { "answer_id": 403491, "author": "CDR", "author_id": 50542, "author_profile": "https://Stackoverflow.com/users/50542", "pm_score": 0, "selected": false, "text": "<p>Try to make the question shorter. That will generate more responses, I guess.</p>\n" }, { "answer_id": 403493, ...
2008/12/31
[ "https://Stackoverflow.com/questions/403433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47204/" ]
I have a small problem with a program that im writing. I have a table - stocks which contains information(products, barcodes etc.) about items stored in a fridge. I then have another table - shop which acts like a shop,containing loads of products and their barcodes.some of the products in the shop table are in the sto...
So, if I got that right you have the following tables: **Stock** with at least a *barcode*, *amount* and *quantity* column **Shop** with at least a *barcode* and a *stock* column I don't understand why you need that *stock* column in the shop table, because you could easily get the products which are in stock by usi...
403,441
<p>We use EJB2.x entity beans with BMP (bean managed persistence). It appears BMP is not supported in EJB3. We had wanted to stay current and upgrade to EJB3. Does anyone know if there are in fact any BMP options available in 3.0?</p> <p>From what I can tell, using 3.0, all entity beans have to use JPA and by defin...
[ { "answer_id": 403491, "author": "CDR", "author_id": 50542, "author_profile": "https://Stackoverflow.com/users/50542", "pm_score": 0, "selected": false, "text": "<p>Try to make the question shorter. That will generate more responses, I guess.</p>\n" }, { "answer_id": 403493, ...
2008/12/31
[ "https://Stackoverflow.com/questions/403441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47281/" ]
We use EJB2.x entity beans with BMP (bean managed persistence). It appears BMP is not supported in EJB3. We had wanted to stay current and upgrade to EJB3. Does anyone know if there are in fact any BMP options available in 3.0? From what I can tell, using 3.0, all entity beans have to use JPA and by definition ORM. Th...
So, if I got that right you have the following tables: **Stock** with at least a *barcode*, *amount* and *quantity* column **Shop** with at least a *barcode* and a *stock* column I don't understand why you need that *stock* column in the shop table, because you could easily get the products which are in stock by usi...
403,443
<p>I've just setup Database mail within MSSQL 2005. I have been able to send email from an administrator account on the server and through a SQL Server Agent job. But, I unable to send email when I tried to send email via a login that just has access to a database for our web application.</p> <p>What is the best way t...
[ { "answer_id": 403650, "author": "Gordon Bell", "author_id": 16473, "author_profile": "https://Stackoverflow.com/users/16473", "pm_score": 1, "selected": false, "text": "<p>You should be able to create a stored procedure <strong>WITH EXECUTE AS OWNER</strong> option so it runs in the con...
2008/12/31
[ "https://Stackoverflow.com/questions/403443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/576/" ]
I've just setup Database mail within MSSQL 2005. I have been able to send email from an administrator account on the server and through a SQL Server Agent job. But, I unable to send email when I tried to send email via a login that just has access to a database for our web application. What is the best way to set up a...
You should be able to create a stored procedure **WITH EXECUTE AS OWNER** option so it runs in the context of the owner rather than the caller. ``` CREATE PROCEDURE [dbo].[sp_SendMail] ( @To nvarchar(1000), @Subject nvarchar(100), @Body nvarchar(max) ) WITH EXECUTE AS OWNER AS BEGIN exec msdb.dbo.sp_s...
403,445
<p>Is there a VB.NET equivalent for C#'s <code>??</code> operator?</p>
[ { "answer_id": 403453, "author": "Firas Assaad", "author_id": 23153, "author_profile": "https://Stackoverflow.com/users/23153", "pm_score": 8, "selected": true, "text": "<p>Use the <code>If()</code> operator with two arguments (<a href=\"https://learn.microsoft.com/en-us/dotnet/visual-ba...
2008/12/31
[ "https://Stackoverflow.com/questions/403445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18821/" ]
Is there a VB.NET equivalent for C#'s `??` operator?
Use the `If()` operator with two arguments ([Microsoft documentation](https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/if-operator#if-operator-called-with-two-arguments)): ```vb ' Variable first is a nullable type. Dim first? As Integer = 3 Dim second As Integer = 6 ' Variable first ...
403,454
<p>I have just started writing my own <em>JavaScript Framework</em> (just for the learning experience), and have prefixed some private members with a <strong>_</strong>, like such:</p> <pre><code>var _isFireBugEnabled = function () { return (window.console &amp;&amp; window.console.firebug); }; </code></pre> <p>W...
[ { "answer_id": 403464, "author": "foxxtrot", "author_id": 10369, "author_profile": "https://Stackoverflow.com/users/10369", "pm_score": 3, "selected": false, "text": "<p>I've actually e-mailed Crockford on this. This was his response:</p>\n\n<blockquote>\n <p>I think _ should be reserve...
2008/12/31
[ "https://Stackoverflow.com/questions/403454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44084/" ]
I have just started writing my own *JavaScript Framework* (just for the learning experience), and have prefixed some private members with a **\_**, like such: ``` var _isFireBugEnabled = function () { return (window.console && window.console.firebug); }; ``` When I ran my code against Crockford's [JSLint](http:/...
The reason is that Douglas Crockford hates about 78% of Javascript\*. Many people think he's a bit strict, and in fact many libraries do use leading underscores in production code. I don't see much wrong with it. There are no side effects. Additionally, the '$', not the underscore, was the symbol set aside for "system...
403,455
<p>When using "var" to declare variables in C#, is there boxing/unboxing taking place?</p> <p><br /> Also is there a chance of a runtime type mis-match when using var to declare variables?</p>
[ { "answer_id": 403456, "author": "configurator", "author_id": 9536, "author_profile": "https://Stackoverflow.com/users/9536", "pm_score": 6, "selected": true, "text": "<p>No. using var is compiled exactly as if you specified the exact type name. e.g.</p>\n\n<pre><code>var x = 5;\n</code>...
2008/12/31
[ "https://Stackoverflow.com/questions/403455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1443363/" ]
When using "var" to declare variables in C#, is there boxing/unboxing taking place? Also is there a chance of a runtime type mis-match when using var to declare variables?
No. using var is compiled exactly as if you specified the exact type name. e.g. ``` var x = 5; ``` and ``` int x = 5; ``` are compiled to the same IL code.
403,457
<p>For the past few years I've focused on back-end development so my javascript &amp; css skills are lacking. I'm volunteering as a webmaster for a site and would like to spruce up the form validation (currently there is none).<br> My problem: Basically I have one form with a few name fields, an email address and a ph...
[ { "answer_id": 403465, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 0, "selected": false, "text": "<p>Struts validation is happening on the server side; JavaScript validation runs on the client. The distinction is import...
2008/12/31
[ "https://Stackoverflow.com/questions/403457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33178/" ]
For the past few years I've focused on back-end development so my javascript & css skills are lacking. I'm volunteering as a webmaster for a site and would like to spruce up the form validation (currently there is none). My problem: Basically I have one form with a few name fields, an email address and a phone numbe...
when you're building the page server-side, mark all the fields with errors in them: ``` <input type="text" name="phone_number" class="error_field"> 555-121 </input> ``` Then in the page's CSS include an entry like: ``` input.error_field { color: #FFF; bgcolor: #C00; } ``` (The period's a "class selector", mean...
403,478
<p>I want to overlay one image with another using CSS. An example of this is the first image (the background if you like) will be a thumbnail link of a product, with the link opening a lightbox / popup showing a larger version of the image. </p> <p>On top of this linked image I would like an image of a magnifying glas...
[ { "answer_id": 403502, "author": "Nathan Long", "author_id": 4376, "author_profile": "https://Stackoverflow.com/users/4376", "pm_score": 7, "selected": false, "text": "<p>One technique, suggested by <a href=\"http://www.tjkdesign.com/articles/png_overlay_with_no_extra_markup.asp\" rel=\"...
2008/12/31
[ "https://Stackoverflow.com/questions/403478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349865/" ]
I want to overlay one image with another using CSS. An example of this is the first image (the background if you like) will be a thumbnail link of a product, with the link opening a lightbox / popup showing a larger version of the image. On top of this linked image I would like an image of a magnifying glass, to show...
I just got done doing this exact thing in a project. The HTML side looked a bit like this: ``` <a href="[fullsize]" class="gallerypic" title=""> <img src="[thumbnail pic]" height="90" width="140" alt="[Gallery Photo]" class="pic" /> <span class="zoom-icon"> <img src="/images/misc/zoom.gif" width="32" height=...
403,480
<p>I have a custom site I'm building with automatic url rewriting using a custom engine. The rewriting works fine as long as the page url doesn't end in somehting like .htm or .html. For these pages it goes directly to the iis 404 page instead of hitting my rewriting engine first.</p> <p>I have the * wildcard handle...
[ { "answer_id": 403553, "author": "Jason", "author_id": 1338, "author_profile": "https://Stackoverflow.com/users/1338", "pm_score": 1, "selected": false, "text": "<p>I think if you are having IIS send all requests to .NET and your handler, then your handler will need to detect if the page...
2008/12/31
[ "https://Stackoverflow.com/questions/403480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50539/" ]
I have a custom site I'm building with automatic url rewriting using a custom engine. The rewriting works fine as long as the page url doesn't end in somehting like .htm or .html. For these pages it goes directly to the iis 404 page instead of hitting my rewriting engine first. I have the \* wildcard handler in the "H...
Don't know if you can or would want to do this, but there is the Ionics Isapi url rewriter you can use. <http://www.codeplex.com/IIRF> Basically install that then set a rule to remove the .html that way it hits your rewrite engine. I use it on IIS 6 with several of my blogs.
403,505
<p>So I have a SQL Query as Follows</p> <pre><code>SELECT P.Date, P.CategoryName, P.ProductName, SUM(Quantity) Quantity, SUM(Sales) TotalSales, IsLevelThree FROM Products P LEFT JOIN LevelThreeTracking LTT ON P.Date = LTT.Date AND P.CategoryName = P.CategoryName AND P.SecurityID = LTT.SecurityID WHERE P.Date = '12...
[ { "answer_id": 403513, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 4, "selected": true, "text": "<p>Does it really need to be converted to LINQ? I would suggest you put that query in a stored procedure because the e...
2008/12/31
[ "https://Stackoverflow.com/questions/403505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6212/" ]
So I have a SQL Query as Follows ``` SELECT P.Date, P.CategoryName, P.ProductName, SUM(Quantity) Quantity, SUM(Sales) TotalSales, IsLevelThree FROM Products P LEFT JOIN LevelThreeTracking LTT ON P.Date = LTT.Date AND P.CategoryName = P.CategoryName AND P.SecurityID = LTT.SecurityID WHERE P.Date = '12-31-2007' AND ...
Does it really need to be converted to LINQ? I would suggest you put that query in a stored procedure because the equivalent LINQ query is painfully unreadable and unmaintainable.
403,509
<p>I have a View class (OrderView.aspx) which shows the details of an order (Account Name, Order Date) as well as a list of order lines via the Repeater control. Each order line is represented by a User Control View (OrderLineView.ascx) which shows the details of the order line (Item Name, Quantity, Price). I have a ...
[ { "answer_id": 403579, "author": "Todd Smith", "author_id": 31624, "author_profile": "https://Stackoverflow.com/users/31624", "pm_score": 1, "selected": false, "text": "<p>Since your OrderLine has a unique ID you can use that to construct a key to be placed in the ModelState errors conta...
2008/12/31
[ "https://Stackoverflow.com/questions/403509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
I have a View class (OrderView.aspx) which shows the details of an order (Account Name, Order Date) as well as a list of order lines via the Repeater control. Each order line is represented by a User Control View (OrderLineView.ascx) which shows the details of the order line (Item Name, Quantity, Price). I have a model...
1 = Check out ModelState. ``` ViewData.ModelState.AddModelError("something.Name", "Please enter a valid Name"); ``` ModelState is actually a dictionary, so you could identify the errors on a per-control basis. I don't know if this is a best practice, but it would probably work. Try something along the lines of ``...
403,516
<p>I have a template I made that sets variables that rarely change, call my headers, calls my banner and sidebar, loads a variable which shows the individual pages, then calls the footer. In one of my headers, I want the URL of the page in the user's address bar. Is there a way to do this?</p> <p>Currently:</p> <pre>...
[ { "answer_id": 403532, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 0, "selected": false, "text": "<p>It sounds like <code>$_SERVER['REQUEST_URI']</code> is what you're after.</p>\n" }, { "answer_id": 403636, "au...
2008/12/31
[ "https://Stackoverflow.com/questions/403516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50544/" ]
I have a template I made that sets variables that rarely change, call my headers, calls my banner and sidebar, loads a variable which shows the individual pages, then calls the footer. In one of my headers, I want the URL of the page in the user's address bar. Is there a way to do this? Currently: ``` <?php $title = ...
The main variables you'll be intersted in is: `$_SERVER['REQUEST_URI']` Holds the path visited, e.g. `/foo/bar` `$_SERVER['PHP_SELF']` is the path to the main PHP file (*NOT* the file you are in as that could be an include but the actual base file) There are a ton of other useful variables worth remembering in $\_SER...
403,539
<p>What are extension methods in .NET?</p> <p><br /><br/></p> <p>EDIT: I have posted a follow up question at <a href="https://stackoverflow.com/questions/403619/usage-of-extension-methods">Usage of Extension Methods</a> </p>
[ { "answer_id": 403555, "author": "Tom Anderson", "author_id": 13502, "author_profile": "https://Stackoverflow.com/users/13502", "pm_score": 3, "selected": false, "text": "<p>Extension methods are ways for developers to \"add on\" methods to objects they can't control.</p>\n\n<p>For insta...
2008/12/31
[ "https://Stackoverflow.com/questions/403539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1443363/" ]
What are extension methods in .NET? EDIT: I have posted a follow up question at [Usage of Extension Methods](https://stackoverflow.com/questions/403619/usage-of-extension-methods)
> > **Extension methods** allow developers to add new methods to the public > contract of an existing CLR type, > without having to sub-class it or > recompile the original type. > > > Extension Methods help blend the > flexibility of "duck typing" support > popular within dynamic languages today > with the p...