qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
424,073
<p>How to determine if a javascript was already loaded by other html file? I want to reduce the redundant loading of the javascript files to decrease the loading time of my webpages. </p>
[ { "answer_id": 424086, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 1, "selected": false, "text": "if (!document.foo)\n{\n //your script here\n\n document.foo = true;\n}\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,092
<p>I have a MySQL Left Join problem.</p> <p>I have three tables which I'm trying to join.</p> <p>A person table:</p> <pre>CREATE TABLE person ( id INT NOT NULL AUTO_INCREMENT, type ENUM('student', 'staff', 'guardian') NOT NULL, first_name CHAR(30) NOT NULL, last_name CHAR(30) NOT NULL, gender ENUM('m', 'f') NOT NULL, dob VARCHAR(30) NOT NULL, PRIMARY KEY (id) );</pre> <p>A student table:</p> <pre>CREATE TABLE student ( id INT NOT NULL AUTO_INCREMENT, person_id INT NOT NULL, primary_guardian INT NOT NULL, secondary_guardian INT, join_date VARCHAR(30) NOT NULL, status ENUM('current', 'graduated', 'expelled', 'other') NOT NULL, tutor_group VARCHAR(30) NOT NULL, year_group VARCHAR(30) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (person_id) REFERENCES person(id) ON DELETE CASCADE, FOREIGN KEY (primary_guardian) REFERENCES guardian(id), FOREIGN KEY (secondary_guardian) REFERENCES guardian(id), FOREIGN KEY (tutor_group) REFERENCES tutor_group(name), FOREIGN KEY (year_group) REFERENCES year_group(name) );</pre> <p>And an incident table:</p> <pre>CREATE TABLE incident ( id INT NOT NULL AUTO_INCREMENT, student INT NOT NULL, staff INT NOT NULL, guardian INT NOT NULL, sent_home BOOLEAN NOT NULL, illness_type VARCHAR(255) NOT NULL, action_taken VARCHAR(255) NOT NULL, incident_date DATETIME NOT NULL, PRIMARY KEY (id), FOREIGN KEY (student) REFERENCES student(id), FOREIGN KEY (staff) REFERENCES staff(id), FOREIGN KEY (guardian) REFERENCES guardian(id) );</pre> <p>What I'm trying to select is the first name, last name and the number of incidents for each student in year 9.</p> <p>Here's my best attempt at the query: </p> <pre>SELECT p.first_name, p.last_name, COUNT(i.student) FROM person p, student s LEFT JOIN incident i ON s.id = i.student WHERE p.id = s.person_id AND s.year_group LIKE "%Year 9%";</pre> <p>However, it ignores any students without an incident which is not what I want - they should be displayed but with a count of 0. If I remove the left join and the count then I get all the students as I would expect. </p> <p>I've probably misunderstood left join but I thought it was supposed to do, essentially what I'm trying to do?</p> <p>Thanks for your help,</p> <p>Adam</p>
[ { "answer_id": 424133, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 0, "selected": false, "text": "LEFT JOIN SELECT\n p.first_name\n , p.last_name\n , (SELECT COUNT(*) FROM incident i WHERE i.student = s.id) \nFROM\n p...
2009/01/08
[ "https://Stackoverflow.com/questions/424092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52116/" ]
424,096
<p>We have three tables A, B, C.</p> <p><strong>Columns</strong></p> <p>A => id, x</p> <p>B => id, y </p> <p>C => A.id, B.id</p> <p>For every row in A there will be a row in B. To relate A and B we are using C (we cannot change the table design). We have to persist information in one transaction. Is there a way to do it using NHibernate?</p>
[ { "answer_id": 424133, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 0, "selected": false, "text": "LEFT JOIN SELECT\n p.first_name\n , p.last_name\n , (SELECT COUNT(*) FROM incident i WHERE i.student = s.id) \nFROM\n p...
2009/01/08
[ "https://Stackoverflow.com/questions/424096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19970/" ]
424,104
<h3>Disclaimer</h3> <p>Yes, I am fully aware that what I am asking about is totally stupid and that anyone who would wish to try such a thing in production code should be fired and/or shot. I'm mainly looking to see if <em>can</em> be done.</p> <p>Now that that's out of the way, is there any way to access private class members in C++ from outside the class? For example, is there any way to do this with pointer offsets?</p> <p>(Naive and otherwise non-production-ready techniques welcome)</p> <h3>Update</h3> <p>As noted in the comments, I asked this question because I wanted to write a blog post on over-encapsulation (and how it affects TDD). I wanted to see if there was a way to say &quot;using private variables isn't a 100% reliable way to enforce encapsulation, even in C++.&quot; At the end, I decided to focus more on how to solve the problem rather than why it's a problem, so I didn't feature some of the stuff brought up here as prominently as I had planned, but I still left a link.</p> <p>At any rate, if anyone's interested in how it came out, here it is: <a href="http://jasonmbaker.wordpress.com/2009/01/08/enemies-of-test-driven-development-part-i-encapsulation/" rel="noreferrer">Enemies of Test Driven Development part I: encapsulation</a> (I suggest reading it before you decide that I'm crazy).</p>
[ { "answer_id": 424125, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 5, "selected": false, "text": "#define private public\n#define class struct\n" }, { "answer_id": 424678, "author": "JaredPar", "author_id"...
2009/01/08
[ "https://Stackoverflow.com/questions/424104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
424,119
<p>I work on a web-based tool where we offer customized prints.</p> <p>Currently we build an XML structure with Java, feed it to the <a href="http://www.xmlmind.com/foconverter/" rel="noreferrer">XMLmind XSL-FO Converter</a> along with customized XSL-FO, which then produces an RTF document.</p> <p>This works fine on simple layouts, but there's some problem areas where I'd like greater control, or where I can't do what I want at all. F.ex: tables in header, footers (e.g., page numbers), columns, having a separate column setup or different page number info on the first page, etc.</p> <p>Do any of you know of better alternatives, either to XMLmind or to the way we get from data to RTF, i.e., Java-> XML, XML+XSL-> RTF? (The only practical limitation for us is the JVM.)</p>
[ { "answer_id": 11319682, "author": "user1491821", "author_id": 1491821, "author_profile": "https://Stackoverflow.com/users/1491821", "pm_score": 0, "selected": false, "text": "import com.lowagie.text.*;\nimport com.lowagie.text.html.simpleparser.HTMLWorker;\nimport com.lowagie.text.html....
2009/01/08
[ "https://Stackoverflow.com/questions/424119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8698/" ]
424,123
<p>What is the relationship between the Windows API and the C run time library?</p>
[ { "answer_id": 424139, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 3, "selected": false, "text": "kernel32.dll depends on:\n ntdll.dll\n\nuser32.dll depends on:\n gdi32.dll\n kernel32\n ntdll.dll\n advapi.dll\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52913/" ]
424,124
<p>I have an ASP.NET server control which relies on JQuery for certain functionality. I've tried to add as a webresource.</p> <p>My problem is my method of including the jquery file adds it to the body, or the form to be exact:</p> <pre><code>this.Page.ClientScript.RegisterClientScriptInclude(...) </code></pre> <p>The alternative to this is to add it as a literal in the head tag:</p> <pre><code>LiteralControl include = new LiteralControl(jslink); this.Page.Header.Controls.Add(include); </code></pre> <p>The problem with this however is any existing code srcs in the head which use JQuery fail, as JQuery is loaded afterwards (ASP.NET adds the literal at the bottom of the control tree).</p> <p>Is there a practical way of making JQuery an embedded resource, but loaded in the head first? Or should I give up now.</p>
[ { "answer_id": 424448, "author": "Crescent Fresh", "author_id": 45433, "author_profile": "https://Stackoverflow.com/users/45433", "pm_score": 3, "selected": false, "text": "[assembly: WebResource(\"<Your Server Control namespace>.jQuery.js\", \"application/x-javascript\")]\n protected ov...
2009/01/08
[ "https://Stackoverflow.com/questions/424124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21574/" ]
424,148
<p>I want to create the following element:</p> <pre><code>&lt;exercises xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;mySchema.xsd&quot;&gt; </code></pre> <p>If I use something like this:</p> <pre><code>&lt;xsl:element name=&quot;excercises&quot;&gt; &lt;xsl:attribute name=&quot;xmlns:xsi&quot; namespace=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;/&gt; </code></pre> <p>Then it creates soemthing like this:</p> <pre><code>&lt;excercises xp_0:xsi=&quot;&quot; xmlns:xp_0=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt; </code></pre> <p>Which doesn't look like what I want...</p>
[ { "answer_id": 424362, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 4, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:stylesheet version=\"1.0\" \n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\...
2009/01/08
[ "https://Stackoverflow.com/questions/424148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30759/" ]
424,151
<p>If I have a simple piece of data to store (an integer or string for example) I might choose to store that in ViewState, or using a HiddenField control.</p> <p>Why would I choose one over the other?</p> <p>ViewState</p> <ul> <li>Hard for the user to decode (thought not impossible), which might be desirable</li> </ul> <p>HiddenField</p> <ul> <li>Value can be used in JavaScript</li> </ul> <p>Are there other pros and cons?</p>
[ { "answer_id": 4717662, "author": "Shawn", "author_id": 538140, "author_profile": "https://Stackoverflow.com/users/538140", "pm_score": 1, "selected": false, "text": "string term = ((TextBox)Page.PreviousPage.FindControl(\"txtSearchTerm\")).Text;\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
424,183
<p>double TotalMinute=300.0 double TotalMinutesAdded=1378.0</p> <pre><code> double TotalMinute=300.0 double TotalMinutesAdded=1378.0 foreach(DataRow dr in ds.Tables[0].Rows) { //Add The above Timings to each Row's 2nd Column DateTime correctDate=Convert.ToDateTime(dr[2]); correctDate.AddMinutes(TotalMinute); correctDate.AddMinutes(TotalMinutesAdded); dr[2]=correctDate; }</code></pre>
[ { "answer_id": 424189, "author": "Janis Veinbergs", "author_id": 50173, "author_profile": "https://Stackoverflow.com/users/50173", "pm_score": 4, "selected": false, "text": "correctDate = correctDate.AddMinutes(TotalMinute);\n" }, { "answer_id": 424190, "author": "Todd", ...
2009/01/08
[ "https://Stackoverflow.com/questions/424183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,192
<p>I would like to provide a horizontal scroll to a textarea in my HTML page. The scroll should appear without wrapping, if I type a long line without a line break. A few friends suggested using overflow-y CSS attribute, which did not work for me. The browsers that I use are IE 6+ and Mozilla 3+.</p>
[ { "answer_id": 424211, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 3, "selected": false, "text": "overflow: scroll; \noverflow-y: scroll; \noverflow-x: scroll; \noverflow:-moz-scrollbars-vertical;\n" }, { "a...
2009/01/08
[ "https://Stackoverflow.com/questions/424192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35392/" ]
424,210
<p>As a response to the recent <a href="http://blog.wired.com/27bstroke6/2009/01/professed-twitt.html" rel="noreferrer">Twitter hijackings</a> and <a href="http://www.codinghorror.com/blog/archives/001206.html" rel="noreferrer">Jeff's post on Dictionary Attacks</a>, what is the best way to secure your website against brute force login attacks?</p> <p>Jeff's post suggests putting in an increasing delay for each attempted login, and a suggestion in the comments is to add a captcha after the 2nd failed attempt.</p> <p>Both these seem like good ideas, but how do you know what "attempt number" it is? You can't rely on a session ID (because an attacker could change it each time) or an IP address (better, but vulnerable to botnets). Simply logging it against the username could, using the delay method, lock out a legitimate user (or at least make the login process very slow for them).</p> <p>Thoughts? Suggestions?</p>
[ { "answer_id": 424222, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 6, "selected": true, "text": "userid timeOfLastFailedLogin numberOfFailedAttempts numbeOfFailedAttempts > X userid" }, { "answer_id": 41276953...
2009/01/08
[ "https://Stackoverflow.com/questions/424210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24181/" ]
424,212
<p>Is there any difference in the performance of the following three SQL statements?</p> <pre><code>SELECT * FROM tableA WHERE EXISTS (SELECT * FROM tableB WHERE tableA.x = tableB.y) SELECT * FROM tableA WHERE EXISTS (SELECT y FROM tableB WHERE tableA.x = tableB.y) SELECT * FROM tableA WHERE EXISTS (SELECT 1 FROM tableB WHERE tableA.x = tableB.y) </code></pre> <p>They all should work and return the same result set. But does it matter if the inner SELECT selects all fields of tableB, one field, or just a constant?</p> <p>Is there any best practice when all statements behave equal?</p>
[ { "answer_id": 424269, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 1, "selected": false, "text": "EXISTS" }, { "answer_id": 4115354, "author": "OMG Ponies", "author_id": 135152, "author_profile": "https...
2009/01/08
[ "https://Stackoverflow.com/questions/424212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52837/" ]
424,220
<p>You may have noticed that we now show an edit summary on Community Wiki posts:</p> <blockquote> <p>community wiki<br> 220 revisions, 48 users</p> </blockquote> <p>I'd like to also show the user who "most owns" the final content displayed on the page, as a percentage of the remaining text:</p> <blockquote> <p>community wiki<br> 220 revisions, 48 users<br> <strong>kronoz</strong> 87%</p> </blockquote> <p>Yes, there could be top (n) "owners", but for now I want the top 1.</p> <p>Assume you have this data structure, a list of user/text pairs ordered chronologically by the time of the post:</p> <pre> User Id Post-Text ------- --------- 12 The quick brown fox jumps over the lazy dog. 27 The quick brown fox jumps, sometimes. 30 I always see the speedy brown fox jumping over the lazy dog. </pre> <p><strong>Which of these users most "owns" the final text?</strong></p> <p>I'm looking for a reasonable algorithm -- it can be an approximation, it doesn't have to be perfect -- to determine the owner. Ideally expressed as a percentage score.</p> <p>Note that we need to factor in edits, deletions, and insertions, so the final result feels reasonable and right. You can use any stackoverflow post with a decent revision history (not just retagging, but frequent post body changes) as a test corpus. Here's a good one, with 15 revisions from 14 different authors. Who is the "owner"?</p> <p><a href="https://stackoverflow.com/revisions/327973/list">https://stackoverflow.com/revisions/327973/list</a></p> <p>Click "view source" to get the raw text of each revision.</p> <p>I should warn you that a pure algorithmic solution might end up being a form of the <a href="http://en.wikipedia.org/wiki/Longest_common_substring_problem" rel="nofollow noreferrer">Longest Common Substring Problem</a>. But as I mentioned, approximations and estimates are fine too if they work well.</p> <p><strong>Solutions in any language are welcome</strong>, but I prefer solutions that are</p> <ol> <li>Fairly easy to translate into c#.</li> <li>Free of dependencies. </li> <li>Put simplicity before efficiency.</li> </ol> <p>It is extraordinarily rare for a post on SO to have more than 25 revisions. But it should "feel" accurate, so if you eyeballed the edits you'd agree with the final decision. I encourage you to <strong>test your algorithm out on stack overflow posts with revision histories</strong> and see if you agree with the final output.</p> <hr> <p>I have now deployed the following approximation, which you can see in action for every <em>new</em> saved revision on Community Wiki posts</p> <ul> <li>do a <a href="http://www.mathertel.de/Diff/" rel="nofollow noreferrer">line based diff</a> of every revision where the body text changes</li> <li>sum the insertion and deletion lines for each revision as "editcount"</li> <li>each userid gets sum of "editcount" they contributed</li> <li>first revision author gets 2x * "editcount" as initial score, as a primary authorship bonus</li> <li>to determine final ownership percentage: each user's edited line count total divided by total number of edited lines in all revisions</li> </ul> <p>(There are also some guard clauses for common simple conditions like 1 revision, only 1 author, etcetera. The line-based diff makes it fairly speedy to recalc for all revisions; in a typical case of say 10 revisions it's ~50ms.)</p> <p>This works fairly well in my testing. It does break down a little when you have small 1 or 2 line posts that several people edit, but I think that's unavoidable. Accepting Joel Neely's answer as closest in spirit to what I went with, and upvoted everything else that seemed workable.</p>
[ { "answer_id": 424286, "author": "cdleary", "author_id": 3594, "author_profile": "https://Stackoverflow.com/users/3594", "pm_score": 2, "selected": false, "text": "difflib #!/usr/bin/env python\n\nimport collections\nimport difflib\nimport logging\nimport pprint\nimport urllib2\nimport r...
2009/01/08
[ "https://Stackoverflow.com/questions/424220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1/" ]
424,264
<p>I am using Jfreechart. I have the following code:</p> <pre><code>TimeSeries t1 = new TimeSeries("EUR/GBP"); t1.add(new TimeSeriesDataItem....); </code></pre> <p>But my SQL query gives date in <code>String</code> format &amp; value in <code>Double</code>. I want to use <code>TimeSeriesDataItem</code>. Please let me know how to convert my String into <code>TimeSeriesDataItem</code>. Please let me know how to add my <code>Double</code> value to <code>TimeSeriesDataItem</code>.</p> <p>Thanks in Advance.</p>
[ { "answer_id": 38387969, "author": "Aditya", "author_id": 6573889, "author_profile": "https://Stackoverflow.com/users/6573889", "pm_score": 0, "selected": false, "text": "Date String date_S = \"04-06-16\"; //your date from SQL\nDate date;\nSimpleDateFormat sdf2 = new SimpleDateFormat(\"d...
2009/01/08
[ "https://Stackoverflow.com/questions/424264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48094/" ]
424,292
<p>The JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random" rel="noreferrer"><code>Math.random()</code></a> function returns a random value between 0 and 1, automatically seeded based on the current time (similar to Java I believe). However, I don't think there's any way to set you own seed for it.</p> <p>How can I make a random number generator that I can provide my own seed value for, so that I can have it produce a repeatable sequence of (pseudo)random numbers?</p>
[ { "answer_id": 424389, "author": "Starkii", "author_id": 14720, "author_profile": "https://Stackoverflow.com/users/14720", "pm_score": 5, "selected": false, "text": "getSeconds() getMinutes()" }, { "answer_id": 424445, "author": "orip", "author_id": 37020, "author_pro...
2009/01/08
[ "https://Stackoverflow.com/questions/424292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6144/" ]
424,311
<p>We already have things like static analysis that tells us what's wrong with our code and where, so should we be endowing our IDEs with more AI features and, if so, which ones? I'm looking for ideas!</p>
[ { "answer_id": 424328, "author": "J.J.", "author_id": 21204, "author_profile": "https://Stackoverflow.com/users/21204", "pm_score": 0, "selected": false, "text": " m = 1;\n if (m > 0) {\n // do something\n } else {\n // do something else <- Never gonna happen.\n }\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9476/" ]
424,331
<p>The VB trick to get the path of the current temporary directory:</p> <pre><code>Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long </code></pre> <p>fails in VBScript. So?</p>
[ { "answer_id": 424332, "author": "Fabien", "author_id": 21132, "author_profile": "https://Stackoverflow.com/users/21132", "pm_score": 7, "selected": true, "text": "WScript.CreateObject(\"Scripting.FileSystemObject\").GetSpecialFolder(2)\n" }, { "answer_id": 424349, "author": ...
2009/01/08
[ "https://Stackoverflow.com/questions/424331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21132/" ]
424,341
<p>Are there any Java VMs which can save their state to a file and then reload that state?</p> <p>If so, which ones?</p>
[ { "answer_id": 424758, "author": "opyate", "author_id": 51280, "author_profile": "https://Stackoverflow.com/users/51280", "pm_score": 2, "selected": false, "text": "$ jps # get JVM process ID XXX\n$ gcore -o core XXX\n$ jsadebugd $JAVA_HOME/bin/java core.XXX\n" }, { "answer_id": ...
2009/01/08
[ "https://Stackoverflow.com/questions/424341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4857/" ]
424,346
<p>For a college project i'm thinking of implementing the business layer in Erlang and then accessing it via multiple front-ends using REST. I would like to avail of OTP features like distributed applications, etc.</p> <p>My question is how do I expose gen_server calls/casts to other applications? Obviously I could make RPC calls via language specific "bridges" like OTP.net or JInterface, but I want a consistent way to access it like REST.</p>
[ { "answer_id": 425004, "author": "Hynek -Pichi- Vychodil", "author_id": 49197, "author_profile": "https://Stackoverflow.com/users/49197", "pm_score": 0, "selected": false, "text": "{get, Resource}\n{set, Resource, Value} % aka PUT\n{delete, Resource}\n{add, Resource, Value} % aka POST (p...
2009/01/08
[ "https://Stackoverflow.com/questions/424346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,348
<p>I have an xml file like this: </p> <pre><code>&lt;root&gt; &lt;item&gt; &lt;name&gt;one&lt;/name&gt; &lt;status&gt;good&lt;/status&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;two&lt;/name&gt; &lt;status&gt;good&lt;/status&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;three&lt;/name&gt; &lt;status&gt;bad&lt;/status&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;four&lt;/name&gt; &lt;status&gt;ugly&lt;/status&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;five&lt;/name&gt; &lt;status&gt;bad&lt;/status&gt; &lt;/item&gt; &lt;/root&gt; </code></pre> <p>I want to transform this using XSLT to get something like: </p> <pre><code>&lt;root&gt; &lt;items&gt;&lt;status&gt;good&lt;/status&gt; &lt;name&gt;one&lt;/name&gt; &lt;name&gt;two&lt;/name&gt; &lt;/items&gt; &lt;items&gt;&lt;status&gt;bad&lt;/status&gt; &lt;name&gt;three&lt;/name&gt; &lt;name&gt;five&lt;/name&gt; &lt;/items&gt; &lt;items&gt;&lt;status&gt;ugly&lt;/status&gt; &lt;name&gt;four&lt;/name&gt; &lt;/items&gt; &lt;/root&gt; </code></pre> <p>In other words, I get a list of items, each with a status, and I want to turn it into a list of statuses, each with a list of items. </p> <p>My initial thought was to do apply-templates matching each status type in turn, but that means I have to know the complete list of statuses. Is there a better way to do it? </p> <p>Thanks for any help. </p>
[ { "answer_id": 424446, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 4, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transfo...
2009/01/08
[ "https://Stackoverflow.com/questions/424348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7211/" ]
424,354
<p>I'm trying to output a sentence containing 4 variables, with their values emboldened using the following code:</p> <pre><code>&lt;mx:Text width="100%" y="307"&gt; &lt;mx:htmlText&gt; &lt;![CDATA[Showing data from &lt;b&gt;{labelStartTime.text} {labelStartDate.text}&lt;/b&gt; to &lt;b&gt;{labelEndTime.text} {labelEndDate.text}&lt;/b&gt;]]&gt; &lt;/mx:htmlText&gt; &lt;/mx:Text&gt; </code></pre> <p>However, this just outputs the variable names, rather than their values. I'm sure I'm missing something simple, but I'd appreciate any pointers.</p> <p>Cheers.</p>
[ { "answer_id": 424446, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 4, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transfo...
2009/01/08
[ "https://Stackoverflow.com/questions/424354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4742/" ]
424,358
<p>How do I increase the default timeout to larger than 1 minute on a WCF service?</p>
[ { "answer_id": 424386, "author": "icelava", "author_id": 2663, "author_profile": "https://Stackoverflow.com/users/2663", "pm_score": 9, "selected": true, "text": "<system.serviceModel>\n <bindings>\n <netTcpBinding>\n <binding name=\"longTimeoutBinding\"\n receiveTimeout=...
2009/01/08
[ "https://Stackoverflow.com/questions/424358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
424,361
<p>When a user request comes in, I can use Context.Request.UserHostAddress to get the user's IP address. How can I get the IP address of the website/server at runtime? I have some reporting code that can be used by multiple websites on the same server, and each website uses a different IP address. So I need to be able to detect the website's IP address at runtime.</p>
[ { "answer_id": 424367, "author": "alex", "author_id": 50564, "author_profile": "https://Stackoverflow.com/users/50564", "pm_score": 4, "selected": false, "text": "System.Net.Dns.GetHostByAddress(System.Net.IPAddress.Parse(System.Web.HttpContext.Current.Request.UserHostName)).HostName;\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43722/" ]
424,366
<p>I have the following enumeration:</p> <pre><code>public enum AuthenticationMethod { FORMS = 1, WINDOWSAUTHENTICATION = 2, SINGLESIGNON = 3 } </code></pre> <p>The problem however is that I need the word "FORMS" when I ask for AuthenticationMethod.FORMS and not the id 1.</p> <p>I have found the following solution for this problem (<a href="http://www.codeproject.com/Articles/11130/String-Enumerations-in-C" rel="noreferrer">link</a>):</p> <p>First I need to create a custom attribute called "StringValue":</p> <pre><code>public class StringValue : System.Attribute { private readonly string _value; public StringValue(string value) { _value = value; } public string Value { get { return _value; } } } </code></pre> <p>Then I can add this attribute to my enumerator:</p> <pre><code>public enum AuthenticationMethod { [StringValue("FORMS")] FORMS = 1, [StringValue("WINDOWS")] WINDOWSAUTHENTICATION = 2, [StringValue("SSO")] SINGLESIGNON = 3 } </code></pre> <p>And of course I need something to retrieve that StringValue:</p> <pre><code>public static class StringEnum { public static string GetStringValue(Enum value) { string output = null; Type type = value.GetType(); //Check first in our cached results... //Look for our 'StringValueAttribute' //in the field's custom attributes FieldInfo fi = type.GetField(value.ToString()); StringValue[] attrs = fi.GetCustomAttributes(typeof(StringValue), false) as StringValue[]; if (attrs.Length &gt; 0) { output = attrs[0].Value; } return output; } } </code></pre> <p>Good now I've got the tools to get a string value for an enumerator. I can then use it like this:</p> <pre><code>string valueOfAuthenticationMethod = StringEnum.GetStringValue(AuthenticationMethod.FORMS); </code></pre> <p>Okay now all of these work like a charm but I find it a whole lot of work. I was wondering if there is a better solution for this.</p> <p>I also tried something with a dictionary and static properties but that wasn't better either.</p>
[ { "answer_id": 424380, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 8, "selected": false, "text": "Enum.GetName(Type MyEnumType, object enumvariable) \n Shipper Shipper x = Shipper.FederalExpress;\nstring s = En...
2009/01/08
[ "https://Stackoverflow.com/questions/424366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29964/" ]
424,368
<p>How would you open a file (that has a known file/app association in the registry) into a "running instance" of the application it's supposed to open in? An example would be, I have Excel open and I click on an XLS file.....the file opens up in the current Excel instance. I want to do this for a custom application...how does the eventing/messaging work that "tells" the current instance that it needs to open a file? Is there a "file watcher" that looks for a request to do so etc? Thanks.. </p>
[ { "answer_id": 424427, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 5, "selected": true, "text": "// This should all be refactored to make it less tightly-coupled, obviously.\nclass MyWindowsApplicationBase : WindowsFor...
2009/01/08
[ "https://Stackoverflow.com/questions/424368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4398/" ]
424,375
<p>This is an example of RegisterClientScriptBlock </p> <pre><code> Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "key","scriptblock", True) </code></pre> <p>Why do the method needs the type as the first parameter ? </p> <p>Thanks.</p>
[ { "answer_id": 12515593, "author": "Peter", "author_id": 15349, "author_profile": "https://Stackoverflow.com/users/15349", "pm_score": 0, "selected": false, "text": "GetType GetType typeof() Page.ClientScript.RegisterClientScriptBlock(GetType(MyClass), \"key\",\"scriptblock\", True)\n" ...
2009/01/08
[ "https://Stackoverflow.com/questions/424375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41968/" ]
424,392
<p>I and my colleagues have an intermittent problem running junit tests or tomcat from within Eclipse.</p> <p>Sometimes the tests will run. Sometimes they will not. There appears to be no pattern and we are not in sync. IE mine might run and others will fail.</p> <p>Stopping/starting Eclipse can resolve the issue (sometimes). Pulling out the network cable ALWAYS resolves the problem (while it is out).</p> <p>When it fails the following happens. On trying to run the class the Console screen appears with the red box. The console screen stays blank for about 30 seconds and then the following appears:</p> <blockquote> <p>Could not connect to: : 2083<br> java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at java.net.Socket.(Socket.java:367) at java.net.Socket.(Socket.java:180) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:560) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:377) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</p> </blockquote> <p>The port number varies. I found a forum post that told me follow this <a href="http://support.microsoft.com/kb/135982" rel="nofollow noreferrer">http://support.microsoft.com/kb/135982</a> But this did not work.</p> <p>We are all on Microsoft XP based machines connecting to the internet via an ISA server/proxy. I am running Eclipse 3.3.3 and MyEclipse 6.0.1</p> <p>Any ideas please ? </p>
[ { "answer_id": 425010, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 0, "selected": false, "text": "ClientAbortException: java.net.SocketException: Broken pipe." } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52934/" ]
424,396
<p>All of a sudden our VB ASP.Net 2.0 WebSite Project started complaining that Exception was not defined.</p> <p>I have discovered that if I add "Imports System" to the header, or explicitly use System.Exception that it works, but this error permeates a lot of other System descendants like the Data namespace, and the DateTime object. We have hundreds and hundreds of pages, so adding Imports System to all of them not only would be time consuming, but it seems like a band-aid fix to the problem.</p> <p>I have checked the Project->Property Pages->References, and the web.config file, and the assembly is imported into the project, it is just not being "Auto Imported" into the Class Files like it USUALLY is. Note this does not JUST affect CodeBehind, but All className.vb files.</p> <p>I would like to fix this problem, but more importantly would like to understand what could cause the System namespace to all of a sudden stop being auto imported. There is obviously some file change that caused this, as my co-worker started seeing the problem this morning after he did a Full-Get on the project.</p> <p>MORE: The Web.Config file located in the Windows\Microsoft.Net...\Config\Web.Config file does have the , and System is added. Adding the tags, and adding System to the LOCAL web.config did nothing to mitigate the problem. </p> <p>Any help would be appreciated. First SO Question, so I hope I was descriptive enough.</p>
[ { "answer_id": 424406, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "<pages> <system.web> <pages>\n <namespaces>\n <add namespace=\"System\"/>\n <add namespace=\"System.Data\"/>\...
2009/01/08
[ "https://Stackoverflow.com/questions/424396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52935/" ]
424,405
<p>I have wish to have a table where all borders (internal/external) are a single pixel in width, I achieve this by setting the <code>border-collapse</code> style on the table.</p> <p>Then I wish to <code>onmouseover</code> each TD cell, changing the <code>border-color</code> to a different color. This works fine if the table border has not been collapsed. But if you collapse the border then it fails to work.</p> <p>However if I don't collapse the border then I can't get a single pixel width border!</p> <p>So is this impossible?</p> <p>EDIT: To clarify, when using border-collapse, and setting TD border color, only the right and bottom border are set.</p> <p>EDIT EDIT: I ended up implementing this changing the background on mouseover. The background GIF is a white box with a border. UUUUGGH! Works perfectly in all browsers though ...</p>
[ { "answer_id": 1909230, "author": "silentmouth", "author_id": 232317, "author_profile": "https://Stackoverflow.com/users/232317", "pm_score": 2, "selected": false, "text": "table { border-collapse: collapse; }\ntable td { border: solid 1px gray; }\ntable td:hover { border: none; outline:...
2009/01/08
[ "https://Stackoverflow.com/questions/424405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,407
<p>I want to handle F1-F12 keys using JavaScript and jQuery.</p> <p>I am not sure what pitfalls there are to avoid, and I am not currently able to test implementations in any other browsers than Internet Explorer 8, Google Chrome and Mozilla FireFox 3.</p> <p>Any suggestions to a full cross-browser solution? Something like a well-tested jQuery library or maybe just vanilla jQuery/JavaScript?</p>
[ { "answer_id": 8803019, "author": "matsev", "author_id": 303598, "author_profile": "https://Stackoverflow.com/users/303598", "pm_score": 6, "selected": false, "text": "shortcut.add(\"F1\", function() {\n alert(\"F1 pressed\");\n});\n shortcut.add(\"Ctrl+Shift+A\", function() {\n al...
2009/01/08
[ "https://Stackoverflow.com/questions/424407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20946/" ]
424,412
<p>I am running into the same problem as in this question:</p> <p><a href="https://stackoverflow.com/questions/22879/how-do-you-prevent-leading-zeros-from-being-stripped-when-importing-an-excel-doc">How do you prevent leading zeros from being stripped when importing an excel doc using c#</a></p> <p>But I am not sure if that is the best solution for my scenario. Here is the code I am using to do the export. Does anyone know what I can change to prevent the leading 0's from being stripped off?</p> <pre><code>private static void Export_with_XSLT_Web(DataSet dsExport, string[] sHeaders, string[] sFileds, ExportFormat FormatType, string FileName) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + FileName); } // XSLT to use for transforming this dataset. MemoryStream stream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8); CreateStylesheet(writer, sHeaders, sFileds, FormatType); writer.Flush(); stream.Seek(0, SeekOrigin.Begin); XmlDataDocument xmlDoc = new XmlDataDocument(dsExport); XslTransform xslTran = new XslTransform(); xslTran.Load(new XmlTextReader(stream), null, null); using(StringWriter sw = new StringWriter()) { xslTran.Transform(xmlDoc, null, sw, null); HttpContext.Current.Response.Write(sw.ToString()); writer.Close(); stream.Close(); HttpContext.Current.Response.End(); } } } </code></pre> <p>Here is the method that creates the stylesheet, is there anything in here that I can change to bring in some or all fields as text.</p> <pre><code>private static void CreateStylesheet(XmlTextWriter writer, string[] sHeaders, string[] sFileds, ExportFormat FormatType) { try { // xsl:stylesheet string ns = "http://www.w3.org/1999/XSL/Transform"; writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("xsl", "stylesheet", ns); writer.WriteAttributeString("version", "1.0"); writer.WriteStartElement("xsl:output"); writer.WriteAttributeString("method", "text"); writer.WriteAttributeString("version", "4.0"); writer.WriteEndElement(); // xsl-template writer.WriteStartElement("xsl:template"); writer.WriteAttributeString("match", "/"); // xsl:value-of for headers for(int i = 0; i &lt; sHeaders.Length; i++) { writer.WriteString("\""); writer.WriteStartElement("xsl:value-of"); writer.WriteAttributeString("select", "'" + sHeaders[i] + "'"); writer.WriteEndElement(); // xsl:value-of writer.WriteString("\""); } // xsl:for-each writer.WriteStartElement("xsl:for-each"); writer.WriteAttributeString("select", "Export/Values"); writer.WriteString("\r\n"); // xsl:value-of for data fields for(int i = 0; i &lt; sFileds.Length; i++) { writer.WriteString("\""); writer.WriteStartElement("xsl:value-of"); writer.WriteAttributeString("select", sFileds[i]); writer.WriteEndElement(); // xsl:value-of writer.WriteString("\""); } writer.WriteEndElement(); // xsl:for-each writer.WriteEndElement(); // xsl-template writer.WriteEndElement(); // xsl:stylesheet writer.WriteEndDocument(); } catch(Exception Ex) { throw Ex; } } </code></pre>
[ { "answer_id": 424492, "author": "Fabrizio C.", "author_id": 49582, "author_profile": "https://Stackoverflow.com/users/49582", "pm_score": 3, "selected": true, "text": "<Row>\n <Cell><Data ss:Type=\"Number\">7</Data></Cell>\n</Row>\n<Row>\n <Cell><Data ss:Type=\"String\" x:Ticked=\...
2009/01/08
[ "https://Stackoverflow.com/questions/424412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
424,422
<p>So I'm newly in charge of projects at my company (We're still only 2 guys, but we're growing) and I want to set up my projects the right way.</p> <p>All my projects are in an SVN repo already, I've got bug tracking software set up, but what I'm looking for is the best way to layout a new project with tests, SVN, and a build server. I want to set up all our new projects for CI, but I'm not sure exactly how to lay everything out so it as smooth as possible.</p> <p>I know I need:</p> <ul> <li>A build server</li> <li>All build/testing materials in the SVN repo (including DB schema)</li> <li>A project layout that's conducive to CI</li> </ul> <p>How do you guys set up your projects? I want to use MSBuild for my build server, since everything is already set up that way thanks to VS, but I'm also looking for tips on how files should be laid out, how projects should be laid out in a solution, etc. As it stands, I've got about 5 projects in my solution, one of which is the testing project that contains all the tests for the rest of my projects. Is this the preferred method?</p> <p>How about layout inside your repository? Where do you keep your DB related stuff? Specs and documents?</p> <p>Do you use any particular software for CI, or just follow the "Continuous integration is more like a state of mind" mantra?</p> <p>In general, I'm looking for tips on getting a new project off the ground the right way, so everything proceeds as smooth as possible later on, as well as being easy for new developers to get acquainted to.</p>
[ { "answer_id": 444747, "author": "danswain", "author_id": 30861, "author_profile": "https://Stackoverflow.com/users/30861", "pm_score": 1, "selected": false, "text": "(SVN REPO)\n/trunk\n MyProject <-- solution & .build file (i use nant or msbuild)\n conf <-- IIS Settings etc go her...
2009/01/08
[ "https://Stackoverflow.com/questions/424422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12624/" ]
424,443
<p>When working an interactive bash session, one aspect from the Windows shell I miss is the <kbd>F8</kbd> key where you start typing a command, hit <kbd>F8</kbd> and the shell finds the most recent command entered in history that matches what you have typed so far. e.g.</p> <pre><code>me@Ubntu07:~&gt;cd /home/jb&lt;F8 Key Here&gt; </code></pre> <p>brings up my prior command:</p> <pre><code>me@Ubntu07:~&gt;cd /home/jboss/server/default/log </code></pre> <p>Is there any way to do this in bash ?</p>
[ { "answer_id": 424458, "author": "JeeBee", "author_id": 17832, "author_profile": "https://Stackoverflow.com/users/17832", "pm_score": 2, "selected": false, "text": "!jb $ nano logconfig.properties\n$ !n\nnano logconfig.properties\n$\n" }, { "answer_id": 424482, "author": "mip...
2009/01/08
[ "https://Stackoverflow.com/questions/424443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43786/" ]
424,450
<p>Does anyone know a good website that summarises what you can do with code blocks (i.e. &lt;% &lt;%= &lt;%# etc) in ASP.Net?</p> <p>Thanks.</p>
[ { "answer_id": 424498, "author": "Aaron Hoffman", "author_id": 47226, "author_profile": "https://Stackoverflow.com/users/47226", "pm_score": 2, "selected": false, "text": "<% - any code\n\n<%= - shortcut for Response.Write() \n\n<%# - is for binding\n\n<%-- - is for commen...
2009/01/08
[ "https://Stackoverflow.com/questions/424450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
424,454
<p>I need to check a string to see if any word in it has multiple occurences. So basically I will accept:</p> <p>"google makes love"</p> <p>but I don't accept:</p> <p>"google makes google love" or "google makes love love google" etc.</p> <p>Any ideas? Really don't know any way to approach this, any help would be greatly appreciated.</p>
[ { "answer_id": 424473, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "function Accept($str)\n{\n $words = explode(\" \", trim($str));\n $len = count($words);\n for ($i = 0; $i < $len; $i+...
2009/01/08
[ "https://Stackoverflow.com/questions/424454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26823/" ]
424,455
<p>This is my first post and I'm quite a novice on C++ and compiling in general.</p> <p>I'm compiling a program which requires some graphs to be drawn. The program create a <em>.dat file and then i should open gnuplot and write plot '</em>.dat'. That's fine.</p> <p>Is there a way to make gnuplot automatically open and show me the plot I need? I should use some system() function in the code to call gnuplot but how can I make him plot what I need?</p> <p>Sorry for my non-perfect English :s</p> <p>Thanks for the attention anyway!</p>
[ { "answer_id": 424483, "author": "flolo", "author_id": 36472, "author_profile": "https://Stackoverflow.com/users/36472", "pm_score": 2, "selected": false, "text": " gnuplot file\n" }, { "answer_id": 424706, "author": "KeithB", "author_id": 2298, "author_profile": "...
2009/01/08
[ "https://Stackoverflow.com/questions/424455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52011/" ]
424,457
<p>I have read a lot of articles on Dependency Injection as well as watched a lot of videos, but I still can't get my head around it. Does anyone have a good analogy to explain it?</p> <p>I watched the first part of the Autumn of Agile screencast and still was a little confused.</p>
[ { "answer_id": 424518, "author": "Peter Hilton", "author_id": 2670, "author_profile": "https://Stackoverflow.com/users/2670", "pm_score": 1, "selected": false, "text": "Girl Boy BoyFactory" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
424,468
<p>I have added the footer <strong><em>Page x of y</em></strong> to my report, but the PAGE_COUNT doesn't seem to work.</p> <p>Maybe the problem occurs because I have many subreports?</p> <p>I get:</p> <pre><code>Page 1 of 1 Page 2 of 0 Page 3 of 0 Page 4 of 0 </code></pre> <p>Any ideas?</p>
[ { "answer_id": 425056, "author": "chburd", "author_id": 53009, "author_profile": "https://Stackoverflow.com/users/53009", "pm_score": 2, "selected": false, "text": "evaluationTime=\"Now\" evaluationTime=\"Report\"" }, { "answer_id": 3940838, "author": "Kwex", "author_id":...
2009/01/08
[ "https://Stackoverflow.com/questions/424468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,469
<p>I am trying to minify a few files with YUI compressor. However, I seem to be getting an error on 2 lines of code, which prevents compression. The .js file for <a href="http://www.gmarwaha.com/jquery/jcarousellite/" rel="noreferrer">jcarouselLite</a> contains 1 error, and my own code contains the other.</p> <p>I have narrowed it down and in both occasions it looks like the the float property used in jQuery is causing this. The line is:</p> <pre><code>li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); (jcarousellite) $("#now-playing .js-kit-rating div:first").css({width: "80px", float: "right"}).addClass("clearing"); (own code) </code></pre> <p>A working example of the error can be seen by running the <a href="http://www.gmarwaha.com/jquery/jcarousellite/js/jcarousellite_1.0.1.js" rel="noreferrer">jCarouselLite code</a> through the YUI compressor, but basically the error returned is invalid property id. </p> <p>Has anyone had similar issues with the YUI compressor?</p>
[ { "answer_id": 424489, "author": "Crescent Fresh", "author_id": 45433, "author_profile": "https://Stackoverflow.com/users/45433", "pm_score": 6, "selected": false, "text": "li.css({overflow: \"hidden\", \"float\": o.vertical ? \"none\" : \"left\"});\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47378/" ]
424,516
<p>I am looking at improving a package that I believe not to be threadsafe when its input is shared between multiple worker threads. According to TDD principles, I should write some tests that fail in the first instance, and these would certainly be useful in assessing the problem.</p> <p>I realise that this is not a simple thing to acheive, and that naively, multi-threaded tests will be nondeterministic as the operating system will determine scheduling and the exact order that various operations are interleaved. I have looked at and used <a href="http://www.cs.umd.edu/projects/PL/multithreadedtc/overview.html" rel="noreferrer">MultithreadedTC</a> in the past, and this was useful. However, in that case I knew in advance exactly where the existing implementation fell down, and thus was able to cook up a nice set of tests that covered it.</p> <p>However, if you're not at the point where you know exactly what the problem is, is there a good way of going about writing a test that stands a good chance of throwing up any potential problems? Are there any libraries that others have found helpful? Would I be right in thinking that from a purist point of view, a multi-threaded test case should just be the same calls and assertions as the usual single-threaded test, only run with multiple worker threads as appropriate?</p> <p>Any offers on tools/best practices/philosophy in general would be welcome.</p>
[ { "answer_id": 14781472, "author": "MiguelMunoz", "author_id": 2028066, "author_profile": "https://Stackoverflow.com/users/2028066", "pm_score": 4, "selected": false, "text": "public void testForThreadClash() {\n final CountDownLatch latch = new CountDownLatch(1);\n for (int i=0; i<50;...
2009/01/08
[ "https://Stackoverflow.com/questions/424516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45664/" ]
424,517
<p>I am currently writing some unit tests for a business-logic class that includes validation routines. For example:</p> <pre><code>public User CreateUser(string username, string password, UserDetails details) { ValidateUserDetails(details); ValidateUsername(username); ValidatePassword(password); // create and return user } </code></pre> <p>Should my test fixture contain tests for every possible validation error that can occur in the Validate* methods, or is it better to leave that for a separate set of tests? Or perhaps the validation logic should be refactored out somehow?</p> <p>My reasoning is that if I decide to test for all the validation errors that can occur within CreateUser, the test fixture will become quite bloated. And most of the validation methods are used from more than one place...</p> <p>Any great patterns or suggestions in this case?</p>
[ { "answer_id": 424820, "author": "Rinat Abdullin", "author_id": 47366, "author_profile": "https://Stackoverflow.com/users/47366", "pm_score": 0, "selected": false, "text": "[Test]\npublic void Test()\n{\n ShouldPass(\"rinat.abdullin@lokad.com\", \"pwd\", \"http://ws.lokad.com/TimeSerieS...
2009/01/08
[ "https://Stackoverflow.com/questions/424517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30056/" ]
424,522
<p>I have dates in the format <code>2008-12-23T00:00:00Z</code>. This look a lot like a <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">ISO 8601 format</a> with a Zulu (UTC) timezone. I though the following code would parse it (using <a href="http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/DateFormatUtils.html#ISO_DATETIME_TIME_ZONE_FORMAT" rel="noreferrer">commons-lang</a>) :</p> <pre><code>String pattern = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(); Date d = DateUtils.parseDate(dateToParse, new String[] { pattern }); </code></pre> <p>If I take the same pattern (<code>yyyy-MM-dd'T'HH:mm:ssZZ</code>) but remove the timezone, it works.</p> <p>Do you know how I can recognize the Zulu timezone ? I have access only to Java 1.4 and Jakarta commons-lang. No <a href="http://www.joda.org/joda-time/" rel="noreferrer">Joda Time</a> for me yet ...</p>
[ { "answer_id": 424554, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 3, "selected": true, "text": "FastDateFormat" }, { "answer_id": 424668, "author": "Argelbargel", "author_id": 2992, "author...
2009/01/08
[ "https://Stackoverflow.com/questions/424522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23704/" ]
424,524
<p>I was working with a online game website. There are some event which call a javascript function and the function have some action with callback. </p> <p>something like this,</p> <pre><code> &lt;input type="button" onclick="changeSomething"/&gt; function changeSomething() { /// some call back, which changes something } </code></pre> <p>now anybody who knows this can call this changeSomething from the address bar of the browser, which I do not want. </p> <p>Very unlikely that somebody will do it, but I want to allow it. </p> <p>Is there anyway to prevent situation like this ?</p> <p>Thanks.</p> <p>P.S. I tried, but still not sure whether I explained it well enought. Please let me know if you are not getting something.</p>
[ { "answer_id": 424543, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": -1, "selected": false, "text": "<input id=\"good' type=\"button\" onclick=\"changeSomething(this.id)\"/>\n\n function changeSomething(...
2009/01/08
[ "https://Stackoverflow.com/questions/424524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41968/" ]
424,545
<p>Is it possible to force a column in a SQL Server 2005 table to a certain value regardless of the value used in an insert or update statement is? Basically, there is a bug in an application that I don't have access to that is trying to insert a date of 1/1/0001 into a datetime column. This is producing a SqlDateTime overflow exception. Since this column isn't even used for anything, I'd like to somehow update the constraints on the columns or something in the database to avoid the error. This is obviously just a temporary emergency patch to avoid the problem... Ideas welcome...</p>
[ { "answer_id": 424619, "author": "Nick", "author_id": 52889, "author_profile": "https://Stackoverflow.com/users/52889", "pm_score": 2, "selected": true, "text": "CREATE TRIGGER T_InsertInventory ON CurrentInventory\nINSTEAD OF INSERT AS\nBEGIN\nINSERT INTO Inventory (PartNumber, Descript...
2009/01/08
[ "https://Stackoverflow.com/questions/424545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,549
<p>Can you guys tell me the difference between them?</p> <p>By the way, is there something called C++ library or C library?</p>
[ { "answer_id": 424653, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 6, "selected": true, "text": "C++ Standard Library C Standard Library C++ Runtime Library C Runtime Library std::type_info C++ Library C L...
2009/01/08
[ "https://Stackoverflow.com/questions/424549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52913/" ]
424,560
<p>I have some JSON data from a web service which gives me data like the following</p> <pre><code>blah blah &lt;greek&gt;a&lt;/greek&gt; </code></pre> <p>I need to be able to convert what is inside the greek tags into their symbol equivalent, using javascript.</p> <p>Any ideas?</p>
[ { "answer_id": 424695, "author": "chills42", "author_id": 23855, "author_profile": "https://Stackoverflow.com/users/23855", "pm_score": 0, "selected": false, "text": "// The difference between standard ascii and greek\nvar diff = 913-65;\nvar originalString = \"A\";\nvar charCode = x.cha...
2009/01/08
[ "https://Stackoverflow.com/questions/424560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
424,561
<p>I have a Java application running on a Websphere application server. When I analyse the system crash core dump file, I get some info like this:</p> <pre><code>ERROR: Symbol file could not be found. Defaulted to export symbols for J9THR23.dll </code></pre> <p>How can I get symbol files for Java?</p> <p>Thanks in advance.</p> <p>More details are here:</p> <pre><code>******************************************************************************* * * * Exception Analysis * * * ******************************************************************************* *** ERROR: Symbol file could not be found. Defaulted to export symbols for J9THR23.dll - ************************************************************************* *** *** *** *** *** Your debugger is not using the correct symbols *** *** *** *** In order for this command to work properly, your symbol path *** *** must point to .pdb files that have full type information. *** *** *** *** Certain .pdb files (such as the public OS symbols) do not *** *** contain the required information. Contact the group that *** *** provided you with these symbols if you need this command to *** *** work. *** *** *** *** Type referenced: ntdll!_PEB *** *** *** ************************************************************************* *** ERROR: Symbol file could not be found. Defaulted to export symbols for j9jit23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for java.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for j9gc23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for jvm.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for jclscar_23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for j9ute23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for J9PRT23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for j9vm23.dll - *** ERROR: Symbol file could not be found. Defaulted to export symbols for DBGHELP.DLL - </code></pre> <p>Alice Gong</p>
[ { "answer_id": 425028, "author": "agnul", "author_id": 6069, "author_profile": "https://Stackoverflow.com/users/6069", "pm_score": 2, "selected": false, "text": "-g" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52950/" ]
424,562
<p>I have a grid laid out like so;</p> <pre><code>+---------+---------+ | Image | Details | | is | pane | | here | for data| | | entry | +---------+---------+ | ListView here to | | select data item | | for top two panes | +---------+---------+ </code></pre> <p>This all works well, but I would now like to change the image to another set of controls saying 'Sorry, no image available' when the selected item in the listview does not have an image</p> <p>I've tried wrapping the image in a DockPanel and setting a DataTemplate there (so I can use DataTriggers) but IntelliSense says no!</p> <p>The ListView uses DataTriggers to do a similar thing, but as I say I can't get my head round how to do it for a single image that does not seem to have access to a DataTemplate. </p> <p>Simplified XAML is below;</p> <pre><code>&lt;Grid DataContext="{Binding Source={StaticResource MyData}}"&gt; &lt;!-- row 0 col 0 --&gt; &lt;Image x:Name="imgPhoto" Source="{Binding ElementName=MyListViewOfData, Path=SelectedItem.PathToImageOnDisk}" /&gt; &lt;!-- row 0 col 1 --&gt; &lt;StackPanel DataContext="{Binding ElementName=MyListViewOfData, Path=SelectedItem}"&gt; &lt;TextBox Name="NameTextBox" Text="{Binding Name}" /&gt; &lt;TextBlock Name="DateCreatedTextBlock" Text="{Binding DateCreated}" /&gt; &lt;/StackPanel&gt; &lt;!-- row 1 cols 0,1 --&gt; &lt;ListView ItemsSource="{Binding}" ItemTemplate="{StaticResource MyListViewTemplate}" IsSynchronizedWithCurrentItem="True" Name="MyListViewOfData" /&gt; &lt;/Grid&gt; </code></pre> <p>Thanks in advance WPF gurus.</p> <p>Ryan</p> <p>Update: Both answers below (Abe and Jobi) were spot on, thanks.</p>
[ { "answer_id": 425220, "author": "Abe Heidebrecht", "author_id": 9268, "author_profile": "https://Stackoverflow.com/users/9268", "pm_score": 3, "selected": true, "text": "<Grid DataContext=\"...\">\n <ContentPresenter Content=\"{Binding SelectedItem, ElementName=MyListViewOfData}\">\n...
2009/01/08
[ "https://Stackoverflow.com/questions/424562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26221/" ]
424,564
<p>if i have data as follows</p> <p>A | 01/01/2008 00:00:00</p> <p>B | 01/01/2008 01:00:00</p> <p>A | 01/01/2008 11:59:00</p> <p>C | 02/01/2008 00:00:00</p> <p>D | 02/01/2008 01:00:00</p> <p>D | 02/01/2008 20:00:00</p> <p>I want to only select the records whose identifiers (A, B, C or D) have occured twice within a 12 hour period. In this example above this would only be 'A'</p> <p>Can anyone help please (this is for an Oracle data base)</p> <p>Thanks</p> <p>M</p>
[ { "answer_id": 424577, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 3, "selected": false, "text": " Select Distinct A.Identifer \n From Table A\n Join Table B -- EDIT to eliminate self Joins (to same row)\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,587
<p>consider the following http request:</p> <pre><code>GET /defects?group-by=priority </code></pre> <p>I would like the returned collection(feed) of defects to be grouped by their priority. i.e. the returned feed consists of defects(resources) and group infromation.</p> <p>I thought about something that will return the groups' titles and count before returning the collection, for example:</p> <pre><code>&lt;content&gt; &lt;Group val="High" count="567"/&gt; &lt;Group val="Medium" count="437"/&gt; &lt;Group val="Low" count="19"/&gt; &lt;Defect ,,,,&gt; &lt;Defect ,,,,&gt; &lt;Defect ,,,,&gt; &lt;/content&gt; </code></pre> <p>The problem with such representation is that the queried resource (URL) is defect so the client expects collection of Defects and not the Group element.</p> <p>I guess one option for solving this problem would be to define a separate groups resource for defects i.e.:</p> <pre><code> defects/groups?group1=priority </code></pre> <p>that will return collection of groups and their count, and then the client can query the defects resource for the data itself. But this design is cumbersome and requires extra round trips, not to mention possible consistency problems when defects was added\removed between the call to the group resource and the defects resource. </p> <p>Bottom line, what is the restful way to return a collection of elements grouped by an attribute?</p> <p><strong>EDIT</strong> I first thought of that this problem should be addressed by the ATOM publishing standard. But even if ATOM had addressed it, I still need to support other representations (XML, JSON) so I am looking for a pattern more inherent in the RESTful approach.</p>
[ { "answer_id": 428467, "author": "DanSingerman", "author_id": 43965, "author_profile": "https://Stackoverflow.com/users/43965", "pm_score": 4, "selected": true, "text": "a group of defects != a defect\n" }, { "answer_id": 55448727, "author": "xshen", "author_id": 6313229,...
2009/01/08
[ "https://Stackoverflow.com/questions/424587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52954/" ]
424,588
<p>In my project I have put all my css classes in the style sheets. </p> <p>The structure I am following was </p> <p>Have a global.css file, which will have all the global styles. And then for each .aspx page one style sheet which will be particular for that file. </p> <p>Although I am talking about the asp.net this should not make any difference to any other web development environment, I guess.</p> <p>Is this way of structuring the css files OK ? How do others arrange their css files, and why ? </p> <p>Thanks.</p> <p><em>Related Question</em></p> <p><a href="https://stackoverflow.com/questions/72911/whats-the-best-way-to-organize-css-rules">What's the best way to organize CSS Rules</a></p>
[ { "answer_id": 425262, "author": "Bryan M.", "author_id": 4636, "author_profile": "https://Stackoverflow.com/users/4636", "pm_score": 0, "selected": false, "text": "#left-column" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41968/" ]
424,598
<p>I'm trying to get a handle on the amount of memory overhead associated with a .NET DataTable, and with individual DataRows within a table.<br> In other words, how much more memory does a data table occupy than what would be needed simply to store a properly typed array of each column of data?<br> I guess there will be some basic table overhead, plus some amount per column, and then again an additional amount per row. </p> <p>So can anyone give an estimate (and, I guess, explanation!) of each/any of these three kinds of overhead?</p>
[ { "answer_id": 424641, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "DataTable DataTable List<T> BindingList<T> // takes **roughly** 112Mb (taskman)\n List<DataTable> tables = new...
2009/01/08
[ "https://Stackoverflow.com/questions/424598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52955/" ]
424,606
<p>I typically use the below function to return the root URL if I ever need this, but thought to ask if jQuery had a "one liner" way to do this ...</p> <pre><code>function getRootURL() { var baseURL = location.href; var rootURL = baseURL.substring(0, baseURL.indexOf('/', 7)); // if the root url is localhost, don't add the directory as cassani doesn't use it if (baseURL.indexOf('localhost') == -1) { return rootURL + "/AppName/"; } else { return rootURL + "/"; } } </code></pre>
[ { "answer_id": 424643, "author": "meouw", "author_id": 12161, "author_profile": "https://Stackoverflow.com/users/12161", "pm_score": 5, "selected": true, "text": "document.location.hostname\n" }, { "answer_id": 424649, "author": "Leandro Ardissone", "author_id": 42565, ...
2009/01/08
[ "https://Stackoverflow.com/questions/424606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2701/" ]
424,626
<p>Ok. So I am pretty new a this. I have a datatable that I want to pass to a stored procedure for further manipulation. I have read some stuff on the web and it looks like I should be able to convert the datatable to XML and then pass that to the stored procedure. What am I doning wrong? I have SQL server 2005. The data never gets passed to the stored procedure.</p> <pre><code>Sub Test() Dim dt As New DataTable Fill datatable code omitted. there are 150 rows in the datatable after this Dim ds As New DataSet ds.Tables.Add(dt) Dim x As XmlDocument x.LoadXml(dt.DataSet.GetXml) Dim ta As New dsTestTableAdapters.TESTRxTableAdapter ta.ProcessFile(x) End Sub </code></pre> <p>The Stored procedure looks like this...</p> <pre><code>ALTER PROCEDURE [dbo].[ProcessFile] ( @x XML ) AS BEGIN 'DO STUFF HERE END </code></pre>
[ { "answer_id": 424643, "author": "meouw", "author_id": 12161, "author_profile": "https://Stackoverflow.com/users/12161", "pm_score": 5, "selected": true, "text": "document.location.hostname\n" }, { "answer_id": 424649, "author": "Leandro Ardissone", "author_id": 42565, ...
2009/01/08
[ "https://Stackoverflow.com/questions/424626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14780/" ]
424,669
<p>I would like to add an operator to a class. I currently have a <code>GetValue()</code> method that I would like to replace with an <code>[]</code> operator.</p> <pre><code>class A { private List&lt;int&gt; values = new List&lt;int&gt;(); public int GetValue(int index) =&gt; values[index]; } </code></pre>
[ { "answer_id": 424677, "author": "Florian Greinacher", "author_id": 31985, "author_profile": "https://Stackoverflow.com/users/31985", "pm_score": 11, "selected": true, "text": "public int this[int key]\n{\n get => GetValue(key);\n set => SetValue(key, value);\n}\n" }, { "an...
2009/01/08
[ "https://Stackoverflow.com/questions/424669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
424,680
<p>Need to find a way to upload files to my server through FTP. But only the ones that have been modified. Is there a simple way of doing that? Command line ftp client or script is preferred. Thanks, Jonas. </p>
[ { "answer_id": 424960, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 2, "selected": false, "text": "ftp rsync ftp rsync rsync" }, { "answer_id": 29494308, "author": "mirek", "author_id"...
2009/01/08
[ "https://Stackoverflow.com/questions/424680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52965/" ]
424,699
<p>I have an entity Customer</p> <pre><code>public class Customer { public virtual int ID { get; set; } public virtual string Firstname { get; set; } public virtual string Lastname { get; set; } } </code></pre> <p>and my DAL method is :</p> <pre><code> public IList&lt;Customer&gt; GetCustomers(Customer example) { var customers = default(IList&lt;Customer&gt;); using (var sessiong = GetSession()) { customers = sessiong.CreateCriteria(typeof(Customer)) .Add(Example.Create(example)) .List&lt;Customer&gt;(); } return customers; } </code></pre> <p>but the problem is that when I call my method like this</p> <pre><code> var exemple = new Customer() { ID = 2 }; var customers = provider.GetCustomers(exemple); </code></pre> <p>I have a collection of all my customers in the database because NHibernate generates the following SQL query</p> <pre><code>NHibernate: SELECT this_.CustomerId as CustomerId0_0_, this_.Firstname as Firstname0_0_, this_.Lastname as Lastname0_0_ FROM Customers this_ WHERE (1=1) </code></pre> <p>NHibernate supports QBE on primary key ? What am I doing wrong ? </p> <p>P.S. I've forgotten to mention the version of NHibernate that I'm using. It's 2.0.1.GA.</p>
[ { "answer_id": 49786438, "author": "neoscribe", "author_id": 1148240, "author_profile": "https://Stackoverflow.com/users/1148240", "pm_score": 0, "selected": false, "text": " criteria.Add(example);\n //HACK: Check for ID query and force NHibernate to take it\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42377/" ]
424,705
<p>I have a search page with parameters at the top and a search button with results at the bottom. The entire thing is wrapped in an update panel inside the master page. After clicking the search button it shows the first page. However if you click the next button on the DataPager it does not show the second page. It shows no results for the second page. Any help would be greatly appreciated.</p>
[ { "answer_id": 518465, "author": "Jojo", "author_id": 63106, "author_profile": "https://Stackoverflow.com/users/63106", "pm_score": 0, "selected": false, "text": " <Triggers>\n <asp:PostBackTrigger ControlID=\"DataPager1\" />\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52962/" ]
424,707
<p>I have a foler called A and inside A, i have 2 folders B and C, B is having a child folder called child B,now i have a program in C .from C I need to get the PHysical path of childB When i am giving Server.MapPath("../B/childB/") It is showing.Error.Can anybody tell me how to solve this ?</p>
[ { "answer_id": 424735, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": true, "text": "MapPath" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40521/" ]
424,709
<p>With my aspect, I track the changes on certain collections by advising certain method calls on instances of <code>java.util.Set</code>, notably <code>add(Object)</code> and <code>remove(Object)</code>. Since the changes are not reflected in the collection itself, invocations of <code>Set.contains(Object)</code> or <code>Set.size()</code> return wrong results.</p> <p>Therefore I want to intercept all method calls to instances of Set (except <code>add</code> and <code>remove</code>), and forward the calls to my up-to-date collection.</p> <p>Of course I could define two advices, using different pointcuts, something like this:</p> <pre><code>// matches Collection.size(), Collection.isEmpty(), ... * around(Collection c) : call(* Collection.*()) &amp;&amp; target(c) &amp;&amp; !remove(/*...*/) &amp;&amp; !add(/*...*/) { if (notApplicable()) return proceed(c); return proceed(getUpToDateCollection()); } // matches Collection.contains(Object), ... * around(Collection c, Object arg) : call(* Collection.*(*)) &amp;&amp; target(c) &amp;&amp; args(arg) &amp;&amp; !remove(/*...*/) &amp;&amp; !add(/*...*/) { if (notApplicable()) return proceed(c, arg); return proceed(getUpToDateCollection(), arg); } </code></pre> <p>It works, but it's pretty ugly, the bodies of my advices being quite analogous. So I would like to "combine" them; effectively having a single advice that be woven for both pointcuts, much like this:</p> <pre><code>* around(Object[] args): call(* Collection.*(..)) &amp;&amp; args(arr) {...}` </code></pre> <p>Is this possible at all? I have the feeling it's not, because in one of the pointcuts I expose the argument (and subsequently use it in the advice) and in the other there is no argument, so it seems impossible to bind the "potential identifier" in the enclosing advice... But I'm hoping that I've overlooked something and you might be able to point me in the right direction. Thanks!</p>
[ { "answer_id": 424735, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": true, "text": "MapPath" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45018/" ]
424,739
<p>Firstly, I'm a newbie to C# and SharePoint, (less than a month's experience) so apologies if this is an obvious or easy question but I've been trawling the net for a couple of days now with absolutely no success.</p> <p>I have an xslt file that I have stored in a subdirectory of 'Style Library' from within the new website but how can I access this from within c#?</p> <p>I've looked at SPSite and SPWeb but neither seems able to do quite what I want.</p> <p>Any and all help will be gratefully received.</p> <p>Many thanks</p> <p>c#newbie</p>
[ { "answer_id": 424769, "author": "Ray Booysen", "author_id": 42124, "author_profile": "https://Stackoverflow.com/users/42124", "pm_score": 2, "selected": true, "text": "SPList list = web.Lists[\"MyLibrary\"];\n if (list != null)\n {\n var results = fr...
2009/01/08
[ "https://Stackoverflow.com/questions/424739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52969/" ]
424,743
<p>Just a general question about what the best practice is:</p> <pre><code>public void Foo() { int x = 5; myControl.Click += (o, e) =&gt; { x = 6; }; } </code></pre> <p>Notice, I'm using the <code>x</code> variable inside my lambda event handler. </p> <p>OR:</p> <pre><code>public class Bar { private int x = 5; public void Foo() { Control myControl = new Control(); myControl.Click += new EventHandler(myControl_Click); } private void myControl_Click(object sender, EventArgs e) { x = 6; } } </code></pre> <p>Here, <code>x</code> is a private member of the class, and therefore I have access to it in my event handler. </p> <p>Now let's say I don't need <code>x</code> anywhere else in the code (for whatever reason), which method is the better way to go?</p>
[ { "answer_id": 424789, "author": "Michael Meadows", "author_id": 7643, "author_profile": "https://Stackoverflow.com/users/7643", "pm_score": 3, "selected": true, "text": "public void Subscribe(Action<string> messageCallBack)\n{\n myButton.Click += () => messageCallBack(\"Button was cl...
2009/01/08
[ "https://Stackoverflow.com/questions/424743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15861/" ]
424,760
<p>Will it ever become obsolete?</p>
[ { "answer_id": 424808, "author": "Treb", "author_id": 22114, "author_profile": "https://Stackoverflow.com/users/22114", "pm_score": -1, "selected": false, "text": "for (;;)" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,764
<p>I'm trying to get ReportViewer to display data from a BindingSource (VB.Net Winforms). </p> <p>I built the report on the underlying dataset. Then I configured the Data Source Instance to the BindingSource. I thought that would apply the sorting, filtering, etc. But it just looks like the data is coming from the dataset instead of the BindingSource. </p> <p>I suspect I'm missing something simple. </p> <p>Update: Or maybe it isn't so simple - I posted this a few days ago and still nobody knows the answer! Maybe I'm trying to do something that can't be done?</p>
[ { "answer_id": 424808, "author": "Treb", "author_id": 22114, "author_profile": "https://Stackoverflow.com/users/22114", "pm_score": -1, "selected": false, "text": "for (;;)" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2342/" ]
424,775
<p>The <code>()</code> seems silly. is there a better way?</p> <p>For example:</p> <p><code>ExternalId.IfNotNullDo(() =&gt; ExternalId = ExternalId.Trim());</code></p>
[ { "answer_id": 424795, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": false, "text": "() => delegate {...} ExternalId.IfNotNullDo(SomeMethod);\n" }, { "answer_id": 424864, "author": "Ruben Ba...
2009/01/08
[ "https://Stackoverflow.com/questions/424775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52972/" ]
424,798
<p>I have created an <a href="http://en.wikipedia.org/wiki/NUnit" rel="nofollow noreferrer">NUnit</a> project (NunitLoginTest.nunit) by selcting my test project in the <code>nunit\bin</code> directory and now I am trying to load that project, but it is giving me the following error.</p> <blockquote> <p>Unable to load Because it is not located under Appbase, could not load file or assembly "nunitLogintest" or one of its dependencies. The system cannot find the specified path</p> </blockquote> <p>What is it related to? I have also checked my configuration file. I am running this from console. </p> <h3>Update:</h3> <p>I want to start NUnit, and then it should load my Visual Studio project that is in some directory and then run all the tests (if I don't define it in any NUnit project).</p> <p>Actually I want to create a batch file to run all this. When I do this it won't load the project. I have defined the c:\Program Files\nunit\bin path in the environment variable.</p>
[ { "answer_id": 424888, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "nunit-console.exe c:\\myproject\\bin\\myproject.test.dll \n <NUnitProject>\n <Settings activeconfig=\"Debug\" appbase=\"C:\\d...
2009/01/08
[ "https://Stackoverflow.com/questions/424798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,800
<p>Let's say I have an Array of numbers: <code>[2,3,3,4,2,2,5,6,7,2]</code></p> <p>What is the best way to find the minimum or maximum value in that Array?</p> <p>Right now, to get the maximum, I am looping through the Array, and resetting a variable to the value if it is greater than the existing value:</p> <pre><code>var myArray:Array /* of Number */ = [2,3,3,4,2,2,5,6,7,2]; var maxValue:Number = 0; for each (var num:Number in myArray) { if (num &gt; maxValue) maxValue = num; } </code></pre> <p>This just doesn't seem like the best performing way to do this (I try to avoid loops whenever possible).</p>
[ { "answer_id": 424835, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "O(n) struct MinMax{\n public int Min,Max;\n}\n\nMinMax FindMinMax(int[] array, int start, int end) {\n if (start == end)\n...
2009/01/08
[ "https://Stackoverflow.com/questions/424800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31298/" ]
424,826
<p>I have this piece of code:</p> <pre><code>var myObj = function () { this.complex = function (text) { /* long piece of code */ } this.parse(text) { return text.replace(/valid_pattern/gi, function ($1) { return this.complex($1); } ); } } </code></pre> <p>Of course calling <strong>this.complex($1)</strong> won't do the trick, because I'm in the scope of the anonymous function. I can't re-scope the anonymous function using <strong>.call(this)</strong> statement either, because in th ta case I would lose the parameters passed to the function by <em>String.replace</em>.</p> <p>So far I'm using the concrete instance of the object. This is my solution:</p> <pre><code>var instance = new myObj; var myObj = function () { this.complex = function (text) { /* long piece of code */ } this.parse(text) { return text.replace(/valid_pattern/gi, function ($1) { return instance.complex($1); } ); } } </code></pre> <p>So far it's sufficient to my needs, but <strong>I'm wondering if there is any universal solution</strong> to this problem. The only idea that has worked for me so far is this:</p> <pre><code>function ($1) { return (new myObj).complex($1); } </code></pre> <p>... which suffers from serious performance issues. Any ideas would be greatly appreciated.</p> <p>-- D.</p> <p>P. S. Sorry about my English, it's not my first language.</p>
[ { "answer_id": 424836, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 0, "selected": false, "text": "var myObj = function () {\n var foo = this.complex = function (text) { /* long piece of code */ }\n this.parse(text) {\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52982/" ]
424,830
<p>This is how I do it at the moment. I try to open the file with the FileShare set to none. So I want exclusive accesss to the file. If I can't get that then its a good bet somebody else has the file locked.</p> <p>There's got to be a better and faster way. Any ideas?</p> <pre><code> try { using (FileStream fs = File.Open(GetLockFilename(), FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { fs.Close(); } // The file is not locked } catch (Exception) { // The file is locked } </code></pre>
[ { "answer_id": 30128507, "author": "Marcus Santodonato", "author_id": 2292196, "author_profile": "https://Stackoverflow.com/users/2292196", "pm_score": 1, "selected": false, "text": " public static bool IsLocked(this FileInfo f)\n {\n try \n {\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42109/" ]
424,842
<p><strong>Dupe: <a href="https://stackoverflow.com/questions/302701/null-difference">Null Difference</a></strong></p> <p>A lifetime ago I came across an article that explained that the following were not equal (in c#):</p> <pre><code>if (o == null) {} if (null == o) {} </code></pre> <p>The article explained that the latter was preferred because it resulted in a more accurate test. I've been coding like that ever since. Now that I understand so much more I was looking for the article, or another like it, to see what the exact findings were, but I can't find anything on the subject.</p> <p>Thoughts? Is there a difference? First glance would say no. But who knows what happens in the bowels of IL and C# compilation.</p>
[ { "answer_id": 424852, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 4, "selected": true, "text": "if (o = null)" }, { "answer_id": 424859, "author": "BFree", "author_id": 15861, "author_profile": "https://...
2009/01/08
[ "https://Stackoverflow.com/questions/424842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52165/" ]
424,846
<p>What is the difference between a framework and an SDK? Take, for example, the MS platform SDK and the .NET framework. Both have API's, both hide their inner workings, and both provide functionality that may not be quickly/easily accessible otherwise (in other words, they serve a real-world purpose).</p> <p>So what's the difference? Is it primarily a marketing game of semantics, or are there actual differences in how developers are expected to interact with the software (and conversely, how the developers can expect the software to behave)? Is one expected to be higher- or lower-level than the other, etc?</p> <p>Thanks!</p> <p>EDIT: This question applies to SDKs and frameworks in general, not just the two mentioned above.</p>
[ { "answer_id": 425322, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 1, "selected": false, "text": "extend" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16457/" ]
424,849
<p>I currently have a small Java program which I would like to run both on the desktop (ie in a JFrame) and in an applet. Currently all of the drawing and logic are handled by a class extending Canvas. This gives me a very nice main method for the Desktop application:</p> <pre><code>public static void main(String[] args) { MyCanvas canvas = new MyCanvas(); JFrame frame = MyCanvas.frameCanvas(canvas); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvas.loop(); } </code></pre> <p>Can I do something similar for the applet? Ideally MyCanvas would remain the same for both cases.</p> <p>Not sure if its important but I am drawing using BufferStrategy with <code>setIgnoreRepaint(true)</code>.</p> <p><b>Edit</b>: To clarify, my issue seems to be painting the canvas -- since all the painting is being done from the <code>canvas.loop()</code> call.</p>
[ { "answer_id": 424935, "author": "Richard Campbell", "author_id": 12254, "author_profile": "https://Stackoverflow.com/users/12254", "pm_score": 1, "selected": false, "text": " public static void main(String args[])\n {\n Applet applet = new AppletApplication();\n Frame frame = ne...
2009/01/08
[ "https://Stackoverflow.com/questions/424849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50264/" ]
424,866
<p>In C# how do you write a DataSet to file without it being written with pretty print?</p> <p>Using C# and .NET 2.0, I've been using dataSet.WriteXml(fileName, XmlWriteMode.IgnoreSchema), which by default is writing the Xml file with pretty print. The company consuming the Xml files I write suggested that writing without the pretty print will not affect them, and will significantly decrease the size of the files. With a little playing around in the System.Xml namespace, I did find a solution. However, in my searching I did not find the answer anywhere, so I thought it might be helpful to someone else in the future if I posted the question. Also, I wouldn't be surprised at all if there's a better or at least different way of accomplishing this.</p> <p>For those that don't know (I didn't until today), Xml "pretty print" is:</p> <pre><code>&lt;?xml version="1.0" standalone="yes"?&gt; &lt;NewDataSet&gt; &lt;Foo&gt; &lt;Bar&gt;abc&lt;/Bar&gt; &lt;/Foo&gt; &lt;/NewDataSet&gt; </code></pre> <p>Without pretty print it looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;NewDataSet&gt;&lt;Foo&gt;&lt;Bar&gt;abc&lt;/Bar&gt;&lt;/Foo&gt;&lt;/NewDataSet&gt; </code></pre> <p>Additionally, the size savings was significant, 70mb files are becoming about 40mb. I'll post my solution later today if no one else has.</p>
[ { "answer_id": 424906, "author": "cjk", "author_id": 52201, "author_profile": "https://Stackoverflow.com/users/52201", "pm_score": 2, "selected": false, "text": "DataSet ds = new DataSet();\nSystem.Xml.XmlTextWriter xmlW = new System.Xml.XmlTextWriter(\"C:\\\\temp\\\\dataset.xml\");\nSys...
2009/01/08
[ "https://Stackoverflow.com/questions/424866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4660/" ]
424,880
<p>Any idea how to initialize .NET delegate that points to method from 'mixed' class instance?</p> <p>I have 'mixed' C++ class like this:</p> <pre><code>class CppMixClass { public: CppMixClass(void){ dotNETclass-&gt;StateChanged += gcnew DotNetClass::ServiceStateEventHandler(&amp;UpdateHealthState); } ~CppMixClass(void); void UpdateState(System::Object^ sender, DotNetClass::StateEventArgs^ e){ //doSmth } } </code></pre> <p>DotNetClass is implemented in C#, and Method declaration is OK with delegate. This line generates error:</p> <pre><code>dotNETclass-&gt;StateChanged += gcnew DotNetClass::ServiceStateEventHandler(&amp;UpdateHealthState); error C2276: '&amp;' : illegal operation on bound member function expression </code></pre> <p>Anyone have a clue about a problem? Maybe coz CppMixClass class is not a pure .NET (ref) class?</p> <p>I got this to work when UpdateHealthState is static method, but I need pointer to instance method.</p> <p>I tried smth like:</p> <pre><code>dotNETclass-&gt;StateChanged += gcnew DotNetClass::ServiceStateEventHandler(this, &amp;UpdateHealthState); </code></pre> <p>But this obviously doesn't work coz this is not pointer (handle) to .NET (ref) class, (System::Object).</p> <p>ServiceStateEventHandler is defined in C# as:</p> <pre><code>public delegate void ServiceStateEventHandler(object sender, ServiceStateEventArgs e); </code></pre> <p>Thanx for reading this :)</p>
[ { "answer_id": 425943, "author": "Jox", "author_id": 35425, "author_profile": "https://Stackoverflow.com/users/35425", "pm_score": 4, "selected": true, "text": "class Demo5\n{\nmsclr::auto_gcroot<FileSystemWatcher^> m_fsw;\npublic:\n// Step (1)\n// Declare the delegate map where you map\...
2009/01/08
[ "https://Stackoverflow.com/questions/424880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35425/" ]
424,886
<p>I have a table of paged data, along with a dynamically created pager (server-side AJAX call, apply returned HTML to the innerHTML of a div). When I click next page on my pager, an AJAX call is sent to the server to retrieve the next set of data, which is returned as a string of HTML. I parse the HTML and render the new table rows. I also retrieve the pager HTML and load it into its parent DIV innerHTML. No problems so far.</p> <p>In Firefox I can click on the pager and all my javascript functions will execute normally. In IE, my first click will now not register, but the second click will perform the expected action.</p> <p><strong>What is it about IE that disables the first click on my returned HTML?</strong></p>
[ { "answer_id": 425162, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 0, "selected": false, "text": "href false false" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43687/" ]
424,895
<p>My company is trying to migrate away from a <strong>.NET</strong> application to something that is purely <strong>web-based</strong>, and very "ajaxy". The original .NET app is fairly interactive, roughly equivalent to Google Maps as far as user interaction is concerned (zoom, pan, annotate features on a vector map).</p> <p>Our .NET developer is really taken with <strong>Flex2</strong>. I'll admit to having a pretty strong Java bias. I also have about a year's worth of experience with <strong>GWT</strong>, and can get things done pretty quickly with it. Our codebase is mostly <strong>J2EE</strong>, so GWT seems a natural fit to me. I have zero experience with Flex, so I really can't make a recommendation for or against it</p> <p>Our primary interests in selecting a framework are the following:</p> <ul> <li>futureproof</li> <li>works on all major browsers </li> <li>fast & responsive user experience</li> <li>code should be unit testable</li> <li>code must be maintainable</li> <li>speed & ease of development</li> <li>supports vector graphics of some sort (SVG a plus)</li> </ul> <p>Care to weigh in on the pros &amp; cons of these two technologies, or even recommend a third option?</p>
[ { "answer_id": 426456, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": false, "text": "* futureproof\n * works on all major browsers\n * fast & responsive user experience\n * code should be unit testable\n *...
2009/01/08
[ "https://Stackoverflow.com/questions/424895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1274957/" ]
424,899
<p>I'm currently writing an iPhone application that uses a UITabBarController with more than 5 Tab Bar Items. Thus, a 'more' tab is automatically generated (like in the YouTube Application). I found out that the corresponding view controller class is <a href="http://ericasadun.com/iPhoneDocs220/interface_u_i_more_list_controller.html" rel="nofollow noreferrer">UIMoreListController</a>, but I don't have any corresponding .h files. So, my code looks like this:</p> <pre><code>@class UIMoreListController; // can't use #import since .h file is missing @implementation SomeUINavigationControllerDelegate - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if ([viewController isKindOfClass:[UIMoreListController class]]) ... // do something if "more" view is active </code></pre> <p>This works like a charm. However, the compiler keeps giving me</p> <blockquote> <p>warning: receiver 'UIMoreListController' is a forward class and corresponding @interface may not exist</p> </blockquote> <p>Is there a neat way of getting rid of this warning (and this particular warning only)? Again, I can't use <a href="https://stackoverflow.com/questions/322597">#import</a> since no .h file is available.</p>
[ { "answer_id": 425385, "author": "user123444555621", "author_id": 27862, "author_profile": "https://Stackoverflow.com/users/27862", "pm_score": 0, "selected": false, "text": "if ([viewController isKindOfClass:[UIMoreListController class]])\n if ([viewController isEqual:[navigationControl...
2009/01/08
[ "https://Stackoverflow.com/questions/424899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27862/" ]
424,919
<p>Let's say you have a table for branches in your organization. Some of them are "main" branches, and others are satellite offices that roll up to a main branch. Other than this distinction, which only impacts a few things in the system, the branches are all peers and have the same attributes (address, etc.). One way to model this is in a table like:</p> <pre><code>CREATE TABLE Branch ( branch_id INT NOT NULL PRIMARY KEY IDENTITY(1,1), branch_name VARCHAR(80) NOT NULL, street VARCHAR(80) NULL, city VARCHAR(30) NULL, state CHAR(2) NULL, zip CHAR(5) NULL, is_satellite_office BIT NOT NULL DEFAULT(0), satellite_to_branch_id INT NULL REFERENCES Branch(branch_id) ) </code></pre> <p>Where <code>is_satellite_office</code> = 1 iff this record is a satellite to another branch, and <code>satellite_to_branch_id</code> refers to which branch you're a satellite of, if any. </p> <p>It's easy enough to put a constraint on the table so that those two columns agree on any given record:</p> <pre><code>CONSTRAINT [CK_Branch] CHECK ( (is_satellite_office = 0 AND satellite_to_branch_id IS NULL) OR (is_satellite_office = 1 AND satellite_to_branch_id IS NOT NULL) ) </code></pre> <p>However, what I really want is a way to guarantee that this recursion only goes <strong>one</strong> level deep ... that is, that if I point to a branch as my parent, it must not have a parent itself, and its value for <code>is_satellite_office</code> must be 0. Put differently, I don't really want a fully recursive tree structure, I just want to limit it to a single parent / child relationship. That's how I'm going to write the code, and if there's a way to enforce it in the database that won't perform like total crap, I'd like to.</p> <p>Any ideas? I'm working on MSSQL 2005, but general (non-vendor-specific) solutions are preferred. And no triggers need apply, unless there's truly no other way to do it.</p> <p>EDIT: To be clear, <code>satellite_to_branch_id</code> is the recursive pointer to another record in the same Branch table. I know that I could remove the <code>is_satellite_office BIT</code> and rely on <code>IsNull(satellite_to_branch_id)</code> to give me the same information, but I find it's a little clearer to be explicit, and besides which, that's not the gist of the question. I'm really looking for a pure SQL-constraint way to prevent recursion-depth of greater than 1.</p>
[ { "answer_id": 424959, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 0, "selected": false, "text": "CREATE TABLE Branch (\n branch_id INT NOT NULL PRIMARY KEY IDENTITY(1,1),\n branch_name VARCHAR(80) NOT NULL,\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/424919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37539/" ]
424,920
<p>In Ruby, methods which change the object have a bang on the end: <code>string.downcase!</code></p> <p>In c# you have to do: <code>foo = foo.ToLower()</code></p> <p>Is there a way to make an extension method like:</p> <p><code>foo.ConvertToLower()</code></p> <p>that would manipulate <code>foo</code>?</p> <p>(I think the answer is no since strings are immutable and you can't do a <code>ref this</code> in an extension method.)</p>
[ { "answer_id": 424972, "author": "Yes - that Jake.", "author_id": 5287, "author_profile": "https://Stackoverflow.com/users/5287", "pm_score": -1, "selected": false, "text": "public static void ConvertToLower(this string s)\n{\n s = s.ToLower();\n}\n" }, { "answer_id": 425033, ...
2009/01/08
[ "https://Stackoverflow.com/questions/424920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52972/" ]
424,927
<p>I've been developing a very large LOB app using my flavor of M-V-VM which I call M-V-MC (Model-View-ModelController), which is a kind of a combination between M-V-C and M-V-VM. I had posted <a href="https://stackoverflow.com/questions/322612/what-are-the-most-common-mistakes-made-in-wpf-development#322679">this answer</a> regarding how views get instantiated in M-V-VM to the question "<a href="https://stackoverflow.com/questions/322612/what-are-the-most-common-mistakes-made-in-wpf-development">what-are-the-most-common-mistakes-made-in-wpf-development</a>".</p> <p><a href="https://stackoverflow.com/users/7021/sam">Sam</a> made the following comment regarding my answer:</p> <blockquote> <p>This creates a follow-up-question: how do you create the views? I use RelayCommands to bind actions from the view to the ViewModel, so the view does not even know an action has fired, does not know he should open a new view. Solution: create an event in the VM for the View to subscribe to?</p> </blockquote> <p>When I originally started M-V-VM development I had this notion that EVERYTHING should live in the ViewModel, and have studied a lot of examples from guys like <a href="http://joshsmithonwpf.wordpress.com/" rel="nofollow noreferrer">Josh Smith</a> and <a href="http://karlshifflett.wordpress.com/" rel="nofollow noreferrer">Karl Shifflett</a>. However I have yet to come up with a good example of when a command needs to live in the ViewModel.</p> <p>For instance, let's say I have a ListView that displays Customers, and a button that I click to allow me to edit the currently selected customer. The ListView (View) is bound to a CustomerVM (ViewModel). Clicking the button fires the EditCustomerCommand which opens a popup window which allows me to edit all the properties of the CustomerVM. Where does this EditCustomerCommand live? If it involves opening a window, (UI functionality), shouldn't it be defined in the code-behind of the view? <img src="https://codingcontext.files.wordpress.com/2009/01/commandflow.png" alt="alt text"></p> <p>Does anyone have any examples of when I should define a command in the View versus the ViewModel?</p> <p><a href="https://stackoverflow.com/users/47006/matthew-wright">Matthew Wright</a> states below:</p> <blockquote> <p>New and delete from a list would be good examples. In those cases, a blank record is added or the current record is deleted by the ViewModel. Any action taken by the view should be in response to those events occurring.</p> </blockquote> <p>So if I click the new button, what happens? A new instance of the CustomerVM is created by the Parent ViewModel and added to it's collection right? So how then would my editing screen get opened? The view should create a new instance of the Customer ViewModel, and pass it in to the ParentVM.Add(newlyCreatedVM) method right? </p> <p>Let's say I delete a customer record via the DeleteCommand living on the VM. the VM calls into the business layer and tries to delete the record. It can't so it returns a message to the VM. I want to display this message in dialogbox. How does the view get the message out of the command action? </p>
[ { "answer_id": 429495, "author": "Jab", "author_id": 29676, "author_profile": "https://Stackoverflow.com/users/29676", "pm_score": 1, "selected": false, "text": " public MyViewModel(IMessage msg)\n {\n _msg = msg;\n }\n public void Delete()\n {\n if(CanDelete)\n...
2009/01/08
[ "https://Stackoverflow.com/questions/424927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
424,932
<p>When a select field is changed, I would like to loop through all of the input values in the form it belongs to using jQuery. This doesn't work below, but I can't figure out exactly how to do this.</p> <pre><code>$("select.mod").change(function(){ $(this).parent().get(0).$(":input").each(function(i){ alert(this.name + " = " + i); }); }); </code></pre>
[ { "answer_id": 425003, "author": "Steve Losh", "author_id": 13498, "author_profile": "https://Stackoverflow.com/users/13498", "pm_score": 4, "selected": true, "text": ".parent() select.mod <p> .parents() $(\"select.mod\").change(function(){\n $(this).parents('form') // For each elemen...
2009/01/08
[ "https://Stackoverflow.com/questions/424932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497/" ]
424,938
<p>How do I write a .net regex which will match a string that does NOT start with "Seat"</p>
[ { "answer_id": 424951, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 3, "selected": false, "text": "return !Regex.IsMatch(\"^Seat.*\", input);\n" }, { "answer_id": 424956, "author": "Soviut", "author_id": ...
2009/01/08
[ "https://Stackoverflow.com/questions/424938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48892/" ]
424,949
<p>I have a MATLAB class which contains a reference to a java object</p> <pre><code>classdef MyClass properties j = myJavaClass end methods ... end end </code></pre> <p>and after I use it (using clear, scope exit or explicitly setting myClass = 0; ) the java object is still alive - even after calling Runtime.gc.</p> <p>I see in the dump that the object is still in the JVM heap for the MATLAB process (using jmap -histo pID) and thus I assume MATLAB itself is still referencing the object - despite calling to clear, clear JAVA, clear classes, etc. - nothing helps</p> <p>Any ideas?</p>
[ { "answer_id": 431246, "author": "Dani", "author_id": 28772, "author_profile": "https://Stackoverflow.com/users/28772", "pm_score": 2, "selected": true, "text": "function delete( obj )\n ...\n jObject = 0;\nend\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28772/" ]
424,952
<p>I just bought a new, sub-US$1,000 laptop, one aimed squarely at the consumer, non-developer market and, looking over the specs, was surprised to find that it came standard with a dual-core processor.</p> <p>This led me to the question: with multicore machines becoming the norm, is it <em>ever</em> correct to write a single-threaded application anymore?</p> <p>Excepting trivial applications, which can reasonably be expected to fit entirely within a single core of a single processor of the weakest system on which it will run, will an application which runs in all one thread be seriously degraded by the way modern OSs spread their execution across cores when no guidance is given by the application as to how to optimize such a split?</p>
[ { "answer_id": 1164431, "author": "Thomas", "author_id": 115355, "author_profile": "https://Stackoverflow.com/users/115355", "pm_score": 0, "selected": false, "text": "cat data.txt | sed 's/,/ /g' | awk '{print $4}' | gzip > foo.txt.gz\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5287/" ]
424,967
<p>I asked this question already at the Microsoft forums, but no answer until now. I am stuck here. I have a quite nested xml snippet, which i like to bind via hierarchical Data templates.</p> <p>Here is the xml snippet:</p> <pre><code>&lt;project&gt; &lt;products&gt; &lt;product name="Product2" foldername="string" dbkey="-2405" dbtable="string"&gt; &lt;inifiles&gt; &lt;inifile name="string" dbkey="-3083" dbtable="string"&gt; &lt;sections&gt; &lt;section name="string" dbkey="-3025" dbtable="string"&gt; &lt;inientries&gt; &lt;inikey name="string" value="string" dbkey="9739" dbtable="string" /&gt; &lt;/inientries&gt; &lt;/section&gt; &lt;/sections&gt; &lt;/inifile&gt; &lt;/inifiles&gt; &lt;subproducts&gt; &lt;subproduct dbkey="1644" dbtable="string" name="Subproduct1"&gt; &lt;inifiles&gt; &lt;inifile name="string" dbkey="-6544" dbtable="string"&gt; &lt;sections&gt; &lt;section name="string" dbkey="2436" dbtable="string"&gt; &lt;inientries&gt; &lt;inikey name="string" value="string" dbkey="-2122" dbtable="string" /&gt; &lt;/inientries&gt; &lt;/section&gt; &lt;/sections&gt; &lt;/inifile&gt; &lt;/inifiles&gt; &lt;/subproduct&gt; &lt;subproduct dbkey="-4746" dbtable="string" name="Subproduct2"&gt; &lt;subinifiles&gt; &lt;subinifile name="string" dbkey="7519" dbtable="string"&gt; &lt;subsections&gt; &lt;subsection name="string" dbkey="1680" dbtable="string"&gt; &lt;subinientries&gt; &lt;subinikey name="string" value="string" dbkey="3682" dbtable="string" /&gt; &lt;/subinientries&gt; &lt;/subsection&gt; &lt;/subsections&gt; &lt;/subinifile&gt; &lt;/subinifiles&gt; &lt;/subproduct&gt; &lt;/subproducts&gt; &lt;/product&gt; `&lt;/products&gt; &lt;/project&gt; </code></pre> <p>My Hierarchical Datatemplates look like this:</p> <pre><code>&lt;HierarchicalDataTemplate DataType="product" ItemsSource="{Binding XPath=inifiles/inifile}" &gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image Width="16" Height="16" Source="Images/gnome-applications.png"/&gt; &lt;TextBlock Text="{Binding XPath=@name}" FontWeight="bold"/&gt; &lt;/StackPanel&gt; &lt;/HierarchicalDataTemplate&gt; &lt;!-- ######################### Ini-Files ######################################### --&gt; &lt;HierarchicalDataTemplate DataType="inifile" ItemsSource="{Binding XPath=sections/section}" x:Name="inifile" &gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image Width="16" Height="16" Source="Images/advanced.png"/&gt; &lt;TextBlock Text="{Binding XPath=@name}"&gt; &lt;TextBlock.ContextMenu&gt; &lt;ContextMenu&gt; &lt;Menu BorderThickness="3"&gt; &lt;MenuItem Header="{Binding XPath=@name}"&gt; &lt;MenuItem Header="_Find in Database"/&gt; &lt;MenuItem Header="_Edit" Tag="{Binding XPath=@value}"/&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;/ContextMenu&gt; &lt;/TextBlock.ContextMenu&gt; &lt;/TextBlock&gt; &lt;TextBlock Text="{Binding XPath=@key}"/&gt; &lt;/StackPanel&gt; &lt;/HierarchicalDataTemplate&gt; &lt;!-- ######################### Sections ######################################### --&gt; &lt;HierarchicalDataTemplate DataType="section" ItemsSource="{Binding XPath=inientries/inikey}"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image Width="16" Height="16" Source="Images/indent.png"/&gt; &lt;TextBlock Text="{Binding XPath=@name}"&gt; &lt;TextBlock.ContextMenu&gt; &lt;ContextMenu&gt; &lt;Menu&gt; &lt;MenuItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Width="Auto" Header="{Binding XPath=@name}"&gt; &lt;MenuItem Header="_Find in Database"/&gt; &lt;MenuItem Header="_Edit" Tag="{Binding XPath=@value}"/&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;/ContextMenu&gt; &lt;/TextBlock.ContextMenu&gt; &lt;/TextBlock&gt; &lt;TextBlock Text="{Binding XPath=@key}"/&gt; &lt;/StackPanel&gt; &lt;/HierarchicalDataTemplate&gt; &lt;!-- ######################### Ini-Keys ######################################### --&gt; &lt;HierarchicalDataTemplate DataType="inikey"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image Width="16" Height="16" Source="Images/keyring.png"/&gt; &lt;TextBlock Text="{Binding XPath=@name}"&gt; &lt;TextBlock.ContextMenu&gt; &lt;ContextMenu&gt; &lt;Menu&gt; &lt;MenuItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Width="Auto" Header="{Binding XPath=@name}"&gt; &lt;MenuItem Header="_Find in Database"/&gt; &lt;MenuItem Header="_Edit" Tag="{Binding XPath=@value}" /&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;/ContextMenu&gt; &lt;/TextBlock.ContextMenu&gt; &lt;/TextBlock&gt; &lt;TextBlock Text="{Binding XPath=@value}"/&gt; &lt;/StackPanel&gt; &lt;/HierarchicalDataTemplate&gt; </code></pre> <p>I can bind to all tags except for the <code>&lt;subproducts&gt;</code> tag. I could read the structure through an XmlDocument, but i would lose all the advantages of the templates.</p>
[ { "answer_id": 1164431, "author": "Thomas", "author_id": 115355, "author_profile": "https://Stackoverflow.com/users/115355", "pm_score": 0, "selected": false, "text": "cat data.txt | sed 's/,/ /g' | awk '{print $4}' | gzip > foo.txt.gz\n" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/424967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
424,982
<p>Meaning, if I have:</p> <pre><code>&lt;mx:Tree&gt; &lt;!-- ... --&gt; &lt;/mx:Tree&gt; </code></pre> <p>and I want to change some of the control's behaviour or add functionality, by doing (in AS):</p> <pre><code>class ChristmasTree extends mx.controls.Tree { // ... } </code></pre> <p>how do I change the MXML so that my class is used?</p> <p>In <a href="http://livedocs.adobe.com/flex/3/html/components_11.html#195546" rel="nofollow noreferrer">the manual it says how to extend components via MXML</a>, but how do I do it with AS?</p>
[ { "answer_id": 425001, "author": "Hanno Fietz", "author_id": 2077, "author_profile": "https://Stackoverflow.com/users/2077", "pm_score": 4, "selected": true, "text": "package myComponents\n{\n // as/myComponents/TextAreaFontControl.as \n import mx.controls.TextArea;\n\n publi...
2009/01/08
[ "https://Stackoverflow.com/questions/424982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
425,016
<p>I'm developing an ASP.NET site off of my Windows XP IIS Installation, and whenever I tell visual studio to attach-to-process to the aspnet_wp.exe it starts a new instance of asp.net development server. Is there a way to make it not start asp.net development server since I don't need it to launch anything?</p>
[ { "answer_id": 425034, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 0, "selected": false, "text": "w3wp.exe" } ]
2009/01/08
[ "https://Stackoverflow.com/questions/425016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53001/" ]
425,020
<p>I have the following SQL Statement. I need to select the latest record for each System.Id using the System.RevisedDate</p> <pre><code>SELECT [System.Id],[System.RevisedDate], [System.Title], [System.State], [System.Reason], [System.CreatedDate], [System.WorkItemType], [System.TeamProject], [Microsoft.VSTS.Scheduling.RemainingWork], [Microsoft.VSTS.Scheduling.CompletedWork], [Microsoft.VSTS.CMMI.Estimate] FROM WorkItems WHERE ([System.WorkItemType] = 'Change Request') AND ([System.CreatedDate] &gt;= '09/30/2008') AND ([System.TeamProject] NOT LIKE '%Deleted%') AND ([System.TeamProject] NOT LIKE '%Sandbox%') </code></pre> <p>Can you please help?</p>
[ { "answer_id": 425041, "author": "Alex Shnayder", "author_id": 26042, "author_profile": "https://Stackoverflow.com/users/26042", "pm_score": 1, "selected": false, "text": "SELECT ID,DATE_FIELD,FIELD1,FIELD2\nFROM TBL1 AS A WHERE DATE_FIELD >= ALL (\n SELECT DATE_FIELD FROM TBL1 AS B\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/425020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44785/" ]
425,029
<p>I'm trying to connect to an oracle database with SQL Developer. </p> <p>I've installed the .Net oracle drivers and placed the <code>tnsnames.ora</code> file at<br> <code>C:\Oracle\product\11.1.0\client_1\Network\Admin</code></p> <p>I'm using the following format in tnsnames.ora:</p> <pre><code>dev = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = idpdev2) ) ) </code></pre> <p>In SQL Developer, when I try to create a new connection, no TNS-names show up as options.</p> <p>Is there something I'm missing?</p>
[ { "answer_id": 425104, "author": "JaseAnderson", "author_id": 4138, "author_profile": "https://Stackoverflow.com/users/4138", "pm_score": 9, "selected": true, "text": "show tns" }, { "answer_id": 425640, "author": "DCookie", "author_id": 8670, "author_profile": "https...
2009/01/08
[ "https://Stackoverflow.com/questions/425029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52996/" ]
425,039
<p>I've tried figuring out this problem for the last 2 days with no luck. I'm simply trying to create an annotation based JUnit test using the spring framework along with hibernate.</p> <p>My IDE is netbeans 6.5 and I'm using hibernate 3, spring 2.5.5 and JUnit 4.4.</p> <p>Here's the error I'm getting:</p> <pre><code>Testcase: testFindContacts(com.mycontacts.data.dao.MyContactHibernateDaoTransactionTest): Caused an ERROR Failed to load ApplicationContext java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:203) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:93) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:130) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [shared-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(I)V at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42) at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:199) Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(I)V at net.sf.cglib.core.DebuggingClassWriter.&lt;init&gt;(DebuggingClassWriter.java:47) at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.&lt;clinit&gt;(Enhancer.java:69) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117) at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162) at org.hibernate.tuple.entity.AbstractEntityTuplizer.&lt;init&gt;(AbstractEntityTuplizer.java:135) at org.hibernate.tuple.entity.PojoEntityTuplizer.&lt;init&gt;(PojoEntityTuplizer.java:55) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.&lt;init&gt;(EntityEntityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.&lt;init&gt;(EntityMetamodel.java:295) at org.hibernate.persister.entity.AbstractEntityPersister.&lt;init&gt;(AbstractEntityPersister.java:434) at org.hibernate.persister.entity.SingleTableEntityPersister.&lt;init&gt;(SingleTableEntityPersister.java:109) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:226) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) </code></pre>
[ { "answer_id": 425153, "author": "Jared", "author_id": 44757, "author_profile": "https://Stackoverflow.com/users/44757", "pm_score": 6, "selected": true, "text": "java.lang.NoSuchMethodError org.objectweb.asm.ClassWriter" }, { "answer_id": 25819217, "author": "tricknology", ...
2009/01/08
[ "https://Stackoverflow.com/questions/425039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17337/" ]
425,049
<p>I want to declare two beans and instantiate them using Spring dependency injection?</p> <pre><code>&lt;bean id="sessionFactory" class="SessionFactoryImpl"&gt; &lt;property name="entityInterceptor" ref="entityInterceptor"/&gt; &lt;/bean&gt; &lt;bean id="entityInterceptor" class="EntityInterceptorImpl"&gt; &lt;property name="sessionFactory" ref="sessionFactory"/&gt; &lt;/bean&gt; </code></pre> <p>But Spring throws an exception saying "FactoryBean which is currently in creation returned null from getObject"</p> <p>Why is inter-dependent bean wiring not working here? Should i specify defferred property binding anywhere?</p>
[ { "answer_id": 425778, "author": "aledbf", "author_id": 53078, "author_profile": "https://Stackoverflow.com/users/53078", "pm_score": 0, "selected": false, "text": " protected DefaultListableBeanFactory createBeanFactory(){\n DefaultListableBeanFactory beanFactory = super.createBeanFa...
2009/01/08
[ "https://Stackoverflow.com/questions/425049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51402/" ]
425,071
<p>I don't think this is possible with just regular expressions, but I'm not an expert so i thought it was worth asking.</p> <p>I'm trying to do a massive search and replace of C# code, using .NET regex. What I want to do is find a line of code where a specific function is called on a variable that is of type DateTime. e.g: </p> <pre><code>axRecord.set_Field("CreatedDate", m_createdDate); </code></pre> <p>and I would know that it's a DateTime variable b/c earlier in that code file would be the line:</p> <pre><code>DateTime m_createdDate; </code></pre> <p>but it seems that I can't use a named group in negative lookbehind like:</p> <pre><code>(?&lt;=DateTime \k&lt;1&gt;.+?)axRecord.set_[^ ]+ (?&lt;1&gt;[^ )]+) </code></pre> <p>and if I try to match the all the text between the variable declaration and the function call like this:</p> <pre><code>DateTime (?&lt;1&gt;[^;]+).+?axRecord.set.+?\k&lt;1&gt; </code></pre> <p>it will find the first match - first based on first variable declared - but then it can't find any other matches, because the code is laid out like this:</p> <pre><code>DateTime m_First; DateTime m_Second; ... axRecord.set_Field("something", m_First); axRecord.set_Field("somethingElse", m_Second); </code></pre> <p>and the first match encompasses the second variable declaration.</p> <p>Is there a good way to do this with just regular expressions, or do I have to resort to scripting in my logic?</p>
[ { "answer_id": 425110, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 1, "selected": false, "text": "void Process(List<string> lines) {\n var comp = StringComparer.Ordinal;\n var map = new Hashset<string>comp);\n var de...
2009/01/08
[ "https://Stackoverflow.com/questions/425071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45139/" ]
425,077
<p>i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk) which is already loaded, but the assembly is locked by the operating system (vista), even if i have unloaded it. </p> <p>f.e.</p> <pre><code>AppDomainSetup setup = new AppDomainSetup(); setup.ShadowCopyFiles = "true"; AppDomain appDomain = AppDomain.CreateDomain(assemblyName + "_AppDomain", AppDomain.CurrentDomain.Evidence, setup); IPlugin plugin = (IPlugin)appDomain.CreateInstanceFromAndUnwrap(assemblyName, "Plugin.MyPlugins"); </code></pre> <p>I also need the assemblyinfos, because I don't know which classes in the pluginassembly implements the IPlugin Interface. It should be possible to have more than one Plugin in one Pluginassembly.</p> <pre><code>Assembly assembly = appDomain.Load(assemblyName); if (assembly != null) { Type[] assemblyTypes = assembly.GetTypes(); foreach (Type assemblyTyp in assemblyTypes) { if (typeof(IPlugin).IsAssignableFrom(assemblyTyp)) { IPlugin plugin = (IPlugin)Activator.CreateInstance(assemblyTyp); plugin.AssemblyName = assemblyNameWithEx; plugin.Host = this; } } } AppDomain.Unload(appDomain); </code></pre> <p>How is it possible to get the assemblyinfos from the appDomain without locking the assembly? </p> <p>best regards</p>
[ { "answer_id": 433103, "author": "Øyvind Skaar", "author_id": 49194, "author_profile": "https://Stackoverflow.com/users/49194", "pm_score": 2, "selected": false, "text": "byte[] fileContent;\nstring path = \"../../../test/bin/Debug/test.dll\"; //Path to plugin assembly\nusing (FileStream...
2009/01/08
[ "https://Stackoverflow.com/questions/425077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52418/" ]
425,092
<p>I have used Excel in my VB6 apps many times before, and have never run into such a weird problem trying to accomplish something very easy..</p> <p>I am trying to open an excel (xls or xlsx) file and read through values, as you can probably see.</p> <p>When I try to open the file, I get an error 70 (permission denied) error. The odd thing is that there is no other instance of excel open (in task manager apps or processes). No one else is trying to access the file whatsoever. I can open the file in excel with no warning, and I can also open/read/close the file in VB6 with the basic "Open File for Input as #1" syntax without error. I can delete the file using Kill() so it can't be a directory permissions issue - Please help - I am at a loss!!!</p> <pre><code> Dim xlApp As New Excel.Application Dim xlWBook As Excel.Workbook 'Error Occurs Here Set xlWBook = xlApp.Workbooks.Open(File) Dim xlSheet As Excel.Worksheet Set xlSheet = xlWBook.Sheets.Item(1) Dim y As Integer For y = 1 To 99999 If Len(xlSheet.Cells(y, 1)) &gt; 0 Then Send xlSheet.Cells(y, 1) &amp; " - " &amp; xlSheet.Cells(y, 2) &amp; "&lt;br&gt;" End If Next Set xlWBook = Nothing Set xlApp = Nothing </code></pre> <p>-Jay</p>
[ { "answer_id": 425106, "author": "Dirk Vollmar", "author_id": 40347, "author_profile": "https://Stackoverflow.com/users/40347", "pm_score": 1, "selected": false, "text": "cd \"C:\\Program Files\\Microsoft Office\\Office12\"\n excel.exe /regserver\n" }, { "answer_id": 9062149, ...
2009/01/08
[ "https://Stackoverflow.com/questions/425092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53017/" ]
425,095
<p>It seems like this should be something built into jQuery without the need for more than a few lines of code, but I can't find the "simple" solution. Say, I have an HTML form:</p> <pre><code>&lt;form method="get" action="page.html"&gt; &lt;input type="hidden" name="field1" value="value1" /&gt; &lt;input type="hidden" name="field2" value="value2" /&gt; &lt;select name="status"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="good"&gt;Good&lt;/option&gt; &lt;option value="bad"&gt;Bad&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; </code></pre> <p>When someone changes the select field, I would like to submit the form using ajax to update the database. I thought there would be some way to do the following without manually creating the values/attributes, just send them all, like:</p> <pre><code>$("select").change(function(){ $.get("page.html?" + serializeForm()); }); </code></pre> <p>What am I missing?</p>
[ { "answer_id": 425109, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 5, "selected": false, "text": "$(document).ready(function() { \n $('#myForm1').ajaxForm(); \n});\n $(\"select\").change(function(){\n $('#my...
2009/01/08
[ "https://Stackoverflow.com/questions/425095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497/" ]
425,112
<p>I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the DAL, I need to implement some extensive features, and I would like to use NHibernate to make things easier.</p> <p>Is there any design patterns/architectures out there that allow a hybrid DAAB/NHibernate DAL ? is it a good idea ?</p> <p>My thinking is: if I had a hybrid DAL I could still pass high traffic/un-dynamic queries through the DAAB side and save the overhead of the dynamic sql generation. But still have nhibernate for more complex queries.</p> <p>Additionally what is the best way to setup NHibernate DAL/BLL for an asp.net webforms application ? I have read the tutorial on the NHibernate site and several others there doesn't seem to be a consensus on starting/ending the nhib session. I'm just looking for best practice example.</p> <p>Thanks</p>
[ { "answer_id": 486455, "author": "ssmith", "author_id": 13729, "author_profile": "https://Stackoverflow.com/users/13729", "pm_score": 1, "selected": false, "text": "public class NHibernateSessionModule : IHttpModule\n {\n public void Init(HttpApplication context)\n {\n ...
2009/01/08
[ "https://Stackoverflow.com/questions/425112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50970/" ]
425,113
<p>I've got some code that was at the bottom of a php file that is in javascript. It goes through lots of weird contortions like converting hex to ascii then doing regex replacements, executing code and so on...</p> <p>Is there any way to find out what it's executing before it actually does it?</p> <p>The code is here:</p> <p><a href="http://pastebin.ca/1303597" rel="nofollow noreferrer">http://pastebin.ca/1303597</a></p>
[ { "answer_id": 425160, "author": "Andrzej Doyle", "author_id": 45664, "author_profile": "https://Stackoverflow.com/users/45664", "pm_score": 6, "selected": true, "text": "\n function EvilInstaller(){};\n EvilInstaller.prototype = {\n getFrameURL : function() {\n v...
2009/01/08
[ "https://Stackoverflow.com/questions/425113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46782/" ]
425,117
<p>I want to pull a series of relationships out of xml files and transform them into a graph I generate with dot. I can obviously do this with a scripting language, but I was curious whether or not this was possible with xslt. Something like: </p> <pre><code>xsltproc dot.xsl *.xml </code></pre> <p>which would produce a file like</p> <pre><code>diagraph { state -&gt; state2 state2 -&gt; state3 [More state relationships from *.xml files] } </code></pre> <p>So I need to both 1) wrap the combined xml transforms with "diagraph {...}" and 2) be able to handle an arbitrary set of xml documents specified on the command line.</p> <p>Is this possible? Any pointers? </p>
[ { "answer_id": 425846, "author": "Dimitre Novatchev", "author_id": 36305, "author_profile": "https://Stackoverflow.com/users/36305", "pm_score": 4, "selected": true, "text": "collection() <xsl:stylesheet version=\"2.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n>\n <xsl...
2009/01/08
[ "https://Stackoverflow.com/questions/425117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
425,122
<p>We are trying to get data out of a SQL Server DB and submit it to a WCF web service. Since using a windows service is not a option in this case, I thought of using SSIS. </p> <p>I have tried using the Web Service Task, but I'm having difficulties getting it to work. I also understand there are limitation to using Web Service Task. What is the best option for use to pass data from SSIS to WCF? Note: We are restricted in using CLR Integration in SQL.</p>
[ { "answer_id": 425846, "author": "Dimitre Novatchev", "author_id": 36305, "author_profile": "https://Stackoverflow.com/users/36305", "pm_score": 4, "selected": true, "text": "collection() <xsl:stylesheet version=\"2.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n>\n <xsl...
2009/01/08
[ "https://Stackoverflow.com/questions/425122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]