qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
278,571
<p>I'm wondering if there is a quick and easy function to clean get variables in my url, before I work with them.( or $_POST come to think of it... )</p> <p>I suppose I could use a regex to replace non-permitted characters, but I'm interested to hear what people use for this sort of thing?</p>
[ { "answer_id": 278664, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 3, "selected": false, "text": "urlencode" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
278,588
<p>I'm using the XML data source feature in Reporting Services 2005 but having some issues with missing data. When there is no value for the first column in a row, it appears that the entire column is ignored by SSRS!</p> <p>The web method request is very simple:</p> <pre><code>&lt;Query&gt; &lt;Method Name="GetIssues" Namespace="http://www.mycompany.com/App/"&gt; &lt;/Method&gt; &lt;SoapAction&gt;http://www.mycompany.com/App/GetIssues&lt;/SoapAction&gt; &lt;ElementPath IgnoreNamespaces="true"&gt;*&lt;/ElementPath&gt; &lt;/Query&gt; </code></pre> <p>Equally, the response is very simple:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;soap:Body&gt; &lt;GetIssuesResponse xmlns="http://www.mycompany.com/App/"&gt; &lt;GetIssuesResult&gt; &lt;Issue&gt; &lt;Title&gt;ABC&lt;/Title&gt; &lt;RaisedBy /&gt; &lt;Action&gt;Do something&lt;/Action&gt; &lt;/Issue&gt; &lt;Issue&gt; &lt;Title&gt;ABC&lt;/Title&gt; &lt;RaisedBy&gt;Jeff Smith&lt;/RaisedBy&gt; &lt;Action&gt;Do something&lt;/Action&gt; &lt;/Issue&gt; &lt;/GetIssuesResult&gt; &lt;/GetIssuesResponse&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>In this example the RaisedBy column will be completely empty. If the 'Issues' are reversed so RaisedBy first has a value, there is no problem. Any ideas?</p>
[ { "answer_id": 278638, "author": "Gene", "author_id": 35630, "author_profile": "https://Stackoverflow.com/users/35630", "pm_score": 4, "selected": true, "text": "<ElementPath IgnoreNamespaces=\"true\">*</ElementPath>\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
278,596
<p>Using Maven 2, is there a way I can list out the jar dependencies as just the file names?</p> <pre><code>mvn dependency:build-classpath </code></pre> <p>can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the copy-dependencies goal copied).</p> <p>So the list I need would be something like</p> <pre><code>activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc... </code></pre> <p>ideally as a maven property, but I guess, a file such as build-classpath can generate will do.</p> <p>What I am trying to achieve is writing a <code>Bundle-ClassPath</code> to an otherwise manually maintained MANIFEST.MF file for a OSGi bundle. (You shouldn't need to understand this bit to answer the question.)</p> <p>To clarify: The question is <strong>not</strong> about how to write manifest headers into the MANIFEST.MF file in a jar (that is easily googleble). I am asking about how to get the data I want to write, namely the list shown above.</p>
[ { "answer_id": 278623, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 2, "selected": false, "text": "<addClasspath>" }, { "answer_id": 708473, "author": "Gabe Mc", "author_id": 86010, "author_profile": "ht...
2008/11/10
[ "https://Stackoverflow.com/questions/278596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1113/" ]
278,604
<p>I need to implement the classic Factory Method pattern in ASP.NET to create server controls dynamically.</p> <p>The only way I've found to create .ascx controls is to use the LoadControl method of the Page/UserControl classes. I find it messy however to link my factory with a page or to pass a page parameter to the factory.</p> <p>Does anybody know of another method to create such controls (such as a static method somewhere i'd have overlooked) ?</p> <p>Thanks.</p>
[ { "answer_id": 278878, "author": "Mathieu Garstecki", "author_id": 22078, "author_profile": "https://Stackoverflow.com/users/22078", "pm_score": 2, "selected": true, "text": "public ControlsFactory\n{\n private Page _containingPage;\n\n public ControlsFactory(Page containingPage)\n...
2008/11/10
[ "https://Stackoverflow.com/questions/278604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22078/" ]
278,622
<p>I'm looking for a method to reliably extract the host name from a URL string in Ruby.</p> <p>e.g. <a href="http://www.mglenn.com/directory" rel="noreferrer">http://www.mglenn.com/directory</a> = www.mglenn.com OR <a href="http://www.mglenn.com?param=x" rel="noreferrer">http://www.mglenn.com?param=x</a> = www.mglenn.com</p>
[ { "answer_id": 278673, "author": "glenatron", "author_id": 15394, "author_profile": "https://Stackoverflow.com/users/15394", "pm_score": 7, "selected": true, "text": "require 'uri'\n\nmyUri = URI.parse( 'http://www.mglenn.com/directory' )\nprint myUri.host\n# => www.mglenn.com\n" }, ...
2008/11/10
[ "https://Stackoverflow.com/questions/278622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9424/" ]
278,627
<p>We've converted our solution from .NET 2.0 to .NET 3.5. All projects converted just fine except for the Website Project, which still doesn't understand what I mean when using 'var' and the like.</p> <p>I've looked in the property pages for the web project, and the Target Framework is set to '.NET Framework 3.5'.</p> <p>Any other ideas?</p>
[ { "answer_id": 278650, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 2, "selected": false, "text": " <assemblies>\n <add assembly=\"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089\"/>\n ...
2008/11/10
[ "https://Stackoverflow.com/questions/278627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3397/" ]
278,633
<p>I must be overlooking something simple. I'm setting a variable from a query result in a MySQL stored procedure like this:</p> <pre><code>SELECT @myName := username FROM User WHERE ID=1; </code></pre> <p>So, @myName is storing the username of userid 1, which is 'Paul'. Great.</p> <p>But later in the stored procedure I run an update on this record:</p> <pre><code>UPDATE User SET username = 'Fred' WHERE ID=1; </code></pre> <p>Now, for some reason, @myName = 'Fred' when it should still equal 'Paul', right? It appears MySQL is just creating a pointer to the record rather than storing a static value in the @myName variable. </p> <p>So in short, I want to be able to store a value in a variable from a query result and assure the value of my variable doesn't change, even when the data in the table it was set from changes.</p> <p>What am I missing? Thanks in advance!</p>
[ { "answer_id": 278681, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 3, "selected": true, "text": "SELECT username INTO myName FROM User WHERE ID=1;\n" }, { "answer_id": 3406850, "author": "user410927", ...
2008/11/10
[ "https://Stackoverflow.com/questions/278633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26180/" ]
278,644
<p>A "static" query is one that remains the same at all times. For example, the "Tags" button on Stackoverflow, or the "7 days" button on Digg. In short, they always map to a specific database query, so you can create them at design time. </p> <p>But I am trying to figure out how to do "dynamic" queries where the user basically dictates how the database query will be created at runtime. For example, on Stackoverflow, you can combine tags and filter the posts in ways you choose. That's a dynamic query albeit a very simple one since what you can combine is within the world of tags. A more complicated example is if you could combine tags and users. </p> <p>First of all, when you have a dynamic query, it sounds like you can no longer use the substitution api to avoid sql injection since the query elements will depend on what the user decided to include in the query. I can't see how else to build this query other than using string append.</p> <p>Secondly, the query could potentially span multiple tables. For example, if SO allows users to filter based on Users and Tags, and these probably live in two different tables, building the query gets a bit more complicated than just appending columns and WHERE clauses.</p> <p>How do I go about implementing something like this?</p>
[ { "answer_id": 278661, "author": "Mladen Prajdic", "author_id": 31345, "author_profile": "https://Stackoverflow.com/users/31345", "pm_score": 0, "selected": false, "text": "CONCAT" }, { "answer_id": 278672, "author": "Bill Karwin", "author_id": 20860, "author_profile"...
2008/11/10
[ "https://Stackoverflow.com/questions/278644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30581/" ]
278,655
<p>When should I put ... at the end of a menu item? I seem to remember reading some rules but can't for the life of me find them.</p> <p>For context - I'm adding a properties option to a right click menu and am wondering if it is appropriate to add them.</p>
[ { "answer_id": 1405784, "author": "Kyle Rosendo", "author_id": 103385, "author_profile": "https://Stackoverflow.com/users/103385", "pm_score": 1, "selected": false, "text": "Dialog" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/770/" ]
278,668
<p>Is it possible to have an ASP.NET MVC route that uses subdomain information to determine its route? For example:</p> <ul> <li><em><strong>user1</strong>.domain.example</em> goes to one place</li> <li><em><strong>user2</strong>.domain.example</em> goes to another?</li> </ul> <p>Or, can I make it so both of these go to the same controller/action with a <code>username</code> parameter?</p>
[ { "answer_id": 541495, "author": "Jon Cahill", "author_id": 10830, "author_profile": "https://Stackoverflow.com/users/10830", "pm_score": 8, "selected": true, "text": "public class ExampleRoute : RouteBase\n{\n\n public override RouteData GetRouteData(HttpContextBase httpContext)\n ...
2008/11/10
[ "https://Stackoverflow.com/questions/278668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19020/" ]
278,674
<p>I've been tasked with the awesome job of generating a look-up table for our application culture information. The columns I need to generate data for are:</p> <ul> <li>Dot Net Code</li> <li>Version</li> <li>Culture Name</li> <li>Country Name</li> <li>Language Name</li> <li>Java Country Code</li> <li>Java Language Code</li> <li>Iso Country Code</li> <li>Iso Language Code</li> </ul> <p>I have found the globalization name space, but I'm sure someone out there has asked the same question, or there is a table already available.</p> <p>Thanks for any help</p>
[ { "answer_id": 278875, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 3, "selected": true, "text": "Locale l = Locale.ITALY;\nSystem.out.println(l.getDisplayCountry() + \": \" + l.getDisplayLanguage());\nSystem.out.println(l...
2008/11/10
[ "https://Stackoverflow.com/questions/278674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36269/" ]
278,676
<p>I'm working the the image upload piece of the <a href="http://www.fckeditor.net/" rel="nofollow noreferrer">FCKEditor</a> and I've got the uploading working properly but am stuck with the server file browser.</p> <p><img src="https://farm4.static.flickr.com/3184/3019956718_f7ab198c16.jpg?v=0" alt="FCKEditor Image Properties dialog"/></p> <p>You can see in the dialog above has a <strong>Browse Server</strong> button which pops up the following dialog</p> <p><img src="https://farm4.static.flickr.com/3054/3019956722_712ae75d24.jpg?v=0" alt="FCKEditor Resources Browser" /></p> <p>The problem is that I have no idea which folder the file browser is pointing at.</p> <p>I've set the <strong>UserFilePath</strong> and <strong>USerFilesAbsolutePath</strong> in the PHP connector config.php to control where my image uploads go.</p> <h3>How can I configure the file browser so that it starts off pointing at the same folder where my uploads are going?</h3> <hr> <p><strong>Edit</strong></p> <p>The <strong>ImageBrowserURL</strong> property is <em>NOT</em> what I'm looking for. That property is used for having the <em>Browser Server</em> button point somewhere other than the default file browser.</p> <p>My problem is figuring out how to point the default file browser to a specific directory.</p>
[ { "answer_id": 281821, "author": "Steve Massing", "author_id": 34889, "author_profile": "https://Stackoverflow.com/users/34889", "pm_score": 1, "selected": false, "text": "FCKConfig.ImageBrowserURL = '/myfilebrowserpath/browser.php' ;\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
278,684
<p>I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent:</p> <pre><code>t =&gt; t.SomeProperty.Contains("stringValue"); </code></pre> <p>So far I have got:</p> <pre><code> private static Expression.Lambda&lt;Func&lt;string, bool&gt;&gt; GetContainsExpression&lt;T&gt;(string propertyName, string propertyValue) { var parameterExp = Expression.Parameter(typeof(T), "type"); var propertyExp = Expression.Property(parameter, propertyName); var containsMethodExp = Expression.*SomeMemberReferenceFunction*("Contains", propertyExp) //this is where I got lost, obviously :) ... return Expression.Lambda&lt;Func&lt;string, bool&gt;&gt;(containsMethodExp, parameterExp); //then something like this } </code></pre> <p>I just don't know how to reference the String.Contains() method.</p> <p>Help appreciated. </p>
[ { "answer_id": 278702, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "class Foo\n{\n public string Bar { get; set; }\n}\nstatic void Main()\n{\n var lambda = GetExpression<Foo>(\"Bar...
2008/11/10
[ "https://Stackoverflow.com/questions/278684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
278,692
<p>If I have a comma separated file like the following:</p> <pre> foo,bar,n ,a,bc,d one,two,three ,a,bc,d </pre> <p>And I want to join the <code>\n,</code> to produce this:</p> <pre> foo,bar,n,a,bc,d one,two,three,a,bc,d </pre> <p>What is the regex trick? I thought that an <code>if (/\n,/)</code> would catch this.</p> <p>Also, will I need to do anything special for a UTF-8 encoded file?</p> <p>Finally, a solution in Groovy would also be helpful.</p>
[ { "answer_id": 278723, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 0, "selected": false, "text": "open(F, \"test.txt\") or die;\nundef $/;\n$s = <F>;\nclose(F);\n$s =~ s/\\n,/,/g;\nprint $s;\n\n$ cat test.txt\nfoo,bar,n...
2008/11/10
[ "https://Stackoverflow.com/questions/278692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
278,703
<p>I know the standard way of using the <a href="https://en.wikipedia.org/wiki/Null_coalescing_operator" rel="noreferrer">null coalescing operator</a> in C# is to set default values.</p> <pre><code>string nobody = null; string somebody = &quot;Bob Saget&quot;; string anybody = &quot;&quot;; anybody = nobody ?? &quot;Mr. T&quot;; // Returns Mr. T anybody = somebody ?? &quot;Mr. T&quot;; // Returns &quot;Bob Saget&quot; </code></pre> <p>But what else can <code>??</code> be used for? It doesn't seem as useful as the <a href="https://en.wikipedia.org/wiki/%3F:" rel="noreferrer">ternary operator</a>, apart from being more concise and easier to read than:</p> <pre><code>nobody = null; anybody = nobody == null ? &quot;Bob Saget&quot; : nobody; // Returns Bob Saget </code></pre> <p>So given that fewer even know about null coalescing operator...</p> <ul> <li><p>Have you used <code>??</code> for something else?</p> </li> <li><p>Is <code>??</code> necessary, or should you just use the ternary operator (that most are familiar with)</p> </li> </ul>
[ { "answer_id": 278713, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "||" }, { "answer_id": 278716, "author": "James Curran", "author_id": 12725, "author_profile": "ht...
2008/11/10
[ "https://Stackoverflow.com/questions/278703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26931/" ]
278,709
<p>I have some user generated content I'm trying to render on my site. The rich text box editor I'm using renders font changes using <code>&lt;font /&gt;</code> tags, which are overridden by CSS on the page.</p> <p>Does anyone know if there is a way to allow rules defined using the <code>&lt;font /&gt;</code> tag to show through?</p> <p><strong>UPDATE</strong><br> Since changing the control I'm using for my rich text editor is not an option and my users have no knowledge of HTML to understand the difference between a <code>&lt;font&gt;</code> tag and any other type of tag, I had no choice but to create a hack to fix my problem. Below is the code I used to solve it. It's a jQuery script that changes all <code>&lt;font /&gt;</code> tag attributes into inline CSS. </p> <pre><code>(function() { $('font[size]').each(function() { var fontSize = this.size; if (fontSize == 1) { $(this).css("font-size", 8); } else if (fontSize == 2) { $(this).css("font-size", 9); } else if (fontSize == 3) { $(this).css("font-size", 11); } else if (fontSize == 4) { $(this).css("font-size", 15); } else if (fontSize == 5) { $(this).css("font-size", 20); } else if (fontSize == 6) { $(this).css("font-size", 25); } }); $('font[face]').each(function() { $(this).css('font-family', this.face); }); $('font[color]').each(function() { $(this).css('color', this.color); }); })(); </code></pre>
[ { "answer_id": 278717, "author": "thismat", "author_id": 14045, "author_profile": "https://Stackoverflow.com/users/14045", "pm_score": 2, "selected": false, "text": "div.MyClass p \n{ \nfont-size: 0.7em !important; \n}\n" }, { "answer_id": 278727, "author": "sblundy", "a...
2008/11/10
[ "https://Stackoverflow.com/questions/278709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
278,719
<p>I have some code doing this :</p> <pre><code> var changes = document.getElementsByName(from); for (var c=0; c&lt;changes.length; c++) { var ch = changes[c]; var current = new String(ch.innerHTML); etc. } </code></pre> <p>This works fine in FF and Chrome but not in IE7. Presumably because getElementsByName isn't working in IE. What's the best workaround?</p>
[ { "answer_id": 278741, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "id=\"\"" }, { "answer_id": 278773, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https...
2008/11/10
[ "https://Stackoverflow.com/questions/278719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36273/" ]
278,732
<p>Currently have the following mapping file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernateHelpers" assembly="App_Code.NHibernateHelpers"&gt; &lt;class name="NHibernateHelpers.Fixture, App_Code" table="Fixture_Lists"&gt; &lt;id name="Id" column="UniqRefNo"&gt; &lt;generator class="guid" /&gt; &lt;/id&gt; &lt;property name="Date" column="FixDate"/&gt; &lt;property name="HomeTeamId" column="HomeId"/&gt; &lt;property name="HomeTeamName" column="Home_Team"/&gt; &lt;property name="AwayTeamId" column="AwayId"/&gt; &lt;property name="AwayTeamName" column="Away_Team"/&gt; &lt;property name="Kickoff" column="Kickoff"/&gt; &lt;bag name="Goals"&gt; &lt;key column="FixID" /&gt; &lt;one-to-many class="NHibernateHelpers.Goal, App_Code"/&gt; &lt;/bag&gt; &lt;bag name="Bookings"&gt; &lt;key column="FixID" /&gt; &lt;one-to-many class="NHibernateHelpers.Booking, App_Code"/&gt; &lt;/bag&gt; &lt;many-to-one name="HomeTeam" class="NHibernateHelpers.Team" column="HomeId" /&gt; &lt;many-to-one name="AwayTeam" class="NHibernateHelpers.Team" column="AwayId" /&gt; &lt;many-to-one name="Division" class="NHibernateHelpers.Division" column="Div_Comp" /&gt; &lt;property name="HomeFullTimeScoreCode" column="Home_FT_Score"/&gt; &lt;property name="AwayFullTimeScoreCode" column="Away_FT_Score"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>Which maps nicely to the legacy database I have inherited, but I would like to add a property named "MatchTime" that contains the output of the stored procedure:</p> <pre><code>EXEC GetMatchTime @FixtureId = :Id </code></pre> <p>where :Id is the Id of the current Fixture object.</p> <p>Is this possible in the mapping file?</p>
[ { "answer_id": 278807, "author": "Watson", "author_id": 25807, "author_profile": "https://Stackoverflow.com/users/25807", "pm_score": 0, "selected": false, "text": "<property name='MatchTime' formula='(EXEC GetMatchTime Id)'/>\n" }, { "answer_id": 278966, "author": "Mr Plough...
2008/11/10
[ "https://Stackoverflow.com/questions/278732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21940/" ]
278,738
<p>I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approaches:</p> <pre><code>&lt;item&gt; &lt;id&gt;&lt;/id&gt; &lt;images&gt; &lt;image width="" height="" href="" alt="" sequence="1" /&gt; &lt;image width="" height="" href="" alt="" sequence="2" /&gt; &lt;image width="" height="" href="" alt="" sequence="3" /&gt; &lt;image width="" height="" href="" alt="" sequence="4" /&gt; &lt;/images&gt; &lt;/item&gt; </code></pre> <p>Obviously there will be more nodes than this, but I'm not showing them all. I figured my primary image would always be the first in the sequence. The problem I'm having is that each of these images will have a thumbnail, medium and large images, so I'm thinking this needs to be broken down further.</p>
[ { "answer_id": 278748, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": true, "text": "sequence" }, { "answer_id": 279034, "author": "Robert Rossney", "author_id": 19403, "author_profile": ...
2008/11/10
[ "https://Stackoverflow.com/questions/278738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
278,746
<p>I really don't understand the fascination with XHTML strict. Inline JavaScript typically requires a rats nest of escapes to make it compatible with XHTML and semi-backwards compatible with MSIE 5 &amp; 6. Then there is the issue of not being OCD enough on user input to make sure you don't miss any illegal characters. It just seems like more effort then its worth. Nevermind that almost every developer I've worked along side of keeps forgetting to ensure the content-type returned from the server is reset for XHTML pages from text/html to application/xhtml+xml.</p> <p>Wish I knew the name of the blogger, but someone else pointed out that a majority of supposedly XHTML compliant websites and open source packages are actually not because of that last issue, forgetting to set the content-type header correctly.</p> <p>I'm looking to understand why XHTML is useful, or build enough of an arsenal of arguments to prevent it ever being used in future projects that I have influence on.</p>
[ { "answer_id": 280401, "author": "Simon", "author_id": 15371, "author_profile": "https://Stackoverflow.com/users/15371", "pm_score": 0, "selected": false, "text": "http://www.example.com/page.php?arg1=val1&arg2=val2\n" }, { "answer_id": 280410, "author": "PhiLho", "author...
2008/11/10
[ "https://Stackoverflow.com/questions/278746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908/" ]
278,758
<p>I run (and am presently completely overhauling) a website that deals with theater (njtheater.com if you're interested).</p> <p>When I query a list of plays from the database, I'd like "The Merchant of Venice" to sort under the "M"s. Of course, when I display the name of the play, I need the "The" in front.</p> <p>What the best way of designing the database to handle this?</p> <p>(I'm using MS-SQL 2000)</p>
[ { "answer_id": 278771, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 1, "selected": false, "text": "article varchar(4)\nsorttitle varchar(255)\ntitle computed (article + sortitle)\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12725/" ]
278,761
<p>I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter.</p> <p>The following code works for the test cases I've tried:</p> <pre> private static string ConvertUriToPath(string fileName) { fileName = fileName.Replace("file:///", ""); fileName = fileName.Replace("/", "\\"); return fileName; } </pre> <p>It seems like there should be something in the .NET Framework that would be much better--I just haven't been able to find it.</p>
[ { "answer_id": 278812, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 0, "selected": false, "text": "Assembly.Location" }, { "answer_id": 278840, "author": "Scott Dorman", "author_id": 1559, "author_...
2008/11/10
[ "https://Stackoverflow.com/questions/278761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3475/" ]
278,768
<p>If I'm reading a text file in shared access mode and another process truncates it, what is the easiest way to detect that? (I'm excluding the obvious choice of refreshing a FileInfo object periodically to check its size) Is there some convenient way to capture an event? (Filewatcher?)</p>
[ { "answer_id": 278791, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 3, "selected": true, "text": "private void myForm_Load(object sender, EventArgs e)\n{\n var fileWatcher = new System.IO.FileSystemWatcher();\n\n // M...
2008/11/10
[ "https://Stackoverflow.com/questions/278768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29021/" ]
278,769
<p>I have an asp.net image button and I want to cancel the click event incase he fails the client side validation... how do I do that?</p>
[ { "answer_id": 278804, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 1, "selected": false, "text": "<asp:Button ID=\"NavigateAway\" runat=\"server\" OnClientClick=\"javascript:return PromptToNavigateOff();\" OnClick=\"...
2008/11/10
[ "https://Stackoverflow.com/questions/278769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
278,784
<p>What is the best compiler to experiment with C++0x features? I have been experimenting with GNU g++ 4.4. </p>
[ { "answer_id": 278830, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "auto" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8863/" ]
278,788
<p>I'm trying to figure out how to parse out the text of an email from any quoted reply text that it might include. I've noticed that usually email clients will put an "On such and such date so and so wrote" or prefix the lines with an angle bracket. Unfortunately, not everyone does this. Does anyone have any idea on how to programmatically detect reply text? I am using C# to write this parser.</p>
[ { "answer_id": 474174, "author": "Oleg Yaroshevych", "author_id": 48724, "author_profile": "https://Stackoverflow.com/users/48724", "pm_score": 5, "selected": false, "text": "new Regex(\"From:\\\\s*\" + Regex.Escape(_mail), RegexOptions.IgnoreCase);\nnew Regex(\"<\" + Regex.Escape(_mail)...
2008/11/10
[ "https://Stackoverflow.com/questions/278788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4550/" ]
278,789
<p>I have a type ahead text field, and when the user hits "Enter" I want to make an ajax call and not submit the form at the same time. My html looks like this:</p> <pre><code>&lt;input id="drug_name" class="drugs_field" type="text" size="30" onkeypress="handleKeyPress(event,this.form); return false;" name="drug[name]" autocomplete="off"/&gt; &lt;div id="drug_name_auto_complete" class="auto_complete" style="display: none;"/&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ var drug_name_auto_completer = new Ajax.Autocompleter('drug_name', 'drug_name_auto_complete', '/sfc/pharmacy/auto_complete_for_drug_name', {}) //]]&gt; &lt;/script&gt; </code></pre>
[ { "answer_id": 278816, "author": "Pim Jager", "author_id": 35197, "author_profile": "https://Stackoverflow.com/users/35197", "pm_score": 1, "selected": false, "text": "<input type='submit' value='submit' onclick='submiFunction(); return false;'>\n" }, { "answer_id": 278833, "...
2008/11/10
[ "https://Stackoverflow.com/questions/278789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486/" ]
278,838
<p>By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's <strong>Build Action</strong> is set to <strong>None</strong>. This is done because the image is magically stored inside a .resources file.</p> <p><strong><em>I</em></strong> want the resource to be stored as an embedded resource (my reasons are irrelevant, but let's just pretend it's so that I can see them inside <strong><a href="http://reflector.red-gate.com/" rel="nofollow noreferrer">RedGate's Reflector</a></strong>).</p> <p>So I changed each image's <strong>Build Action</strong> to <strong>Embedded Resource</strong>, and the resource then appears inside Lutz's Reflector - exactly as I want. </p> <p><strong>Unfortunately</strong>, <a href="http://msdn.microsoft.com/en-us/library/0c6xyb66(VS.80).aspx" rel="nofollow noreferrer">Microsoft says specifically not to do this</a>:</p> <blockquote> <p>Note that when the resource editor adds an image, it sets <strong>Build Action</strong> to <strong>None</strong>, because the .resx file references the image file. At build time, the image is pulled into the .resources file created out of the .resx file. The image can then easily be accessed via the strongly-typed class auto-generated for the .resx file. </p> <p>Therefore, you should not change this setting to <strong>Embedded Resource</strong>, because doing so would include the image twice in the assembly.</p> </blockquote> <p>So what is the <strong>proper way</strong> to include an image as an embedded resource?</p>
[ { "answer_id": 278911, "author": "Todd", "author_id": 31940, "author_profile": "https://Stackoverflow.com/users/31940", "pm_score": 3, "selected": false, "text": "ResourceManager" }, { "answer_id": 483891, "author": "Dirk Vollmar", "author_id": 40347, "author_profile"...
2008/11/10
[ "https://Stackoverflow.com/questions/278838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
278,856
<p>I tried using the IHttpModule and managed to convert the urls just fine, but all of my images returned path error (all going through the new url directory).</p> <p>whats the solution?</p>
[ { "answer_id": 278979, "author": "Keltex", "author_id": 28260, "author_profile": "https://Stackoverflow.com/users/28260", "pm_score": 1, "selected": false, "text": "<img src='images/something.gif' />\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
278,858
<p>Here is my code: </p> <pre><code>ThreadStart threadStart = controller.OpenFile; Thread thread = new Thread(threadStart); thread.Start(); </code></pre> <p>In the OpenFile function, my code looks like:</p> <pre><code>System.Console.Error.WriteLine("Launching"); </code></pre> <p>The code in OpenFile doesn't get executed for 30 seconds exactly. It starts immediately on my machine, but in our production environment it takes 30 seconds before that print statement will execute.</p> <p>Is there a setting or something that might be doing this? Where would I start looking?</p>
[ { "answer_id": 279011, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 0, "selected": false, "text": "using System;\nusing System.Threading;\n\nnamespace Net_Threading_Problem\n{\n class Program\n {\n stat...
2008/11/10
[ "https://Stackoverflow.com/questions/278858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261/" ]
278,868
<p>I am doing the following in PHP:</p> <pre><code>exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf'); </code></pre> <p>When I run this from the command line, it runs fine and finishes in a second or two.</p> <p>When I run this command from PHP exec, the java process takes 100% CPU and never returns.</p> <p>Any ideas?</p> <p>I have also tried running the above command with '/usr/bin/java -Djava.awt.headless=true'.</p> <p>I am running Mac OS X 10.5.5, MAMP 1.7, PHP 5.2.5</p>
[ { "answer_id": 363758, "author": "Keeth", "author_id": 20588, "author_profile": "https://Stackoverflow.com/users/20588", "pm_score": 5, "selected": true, "text": "exec('java -version');\n" }, { "answer_id": 4488967, "author": "Pontus", "author_id": 548511, "author_pro...
2008/11/10
[ "https://Stackoverflow.com/questions/278868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20588/" ]
278,871
<p>I am using:</p> <pre><code>set constraints all deferred; (lots of deletes and inserts) commit; </code></pre> <p>This works as expected. If there are any broken relationships then the commit fails and an error is raised listing ONE of the FKs that it fails on.</p> <p>The user fixes the offending data and runs again. then hits another FK issue and repeats the process.</p> <p>What I really want is a list of ALL FKs in one go that would cause the commit to fail.</p> <p>I can of course write something to check every FK relationship through a select statement (one select per FK), but the beauty of using the deferred session is that this is all handled for me.</p>
[ { "answer_id": 290971, "author": "GHZ", "author_id": 18138, "author_profile": "https://Stackoverflow.com/users/18138", "pm_score": 2, "selected": false, "text": "SQL> create table a (id number primary key);\n\nTable created.\n\nSQL> create table b (id number primary key, a_id number, con...
2008/11/10
[ "https://Stackoverflow.com/questions/278871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18138/" ]
278,873
<p>you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code:</p> <pre><code>OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. </code></pre> <p>the resulting file is owned and grouped according to a pre-defined admin user, which is fine, but the sticky wicket is that the permissions are set to 660/rw-rw----, meaning I can't examine the results. is there a way (possibly using that vaguely defined TYPE addition?) I can specify the resulting permissions on the new file?</p> <p>thanks!</p>
[ { "answer_id": 303145, "author": "tomdemuyt", "author_id": 7602, "author_profile": "https://Stackoverflow.com/users/7602", "pm_score": 2, "selected": false, "text": "chmod" }, { "answer_id": 330365, "author": "Community", "author_id": -1, "author_profile": "https://St...
2008/11/10
[ "https://Stackoverflow.com/questions/278873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29003/" ]
278,882
<p>In PL/SQL, I would like to pass in a "source" schema as a parameter to a stored procedure. For instance:</p> <pre><code>BEGIN CURSOR my_cursor IS SELECT my_field FROM &lt;schema&gt;.my_table ... </code></pre> <p>I want the 'schema' value to come from an input parameter into the stored procedure. Does anyone know how I could do that?</p> <p>P.S. Sorry if this is a stupid simple question, but I'm new to PL/SQL and must get some functions written quickly.</p>
[ { "answer_id": 278903, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 4, "selected": true, "text": "PROCEDURE select_from_schema( the_schema VARCHAR2)\nIS\n TYPE my_cursor_type IS REF CURSOR;\n my_cursor my_cursor_type;...
2008/11/10
[ "https://Stackoverflow.com/questions/278882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20133/" ]
278,896
<p>Our product has the requirement of exporting its native format (essentially an XML file) to Excel for viewing/editing. However, what this entails is having a dependency on Excel (or Office) itself for our product build - something that we do not want. </p> <p>What we have done is export the data from our native format to a csv file which can be opened in Excel. If user selects an option to open the generated report as well, we (try to) launch Excel application to open it (ofcourse it requires Excel to be already present on the client system).</p> <p>The data for most part is flat list of records.</p> <p>Is there a better format (or even a better way) to handle this requirement? This is a common requirement for many products - how do you handle this?</p>
[ { "answer_id": 15227291, "author": "Mike Gledhill", "author_id": 391605, "author_profile": "https://Stackoverflow.com/users/391605", "pm_score": 0, "selected": false, "text": "DataSet ds = CreateSampleData();\nCreateExcelFile.CreateExcelDocument(ds, \"C:\\\\Sample.xlsx\");\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/278896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1065163/" ]
278,902
<p>I've got a bunch of properties which I am going to use read/write locks on. I can implement them either with a <code>try finally</code> or a <code>using</code> clause.</p> <p>In the <code>try finally</code> I would acquire the lock before the <code>try</code>, and release in the <code>finally</code>. In the <code>using</code> clause, I would create a class which acquires the lock in its constructor, and releases in its Dispose method.</p> <p>I'm using read/write locks in a lot of places, so I've been looking for ways that might be more concise than <code>try finally</code>. I'm interested in hearing some ideas on why one way may not be recommended, or why one might be better than another.</p> <p>Method 1 (<code>try finally</code>):</p> <pre><code>static ReaderWriterLock rwlMyLock_m = new ReaderWriterLock(); private DateTime dtMyDateTime_m public DateTime MyDateTime { get { rwlMyLock_m .AcquireReaderLock(0); try { return dtMyDateTime_m } finally { rwlMyLock_m .ReleaseReaderLock(); } } set { rwlMyLock_m .AcquireWriterLock(0); try { dtMyDateTime_m = value; } finally { rwlMyLock_m .ReleaseWriterLock(); } } } </code></pre> <p>Method 2:</p> <pre><code>static ReaderWriterLock rwlMyLock_m = new ReaderWriterLock(); private DateTime dtMyDateTime_m public DateTime MyDateTime { get { using (new ReadLock(rwlMyLock_m)) { return dtMyDateTime_m; } } set { using (new WriteLock(rwlMyLock_m)) { dtMyDateTime_m = value; } } } public class ReadLock : IDisposable { private ReaderWriterLock rwl; public ReadLock(ReaderWriterLock rwl) { this.rwl = rwl; rwl.AcquireReaderLock(0); } public void Dispose() { rwl.ReleaseReaderLock(); } } public class WriteLock : IDisposable { private ReaderWriterLock rwl; public WriteLock(ReaderWriterLock rwl) { this.rwl = rwl; rwl.AcquireWriterLock(0); } public void Dispose() { rwl.ReleaseWriterLock(); } } </code></pre>
[ { "answer_id": 278924, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 8, "selected": true, "text": "{\n Font font1 = new Font(\"Arial\", 10.0f);\n try\n {\n byte charset = font1.GdiCharSet;\n }\n finally\n {\n if ...
2008/11/10
[ "https://Stackoverflow.com/questions/278902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
278,914
<p>The span element seems to be exactly like a div, but at the in-line level rather than at the block level. However, I can't seem to think of any beneficial logical divisions that the span element can provide. </p> <p>A single sentence, or word if not contained in a sentence, seems to be the smallest logical part. Ignoring CSS, since CSS is only for layout and not for semantic meaning, <strong>when does span provide additional semantic value by chopping up a sentence or string of words</strong>? </p> <p>It seems that in all cases, other elements are better suited to adding semantic value, making span a purely layout element. Is this true?</p>
[ { "answer_id": 278930, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": false, "text": "<div class=\"name\">\n <span class=\"firstname\">John</span>\n <span class=\"lastname\">Doe</span>\n</div>\n" }, { ...
2008/11/10
[ "https://Stackoverflow.com/questions/278914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20770/" ]
278,927
<p>I'm inserting an img tag into my document with the new Element constructor like this (this works just fine):</p> <pre><code>$('placeholder').insert(new Element("img", {id:'something', src:myImage})) </code></pre> <p>I would like to trigger a function when this image loads, but I can't figure out the correct syntax. I'm guess it's something like this (which doesn't work).</p> <pre><code>$('placeholder').insert(new Element("img", {id:'something', src:myImage, onload:function(){alert("MOO")}})) </code></pre> <p>I'm hoping to do this in the same line of code and not to have to attach an event observer separately.</p> <p><strong>EDIT:</strong> The event needs to be registered when the element is <strong>created</strong>, not after. If the image loads before the event is attached, the event will never fire.</p>
[ { "answer_id": 278987, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 0, "selected": false, "text": "$('placeholder').insert(new Element(\"img\", \n {id:'something', src:myImage, onload:\"javascript:moo()\"}))\n\nfunction ...
2008/11/10
[ "https://Stackoverflow.com/questions/278927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
278,932
<p>I'm building some custom tools to work against a JIRA install, and the exposed SOAP API is great, except that none of the arguments are named.</p> <p>For example, the prototype for getIssue is:</p> <pre><code>RemoteIssue getIssue (string in0, string in1); </code></pre> <p>All of the SOAP RPC methods follow this convention, so without documentation I'm pretty hardpressed to figure out what to pass on a lot of these.</p> <p>Does anyone know of a definitive API documentation guide?</p>
[ { "answer_id": 279078, "author": "Tony Arkles", "author_id": 13868, "author_profile": "https://Stackoverflow.com/users/13868", "pm_score": 2, "selected": false, "text": "self.proxy = WSDL.Proxy( jiraUrl )\nself.token = self.proxy.login(self.username, self.password)\n...\nissues = self.pr...
2008/11/10
[ "https://Stackoverflow.com/questions/278932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
278,940
<p>I'm looking to vertically align text by adding <code>&lt;br /&gt;</code> tags between characters with jQuery.</p> <pre><code>&lt;div id="foo"&gt;&lt;label&gt;Vertical Text&lt;/label&gt;&lt;/div&gt; </code></pre> <p>would look like this:</p> <p>V<br /> e<br /> r<br /> t<br /> i<br /> c<br /> a<br /> l<br /> <br /> T<br /> e<br /> x<br /> t<br /></p>
[ { "answer_id": 278990, "author": "okoman", "author_id": 35903, "author_profile": "https://Stackoverflow.com/users/35903", "pm_score": 2, "selected": false, "text": "var element = $( '#foo label' );\nvar newData = '';\nvar data = element.text();\nvar length = data.length;\nvar i = 0;\n\nw...
2008/11/10
[ "https://Stackoverflow.com/questions/278940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9750/" ]
278,941
<p>Im having problems displaying records to my view when passing viewdata to a user control. This is only apparent for linq to sql objects where I am using table joins.</p> <p>The exception I receive is "Unable to cast object of type '&lt;>f__AnonymousType4<code>10[System.String,System.Int32,System.Nullable</code>1[System.DateTime],System.String,System.String,System.String,System.String,System.String,System.Nullable<code>1[System.Single],System.Nullable</code>1[System.Double]]' to type App.Models.table1."</p> <p>I have searched for a fix to this issue but not too familiar on whats wrong here for me to search for the right subject. This should be working in theory and this works for single table retrieving but when I added a join in their I ran into problems. I am currently using a foreach statement to query through my data via single table declaration. Any help would be greatly appreciated. Thanks in advance.</p> <p>My current setup is:</p> <p>CViewDataUC.cs(my class to hold viewdata and data connections specifically for user controls)</p> <pre><code>public void Info(ViewDataDictionary viewData, int id) { var dataContext = new testDataContext(); var info = from table1 in dataContext.table1 join table2 in dataContext.table2 on table1.type_id equals table2.type_id join table3 in dataContext.table3 on table1.id equals table3.id join table4 in dataContext.table4 on table1.id equals table4.id where table1.id == id select new { table1.column1, table1.column2, table1.column3, table1.column4, table1.column5, table1.column6, table1.column7, table2.column1, table3.column1, table4.column1 }; viewData["vd_Info"] = info; } </code></pre> <p>HomeController.cs(Controller)</p> <pre><code>public ActionResult Information(int id) { ViewData["Title"] = "Information"; CViewDataUC o_info = new CViewDataUC(); o_info.Info(this.ViewData, id); return View(); } </code></pre> <p>Information.aspx(View)</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Info.aspx.cs" Inherits="App.Views.Info" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;%Html.RenderPartial("~/Views/UserControls/Info.ascx", ViewData["vd_Info"]);%&gt; &lt;/asp:Content&gt; </code></pre> <p>Info.ascx(User Control)</p> <pre><code>&lt;%foreach (table1 m in (IEnumerable)ViewData.Model) { %&gt; &lt;div class="left"&gt; &lt;br /&gt; &lt;br /&gt; &lt;p id="medium"&gt; Column 1 &lt;br /&gt; &lt;%= Html.TextBox("column1", m.column1, new {@class = "textBox", @readonly = "readonly" })%&gt; Column 1 &lt;br /&gt; &lt;%= Html.TextBox("column2", m.column2, new {@class = "textBox", @readonly = "readonly" })%&gt; &lt;br /&gt; Column 1 &lt;br /&gt; &lt;%= Html.TextBox("column3", m.column3, new {@class = "textBox", @readonly = "readonly" })%&gt; &lt;/p&gt; &lt;/div&gt; &lt;%}%&gt; </code></pre>
[ { "answer_id": 278964, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 3, "selected": true, "text": "foreach (table1 m in (IEnumerable)ViewData.Model)\n" }, { "answer_id": 279136, "author": "Ayo", "author_i...
2008/11/10
[ "https://Stackoverflow.com/questions/278941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24130/" ]
278,943
<p>I am trying to do this...</p> <pre><code>&lt;Image x:Name="imgGroupImage" Source="Images\unlock.png" Margin="0,0,5,0" /&gt; </code></pre> <p>But I get this error...</p> <blockquote> <p>Cannot convert string 'Images\unlock.png' in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'forms/images/unlock.png'. Error at object 'System.Windows.HierarchicalDataTemplate' in markup file 'Fuse;component/forms/mainwindow.xaml' Line 273 Position 51.</p> </blockquote> <p>As you can see, my form that includes this XAML is in a folder named Forms. My Images are in a folder named Images. How do I map from Forms to Images?</p> <p>I tried <code>Source="..Images\unlock.png"</code> which does not work in WPF.</p> <p>Any help?</p>
[ { "answer_id": 278969, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": true, "text": "Source=\"/Images/unlock.png\"\n" }, { "answer_id": 278974, "author": "Community", "author_id": -1, "a...
2008/11/10
[ "https://Stackoverflow.com/questions/278943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6514/" ]
278,965
<p>I use URLLoader to load data into my Flex app (mostly XML) and my buddy who is doing the same thing mostly uses HTTPService. Is there a specific or valid reason to use on over the other?</p>
[ { "answer_id": 280795, "author": "Matt MacLean", "author_id": 22, "author_profile": "https://Stackoverflow.com/users/22", "pm_score": 5, "selected": true, "text": "var token:AsyncToken = httpService.send({someVariable: 123});\ntoken.requestStartTime = getTimer();\ntoken.addResponder(new ...
2008/11/10
[ "https://Stackoverflow.com/questions/278965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3435/" ]
278,982
<p>Would the following SQL statement automatically create an index on Table1.Table1Column, or must one be explicitly created?</p> <p>Database engine is SQL Server 2000</p> <pre><code> CREATE TABLE [Table1] ( . . . CONSTRAINT [FK_Table1_Table2] FOREIGN KEY ( [Table1Column] ) REFERENCES [Table2] ( [Table2ID] ) ) </code></pre>
[ { "answer_id": 33905720, "author": "David Sopko", "author_id": 1197553, "author_profile": "https://Stackoverflow.com/users/1197553", "pm_score": 3, "selected": false, "text": "CREATE TABLE MasterOrder (\n MasterOrderID INT PRIMARY KEY)\n\nCREATE TABLE OrderDetail(\n OrderDetailID INT...
2008/11/10
[ "https://Stackoverflow.com/questions/278982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36307/" ]
278,997
<p>More specifically, if I have:</p> <pre><code>public class TempClass : TempInterface { int TempInterface.TempProperty { get; set; } int TempInterface.TempProperty2 { get; set; } public int TempProperty { get; set; } } public interface TempInterface { int TempProperty { get; set; } int TempProperty2 { get; set; } } </code></pre> <p>How do I use reflection to get all the propertyInfos for properties explicitly implementing TempInterface?</p> <p>Thanks.</p>
[ { "answer_id": 279087, "author": "Robert Rossney", "author_id": 19403, "author_profile": "https://Stackoverflow.com/users/19403", "pm_score": 0, "selected": false, "text": " var props = typeof(TempClass).GetInterfaces().Where(i => i.Name==\"TempInterface\").SelectMany(i => i.GetPr...
2008/11/10
[ "https://Stackoverflow.com/questions/278997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
279,001
<p>When using a Silverlight-enabled WCF service, where is the best place to instantiate the service and to call the CloseAsync() method?</p> <p>Should you say, instantiate an instance each time you need to make a call to the service, or is it better to just instantiate an instance as a variable of the UserControl that will be making the calls?</p> <p>Then, where is it better to call the CloseAsync method? Should you call it in each of the "someServiceCall_completed" event methods? Or, if created as a variable of the UserControl class, is there a single place to call it? Like a Dispose method, or something equivalent for the UserControl class.</p> <p>Thanks,</p> <p>Jeff</p>
[ { "answer_id": 3045259, "author": "WhiteN01se", "author_id": 335525, "author_profile": "https://Stackoverflow.com/users/335525", "pm_score": 1, "selected": false, "text": "...\n{\n App.Client.MyOperationCompleted += Client_MyOperationCompleted;\n App.Client.MyOperationAsync(...);\n...
2008/11/10
[ "https://Stackoverflow.com/questions/279001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12172/" ]
279,019
<p>I am working an a search page that allows users to search for houses for sale. Typical search criteria include price/zip code/# bedrooms/etc.</p> <p>I would like to allow the user to save this criteria in a database and email new homes daily.</p> <p>I could either:</p> <p>1) Serialize a "SavedSearch" object into a string and save that to the database, then deserialize as needed.</p> <p>2) Have a list of columns in a tblSavedSearch corresponding to the search criteria - price/zip/# bedrooms/etc.</p> <p>I am concerned that if I choose option 1, my saved search criteria will change and leave the searialized objects in the database invalid, but option 2 doesn't feel like an optimal solution either.</p> <p>How have others solved this problem?</p>
[ { "answer_id": 279070, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 4, "selected": true, "text": "search.action?price=20000&rooms=3\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36313/" ]
279,024
<p>How would I return multiple values (say, a number and a string) from a user-defined function in SQL Server?</p>
[ { "answer_id": 279061, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 3, "selected": false, "text": "-- ============================================= \n-- Create inline function (IF) \n-- ==================================...
2008/11/10
[ "https://Stackoverflow.com/questions/279024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9702/" ]
279,038
<p>I'm trying to work through the problems on <a href="http://projecteuler.net" rel="noreferrer">projecteuler.net</a> but I keep running into a couple of problems.</p> <p>The first is a question of storing large quanities of elements in a <code>List&lt;t&gt;</code>. I keep getting OutOfMemoryException's when storing large quantities in the list.</p> <p>Now I admit I might not be doing these things in the best way but, is there some way of defining how much memory the app can consume?</p> <p>It usually crashes when I get abour 100,000,000 elements :S</p> <p>Secondly, some of the questions require the addition of massive numbers. I use ulong data type where I think the number is going to get super big, but I still manage to wrap past the largest supported int and get into negative numbers.</p> <p>Do you have any tips for working with incredibly large numbers?</p>
[ { "answer_id": 45905678, "author": "Abhilash Virat", "author_id": 5255098, "author_profile": "https://Stackoverflow.com/users/5255098", "pm_score": 0, "selected": false, "text": "class Solution\n{\n static void Main(String[] args)\n {\n int n = 5;\n string[] unsorted ...
2008/11/10
[ "https://Stackoverflow.com/questions/279038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1741868/" ]
279,043
<p>Let's take a very simple example:</p> <ul> <li>In my window1.xaml, i have a label control named 'lblProduct'.</li> <li>In my window1.xaml.cs, i have a public method called CalculateProduct(Int Var1, Int Var2). CalculateProduct will, as you may have guessed, calculate the product of the variables passed in.</li> </ul> <p>I'd like to simply bind the results of 'CalculateProduct' to my label. My actual use case is a little more complicated than this. However, if I could get this up and running not only would I be quite happy, I'd be able to figure out the rest.</p> <p>I've seen interesting examples using the ObjectDataProvider to bind to a static method of a new class. While this is well and good, I don't feel the need to create a new class when I've already instantiated the one for my window. In addition, there may be other global variables that I'd like to take advantage of in my Window1 class.</p> <p>Thanks for your time and help,</p> <p>Abel.</p>
[ { "answer_id": 279139, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "ObjectDataProvider" }, { "answer_id": 279250, "author": "AJ.", "author_id": 27457, "author_profile...
2008/11/10
[ "https://Stackoverflow.com/questions/279043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36308/" ]
279,065
<p>I have this as Main</p> <pre><code>int[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 }; MyMath.Reverse(M); for (int i = 0; i &lt; M.Length; i++) Console.WriteLine(M[i].ToString() + ", "); </code></pre> <hr> <p>After I created the class MyMath I made the Reverse method </p> <pre><code>public int Reverse(Array M) { int len = M.Length; for (int i = 0; i &lt; len / 2; i++) { int temp = M[i]; M[i] = M[len - i - 1]; M[len - i - 1] = temp; } } </code></pre> <p>but I'm sure it's wrong because it's not working :-) so do you have a different code to write in the reverse method?</p> <p>note: I don't want to use the built in Reverse in the Array class</p> <hr> <p>yes guys when i used the built in reverse method i got this error</p> <p>Process is terminated due to StackOverflowException.</p> <p>thats after i wrote the method as</p> <pre><code>public static int Reverse(Array M) { return Reverse(M); } </code></pre> <p>So then I tried to create my own reverse method and there i got stuck </p>
[ { "answer_id": 279100, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 0, "selected": false, "text": "private void Whatever()\n{\n int[] M = { 10, 2, 30, 4, 50, 6, 7, 80 };\n ReverseArray(ref M);\n\n}\n\nprivate void Re...
2008/11/10
[ "https://Stackoverflow.com/questions/279065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,066
<p>Our company uses an app that was originally ColdFusion + Access later converted to classic ASP + MS Sql for task/time tracking called the request system. It's broken down by department, so there's one for MIS, marketing, logistics, etc. The problem comes in when (mainly managers) are using more than one at a time, with 2 browser windows open. The request system uses session variables, a lot of session variables, "session" is referenced 2300 times in the application. When 2 are open at once as you can imagine this causes all sorts of anomalies from the variables getting mixed up.</p> <p>There's a 3 year old MIS request in the system to "fix" this and it's been worked on by 3 developers, and now it's my turn to take a shot at it. I was wondering if anyone else has had to work on a project like this, and if there was some sort of hack to try and mitigate some of the problems. I was thinking of maybe calling something in global.asa to load misc. session variables from the querystring. The problem is, there's all sorts of this going on:</p> <pre><code>If (Session("Application") &lt;&gt; Request("App")) and Request("App") &lt;&gt; "" THEN Session("Application") = Request("App") End If </code></pre> <p>Looking at the functions in include files, you'll have a function with 4 parameters, that makes references to 6 different session variables. So you get the idea, this is going to be painful.</p> <p>Has anyone had to do anything like this in the past? Any hacks you found useful?</p>
[ { "answer_id": 1077858, "author": "davidsleeps", "author_id": 51507, "author_profile": "https://Stackoverflow.com/users/51507", "pm_score": 0, "selected": false, "text": "Private Const PREFIX As String = \"MyPrefix_\"\nPublic Shared Property MyVariable() As String\n Get\n Retur...
2008/11/10
[ "https://Stackoverflow.com/questions/279066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1302/" ]
279,071
<p>I have an ASP.NET 2.0 (C#) webpage with a link that pulls a blob from a MS SQL database and ouputs it in the appropriat file format, i.e., Word, WordPerfect, PDF.</p> <p>My users would like to print these files with one click. Right now they have to click the link to open the file, then click the "Print" button within the application that they file opened.</p> <p>In addition, I would like to send multiple documents to the printer, using one click, if possible.</p> <p>Thanks.</p>
[ { "answer_id": 279099, "author": "ine", "author_id": 4965, "author_profile": "https://Stackoverflow.com/users/4965", "pm_score": 0, "selected": false, "text": "<body onload=\"window.print()\">\n...\n</body>\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29613/" ]
279,094
<p>I would like to use Python to script an application that advertises itself as providing an OLE component. How should I get started?</p> <p>I don't yet know what methods I need to call on the COMponents I will be accessing. Should I use win32com to load those components, and then start pressing 'tab' in IPython?</p>
[ { "answer_id": 279117, "author": "Ali Afshar", "author_id": 28380, "author_profile": "https://Stackoverflow.com/users/28380", "pm_score": 2, "selected": false, "text": "from win32com.client.dynamic import Dispatch\n\n# Excel\nexcel = Dispatch('Excel.Application')\n\n# Vim\nvim = Dispatch...
2008/11/10
[ "https://Stackoverflow.com/questions/279094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36330/" ]
279,112
<p>What is the troubleshooting process for the "Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80080005" errors in .Net? To clarify: I am getting this at runtime, on my XP machine, with client being .net code running under admin account. {XXXX} refers to one of our in-house COM components. </p> <p>From what I understand, 0x80080005 refers to "permission denied", but where do I go to check/change the permissions? Or am I completely wrong here, and the error is coming from the component itself, and not out of Windows COM subsystem?</p>
[ { "answer_id": 279196, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 1, "selected": false, "text": "CO_E_SERVER_EXEC_FAILURE" }, { "answer_id": 279317, "author": "Mark Brackett", "author_id": 2199, ...
2008/11/10
[ "https://Stackoverflow.com/questions/279112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8032/" ]
279,114
<p>I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following:</p> <pre><code>StreamReader arrComputer = new StreamReader(FileDialog.filename)(); </code></pre> <p>I got this exception:</p> <pre><code>The type or namespace name 'StreamReader' could not be found (are you missing a using directive or an assembly reference?) </code></pre> <p>I'm very new to C# so I'm sure I'm making a newbie mistake.</p>
[ { "answer_id": 279118, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "using System.IO;\n\n\nStreamReader arrComputer = new StreamReader(FileDialog.filename);\n" }, { "answer_id": ...
2008/11/10
[ "https://Stackoverflow.com/questions/279114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35760/" ]
279,119
<p>I like to use IPython's zope profile to inspect my Plone instance, but a few annoying permissions differences come up compared to inserting a breakpoint and hitting it with the admin user.</p> <p>For example, I would like to iterate over the content objects in an unpublished testing folder. This query will return no results in the shell, but works from a breakpoint.</p> <pre><code>$ bin/instance shell $ ipython --profile=zope from Products.CMFPlone.utils import getToolByName catalog = getToolByName(context, 'portal_catalog') catalog({'path':'Plone/testing'}) </code></pre> <p>Can I authenticate as admin or otherwise rejigger the permissions to fully manipulate my site from ipython?</p>
[ { "answer_id": 427914, "author": "bruno desthuilliers", "author_id": 41316, "author_profile": "https://Stackoverflow.com/users/41316", "pm_score": 2, "selected": false, "text": "from sys import stdin, stdout, exit\nimport base64\nfrom thread import get_ident\nfrom ZPublisher.HTTPRequest ...
2008/11/10
[ "https://Stackoverflow.com/questions/279119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36330/" ]
279,144
<p>I have a large Java app that is split up into multiple projects. Each project has its own folder in a Subversion repository like so:</p> <p>AccountingCore</p> <ul> <li>trunk</li> <li>branches</li> <li>tags</li> </ul> <p>Common</p> <ul> <li>trunk</li> <li>branches</li> <li>tags</li> </ul> <p>WebCommon</p> <ul> <li>trunk</li> <li>branches</li> <li>tags</li> </ul> <p>etc...</p> <p>I want to start using <strong>git-svn</strong> locally instead of subversion. </p> <p>This may be a stupid question, but is there a way to checkout <em>all the projects</em> in the repository at once (including branches and all) instead checking out each project individually?</p> <p>Thanks, Tony</p>
[ { "answer_id": 281010, "author": "Bram Geron", "author_id": 2147872, "author_profile": "https://Stackoverflow.com/users/2147872", "pm_score": 3, "selected": true, "text": "for DIR in AccountingCore Common WebCommon; do mkdir $DIR; cd $DIR; git init; git svn init -s svn://host/path/$DIR; ...
2008/11/10
[ "https://Stackoverflow.com/questions/279144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,145
<p>What is the most elegant way of bubble-sorting in F#?</p> <p><strong>UPDATE</strong></p> <p>As pointed out in one of the answers, bubble sorting isn't efficient in a functional language to begin with. A humourously-cynical commenter also pointed out that bubble sorting is only appropriate when the list is small and it's almost sorted anyway. </p> <p>However, I'm curious to see how a clever bubble-sort can be written in F#, since I've done bubble sorts in C#, C++, and Java EE in the past, and since I'm an F# newbie.</p>
[ { "answer_id": 279587, "author": "Tomas Petricek", "author_id": 33518, "author_profile": "https://Stackoverflow.com/users/33518", "pm_score": 5, "selected": true, "text": "let sort l = \n let rec sortUtil acc rev l =\n match l, rev with\n | [], true -> acc |> List.rev\n | [], f...
2008/11/10
[ "https://Stackoverflow.com/questions/279145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32462/" ]
279,148
<p>I have a table of 155K records. I can scroll only 65K records in combo box of a form having recordsource with query or sql, selecting three fields from that table. Why it does not list all 155K records even the query, which I am using as recordsource, shows all records outside of the form.</p>
[ { "answer_id": 286853, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 0, "selected": false, "text": "SELECT tp.PersonKey, \n tp.Surname & \", \" & tp.Forename AS PersonName\nFROM tblPersons tp\nWHERE tp.Surname \nLIKE For...
2008/11/10
[ "https://Stackoverflow.com/questions/279148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,154
<p>I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no owner Document.</p> <p>I could create a new Document and import the nodes from the old one, but I'm afraid there might be bits of Document metadata that get lost. Same thing with writing the Document to a string and parsing it back in.</p> <p>Any ideas?</p> <p>By the way, I'm stuck at Java 1.4.2, for reasons beyond my control.</p>
[ { "answer_id": 2109128, "author": "Ichiro Furusato", "author_id": 230955, "author_profile": "https://Stackoverflow.com/users/230955", "pm_score": 3, "selected": false, "text": "TransformerFactory tfactory = TransformerFactory.newInstance();\nTransformer tx = tfactory.newTransformer();\...
2008/11/10
[ "https://Stackoverflow.com/questions/279154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25498/" ]
279,158
<p>I'm going to try to ask my question in the context of a simple example...</p> <p>Let's say I have an abstract base class Car. Car has-a basic Engine object. I have a method StartEngine() in the abstract Car class that delegates the starting of the engine to the Engine object.</p> <p>How do I allow subclasses of Car (like Ferrari) to declare the Engine object as a specific type of engine (e.g., TurboEngine)? Do I need another Car class (TurboCar)?</p> <p>I'm inheriting a plain old Engine object and I cannot re-declare (or override) it as a TurboEngine in my Car subclasses. </p> <p><strong>EDIT:</strong> I understand that I can plug any subclass of Engine into myEngine reference within my Ferrari class...but how can I call methods that only the TurboEngine exposes? Because myEngine is inherited as a base Engine, none of the turbo stuff is included. </p> <p>Thanks!</p>
[ { "answer_id": 279180, "author": "Chris Boran", "author_id": 25660, "author_profile": "https://Stackoverflow.com/users/25660", "pm_score": 0, "selected": false, "text": "setEngine()" }, { "answer_id": 279183, "author": "Larry OBrien", "author_id": 10116, "author_profi...
2008/11/10
[ "https://Stackoverflow.com/questions/279158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
279,169
<p>Is it possible to deploy a website using <code>git push</code>? I have a hunch it has something to do with using <a href="http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">git hooks</a> to perform a <code>git reset --hard</code> on the server side, but how would I go about accomplishing this?</p>
[ { "answer_id": 327315, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 9, "selected": true, "text": "[remote \"production\"]\n url = username@webserver:/path/to/htdocs/.git\n" }, { "answer_id": 2806602, "autho...
2008/11/10
[ "https://Stackoverflow.com/questions/279169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658/" ]
279,170
<p> I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.</p> <p>Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?</p> <p>This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.</p>
[ { "answer_id": 279244, "author": "chroder", "author_id": 18802, "author_profile": "https://Stackoverflow.com/users/18802", "pm_score": 6, "selected": false, "text": "default_charset" }, { "answer_id": 279279, "author": "chazomaticus", "author_id": 30497, "author_profi...
2008/11/10
[ "https://Stackoverflow.com/questions/279170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1951/" ]
279,173
<p>Is there anything in Visual Studio that will report memory leaks like Codeguard?</p> <p>eg:</p> <pre><code>Error 00001. 0x300010 (Thread 0x0FA4): Resource leak: The object (0xC65D84) was never deleted The object (0x00C65D84) [size: 4 bytes] was created with new | element2.cpp line 3: | #include "element2.h" | |&gt;CS225::Element2::Element2(int _val) : p_val(new int(_val)) { } | | CS225::Element2::Element2(const Element2&amp; rhs) Call Tree: 0x0040E3A7(=bcc_cg.exe:0x01:00D3A7) element2.cpp#3 0x00409116(=bcc_cg.exe:0x01:008116) element-factory.h#19 0x0040D964(=bcc_cg.exe:0x01:00C964) array.cpp#87 0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394 0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415 0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420 ------------------------------------------ Error 00002. 0x300010 (Thread 0x0FA4): Resource leak: The object (0xC65D58) was never deleted The object (0x00C65D58) [size: 4 bytes] was created with new | element2.cpp line 6: | | CS225::Element2::Element2(const Element2&amp; rhs) |&gt; : AbstractElement(), p_val(new int(*rhs.p_val)) | { } | Call Tree: 0x0040E4B7(=bcc_cg.exe:0x01:00D4B7) element2.cpp#6 0x0040E652(=bcc_cg.exe:0x01:00D652) element2.cpp#26 0x0040D8CD(=bcc_cg.exe:0x01:00C8CD) array.cpp#81 0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394 0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415 0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420 </code></pre>
[ { "answer_id": 279188, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 3, "selected": true, "text": "<crtdbg.h" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34799/" ]
279,190
<p>How can I extract the list of colors in the System.Drawing.Color struct into a collection or array?</p> <p>Is there a more efficient way of getting a collection of colors than using this struct as a base?</p>
[ { "answer_id": 279207, "author": "jons911", "author_id": 34375, "author_profile": "https://Stackoverflow.com/users/34375", "pm_score": 5, "selected": true, "text": "string[] colors = Enum.GetNames(typeof(System.Drawing.KnownColor));\n" }, { "answer_id": 279219, "author": "Rog...
2008/11/10
[ "https://Stackoverflow.com/questions/279190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583/" ]
279,195
<p>I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial</p> <p>Unfortunately, Flex Builder 3 is flagging a "Access of undefined property JSON" error on the line</p> <p><code>var arr:Array = (JSON.decode(rawData) as Array);</code></p> <p>I don't know what it wants, since I included the import line. </p>
[ { "answer_id": 13985779, "author": "Dinesh", "author_id": 1059093, "author_profile": "https://Stackoverflow.com/users/1059093", "pm_score": 2, "selected": false, "text": "var arr:Array = (com.adobe.serialization.json.JSON.decode(rawData) as Array);\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32392/" ]
279,208
<p>After two years of C#, I'm now back to VB.net because of my current job. In C#, I can do a short hand testing for null or false value on a string variable like this:</p> <pre><code>if(!String.IsNullOrEmpty(blah)) { ...code goes here } </code></pre> <p>however I'm a little confused about how to do this in VB.net.</p> <pre><code>if Not String.IsNullOrEmpty(blah) then ...code goes here end if </code></pre> <p>Does the above statement mean if the string is not null or empty? Is the <code>Not</code> keyword operate like the C#'s <code>!</code> operator?</p>
[ { "answer_id": 279224, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "Not" }, { "answer_id": 279309, "author": "HTTP 410", "author_id": 13118, "author_profile": "https...
2008/11/10
[ "https://Stackoverflow.com/questions/279208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
279,220
<p>I've written a web service using ASP.NET (in C#) and I'm attempting to write an example PHP client using NuSOAP. Where I'm tripped up on are examples of how to do this; some show <code>soapval</code> being used (and I don't quite understand the parameters - for example passing <code>false</code> as <code>string</code> types, etc.), while others are just using straight <code>array</code>s. Let's say the WSDL for my web service as reported by <code>http://localhost:3333/Service.asmx?wsdl</code> looks something like:</p> <pre><code>POST /Service.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/webservices/DoSomething" &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; &lt;DoSomething xmlns="http://tempuri.org/webservices"&gt; &lt;anId&gt;int&lt;/anId&gt; &lt;action&gt;string&lt;/action&gt; &lt;parameters&gt; &lt;Param&gt; &lt;Value&gt;string&lt;/Value&gt; &lt;Name&gt;string&lt;/Name&gt; &lt;/Param&gt; &lt;Param&gt; &lt;Value&gt;string&lt;/Value&gt; &lt;Name&gt;string&lt;/Name&gt; &lt;/Param&gt; &lt;/parameters&gt; &lt;/DoSomething&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>My first PHP attempt looks like:</p> <pre><code>&lt;?php require_once('lib/nusoap.php'); $client = new nusoap_client('http://localhost:3333/Service.asmx?wsdl'); $params = array( 'anId' =&gt; 3, //new soapval('anId', 'int', 3), 'action' =&gt; 'OMNOMNOMNOM', 'parameters' =&gt; array( 'firstName' =&gt; 'Scott', 'lastName' =&gt; 'Smith' ) ); $result = $client-&gt;call('DoSomething', $params, 'http://tempuri.org/webservices/DoSomething', 'http://tempuri.org/webservices/DoSomething'); print_r($result); ?&gt; </code></pre> <p>Now aside from the Param type being a complex type which I'm pretty sure my simple <code>$array</code> attempt will not automagically work with, I'm breakpointing in my web service and seeing the method I've marked as <code>WebMethod</code> (without renaming it, its literally <code>DoSomething</code>) and seeing the arguments are all default values (the <code>int</code> is <code>0</code>, the <code>string</code> is <code>null</code>, etc.).</p> <p>What should my PHP syntax look like, and what do I have to do to pass the <code>Param</code> type correctly?</p>
[ { "answer_id": 279407, "author": "John Lemp", "author_id": 12915, "author_profile": "https://Stackoverflow.com/users/12915", "pm_score": 4, "selected": true, "text": "<?php\nrequire_once('lib/nusoap.php');\n$client = new nusoap_client('http://localhost:3333/Service.asmx?wsdl');\n\n$param...
2008/11/10
[ "https://Stackoverflow.com/questions/279220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5645/" ]
279,221
<p>I have a VB6 picture box that gets an image from a video capture device.</p> <p>I'm trying to figure out how to then convert the picture box to a byte array.</p>
[ { "answer_id": 279231, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "PropertyBag" }, { "answer_id": 281986, "author": "Keith Maurino", "author_id": 1096640, "author_p...
2008/11/10
[ "https://Stackoverflow.com/questions/279221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1096640/" ]
279,236
<p>I'm attempting to resize pngs with transparent backgrounds in PHP and the code samples I've found online don't work for me. Here's the code I'm using, advice will be much appreciated!</p> <pre><code>$this-&gt;image = imagecreatefrompng($filename); imagesavealpha($this-&gt;image, true); $newImage = imagecreatetruecolor($width, $height); // Make a new transparent image and turn off alpha blending to keep the alpha channel $background = imagecolorallocatealpha($newImage, 255, 255, 255, 127); imagecolortransparent($newImage, $background); imagealphablending($newImage, false); imagesavealpha($newImage, true); imagecopyresampled($newImage, $this-&gt;image, 0, 0, 0, 0, $width, $height, $this-&gt;getWidth(), $this-&gt;getHeight()); $this-&gt;image = $newImage; imagepng($this-&gt;image,$filename); </code></pre> <p><br /> <strong>Update</strong> By 'not working' I meant to say the background color changes to black when I resize pngs.</p>
[ { "answer_id": 279310, "author": "Dycey", "author_id": 35961, "author_profile": "https://Stackoverflow.com/users/35961", "pm_score": 7, "selected": true, "text": "false" }, { "answer_id": 1655575, "author": "sbeam", "author_id": 125875, "author_profile": "https://Stac...
2008/11/10
[ "https://Stackoverflow.com/questions/279236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/956/" ]
279,237
<p>How do I import a Python module given its relative path?</p> <p>For example, if <code>dirFoo</code> contains <code>Foo.py</code> and <code>dirBar</code>, and <code>dirBar</code> contains <code>Bar.py</code>, how do I import <code>Bar.py</code> into <code>Foo.py</code>?</p> <p>Here's a visual representation:</p> <pre><code>dirFoo\ Foo.py dirBar\ Bar.py </code></pre> <p><code>Foo</code> wishes to include <code>Bar</code>, but restructuring the folder hierarchy is not an option.</p>
[ { "answer_id": 279253, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 8, "selected": false, "text": "__init__.py" }, { "answer_id": 279287, "author": "bouvard", "author_id": 24608, "author_profile": "http...
2008/11/10
[ "https://Stackoverflow.com/questions/279237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388/" ]
279,240
<p>I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?)</p> <p><strong>A concrete example</strong>: given the following XML</p> <pre><code>&lt;log&gt; &lt;entry revision="1"&gt; &lt;author&gt;J Random Hacker&lt;/author&gt; &lt;message&gt;Some pithy explanation&lt;/message&gt; &lt;/entry&gt; &lt;/log&gt; </code></pre> <p>I'd like to associate a CSS with this XML such that when viewed in a modern (WebKit, FireFox) browser, I see something like:</p> <pre><code>+----------------------------------+ | revision | 1 | +----------------------------------+ | author | J Random Hacker | +----------------------------------+ | message | Some pithy explanation| +----------------------------------+ </code></pre> <p>Where my oh-so-beautiful ascii-art is meant to indicate some table-like layout.</p> <p>That is: XML+CSS --> "pixels for user" instead of XML+XSLT --> XHTML+CSS --> "pixels for user".</p> <p>My hope is that this approach could be simpler way (for me) to present XML documents that are already document-like in their structure. I'm also just plain curious.</p>
[ { "answer_id": 279260, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 1, "selected": false, "text": "author{\n display:block;\n color:#888888;\n}\n" }, { "answer_id": 279267, "author": "Daan", ...
2008/11/10
[ "https://Stackoverflow.com/questions/279240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33412/" ]
279,269
<p>If I have data in the following format</p> <pre><code> id subid text 1 1 Hello 1 2 World 1 3 ! 2 1 B 2 2 B 2 3 Q </code></pre> <p>And would like it in this format:</p> <pre><code> id fold 1 HelloWorld! 2 BBQ </code></pre> <p>How could I accomplish it in T-SQL?</p>
[ { "answer_id": 279274, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "--initial data table\ncreate table #tmp (\n id int,\n subid int,\n txt varchar(256)\n)\n\n--populate with sa...
2008/11/10
[ "https://Stackoverflow.com/questions/279269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
279,270
<p>Which style of Ruby string quoting do you favour? Up until now I've always used <code>'single quotes'</code> unless the string contains certain escape sequences or interpolation, in which case I obviously have to use <code>"double quotes"</code>.</p> <p>However, is there really any reason not to just use double quoted strings everywhere?</p>
[ { "answer_id": 280113, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "mystring.gsub( /(fo+)bar/, '\\1baz' )\nmystring.gsub( /(fo+)bar/, \"\\\\1baz\" )" }, { "answer_id": 282567, "autho...
2008/11/10
[ "https://Stackoverflow.com/questions/279270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450/" ]
279,282
<p>Let's say I do something in Java like:</p> <pre> <code> RemoteResponse response = null; try { FutureTask task new FutureTask(....); executor.execute(task); response = task.get(1000, TimeUnits.MILLISECONDS); } catch( TimeoutException te ) { <b> .. should I do something special here? ... .. what happens to the return value of the task if task.get() throws an exception? ... .. is it ever garbage collected? .. </b> } </code> </pre> <p>My question is does something hold onto RemoteResponse in the case where TimeoutException is thrown? Will it get garbage collected? Do I have to call the cancel() method on the task for that to happen?</p>
[ { "answer_id": 279321, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 3, "selected": true, "text": "response" }, { "answer_id": 1433218, "author": "Nathan Feger", "author_id": 8563, "author_profile": "h...
2008/11/10
[ "https://Stackoverflow.com/questions/279282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095/" ]
279,293
<p>We are repurposing an application server running WebSphere 6.0.2.23. I would like to rename the various application server to better reflect its new role. </p> <p>How can you rename an application server? </p> <p>It seems like wsadmin can do it, but I'm struggling with the object hierarchy.</p>
[ { "answer_id": 2681177, "author": "ndarkduck", "author_id": 322055, "author_profile": "https://Stackoverflow.com/users/322055", "pm_score": 2, "selected": false, "text": "/usr/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ws_ant.sh \\\n-profileName AppSrv01 \\\n-buildfile exportImport.xm...
2008/11/10
[ "https://Stackoverflow.com/questions/279293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16484/" ]
279,296
<p>Given a date how can I add a number of days to it, but exclude weekends. For example, given 11/12/2008 (Wednesday) and adding five will result in 11/19/2008 (Wednesday) rather than 11/17/2008 (Monday).</p> <p>I can think of a simple solution like looping through each day to add and checking to see if it is a weekend, but I'd like to see if there is something more elegant. I'd also be interested in any F# solution.</p>
[ { "answer_id": 279316, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": -1, "selected": false, "text": "W + N % 5.\n" }, { "answer_id": 279357, "author": "LeppyR64", "author_id": 16592, "author_profile": "htt...
2008/11/10
[ "https://Stackoverflow.com/questions/279296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45/" ]
279,306
<p>Ok. I'm having an issue with the following bit of code:</p> <pre><code>StreamReader arrComputer = new StreamReader(FileDialog.FileName); </code></pre> <p>My first question had been answered already now my second question focuses on the tail end of this code.</p> <p>I'm reading a text file <code>StreamReader</code> that the user selects with a button event using <code>OpenFileDialog</code> </p> <pre><code>private void button1_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.InitialDirectory = @"C:\"; fileDialog.Filter = "Text|*.txt|All|*.*"; if (fileDialog.ShowDialog() == DialogResult.OK) ; textBox1.Text = fileDialog.FileName; buttonRun.Enabled = true; } </code></pre> <p>The later in the code the user will click a "Run" button to execute some code against each item in the list.</p> <p>I'm having problems using StreamReader to parse the list using the following code:</p> <pre><code>private void buttonRun_Click(object sender, EventArgs e) { StreamReader arrComputer = new StreamReader(FileDialog.FileName); } </code></pre> <p>This is the error I receive from my coding:</p> <pre><code>"An object reference is required for the non-static field, method, or property 'System.Windows.Forms.FileDialog.FileName.get' " </code></pre> <p>I think I understand the problem but I'm having a hard time working it out.</p>
[ { "answer_id": 279314, "author": "dnord", "author_id": 3248, "author_profile": "https://Stackoverflow.com/users/3248", "pm_score": 0, "selected": false, "text": "FileDialog" }, { "answer_id": 279322, "author": "shahkalpesh", "author_id": 23574, "author_profile": "http...
2008/11/10
[ "https://Stackoverflow.com/questions/279306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35760/" ]
279,324
<p>Im trying to find a best practice to load usercontrols using Ajax.</p> <p>My first approach where simply using an UpdatePanel and popuplating it with LoadControl() on ajax postbacks but this would rerender other loaded usercontrols in the same UpdatePanel. Also I cannot have a predefined set of UpdatePanels since the number of UserControls I need to load will vary.</p> <p>Is there any best practice for this type of scenario?</p> <p>If needed I could implement a framework or some type of custom controls if that would be a solution but I would love to do this with ASP.NET 3.5 and the AjaxControlToolkit if possible.</p>
[ { "answer_id": 279486, "author": "Morten Bergfall", "author_id": 447694, "author_profile": "https://Stackoverflow.com/users/447694", "pm_score": 4, "selected": true, "text": "$('#SomeContainer').Load(\"default.aspx?What=GimmeSomeSweetAjax\");\n" }, { "answer_id": 13636651, "a...
2008/11/10
[ "https://Stackoverflow.com/questions/279324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19264/" ]
279,326
<p>I'm working on a simple little function to download a file from an SSL-enabled website using the WinInet functions, namely InternetOpen and InternetOpenURL. I had was initially failing the call to InternetOpenURL with a <code>ERROR_INTERNET_INVALID_CA</code> (12045) because I was using a self-signed certificate on my test server, and found out (<a href="http://support.microsoft.com/kb/q182888/" rel="nofollow noreferrer">http://support.microsoft.com/kb/q182888/</a>) that the fix seemed to be to use the InternetQueryOption/InternetSetOption combination to pass various flags to <code>INTERNET_OPTION_SECURITY_FLAGS</code> option. Now, however, InternetQueryOption fails with a <code>ERROR_INTERNET_INCORRECT_HANDLE</code> (12018) response from GetLastError(). Any ideas why this would be the case? I'm using the handle that came directly from InternetOpen, which previously worked fine with a non-SSL InternetOpenURL. Shouldn't this be the correct handle?</p> <p>I don't have the actual code (different computer), but it is very similar to the following, and fails on InternetGetOption with <code>ERROR_INTERNET_INCORRECT_HANDLE</code>:</p> <pre><code> HINTERNET hReq = InternetOpen(...) if (!hReq) { printf("InternetOpen Error: %d", GetLastError()); } DWORD dwFlags = 0; DWORD dwBuffLen = sizeof(dwFlags); BOOL ret = false; ret = InternetQueryOption(hReq, INTERNET_OPTION_SECURITY_FLAGS, (LPVOID)&amp;dwFlags, &amp;dwBuffLen); if (!ret) { printf("InternetQueryOption Error: %d", GetLastError()); } dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA; ret = InternetSetOption(hReq, INTERNET_OPTION_SECURITY_FLAGS, &amp;dwFlags, sizeof (dwFlags) ); if (!ret) { printf("InternetSetOption Error: %d", GetLastError()); } InternetOpenURL(hReq, ...) </code></pre>
[ { "answer_id": 279419, "author": "bdumitriu", "author_id": 35415, "author_profile": "https://Stackoverflow.com/users/35415", "pm_score": 0, "selected": false, "text": "hReq" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,329
<p>What's the quickest way to convert a date in one format, say </p> <blockquote> <p>2008-06-01</p> </blockquote> <p>to a date in another format, say </p> <blockquote> <p>Sun 1st June 2008</p> </blockquote> <p>The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fashion. I'm running GNU bash, version <code>3.2.17(1)-release (i386-apple-darwin9.0)</code>.</p> <p>[Background: The reason that I want to do it from the command line, is that what I really want is to write it into a TextMate command... It's an annoying task I have to do all the time in textMate.]</p>
[ { "answer_id": 279340, "author": "bdumitriu", "author_id": 35415, "author_profile": "https://Stackoverflow.com/users/35415", "pm_score": 0, "selected": false, "text": "date -d yyyy-mm-dd\n" }, { "answer_id": 279352, "author": "Brian L", "author_id": 25848, "author_pro...
2008/11/10
[ "https://Stackoverflow.com/questions/279329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35961/" ]
279,359
<p>I have this Array i wrote a function MostFreq that takes an array of integers and return 2 values : the more frequent number in the array and its frequency check this code i worte what do you think ? is there a better way to do it?</p> <pre><code>static void Main() { int [] M={4,5,6,4,4,3,5,3}; int x; int f=MyMath.MostFreq(M,out x ); console.WriteLine("the most Frequent Item = {0} with frequency = {1}",x,f); } </code></pre> <p>=====</p> <p>in the class Mymath</p> <pre><code>public static int MostFreq(int[] _M, out int x) { //First I need to sort the array in ascending order int Max_Freq, No_Freq, i, k; Array.Sort(_M); k = _M[0]; Max_Freq = 0; i = 0; x = 0; while (i &lt; _M.Length) { //No_Freq= the frequency of the current number No_Freq = 0; //X here is the number which is appear in the array Frequently while (k == _M[i]) { No_Freq++; i++; if (i == _M.Length) break; } if (No_Freq &gt; Max_Freq) { //so it will be printed the same Max_Freq = No_Freq; x = k; } if (i &lt; _M.Length) k = _M[i]; } return (Max_Freq); } </code></pre>
[ { "answer_id": 279394, "author": "Nathan W", "author_id": 6335, "author_profile": "https://Stackoverflow.com/users/6335", "pm_score": 4, "selected": true, "text": "Dim i = From Numbers In ints _\n Group Numbers By Numbers Into Group _\n Aggregate feq In Group Into C...
2008/11/10
[ "https://Stackoverflow.com/questions/279359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,360
<p>I have a windows service that uses log4net. We noticed that the service in question was running painfully slow so we attached a debugger to it and stepped through. It appears that each time it tries to write an entry to the log via log4net that it takes anywhere from 10 to 30 seconds before the next line of code can execute. Obviously this adds up...</p> <p>The service is 2.0 .net We're using log4Net 1.2.0.30714. We've tested this on a machine running vista and a machine running win sever 2003 and have seen the same or similar results.</p>
[ { "answer_id": 281272, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<appender name=\"RollingFileAppender\" type=\"log4net.Appender.RollingFileAppender,log4net\">\n <file value=\"D:\\\\ROPLo...
2008/11/10
[ "https://Stackoverflow.com/questions/279360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
279,374
<p>I had the following line snippet of code that searches for a propery of an instance by name:</p> <pre><code>var prop = Backend.GetType().GetProperty(fieldName); </code></pre> <p>Now I want to ignore the case of fieldName, so I tried the following:</p> <pre><code>var prop = Backend.GetType().GetProperty(fieldName, BindingFlags.IgnoreCase); </code></pre> <p>... No dice. Now prop won't find field names that have the exact case.</p> <p>Hence..... How do I use .Net reflection to search for a property by name ignoring case?</p>
[ { "answer_id": 279395, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "BindingFlags.Public | BindingFlags.Instance" }, { "answer_id": 279402, "author": "Jeffrey Harrington", "a...
2008/11/10
[ "https://Stackoverflow.com/questions/279374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2744/" ]
279,391
<p>When developing JavaScript, I tend to separate JavaScript code out into different files and then run a script to concatenate the files and compress or pack the resulting file. In the end, I have one file that I need to include on my production site. </p> <p>This approach has usually worked, but I've started to run into a problems with prototypal inheritance. Specifically, if one class inherits from another class, the file for the parent class needs to be included already for the inheritance to work. If the concatenation script I'm using is simply concatenating a directory full of files, the child class might occur in the code before the parent class. Like this:</p> <p><em>parent_class.js</em></p> <pre><code>var Namespace = Namespace || {}; Namespace.Parent = function () { }; Namespace.Parent.prototype.doStuff = function () { ... }; </code></pre> <p><em>child_class.js</em></p> <pre><code>var NameSpace = Namespace || {}; Namespace.Child = function () { ... }; Namespace.Child.prototype = new Namespace.Parent(); </code></pre> <p>The only way this works is if parent_class.js is included before child_class.js, which might not happen if the concatenation script places the child code before the parent code. </p> <p>Is there a way to write this code so that the functionality is the same, but the order in which the code is written no longer matters?</p> <p>Edit: I forgot that I'm using namespaces as well, so I added that to the code as well, which might change things a little bit.</p>
[ { "answer_id": 279476, "author": "mercutio", "author_id": 1951, "author_profile": "https://Stackoverflow.com/users/1951", "pm_score": 3, "selected": true, "text": "01_parent.js\n02_child.js\n" }, { "answer_id": 279492, "author": "Jason Bunting", "author_id": 1790, "au...
2008/11/10
[ "https://Stackoverflow.com/questions/279391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22291/" ]
279,392
<p>My SQL table looks like this:</p> <pre><code>CREATE TABLE Page ( Id int primary key, ParentId int, -- refers to Page.Id Title varchar(255), Content ntext ) </code></pre> <p>and maps to the following class in my ActiveRecord model:</p> <pre><code>[ActiveRecord] public class Page { [PrimaryKey] public int Id { get; set; } [BelongsTo("Parent")] public virtual Page Parent { get; set; } [Property] public string Title { get; set; } [Property] public string Content { get; set; } [HasMany(typeof(Page), "Parent", "Page")] public IList&lt;Page&gt; Children { get; set; } } </code></pre> <p>I'm using ActiveRecord to retrieve the tree roots using the following code:</p> <pre><code>var rootPages = new SimpleQuery&lt;Page&gt;(@"from Page p where p.Parent is null"); return(rootPages.Execute()); </code></pre> <p>This gives me the correct object graph, but a SQL Profiler trace shows that child pages are being loaded by a separate query for every non-leaf node in the tree.</p> <p>How can I get ActiveRecord to load the whole lot up front <code>("SELECT * FROM Page")</code> and then sort the in-memory objects to give me the required parent-child relationships?</p>
[ { "answer_id": 290886, "author": "Neil Hewitt", "author_id": 22178, "author_profile": "https://Stackoverflow.com/users/22178", "pm_score": -1, "selected": false, "text": "var rootPages = new SimpleQuery<Page>(@\"from Page p left join fetch p.Children where p.Parent is null\");\nreturn(ro...
2008/11/10
[ "https://Stackoverflow.com/questions/279392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5017/" ]
279,398
<p>I have created a reference to an IIS hosted WCF service in my ASP.NET website project on my local workstation through the "Add Service Reference" option in Visual Studio 2008. I was able to execute the service from my local workstation.</p> <p>When I move the ASP.NET web site using the "Copy Web Site" feature in Visual Studio 2008 to the development server and browse to the page consuming the service, I get the following error:</p> <blockquote> <p>Reference.svcmap: Specified argument was out of the range of valid values.</p> </blockquote> <p>Has anyone experienced this same error and know how to resolve it?</p> <p><b>EDIT:</b> My development server is Win2k3 with IIS 6</p>
[ { "answer_id": 284516, "author": "Michael Kniskern", "author_id": 26327, "author_profile": "https://Stackoverflow.com/users/26327", "pm_score": 2, "selected": true, "text": "svcutil /t:code http://<service_url> /out:<file_name>.cs /config:<file_name>.config\n" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
279,404
<p>I know that in the original C++0x standard there was a feature called <code>export</code>.</p> <p>But I can't find a description or explanation of this feature. What is it supposed to do? Also: which compiler is supporting it?</p>
[ { "answer_id": 279571, "author": "Rodyland", "author_id": 10681, "author_profile": "https://Stackoverflow.com/users/10681", "pm_score": 3, "selected": false, "text": "export" }, { "answer_id": 3402843, "author": "Community", "author_id": -1, "author_profile": "https:/...
2008/11/10
[ "https://Stackoverflow.com/questions/279404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35744/" ]
279,406
<p>I have a sequential workflow with a number of Activities. One of these activities needs to access my paid S3 account. It works fine, but to be cautious, I would like to make sure it can handle unexpected situations, such as 'Host not found' or some timeout, etc.</p> <p>So .. i would normally put the code inside a TRY / CATCH. That's fine .. but i'm not sure of what i should do with the workflow .. because if the code fails to complete correctly, the rest of the workflow shouldn't occur (based on the logic of this workflow).</p> <p>So, i wanted to maybe retry the connect a few times .. and if that finally fails, call an Email Activity and terminate workflow.</p> <p>Can anyone make any suggestions, links to vid's or screenies that help show what is the best practice for this?</p> <p>cheers!</p>
[ { "answer_id": 279612, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 3, "selected": true, "text": "FaultHandlerActivity" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30674/" ]
279,410
<p>Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame? </p> <p>I'm trying to locate the corner/center points of an object (rectangle). The way I'm currently doing it, is by brute force (scanning the image for the object) and not accurate. I'm wondering if there is functionality under the hood that i'm not aware of.</p> <p><strong>Edit Details</strong>: The size about the same as a small soda can. The camera is positioned above the object, to give it a 2D/Rectangle feel. The orientation/angle from from the camera is random, which is calculated from the corner points.</p> <p>It's just a white background, with the object on it (black). The quality of the shot is about what you'd expect to see from a Logitech webcam.</p> <p>Once I get the corner points, I calculate the center. The center point is then converted to centimeters.</p> <p>It's refining just 'how' I get those 4 corners is what I'm trying to focus on. You can see my brute force method with this image: <a href="https://i.stack.imgur.com/jUV9H.png" rel="nofollow noreferrer">Image</a></p>
[ { "answer_id": 321692, "author": "Ismael C", "author_id": 41096, "author_profile": "https://Stackoverflow.com/users/41096", "pm_score": 6, "selected": true, "text": "0. rectangles <- {}\n1. image <- load image\n2. for every channel:\n2.1 image_canny <- apply canny edge detector to this ...
2008/11/10
[ "https://Stackoverflow.com/questions/279410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568/" ]
279,414
<p>Been trying to upgrade my subversion installation, but due to (what I believe) are limited rights (I'm using hosted Linux account), I'm not able to properly "./configure" and compile the source code (see posts <a href="https://stackoverflow.com/questions/189906/upgrade-subversion-143-to-152-on-debian-hosted-account">Post1</a> and <a href="https://stackoverflow.com/questions/274656/building-subversion-154-on-debian-could-not-find-library-containing-rsanew">Post2</a> if very interested)</p> <p>So, I'm thinking if I could just download <strong>pre-compiled binaries</strong>, the just might solve my problems. If you have better ideas - I'd love to hear that too!</p> <p>NB: I'm not able to call <strong>aptitude</strong> or <strong>apt-get install subversion</strong> as suggested by <a href="http://subversion.tigris.org/getting.html#debian" rel="nofollow noreferrer">subversion.tigris.com</a></p> <p><strong>I'm also interested in knowing how I would go about installing those pre-compiled binaries :)</strong></p>
[ { "answer_id": 279424, "author": "Can Berk Güder", "author_id": 2119, "author_profile": "https://Stackoverflow.com/users/2119", "pm_score": 4, "selected": true, "text": "dpkg-deb -x" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18274/" ]
279,421
<p>I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by said agency that a government bureaucrat doesn't spot that this is a reproduction. The data entered in the form is not saved anywhere or even submitted back to a web server. All that matters is that our users can easily find these forms on our intranet site and type into the form for printing with their normal keyboard.</p> <p>On the screen I want to leave the radio button as-is, to enforce and communicate radio button usage (choose only one option). However, when it prints out I need it to print with the square checkbox style rather than the round radio button style. I know how to use a media selector to set styles for print only, so that's not the issue. It's just that I don't know if I can style the radio button like I want at all. </p> <p>If I can't get this working I'm gonna have to create a checkbox to shadow each radio button, use javascript to keep the checkboxes and radio buttons in sync, and css to show the one I care about in the proper medium. Obviously if I can just style them it would save a lot of work.</p>
[ { "answer_id": 279510, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 5, "selected": false, "text": "input[type=radio] {content:url(mycheckbox.png)}\ninput[type=radio]:checked {content:url(mycheckbox-checked.png)}\n" }, ...
2008/11/10
[ "https://Stackoverflow.com/questions/279421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
279,431
<p>I'd like to find a way to do a SQL query that will calculate the cidr (bit representation) of a subnet mask stored in the database. So for example, I've got either 255.255.255.0 or its decimal value (4294967040) stored in the database. I'd like to do a select and get back /24 representation via the query.</p> <p>I've done things like the following to determine the last IP of a subnet so I'm hoping to do something similar to determine the cidr representation of a mask.</p> <pre><code>select concat(inet_ntoa(ip_addr),'-', inet_ntoa(ip_addr+(POWER(2,32)-ip_mask-1))) range from subnets order by ip_addr </code></pre> <p>Preferably this would be a SQL statement that would work under mysql, postgres, oracle etc.</p>
[ { "answer_id": 282528, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "CREATE TABLE cidr (\n bits INT UNSIGNED PRIMARY KEY,\n mask INT UNSIGNED NOT NULL\n);\n\nINSERT INTO cidr (bits) VAL...
2008/11/10
[ "https://Stackoverflow.com/questions/279431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14230/" ]
279,434
<p>I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?</p>
[ { "answer_id": 279477, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 1, "selected": false, "text": "Pexpect" } ]
2008/11/10
[ "https://Stackoverflow.com/questions/279434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35305/" ]
279,444
<p>I'm pulling email address records from a table in SQL Server 2005, and want to build a single string to use as the <code>@recipients</code> list with <code>sp_send_dbmail</code>. The table has a field called EmailAddress and there are 10 records in the table.</p> <p>I'm doing this:</p> <pre><code>DECLARE @email VARCHAR(MAX) SELECT @email = ISNULL(@email + '; ', '') + EmailAddress FROM accounts </code></pre> <p>Now @email has a semi-delimited list of 10 email address from the accounts table.</p> <p>My questions is why/how does this work? Why doesn't @email only have the last email address in the table?</p>
[ { "answer_id": 279467, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "@email" }, { "answer_id": 279490, "author": "bdumitriu", "author_id": 35415, "author_profile": "htt...
2008/11/10
[ "https://Stackoverflow.com/questions/279444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624/" ]
279,451
<p>In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control?</p> <p>If you right-click on a website project and select Property Pages, the first screen (References) lists all the project references.</p> <p>System.* references are listed as type GAC, and other DLL files can be listed as BIN or Project.</p> <p>The problem occurs when you include something as a project reference, and then commit it to source control (for us, Subversion, ignoring .dll and .pdb files.)</p> <p>Another developer gets updated code from the repository and has to manually set up all of these project references, but I can't even determine where this information is stored, unless it's in that .suo, which is NOT source-control friendly.</p>
[ { "answer_id": 279470, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 5, "selected": true, "text": "Project(\"{xxxxxxx-7377-xxxx-xxxx-BC803B73C61A}\") = \"XXXXXXX.Web\", \"XXXXXXX.Web\", \"{xxxxxxxx-BB14-xxxx-B3B6-8BF6D8...
2008/11/10
[ "https://Stackoverflow.com/questions/279451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10039/" ]
279,455
<p>On an ASP.NET page, I have a GridView populated with the results of a LINQ query. I'm setting the DataSource in code, then calling DataBind on it. In the GridView's RowDataBound event, I'm selectively hiding links in some GridView fields based on the query results. (For instance, I hide the "Show Parent" link of the row in question has no parent row.)</p> <p>This works fine initially. But on postback (when I <em>don't</em> call DataBind, but the GridView stays populated through ViewState), the data displays, but the RowDataBound event (obviously) doesn't fire, and my links don't get hidden.</p> <p>What's the best way to get the links to be hidden after a postback?</p>
[ { "answer_id": 281768, "author": "sirrocco", "author_id": 5246, "author_profile": "https://Stackoverflow.com/users/5246", "pm_score": 1, "selected": false, "text": "Visible='<%#ShowParentLink()%>'\n" }, { "answer_id": 285458, "author": "Ryan Lundy", "author_id": 5486, ...
2008/11/10
[ "https://Stackoverflow.com/questions/279455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5486/" ]
279,469
<p>I recently wrote a webservice to be used with Silverlight which uses the ASP.net membership and roles.</p> <p>To validate the client in the service I look at the HTTPContext.Current.User (Which works when the service is called from Silverlight)</p> <p>However, I've been trying to call the same service from an asp.net postback. But when I step-thru to the service the HTTPContext.Current has an emplty string for the username.</p> <p>I'm guessing there is something that I'm not doing in the web.config file which is causing the httpContext to not be sent through the proxy to my service?</p> <p>Any ideas would be appreciated. I need to be able to validate the client somehow using asp.net membership and roles and have it work from both an asp.net client and a silverlight client.</p>
[ { "answer_id": 282894, "author": "JSmyth", "author_id": 54794, "author_profile": "https://Stackoverflow.com/users/54794", "pm_score": 2, "selected": false, "text": " using (OperationContextScope scope = new OperationContextScope(ws.InnerChannel))\n {\nHttpRequestMessageProperty htt...
2008/11/10
[ "https://Stackoverflow.com/questions/279469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54794/" ]
279,472
<p>I have a form with a lot of controls on it. How can I detect when the mouse leaves the form? I've tried wiring up a MouseLeave event for every single control and the form, but that does not work because those events fire all the time as the mouse passes over controls. Is there a way that actually works.?</p>
[ { "answer_id": 279741, "author": "Eren Aygunes", "author_id": 27980, "author_profile": "https://Stackoverflow.com/users/27980", "pm_score": 4, "selected": true, "text": " protected override void OnControlAdded(ControlEventArgs e)\n {\n SubscribeEvents(e.Control);\n ba...
2008/11/10
[ "https://Stackoverflow.com/questions/279472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9382/" ]