qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
53,426
<p>What memory leak detectors have people had a good experience with?</p> <p>Here is a summary of the answers so far:</p> <p><a href="http://valgrind.org/" rel="noreferrer">Valgrind</a> - Instrumentation framework for building dynamic analysis tools.</p> <p><a href="http://directory.fsf.org/project/ElectricFence/" rel="noreferrer">Electric Fence</a> - A tool that works with GDB</p> <p><a href="http://splint.org/" rel="noreferrer">Splint</a> - Annotation-Assisted Lightweight Static Checking</p> <p><a href="http://www.glowcode.com/" rel="noreferrer">Glow Code</a> - This is a complete real-time performance and memory profiler for Windows and .NET programmers who develop applications with C++, C#, or any .NET Framework</p> <p>Also see this <a href="https://stackoverflow.com/questions/45627/how-do-you-detectavoid-memory-leaks-in-your-unmanaged-code">stackoverflow post</a>.</p>
[ { "answer_id": 276821, "author": "Artelius", "author_id": 31945, "author_profile": "https://Stackoverflow.com/users/31945", "pm_score": 2, "selected": false, "text": "-fmudflap -lmudflap\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064/" ]
53,428
<p>I'm evaluating and looking at using CherryPy for a project that's basically a JavaScript front-end from the client-side (browser) that talks to a Python web service on the back-end. So, I really need something fast and lightweight on the back-end that I can implement using Python that then speaks to the PostgreSQL DB via an ORM (JSON to the browser).</p> <p>I'm also looking at Django, which I like, since its ORM is built-in. However, I think Django might be a little more than I really need (i.e. more features than I really need == slower?).</p> <p>Anyone have any experience with different Python ORM solutions that can compare and contrast their features and functionality, speed, efficiency, etc.?</p>
[ { "answer_id": 53463, "author": "Yon", "author_id": 3117, "author_profile": "https://Stackoverflow.com/users/3117", "pm_score": -1, "selected": false, "text": ">>> ed_user = User('ed', 'Ed Jones', 'edspassword')\n>>> session.add(ed_user)\n>>> our_user = session.query(User).filter_by(name...
2008/09/10
[ "https://Stackoverflow.com/questions/53428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5499/" ]
53,435
<p>I'm doing something bad in my ASP.NET app. It could be the any number of CTP libraries I'm using or I'm just not disposing something properly. But when I redeploy my ASP.NET to my Vista IIS7 install or my server's IIS6 install I crash an IIS worker process.</p> <p>I've narrowed the problem down to my HTTP crawler, which is a multithreaded beast that crawls sites for useful information when asked to. After I start a crawler and redeploy the app over the top, rather than gracefully unloading the appDomain and reloading, an IIS worker process will crash (popping up a crash message) and continue reloading the app domain.</p> <p>When this crash happens, where can I find the crash dump for analysis?</p>
[ { "answer_id": 66625, "author": "sachaa", "author_id": 1152057, "author_profile": "https://Stackoverflow.com/users/1152057", "pm_score": 5, "selected": true, "text": "cscript adplus.vbs -crash -pn w3wp.exe\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209/" ]
53,472
<p>I have some Ruby code which takes dates on the command line in the format:</p> <pre><code>-d 20080101,20080201..20080229,20080301 </code></pre> <p>I want to run for all dates between <code>20080201</code> and <code>20080229</code> inclusive and the other dates present in the list.</p> <p>I can get the string <code>20080201..20080229</code>, so is the best way to convert this to a Range instance? Currently, I am using <code>eval</code>, but it feels like there should be a better way.</p> <hr> <p>@Purfideas I was kind of looking for a more general answer for converting any string of type <code>int..int</code> to a Range I guess.</p>
[ { "answer_id": 53504, "author": "Purfideas", "author_id": 4615, "author_profile": "https://Stackoverflow.com/users/4615", "pm_score": 2, "selected": false, "text": "require 'date'\n\nends = '20080201..20080229'.split('..').map{|d| Date.parse(d)}\n(ends[0]..ends[1]).each do |d|\n p d.day...
2008/09/10
[ "https://Stackoverflow.com/questions/53472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4121/" ]
53,473
<p>I am trying to apply styles to HTML tags dynamically by reading in the value of certain HTML attributes and applying a class name based on their values. For instance, if I have:</p> <pre><code>&lt;p height="30"&gt; </code></pre> <p>I want to apply a <code>class="h30"</code> to that paragraph so that I can style it in my style sheet. I can't find any information on getting the value of an attribute that is not an <code>id</code> or <code>class</code>. Help?</p>
[ { "answer_id": 53475, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 0, "selected": false, "text": "for (e in ...) {\n if (e.height == 30) {\n e.className = \"h30\";\n }\n}\n" }, { "answer_id": 53593,...
2008/09/10
[ "https://Stackoverflow.com/questions/53473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5512/" ]
53,480
<p>Hey, I'm using <a href="http://en.wikipedia.org/wiki/Levenshtein_distance" rel="nofollow noreferrer">Levenshteins</a> algorithm to get distance between source and target string.</p> <p>also I have method which returns value from 0 to 1:</p> <pre><code>/// &lt;summary&gt; /// Gets the similarity between two strings. /// All relation scores are in the [0, 1] range, /// which means that if the score gets a maximum value (equal to 1) /// then the two string are absolutely similar /// &lt;/summary&gt; /// &lt;param name="string1"&gt;The string1.&lt;/param&gt; /// &lt;param name="string2"&gt;The string2.&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; public static float CalculateSimilarity(String s1, String s2) { if ((s1 == null) || (s2 == null)) return 0.0f; float dis = LevenshteinDistance.Compute(s1, s2); float maxLen = s1.Length; if (maxLen &lt; s2.Length) maxLen = s2.Length; if (maxLen == 0.0F) return 1.0F; else return 1.0F - dis / maxLen; } </code></pre> <p>but this for me is not enough. Because I need more complex way to match two sentences.</p> <p>For example I want automatically tag some music, I have original song names, and i have songs with trash, like <em>super, quality,</em> years like <em>2007, 2008,</em> etc..etc.. also some files have just <a href="http://trash..thash..song_name_mp3.mp3" rel="nofollow noreferrer">http://trash..thash..song_name_mp3.mp3</a>, other are normal. I want to create an algorithm which will work just more perfect than mine now.. Maybe anyone can help me?</p> <p>here is my current algo:</p> <pre><code>/// &lt;summary&gt; /// if we need to ignore this target. /// &lt;/summary&gt; /// &lt;param name="targetString"&gt;The target string.&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; private bool doIgnore(String targetString) { if ((targetString != null) &amp;&amp; (targetString != String.Empty)) { for (int i = 0; i &lt; ignoreWordsList.Length; ++i) { //* if we found ignore word or target string matching some some special cases like years (Regex). if (targetString == ignoreWordsList[i] || (isMatchInSpecialCases(targetString))) return true; } } return false; } /// &lt;summary&gt; /// Removes the duplicates. /// &lt;/summary&gt; /// &lt;param name="list"&gt;The list.&lt;/param&gt; private void removeDuplicates(List&lt;String&gt; list) { if ((list != null) &amp;&amp; (list.Count &gt; 0)) { for (int i = 0; i &lt; list.Count - 1; ++i) { if (list[i] == list[i + 1]) { list.RemoveAt(i); --i; } } } } /// &lt;summary&gt; /// Does the fuzzy match. /// &lt;/summary&gt; /// &lt;param name="targetTitle"&gt;The target title.&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; private TitleMatchResult doFuzzyMatch(String targetTitle) { TitleMatchResult matchResult = null; if (targetTitle != null &amp;&amp; targetTitle != String.Empty) { try { //* change target title (string) to lower case. targetTitle = targetTitle.ToLower(); //* scores, we will select higher score at the end. Dictionary&lt;Title, float&gt; scores = new Dictionary&lt;Title, float&gt;(); //* do split special chars: '-', ' ', '.', ',', '?', '/', ':', ';', '%', '(', ')', '#', '\"', '\'', '!', '|', '^', '*', '[', ']', '{', '}', '=', '!', '+', '_' List&lt;String&gt; targetKeywords = new List&lt;string&gt;(targetTitle.Split(ignoreCharsList, StringSplitOptions.RemoveEmptyEntries)); //* remove all trash from keywords, like super, quality, etc.. targetKeywords.RemoveAll(delegate(String x) { return doIgnore(x); }); //* sort keywords. targetKeywords.Sort(); //* remove some duplicates. removeDuplicates(targetKeywords); //* go through all original titles. foreach (Title sourceTitle in titles) { float tempScore = 0f; //* split orig. title to keywords list. List&lt;String&gt; sourceKeywords = new List&lt;string&gt;(sourceTitle.Name.Split(ignoreCharsList, StringSplitOptions.RemoveEmptyEntries)); sourceKeywords.Sort(); removeDuplicates(sourceKeywords); //* go through all source ttl keywords. foreach (String keyw1 in sourceKeywords) { float max = float.MinValue; foreach (String keyw2 in targetKeywords) { float currentScore = StringMatching.StringMatching.CalculateSimilarity(keyw1.ToLower(), keyw2); if (currentScore &gt; max) { max = currentScore; } } tempScore += max; } //* calculate average score. float averageScore = (tempScore / Math.Max(targetKeywords.Count, sourceKeywords.Count)); //* if average score is bigger than minimal score and target title is not in this source title ignore list. if (averageScore &gt;= minimalScore &amp;&amp; !sourceTitle.doIgnore(targetTitle)) { //* add score. scores.Add(sourceTitle, averageScore); } } //* choose biggest score. float maxi = float.MinValue; foreach (KeyValuePair&lt;Title, float&gt; kvp in scores) { if (kvp.Value &gt; maxi) { maxi = kvp.Value; matchResult = new TitleMatchResult(maxi, kvp.Key, MatchTechnique.FuzzyLogic); } } } catch { } } //* return result. return matchResult; } </code></pre> <p>This works normally but just in some cases, a lot of titles which should match, does not match... I think I need some kind of formula to play with weights and etc, but i can't think of one.. </p> <p>Ideas? Suggestions? Algos?</p> <p>by the way I already know this topic (My colleague already posted it but we cannot come with a proper solution for this problem.): <a href="https://stackoverflow.com/questions/49263/approximate-string-matching-algorithms">Approximate string matching algorithms</a></p>
[ { "answer_id": 10079256, "author": "Alain", "author_id": 529618, "author_profile": "https://Stackoverflow.com/users/529618", "pm_score": 4, "selected": false, "text": "Public Function valuePhrase#(ByRef S1$, ByRef S2$)\n valuePhrase = LevenshteinDistance(S1, S2)\nEnd Function\n\nPubli...
2008/09/10
[ "https://Stackoverflow.com/questions/53480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369/" ]
53,482
<p>I have long since forgotten the password for the root user on one of my boxes. Is there a way I can change it without having to log in to the instance, or will I have to reinstall?</p>
[ { "answer_id": 53483, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 2, "selected": false, "text": "mysqladmin -u root password <password>\n" }, { "answer_id": 53567, "author": "BlaM", "author_id": 999...
2008/09/10
[ "https://Stackoverflow.com/questions/53482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
53,491
<p>How do I enable external access to MySQL Server? I can connect locally but I cannot connect from another box on the network.</p> <p>I just tried</p> <pre><code>grant all privileges on *.* to root@'%' identified by '*****' with grant option; </code></pre> <p>And restarted MySQL Server with no success.</p>
[ { "answer_id": 53512, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 6, "selected": true, "text": "bind-address" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
53,497
<p>I'm having trouble writing a regular expression that matches valid IPv6 addresses, including those in their compressed form (with <code>::</code> or leading zeros omitted from each byte pair). </p> <p>Can someone suggest a regular expression that would fulfill the requirement?</p> <p>I'm considering expanding each byte pair and matching the result with a simpler regex.</p>
[ { "answer_id": 53499, "author": "Factor Mystic", "author_id": 1569, "author_profile": "https://Stackoverflow.com/users/1569", "pm_score": 5, "selected": false, "text": "(\\A([0-9a-f]{1,4}:){1,1}(:[0-9a-f]{1,4}){1,6}\\Z)|\n(\\A([0-9a-f]{1,4}:){1,2}(:[0-9a-f]{1,4}){1,5}\\Z)|\n(\\A([0-9a-f]...
2008/09/10
[ "https://Stackoverflow.com/questions/53497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
53,501
<p>I am developing console application in .Net and I want to change a behavior a little based on information that application was started from cmd.exe or from explorer.exe. Is it possible?</p>
[ { "answer_id": 53526, "author": "Factor Mystic", "author_id": 1569, "author_profile": "https://Stackoverflow.com/users/1569", "pm_score": 4, "selected": true, "text": "Process this_process = Process.GetCurrentProcess();\nint parent_pid = 0;\nusing (ManagementObject MgmtObj = new Manageme...
2008/09/10
[ "https://Stackoverflow.com/questions/53501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361/" ]
53,511
<p>If I use restful_authentication in my ruby on rails app are passwords transfered between the broswer and the server in paintext? And if so how worried should I be about it?</p>
[ { "answer_id": 232301, "author": "two-bit-fool", "author_id": 23899, "author_profile": "https://Stackoverflow.com/users/23899", "pm_score": 2, "selected": false, "text": "filter_parameter_logging :password\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4474/" ]
53,513
<p>For example, if passed the following:</p> <pre><code>a = [] </code></pre> <p>How do I check to see if <code>a</code> is empty?</p>
[ { "answer_id": 53522, "author": "Patrick", "author_id": 429, "author_profile": "https://Stackoverflow.com/users/429", "pm_score": 14, "selected": true, "text": "if not a:\n print(\"List is empty\")\n" }, { "answer_id": 53525, "author": "Peter Hoffmann", "author_id": 72...
2008/09/10
[ "https://Stackoverflow.com/questions/53513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
53,532
<p>I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework. JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing framework that supports testing Tomcat servlets? Eclipse integration is nice but not necessary. </p>
[ { "answer_id": 53535, "author": "Will Sargent", "author_id": 5266, "author_profile": "https://Stackoverflow.com/users/5266", "pm_score": 3, "selected": false, "text": "public void testPost() {\n mockRequest = createMock(HttpServletRequest.class);\n mockResponse = createMock(HttpServl...
2008/09/10
[ "https://Stackoverflow.com/questions/53532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1702/" ]
53,538
<p>Is it possible to order results in SQL Server 2005 by the relevance of a freetext match? In MySQL you can use the (roughly equivalent) MATCH function in the ORDER BY section, but I haven't found any equivalence in SQL Server.</p> <p>From the <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html" rel="noreferrer">MySQL docs</a>:</p> <blockquote> <p>For each row in the table, MATCH() returns a relevance value; that is, a similarity measure between the search string and the text in that row in the columns named in the MATCH() list.</p> </blockquote> <p>So for example you could order by the number of votes, then this relevance, and finally by a creation date. Is this something that can be done, or am I stuck with just returning the matching values and not having this ordering ability?</p>
[ { "answer_id": 53540, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": 3, "selected": true, "text": "FREETEXTTABLE" }, { "answer_id": 58179, "author": "Josef", "author_id": 5581, "author_profile": "https://Stacko...
2008/09/10
[ "https://Stackoverflow.com/questions/53538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1612/" ]
53,543
<p>Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation?</p>
[ { "answer_id": 53549, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https://Stackoverflow.com/users/2260", "pm_score": 4, "selected": false, "text": "import mymodule_jython as mymodule\n\nimport mymodule_cpython as mymodule\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
53,545
<p>I have an exe with an <code>App.Config</code> file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.</p> <p>The question is how can I access the app.config property in the exe from the wrapper dll?</p> <p>Maybe I should be a little bit more in my questions, I have the following app.config content with the exe:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="myKey" value="myValue"/&gt; &lt;/appSettings&gt; &lt;/configuration&gt; </code></pre> <p>The question is how to how to get "myValue" out from the wrapper dll?</p> <hr> <p>thanks for your solution.</p> <p>Actually my initial concept was to avoid XML file reading method or LINQ or whatever. My preferred solution was to use the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx" rel="noreferrer">configuration manager libraries and the like</a>.</p> <p>I'll appreciate any help that uses the classes that are normally associated with accessing app.config properties. </p>
[ { "answer_id": 53553, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 5, "selected": false, "text": "static void GetMappedExeConfigurationSections()\n{\n // Get the machine.config file.\n ExeConfigurationFileMap fileMap =\n...
2008/09/10
[ "https://Stackoverflow.com/questions/53545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
53,562
<p>What are the steps required to enable Hibernate's second-level cache, when using the Java Persistence API (annotated entities)? How do I check that it's working? I'm using JBoss 4.2.2.GA.</p> <p>From the Hibernate documentation, it seems that I need to enable the cache and specify a cache provider in <em>persistence.xml</em>, like:</p> <pre><code>&lt;property name="hibernate.cache.use_second_level_cache" value="true" /&gt; &lt;property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /&gt; </code></pre> <p>What else is required? Do I need to add <em>@Cache</em> annotations to my JPA entities?</p> <p>How can I tell if the cache is working? I have tried accessing cache statistics after running a Query, but <em>Statistics.getSecondLevelCacheStatistics</em> returns null, perhaps because I don't know what 'region' name to use.</p>
[ { "answer_id": 54415, "author": "Peter Hilton", "author_id": 2670, "author_profile": "https://Stackoverflow.com/users/2670", "pm_score": 2, "selected": false, "text": "<property name=\"hibernate.cache.provider_class\" \n value=\"net.sf.ehcache.hibernate.EhCacheProvider\" />\n" ...
2008/09/10
[ "https://Stackoverflow.com/questions/53562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2670/" ]
53,569
<p>What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:</p> <pre><code>git log $(git merge-base HEAD branch)..branch </code></pre> <p>The documentation for <a href="http://git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> indicates that <code>git diff A...B</code> is equivalent to <code>git diff $(git-merge-base A B) B</code>. On the other hand, the documentation for <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html" rel="noreferrer">git-rev-parse</a> indicates that <code>r1...r2</code> is defined as <code>r1 r2 --not $(git merge-base --all r1 r2)</code>.</p> <p>Why are these different? Note that <code>git diff HEAD...branch</code> gives me the diffs I want, but the corresponding git log command gives me more than what I want.</p> <p>In pictures, suppose this:</p> <pre> x---y---z---branch / ---a---b---c---d---e---HEAD </pre> <p>I would like to get a log containing commits x, y, z.</p> <ul> <li><code>git diff HEAD...branch</code> gives these commits</li> <li>however, <code>git log HEAD...branch</code> gives x, y, z, c, d, e.</li> </ul>
[ { "answer_id": 53573, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 9, "selected": true, "text": "A...B" }, { "answer_id": 273683, "author": "skiphoppy", "author_id": 18103, "author_profile": "https://...
2008/09/10
[ "https://Stackoverflow.com/questions/53569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/893/" ]
53,599
<p>Ulimately I just wanted to extract strings from the .rc file so I could translate them, but anything that goes with .rc files works for me.</p>
[ { "answer_id": 98442, "author": "jussij", "author_id": 14738, "author_profile": "https://Stackoverflow.com/users/14738", "pm_score": 0, "selected": false, "text": "# Run Script Using This Command Line\n#\n# sed.exe -n -f sed.txt test.rc\n#\n\n# Check for lines that contain strings\n/\\...
2008/09/10
[ "https://Stackoverflow.com/questions/53599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4880/" ]
53,609
<p>I hope this qualifies as a programming question, as in any programming tutorial, you eventually come across 'foo' in the code examples. (yeah, right?)</p> <p>what does 'foo' really mean?</p> <p>If it is meant to mean <strong>nothing</strong>, when did it begin to be used so?</p>
[ { "answer_id": 58617, "author": "Will Harris", "author_id": 4702, "author_profile": "https://Stackoverflow.com/users/4702", "pm_score": 5, "selected": false, "text": "foo" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123/" ]
53,623
<p>I want to get whois information of a domain name from my c#/java programs. Is there a simple way to do this? </p>
[ { "answer_id": 53632, "author": "Chris Bunch", "author_id": 422, "author_profile": "https://Stackoverflow.com/users/422", "pm_score": -1, "selected": false, "text": "whois" }, { "answer_id": 177758, "author": "Alnitak", "author_id": 6782, "author_profile": "https://St...
2008/09/10
[ "https://Stackoverflow.com/questions/53623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
53,629
<p>Is it possible to see the history of changes to a particular line of code in a Subversion repository?</p> <p>I'd like, for instance, to be able to see when a particular statement was added or when that statement was changed, even if its line number is not the same any more.</p>
[ { "answer_id": 53634, "author": "Brad Wilson", "author_id": 1554, "author_profile": "https://Stackoverflow.com/users/1554", "pm_score": -1, "selected": false, "text": "svn blame" }, { "answer_id": 53636, "author": "Peter Hoffmann", "author_id": 720, "author_profile": ...
2008/09/10
[ "https://Stackoverflow.com/questions/53629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1428/" ]
53,649
<p>Using reflection, I need to investigate a user DLL and create an object of a class in it.</p> <p>What is the simple way of doing it?</p>
[ { "answer_id": 53658, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 2, "selected": false, "text": "System.Reflection.Assembly" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/195/" ]
53,652
<p>This might be a bit on the silly side of things but I need to send the contents of a DataTable (unknown columns, unknown contents) via a text e-mail. Basic idea is to loop over rows and columns and output all cell contents into a StringBuilder using .ToString(). </p> <p>Formatting is a big issue though. Any tips/ideas on how to make this look "readable" in a text format ? </p> <p>I'm thinking on "padding" each cell with empty spaces, but I also need to split some cells into multiple lines, and this makes the StringBuilder approach a bit messy ( because the second line of text from the first column comes after the first line of text in the last column,etc.)</p>
[ { "answer_id": 53665, "author": "Lukas Šalkauskas", "author_id": 5369, "author_profile": "https://Stackoverflow.com/users/5369", "pm_score": -1, "selected": false, "text": "Dim Str As String = \"\"\n 'Create File if doesn't exist\n Dim FILE_NAME As String = \"C:\\temp\\Custom.t...
2008/09/10
[ "https://Stackoverflow.com/questions/53652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3263/" ]
53,664
<p>I've started using Vim to develop Perl scripts and am starting to find it very powerful. </p> <p>One thing I like is to be able to open multiple files at once with:</p> <pre><code>vi main.pl maintenance.pl </code></pre> <p>and then hop between them with:</p> <pre><code>:n :prev </code></pre> <p>and see which file are open with:</p> <pre><code>:args </code></pre> <p>And to add a file, I can say: </p> <pre><code>:n test.pl </code></pre> <p>which I expect would then be added to my list of files, but instead it wipes out my current file list and when I type <code>:args</code> I only have <code>test.pl</code> open.</p> <p>So how can I add and remove files in my args list?</p>
[ { "answer_id": 53667, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": ":tabe [filename]" }, { "answer_id": 53668, "author": "fijter", "author_id": 3215, "author_profile"...
2008/09/10
[ "https://Stackoverflow.com/questions/53664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
53,666
<p>Say I have an interface IFoo which I am mocking. There are 3 methods on this interface. I need to test that the system under test calls at least one of the three methods. I don't care how many times, or with what arguments it does call, but the case where it ignores all the methods and does not touch the IFoo mock is the failure case.</p> <p>I've been looking through the Expect.Call documentation but can't see an easy way to do it.</p> <p>Any ideas?</p>
[ { "answer_id": 58623, "author": "Spoike", "author_id": 3713, "author_profile": "https://Stackoverflow.com/users/3713", "pm_score": 0, "selected": false, "text": "[TestFixture]\npublic class MyTest {\n\n // The mocked interface\n public class MockedInterface implements MyInterface {...
2008/09/10
[ "https://Stackoverflow.com/questions/53666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3024/" ]
53,676
<p>When trying to connect to an <code>ORACLE</code> user via TOAD (Quest Software) or any other means (<code>Oracle Enterprise Manager</code>) I get this error:</p> <blockquote> <p><code>ORA-011033: ORACLE initialization or shutdown in progress</code></p> </blockquote>
[ { "answer_id": 53684, "author": "rohancragg", "author_id": 5351, "author_profile": "https://Stackoverflow.com/users/5351", "pm_score": 8, "selected": true, "text": "SQL> startup mount\n\nORACLE Instance started\n\nSQL> recover database \n\nMedia recovery complete\n\nSQL> alter database o...
2008/09/10
[ "https://Stackoverflow.com/questions/53676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351/" ]
53,715
<p>Does Delphi call inherited on overridden procedures if there is no explicit call in the code ie (inherited;), I have the following structure (from super to sub class)</p> <p>TForm >> TBaseForm >> TAnyOtherForm</p> <p>All the forms in the project will be derived from TBaseForm, as this will have all the standard set-up and destructive parts that are used for every form (security, validation ect). </p> <p>TBaseForm has onCreate and onDestroy procedures with the code to do this, but if someone (ie me) forgot to add inherited to the onCreate on TAnyOtherForm would Delphi call it for me? I have found references on the web that say it is not required, but nowhere says if it gets called if it is omitted from the code.</p> <p>Also if it does call inherited for me, when will it call it?</p>
[ { "answer_id": 53785, "author": "Frank", "author_id": 4474, "author_profile": "https://Stackoverflow.com/users/4474", "pm_score": 2, "selected": false, "text": "// interface\n\nTBaseForm = Class(TForm)\n...\nProtected\n Procedure DoCreate(Sender : TObject); Override;\nEnd\n\n// implem...
2008/09/10
[ "https://Stackoverflow.com/questions/53715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2098/" ]
53,719
<p>It is obviously possible to hide individual data points in an Excel line chart.</p> <ul> <li>Select a data point. </li> <li>Right click -> Format Data Point... </li> <li>Select Patterns</li> <li>Tab Set Line to None</li> </ul> <p>How do you accomplish the same thing in VBA? Intuition tells me there should be a property on the <a href="http://msdn.microsoft.com/en-us/library/aa174283(office.11).aspx" rel="nofollow noreferrer">Point object</a> <code>Chart.SeriesCollection(&lt;index&gt;).Points(&lt;index&gt;</code> which deals with this...</p>
[ { "answer_id": 67650, "author": "SpyJournal", "author_id": 10326, "author_profile": "https://Stackoverflow.com/users/10326", "pm_score": 2, "selected": false, "text": "IF" }, { "answer_id": 471678, "author": "Community", "author_id": -1, "author_profile": "https://Sta...
2008/09/10
[ "https://Stackoverflow.com/questions/53719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5085/" ]
53,728
<p>I am not concerned about other kinds of attacks. Just want to know whether HTML Encode can prevent all kinds of XSS attacks.</p> <p>Is there some way to do an XSS attack even if HTML Encode is used?</p>
[ { "answer_id": 53739, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": -1, "selected": false, "text": "&lt;script/&gt;\n" }, { "answer_id": 53816, "author": "metavida", "author_id": 5539, "author_profile": ...
2008/09/10
[ "https://Stackoverflow.com/questions/53728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
53,734
<p>If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says <a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc20020_1251/html/databases/databases644.htm" rel="noreferrer">this</a>:</p> <p><em>"the table must contain data when the index is created. If you create the temporary table and create the index on an empty table, Adaptive Server does not create column statistics such as histograms and densities. If you insert data rows after creating the index, the optimizer has incomplete statistics."</em></p> <p>but recently a colleague mentioned that if I create the temp table and indices in a different stored procedure to the one which actually uses the temporary table, then Adaptive Server optimiser <em>will</em> be able to make use of them.</p> <p>On the whole, I'm not a big fan of wrapper procedures that add little value, so I've not actually got around to testing this, but I thought I'd put the question out there, to see if anyone had any other approaches or advice?</p>
[ { "answer_id": 153680, "author": "AJ.", "author_id": 7211, "author_profile": "https://Stackoverflow.com/users/7211", "pm_score": 4, "selected": true, "text": "SELECT * \nFROM #table (index idIndex) \nWHERE id = @id\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1030/" ]
53,744
<p>I would like to know how can i escape a # in velocity. Backslash seems to escape it but it prints itself as well</p> <p>This: </p> <pre><code>\#\# </code></pre> <p>prints: </p> <pre><code>\#\# </code></pre> <p>I would like: </p> <pre><code>## </code></pre>
[ { "answer_id": 64246, "author": "Nathan Bubna", "author_id": 8131, "author_profile": "https://Stackoverflow.com/users/8131", "pm_score": 6, "selected": false, "text": "#set( $H = '#' )\n$H$H\n" }, { "answer_id": 7093929, "author": "alvi", "author_id": 644958, "author_...
2008/09/10
[ "https://Stackoverflow.com/questions/53744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
53,757
<p>Which compiles to faster code: "ans = n * 3" or "ans = n+(n*2)"?</p> <p>Assuming that n is either an int or a long, and it is is running on a modern Win32 Intel box.</p> <p>Would this be different if there was some dereferencing involved, that is, which of these would be faster?</p> <pre> long a; long *pn; long ans; ... *pn = some_number; ans = *pn * 3; </pre> <p>Or</p> <pre> ans = *pn+(*pn*2); </pre> <p>Or, is it something one need not worry about as optimizing compilers are likely to account for this in any case?</p>
[ { "answer_id": 53763, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 0, "selected": false, "text": "* 2" }, { "answer_id": 53781, "author": "Antti Kissaniemi", "author_id": 2948, "author_profile": "...
2008/09/10
[ "https://Stackoverflow.com/questions/53757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3137/" ]
53,786
<p>I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation)</p> <p>I've chosen the <a href="http://en.wikipedia.org/wiki/Weibull_distribution" rel="nofollow noreferrer">Weibull</a> distribution as it "sort of" matches the distribution I've observed (ramps up quickly, drops off quickly but not instantly)</p> <p>I use this distribution to generate the number of requests that should be sent each day between a given start and end date</p> <p>I've hacked together an algorithm in Python that sort of works but it feels kludgy:</p> <pre><code>how_many_days = (end_date - start_date).days freqs = defaultdict(int) for x in xrange(how_many_responses): freqs[int(how_many_days * weibullvariate(0.5, 2))] += 1 timeline = [] day = start_date for i,freq in sorted(freqs.iteritems()): timeline.append((day, freq)) day += timedelta(days=1) return timeline </code></pre> <p>What better ways are there to do this? </p>
[ { "answer_id": 56032, "author": "Kai", "author_id": 2963, "author_profile": "https://Stackoverflow.com/users/2963", "pm_score": 0, "selected": false, "text": "from datetime import *\nfrom random import *\n\ntimeline = []\nscaling = 10\nstart_date = date(2008, 5, 1)\nend_date = date(2008,...
2008/09/10
[ "https://Stackoverflow.com/questions/53786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5357/" ]
53,796
<p>A GUI driven application needs to host some prebuilt WinForms based components. These components provide high performance interactive views using a mixture of GDI+ and DirectX. The views handle control input and display custom graphical renderings. The components are tested in a WinForms harness by the supplier.</p> <p>Can a commericial application use WPF for its GUI and rely on <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx" rel="noreferrer" title="WindowsFormsHost">WindowsFormsHost</a> to host the WinForms components or have you experience of technical glitches e.g. input lags, update issues that would make you cautious?</p>
[ { "answer_id": 53855, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 0, "selected": false, "text": "Application" }, { "answer_id": 70064, "author": "AndyL", "author_id": 9944, "author_profile": "http...
2008/09/10
[ "https://Stackoverflow.com/questions/53796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427/" ]
53,803
<p>We're looking at moving from a check-out/edit/check-in style of version control system to Subversion, and during the evaluation we discovered that when you perform an Update action in TortoiseSVN (and presumably in any Subversion client?), if changes in the repository that need to be applied to files that you've been editing don't cause any conflicts then they'll be automatically/silently merged.</p> <p>This scares us a little, as it's possible that this merge, while not producing any compile errors, could at least introduce some logic errors that may not be easily detected.</p> <p>Very simple example: I'm working within a C# method changing some logic in the latter-part of the method, and somebody else changes the value that a variable gets initialised to at the start of the method. The other person's change isn't in the lines of code that I'm working on so there won't be a conflict; but it's possible to dramatically change the output of the method.</p> <p>What we were hoping the situation would be is that if a merge needs to occur, then the two files would be shown and at least a simple accept/reject change option be presented, so that at least we're aware that something has changed and are given the option to see if it impacts our code.</p> <p>Is there a way to do this with Subversion/TortoiseSVN? Or are we stuck in our present working ways too much and should just let it do it's thing...</p>
[ { "answer_id": 53812, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 3, "selected": false, "text": "svn --diff-cmd=/bin/false\n" }, { "answer_id": 7673033, "author": "Nordic Mainframe", "author_id": 385433, "a...
2008/09/10
[ "https://Stackoverflow.com/questions/53803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5517/" ]
53,806
<p>What was the motivation for having the <code>reintroduce</code> keyword in Delphi?</p> <p>If you have a child class that contains a function with the same name as a virtual function in the parent class and it is not declared with the override modifier then it is a compile error. Adding the reintroduce modifier in such situations fixes the error, but I have never grasped the reasoning for the compile error.</p>
[ { "answer_id": 68154, "author": "Francesca", "author_id": 9842, "author_profile": "https://Stackoverflow.com/users/9842", "pm_score": 2, "selected": false, "text": "TDescendant.MyMethod" }, { "answer_id": 142459, "author": "Frank", "author_id": 4474, "author_profile":...
2008/09/10
[ "https://Stackoverflow.com/questions/53806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4474/" ]
53,808
<p>When interviewing college coops/interns or recent graduates it helps to have a Java programming question that they can do on a white board in 15 minutes. Does anyone have examples of good questions like this? A C++ question I was once asked in an interview was to write a string to integer function which is along the lines of the level of question I am looking for examples of.</p>
[ { "answer_id": 53828, "author": "David Webb", "author_id": 3171, "author_profile": "https://Stackoverflow.com/users/3171", "pm_score": 3, "selected": false, "text": "final" }, { "answer_id": 53830, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https:...
2008/09/10
[ "https://Stackoverflow.com/questions/53808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3637/" ]
53,811
<p>Do you normally set your compiler to optimize for maximum speed or smallest code size? or do you manually configure individual optimization settings? Why?</p> <p>I notice most of the time people tend to just leave compiler optimization settings to their default state, which with visual c++ means max speed. I've always felt that the default settings had more to do with looking good on benchmarks, which tend to be small programs that will fit entirely within the L2 cache than what's best for overall performance, so I normally set it optimize for smallest size.</p>
[ { "answer_id": 53826, "author": "Claes Mogren", "author_id": 4992, "author_profile": "https://Stackoverflow.com/users/4992", "pm_score": 4, "selected": true, "text": "A relative graph of fitnesses:\n\n Acovea Best-of-the-Best: ************************************** (2.55...
2008/09/10
[ "https://Stackoverflow.com/questions/53811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4086/" ]
53,820
<p>In the application I'm developping (in Java/swing), I have to show a full screen window on the <em>second</em> screen of the user. I did this using a code similar to the one you'll find below... Be, as soon as I click in a window opened by windows explorer, or as soon as I open windows explorer (i'm using windows XP), the full screen window is minimized...</p> <p>Do you know any way or workaround to fix this problem, or is there something important I did not understand with full screen windows?</p> <p>Thanks for the help,</p> <pre><code>import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JWindow; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Window; import javax.swing.JButton; import javax.swing.JToggleButton; import java.awt.Rectangle; import java.awt.GridBagLayout; import javax.swing.JLabel; public class FullScreenTest { private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="94,35" private JPanel jContentPane = null; private JToggleButton jToggleButton = null; private JPanel jFSPanel = null; // @jve:decl-index=0:visual-constraint="392,37" private JLabel jLabel = null; private Window window; /** * This method initializes jFrame * * @return javax.swing.JFrame */ private JFrame getJFrame() { if (jFrame == null) { jFrame = new JFrame(); jFrame.setSize(new Dimension(474, 105)); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jFrame.setContentPane(getJContentPane()); } return jFrame; } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(getJToggleButton(), null); } return jContentPane; } /** * This method initializes jToggleButton * * @return javax.swing.JToggleButton */ private JToggleButton getJToggleButton() { if (jToggleButton == null) { jToggleButton = new JToggleButton(); jToggleButton.setBounds(new Rectangle(50, 23, 360, 28)); jToggleButton.setText("Show Full Screen Window on 2nd screen"); jToggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { showFullScreenWindow(jToggleButton.isSelected()); } }); } return jToggleButton; } protected void showFullScreenWindow(boolean b) { if(window==null){ window = initFullScreenWindow(); } window.setVisible(b); } private Window initFullScreenWindow() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); GraphicsDevice gd = gds[1]; JWindow window = new JWindow(gd.getDefaultConfiguration()); window.setContentPane(getJFSPanel()); gd.setFullScreenWindow(window); return window; } /** * This method initializes jFSPanel * * @return javax.swing.JPanel */ private JPanel getJFSPanel() { if (jFSPanel == null) { jLabel = new JLabel(); jLabel.setBounds(new Rectangle(18, 19, 500, 66)); jLabel.setText("Hello ! Now, juste open windows explorer and see what happens..."); jFSPanel = new JPanel(); jFSPanel.setLayout(null); jFSPanel.setSize(new Dimension(500, 107)); jFSPanel.add(jLabel, null); } return jFSPanel; } /** * @param args */ public static void main(String[] args) { FullScreenTest me = new FullScreenTest(); me.getJFrame().setVisible(true); } } </code></pre>
[ { "answer_id": 56166, "author": "Laurent K", "author_id": 2965, "author_profile": "https://Stackoverflow.com/users/2965", "pm_score": 0, "selected": false, "text": "private Window initFullScreenWindow() {\n GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();\n ...
2008/09/10
[ "https://Stackoverflow.com/questions/53820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2965/" ]
53,827
<p>I'm using MinGW with GCC 3.4.5 (mingw-special vista r3).</p> <p>My C application uses a lot of stack so I was wondering is there any way I can tell programatically how much stack is remaining so I can cleanly handle the situation if I find that I'm about to run out.</p> <p>If not what other ways would you work around the problem of potentially running out of stack space?</p> <p>I've no idea what size of stack I'll start with so would need to identify that programatically also.</p>
[ { "answer_id": 53836, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 4, "selected": false, "text": "size_t top_of_stack;\n\nvoid Main()\n{\n int x=0;\n top_of_stack = (size_t) &x;\n\n do_something_very_recursive(....)\n...
2008/09/10
[ "https://Stackoverflow.com/questions/53827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5330/" ]
53,844
<p>I would like to do the equivalent of:</p> <pre><code>object result = Eval("1 + 3"); string now = Eval("System.DateTime.Now().ToString()") as string </code></pre> <p>Following Biri s <a href="http://www.codeproject.com/KB/cs/evalcscode.aspx" rel="noreferrer">link</a>, I got this snippet (modified to remove obsolete method <code>ICodeCompiler.CreateCompiler()</code>:</p> <pre><code>private object Eval(string sExpression) { CSharpCodeProvider c = new CSharpCodeProvider(); CompilerParameters cp = new CompilerParameters(); cp.ReferencedAssemblies.Add("system.dll"); cp.CompilerOptions = "/t:library"; cp.GenerateInMemory = true; StringBuilder sb = new StringBuilder(""); sb.Append("using System;\n"); sb.Append("namespace CSCodeEvaler{ \n"); sb.Append("public class CSCodeEvaler{ \n"); sb.Append("public object EvalCode(){\n"); sb.Append("return " + sExpression + "; \n"); sb.Append("} \n"); sb.Append("} \n"); sb.Append("}\n"); CompilerResults cr = c.CompileAssemblyFromSource(cp, sb.ToString()); if (cr.Errors.Count &gt; 0) { throw new InvalidExpressionException( string.Format("Error ({0}) evaluating: {1}", cr.Errors[0].ErrorText, sExpression)); } System.Reflection.Assembly a = cr.CompiledAssembly; object o = a.CreateInstance("CSCodeEvaler.CSCodeEvaler"); Type t = o.GetType(); MethodInfo mi = t.GetMethod("EvalCode"); object s = mi.Invoke(o, null); return s; } </code></pre>
[ { "answer_id": 54339, "author": "JJJ", "author_id": 5547, "author_profile": "https://Stackoverflow.com/users/5547", "pm_score": 1, "selected": false, "text": "using System;\npublic class Test\n{\n static public void DoStuff( Scripting.IJob Job)\n {\n Console.WriteLine( \"Hep...
2008/09/10
[ "https://Stackoverflow.com/questions/53844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2260/" ]
53,849
<p>Java has a convenient split method:</p> <pre><code>String str = "The quick brown fox"; String[] results = str.split(" "); </code></pre> <p>Is there an easy way to do this in C++?</p>
[ { "answer_id": 53862, "author": "vzczc", "author_id": 224, "author_profile": "https://Stackoverflow.com/users/224", "pm_score": 5, "selected": false, "text": "//Header file\nclass Tokenizer \n{\n public:\n static const std::string DELIMITERS;\n Tokenizer(const std::strin...
2008/09/10
[ "https://Stackoverflow.com/questions/53849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
53,911
<p>Programming in vim I often go search for something, yank it, then go back to where I was, insert it, modify it.</p> <p>The problem is that after I search and find, I need to MANUALLY find my way back to where I was.</p> <p>Is there an automatic way to go back to where I was when I initiated my last search?</p>
[ { "answer_id": 53924, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 6, "selected": false, "text": ":marks" }, { "answer_id": 53926, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://...
2008/09/10
[ "https://Stackoverflow.com/questions/53911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
53,939
<p>I'm running Visual Studio 2008 with the stuff-of-nightmares awful MS test framework. Trouble is that it's sending my CPU to 100% (well 25% on a quad-core).</p> <p>My question is why can't Visual Studio run on more than one core? Surely M$ must have a sufficient handle on threading to get this to work.</p>
[ { "answer_id": 3357049, "author": "Olivier Dagenais", "author_id": 98903, "author_profile": "https://Stackoverflow.com/users/98903", "pm_score": 2, "selected": false, "text": "parallelTestCount" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1122/" ]
53,945
<p>I am currently loading a lightbox style popup that loads it's HTML from an XHR call. This content is then displayed in a 'modal' popup using <code>element.innerHTML = content</code> This works like a charm.</p> <p>In another section of this website I use a Flickr 'badge' (<a href="http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/" rel="noreferrer">http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/</a>) to load flickr images dynamically. This is done including a script tag that loads a flickr javascript, which in turn does some <code>document.write</code> statments.</p> <p>Both of them work perfectly when included in the HTML. Only when loading the flickr badge code <em>inside</em> the lightbox, no content is rendered at all. It seems that using <code>innerHTML</code> to write <code>document.write</code> statements is taking it a step too far, but I cannot find any clue in the javascript implementations (FF2&amp;3, IE6&amp;7) of this behavior.</p> <p>Can anyone clarify if this should or shouldn't work? Thanks.</p>
[ { "answer_id": 54002, "author": "Jon Cram", "author_id": 5343, "author_profile": "https://Stackoverflow.com/users/5343", "pm_score": 0, "selected": false, "text": "document.write" }, { "answer_id": 54026, "author": "Kamiel Wanrooij", "author_id": 4174, "author_profile...
2008/09/10
[ "https://Stackoverflow.com/questions/53945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4174/" ]
53,961
<p>I'm working with a large (270+ project) VS.Net solution. Yes, I know this is pushing the friendship with VS but it's inherited and blah blah. Anyway, to speed up the solution load and compile time I've removed all projects that I'm not currently working on... which in turn has removed those project references from the projects I want to retain. So now I'm going through a mind numbing process of adding binary references to the retained projects so that the referenced Types can be found.</p> <p>Here's how I'm working at present;</p> <ul> <li>Attempt to compile, get thousands of errors, 'type or namespace missing'</li> <li>Copy the first line of the error list to the clipboard</li> <li>Using a perl script hooked up to a hotkey (AHK) I extract the type name from the error message and store it in the windows clipboard</li> <li>I paste the type name into source insight symbol browser and note the assembly containing the Type</li> <li>I go back to VS and add that assembly as a binary reference to the relevant project</li> </ul> <p>So now, after about 30 mins I'm thinking there's just got to be a quicker way...</p>
[ { "answer_id": 54063, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 1, "selected": false, "text": " <ItemGroup>\n <ProjectReference Include=\"..\\WindowsApplication2\\WindowsApplication2.csproj\">\n <Project>{7...
2008/09/10
[ "https://Stackoverflow.com/questions/53961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4200/" ]
53,965
<pre><code>$output = preg_replace("|(/D)(/s+)(/d+)(;)|", "//1,//3;", $output); </code></pre> <p>I'm trying to replace all alphabetical character followed by one or more whitespace characters (tabs and/or spaces) followed by one or more numerical characters followed by a semicolon with the alphabetical character followed by a comma followed by the numerical digits and then the semicolon.</p> <p>I'll provide an example:</p> <p>Start:</p> <pre><code>hello world 1007; </code></pre> <p>End:</p> <pre><code>hello world,1007; </code></pre>
[ { "answer_id": 53993, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 4, "selected": true, "text": "|" }, { "answer_id": 54018, "author": "Alan Storm", "author_id": 4668, "author_profile": "https://Stacko...
2008/09/10
[ "https://Stackoverflow.com/questions/53965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
53,967
<p>I have a class that map objects to objects, but unlike dictionary it maps them both ways. I am now trying to implement a custom <code>IEnumerator</code> interface that iterates through the values.</p> <pre><code>public class Mapper&lt;K,T&gt; : IEnumerable&lt;T&gt;, IEnumerator&lt;T&gt; { C5.TreeDictionary&lt;K,T&gt; KToTMap = new TreeDictionary&lt;K,T&gt;(); C5.HashDictionary&lt;T,K&gt; TToKMap = new HashDictionary&lt;T,K&gt;(); public void Add(K key, T value) { KToTMap.Add(key, value); TToKMap.Add(value, key); } public int Count { get { return KToTMap.Count; } } public K this[T obj] { get { return TToKMap[obj]; } } public T this[K obj] { get { return KToTMap[obj]; } } public IEnumerator&lt;T&gt; GetEnumerator() { return KToTMap.Values.GetEnumerator(); } public T Current { get { throw new NotImplementedException(); } } public void Dispose() { throw new NotImplementedException(); } object System.Collections.IEnumerator.Current { get { throw new NotImplementedException(); } } public bool MoveNext() { ; } public void Reset() { throw new NotImplementedException(); } } </code></pre>
[ { "answer_id": 53999, "author": "Pop Catalin", "author_id": 4685, "author_profile": "https://Stackoverflow.com/users/4685", "pm_score": 3, "selected": false, "text": "IEnumerable<T>" }, { "answer_id": 14999790, "author": "Jack", "author_id": 794594, "author_profile": ...
2008/09/10
[ "https://Stackoverflow.com/questions/53967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4694/" ]
53,989
<p>Usually Flash and Flex applications are embedded on in HTML using either a combination of <code>object</code> and <code>embed</code> tags, or more commonly using JavaScript. However, if you link directly to a SWF file it will open in the browser window and without looking in the address bar you can't tell that it wasn't embedded in HTML with the size set to 100% width and height.</p> <p>Considering the overhead of the HTML, CSS and JavaScript needed to embed a Flash or Flex application filling 100% of the browser window, what are the downsides of linking directly to the SWF file instead? What are the upsides?</p> <p>I can think of one upside and three downsides: you don't need the 100+ lines of HTML, JavaScript and CSS that are otherwise required, but you have no plugin detection, no version checking and you lose your best SEO option (progressive enhancement).</p> <p><em>Update</em> don't get hung up on the 100+ lines, I simply mean that the the amount of code needed to embed a SWF is quite a lot (and I mean including libraries like SWFObject), and it's just for displaying the SWF, which can be done without a single line by linking to it directly.</p>
[ { "answer_id": 54155, "author": "hasseg", "author_id": 4111, "author_profile": "https://Stackoverflow.com/users/4111", "pm_score": 1, "selected": false, "text": "Application.application.parameters" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109/" ]
53,997
<p>I am trying to implement AJAX in my Google App Engine application, and so I am looking for a good AJAX framework that will help me. Anyone has any idea?</p> <p>I am thinking about Google Web Toolkit, how good it is in terms of creating AJAX for Google App Engine?</p>
[ { "answer_id": 605156, "author": "mahmoud", "author_id": 72931, "author_profile": "https://Stackoverflow.com/users/72931", "pm_score": 2, "selected": false, "text": "def Get(self, user):\n self.handleRequest()\n\ndef Post(self, user):\n self.handleRequest()\n\n\ndef handleRequest(s...
2008/09/10
[ "https://Stackoverflow.com/questions/53997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
54,001
<p>Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this error. </p> <p>I don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.</p>
[ { "answer_id": 228209, "author": "Mark Glorie", "author_id": 952, "author_profile": "https://Stackoverflow.com/users/952", "pm_score": 3, "selected": false, "text": "Public Class [Global]\n Inherits System.Web.HttpApplication\n ...\n" }, { "answer_id": 8938480, "author"...
2008/09/10
[ "https://Stackoverflow.com/questions/54001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
54,010
<p>I've recently been working on a beginner's project in Scala, and have a beginner question about Scala's Lists.</p> <p>Say I have a list of tuples ( <code>List[Tuple2[String, String]]</code>, for example). Is there a convenience method to return the first occurence of a specified tuple from the List, or is it necessary to iterate through the list by hand?</p>
[ { "answer_id": 66489, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 2, "selected": false, "text": "find" }, { "answer_id": 392351, "author": "Community", "author_id": -1, "author_profile": "https:/...
2008/09/10
[ "https://Stackoverflow.com/questions/54010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
54,036
<p>how can i create an application to read all my browser (firefox) history? i noticed that i have in </p> <p>C:\Users\user.name\AppData\Local\Mozilla\Firefox\Profiles\646vwtnu.default</p> <p>what looks like a sqlite database (urlclassifier3.sqlite) but i don't know if its really what is used to store de history information. i searched for examples on how to do this but didn't find anything.</p> <p>ps: although the title is similar i believe this question is not the same as <a href="https://stackoverflow.com/questions/48805/how-do-you-access-browser-history">"How do you access browser history?"</a></p>
[ { "answer_id": 54074, "author": "hasseg", "author_id": 4111, "author_profile": "https://Stackoverflow.com/users/4111", "pm_score": 4, "selected": true, "text": "places.sqlite" }, { "answer_id": 56201, "author": "Vitor Silva", "author_id": 1842864, "author_profile": "h...
2008/09/10
[ "https://Stackoverflow.com/questions/54036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1842864/" ]
54,037
<p>Say you've got a credit card number with an expiration date of 05/08 - i.e. May 2008.</p> <p>Does that mean the card expires on the morning of the 1st of May 2008, or the night of the 31st of May 2008?</p>
[ { "answer_id": 54041, "author": "David Webb", "author_id": 3171, "author_profile": "https://Stackoverflow.com/users/3171", "pm_score": 4, "selected": false, "text": "EXPIRES END" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797/" ]
54,047
<p>I've been trying to figure out a regex to allow me to search for a particular string while automatically skipping comments. Anyone have an RE like this or know of one? It doesn't even need to be sophisticated enough to skip <code>#if 0</code> blocks; I just want it to skip over <code>//</code> and <code>/*</code> blocks. The converse, that is only search inside comment blocks, would be very useful too. </p> <p>Environment: VS 2003</p>
[ { "answer_id": 54148, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "\"This is \\\"a test\\\"\"" }, { "answer_id": 55604, "author": "jfs", "author_id": 4279, "author_prof...
2008/09/10
[ "https://Stackoverflow.com/questions/54047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2820/" ]
54,050
<p>We have an ASP.NET application that manages it's own User, Roles and Permission database and we have recently added a field to the User table to hold the Windows domain account. </p> <p>I would like to make it so that the user doesn't have to <strong>physically</strong> log in to our application, but rather would be automatically logged in based on the currently logged in Windows domain account DOMAIN\username. We want to authenticate the Windows domain account against our own User table. </p> <p>This is a piece of cake to do in Windows Forms, is it possible to do this in Web Forms?</p> <p>I don't want the user to be prompted with a Windows challenge screen, I want our system to handle the log in.</p> <p><strong>Clarification</strong>: We are using our own custom Principal object.</p> <p><strong>Clarification</strong>: Not sure if it makes a difference or not, but we are using IIS7.</p>
[ { "answer_id": 54065, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": 1, "selected": false, "text": "using System.Security.Principal;\n...\nWindowsPrincipal wp = (WindowsPrincipal)HttpContext.Current.User;\n" }, { "answer_i...
2008/09/10
[ "https://Stackoverflow.com/questions/54050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
54,052
<p>Are there any free tools available to view the contents of the solution user options file (the .suo file that accompanies solution files)?</p> <p>I know it's basically formatted as a file system within the file, but I'd like to be able to view the contents so that I can figure out which aspects of my solution and customizations are causing it grow very large over time.</p>
[ { "answer_id": 59385061, "author": "Drew Noakes", "author_id": 24874, "author_profile": "https://Stackoverflow.com/users/24874", "pm_score": 1, "selected": false, "text": "dotnet install --global suo\nsuo view <path-to-suo-file>\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507/" ]
54,059
<p>Say I have a linked list of numbers of length <code>N</code>. <code>N</code> is very large and I don’t know in advance the exact value of <code>N</code>. </p> <p>How can I most efficiently write a function that will return <code>k</code> completely <em>random numbers</em> from the list?</p>
[ { "answer_id": 54072, "author": "Christian Oudard", "author_id": 3757, "author_profile": "https://Stackoverflow.com/users/3757", "pm_score": -1, "selected": false, "text": "O(N*k)" }, { "answer_id": 54083, "author": "George Mauer", "author_id": 5056, "author_profile":...
2008/09/10
[ "https://Stackoverflow.com/questions/54059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797/" ]
54,068
<p>I'm looking at a new computer which will probably have vista on it. But there are so many editions of vista; are there any weird restrictions on what you can run on the various editions? For instance you couldn't run IIS on Windows ME. Can you still run IIS on the home editions of vista? </p>
[ { "answer_id": 54072, "author": "Christian Oudard", "author_id": 3757, "author_profile": "https://Stackoverflow.com/users/3757", "pm_score": -1, "selected": false, "text": "O(N*k)" }, { "answer_id": 54083, "author": "George Mauer", "author_id": 5056, "author_profile":...
2008/09/10
[ "https://Stackoverflow.com/questions/54068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/361/" ]
54,092
<p><br /> I need to send MMS thought a C# application. I have already found 2 interesting components: <a href="http://www.winwap.com" rel="nofollow noreferrer">http://www.winwap.com</a><br /> <a href="http://www.nowsms.com" rel="nofollow noreferrer">http://www.nowsms.com</a></p> <p>Does anyone have experience with other third party components?<br /> Could someone explain what kind of server I need to send those MMS? Is it a classic SMTP Server? </p>
[ { "answer_id": 32959714, "author": "rickyrobinett", "author_id": 3037626, "author_profile": "https://Stackoverflow.com/users/3037626", "pm_score": 0, "selected": false, "text": " // Send a new outgoing MMS by POSTing to the Messages resource */\n client.SendMessage(\n \"YYY-YYY...
2008/09/10
[ "https://Stackoverflow.com/questions/54092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/296/" ]
54,096
<p>I got a little curious after reading <a href="http://it.slashdot.org/it/08/09/09/1558218.shtml" rel="noreferrer">this /. article</a> over hijacking HTTPS cookies. I tracked it down a bit, and a good resource I stumbled across lists a few ways to secure cookies <a href="http://casabasecurity.com/content/using-aspnet-session-handling-secure-sites-set-secure-flag" rel="noreferrer">here</a>. Must I use adsutil, or will setting requireSSL in the httpCookies section of web.config cover session cookies in addition to all others (<a href="http://msdn2.microsoft.com/en-us/library/ms228262.aspx" rel="noreferrer">covered here</a>)? Is there anything else I should be considering to harden sessions further?</p>
[ { "answer_id": 32959714, "author": "rickyrobinett", "author_id": 3037626, "author_profile": "https://Stackoverflow.com/users/3037626", "pm_score": 0, "selected": false, "text": " // Send a new outgoing MMS by POSTing to the Messages resource */\n client.SendMessage(\n \"YYY-YYY...
2008/09/10
[ "https://Stackoverflow.com/questions/54096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1212/" ]
54,104
<p>Surprisingly as you get good at vim, you can code even faster than standard IDEs such as Eclipse. But one thing I really miss is code completion, especially for long variable names and functions.</p> <p>Is there any way to enable code completion for Perl in vim?</p>
[ { "answer_id": 54116, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 3, "selected": false, "text": "autocmd FileType php set omnifunc=phpcomplete#CompletePHP\n" }, { "answer_id": 72727, "author": "Matt Siegman", ...
2008/09/10
[ "https://Stackoverflow.com/questions/54104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
54,118
<p>Database? Page variables? Enum?</p> <p>I'm looking for opinions here. </p>
[ { "answer_id": 57722, "author": "Zack Peterson", "author_id": 83, "author_profile": "https://Stackoverflow.com/users/83", "pm_score": 1, "selected": false, "text": "<asp:SiteMapPath ID=\"SiteMapPath1\" runat=\"server\" />\n<asp:Menu ID=\"Menu1\" runat=\"server\" DataSourceID=\"SiteMapDat...
2008/09/10
[ "https://Stackoverflow.com/questions/54118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4140/" ]
54,138
<p>I have a third-party app that creates HTML-based reports that I need to display. I have <em>some</em> control over how they look, but in general it's pretty primitive. I <em>can</em> inject some javascript, though. I'd like to try to inject some jQuery goodness into it to tidy it up some. One specific thing I would like to do is to take a table (an actual HTML &lt;table&gt;) that always contains one row and a variable number of columns and magically convert that into a tabbed view where the contents (always one &lt;div&gt; that I can supply an ID if necessary) of each original table cell represents a sheet in the tabbed view. I haven't found any good (read: simple) examples of re-parenting items like this, so I'm not sure where to begin. Can someone provide some hints on how I might try this?</p>
[ { "answer_id": 54190, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 0, "selected": false, "text": "<ul>" }, { "answer_id": 76943, "author": "Rich McCollister", "author_id": 9306, "author_profile": "http...
2008/09/10
[ "https://Stackoverflow.com/questions/54138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404/" ]
54,142
<p>How does the comma operator work in C++?</p> <p>For instance, if I do:</p> <pre><code>a = b, c; </code></pre> <p>Does a end up equaling b or c? </p> <p>(Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)</p> <p><strong>Update:</strong> This question has exposed a nuance when using the comma operator. Just to document this:</p> <pre><code>a = b, c; // a is set to the value of b! a = (b, c); // a is set to the value of c! </code></pre> <p>This question was actually inspired by a typo in code. What was intended to be</p> <pre><code>a = b; c = d; </code></pre> <p>Turned into</p> <pre><code>a = b, // &lt;- Note comma typo! c = d; </code></pre>
[ { "answer_id": 54146, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 7, "selected": true, "text": "b" }, { "answer_id": 54172, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "http...
2008/09/10
[ "https://Stackoverflow.com/questions/54142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1541/" ]
54,147
<p>I want to insert some special characters at the caret inside textboxes using javascript on a button. How can this be done?</p> <p>The script needs to find the active textbox and insert the character at the caret in that textbox. The script also needs to work in IE and Firefox.</p> <p><strong>EDIT:</strong> It is also ok to insert the character "last" in the previously active textbox.</p>
[ { "answer_id": 54167, "author": "Brian Warshaw", "author_id": 1344, "author_profile": "https://Stackoverflow.com/users/1344", "pm_score": 0, "selected": false, "text": "onblur" }, { "answer_id": 54269, "author": "Brian Warshaw", "author_id": 1344, "author_profile": "h...
2008/09/10
[ "https://Stackoverflow.com/questions/54147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1523/" ]
54,176
<p>I'm looking at improving the performance of some SQL, currently CTEs are being used and referenced multiple times in the script. Would I get improvements using a table variable instead? (Can't use a temporary table as the code is within functions).</p>
[ { "answer_id": 73371261, "author": "Shnugo", "author_id": 5089204, "author_profile": "https://Stackoverflow.com/users/5089204", "pm_score": 3, "selected": false, "text": "WITH()" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5556/" ]
54,188
<p>I have two threads, one updating an int and one reading it. This is a statistic value where the order of the reads and writes is irrelevant.</p> <p>My question is, do I need to synchronize access to this multi-byte value anyway? Or, put another way, can part of the write be complete and get interrupted, and then the read happen.</p> <p>For example, think of a value = 0x0000FFFF that gets incremented value of 0x00010000.</p> <p>Is there a time where the value looks like 0x0001FFFF that I should be worried about? Certainly the larger the type, the more possible something like this to happen.</p> <p>I've always synchronized these types of accesses, but was curious what the community thinks.</p>
[ { "answer_id": 3378960, "author": "siddhusingh", "author_id": 306819, "author_profile": "https://Stackoverflow.com/users/306819", "pm_score": 0, "selected": false, "text": "int x;\nx++;\nx=x+5;\n" }, { "answer_id": 9903090, "author": "etham", "author_id": 806286, "aut...
2008/09/10
[ "https://Stackoverflow.com/questions/54188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2167252/" ]
54,199
<p>How to implement Repository pattern withe LinqToEntities how to implement the interface </p>
[ { "answer_id": 3378960, "author": "siddhusingh", "author_id": 306819, "author_profile": "https://Stackoverflow.com/users/306819", "pm_score": 0, "selected": false, "text": "int x;\nx++;\nx=x+5;\n" }, { "answer_id": 9903090, "author": "etham", "author_id": 806286, "aut...
2008/09/10
[ "https://Stackoverflow.com/questions/54199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2442689/" ]
54,200
<p>I am developing a web app which requires a username and password to be stored in the web.Config, it also refers to some URLs which will be requested by the web app itself and never the client.</p> <p>I know the .Net framework will not allow a web.config file to be served, however I still think its bad practice to leave this sort of information in plain text. </p> <p>Everything I have read so far requires me to use a command line switch or to store values in the registry of the server. I have access to neither of these as the host is online and I have only FTP and Control Panel (helm) access.</p> <p>Can anyone recommend any good, free encryption DLL's or methods which I can use? I'd rather not develop my own!</p> <p>Thanks for the feedback so far guys but I am not able to issue commands and and not able to edit the registry. Its going to have to be an encryption util/helper but just wondering which one!</p>
[ { "answer_id": 40489084, "author": "Matt", "author_id": 1016343, "author_profile": "https://Stackoverflow.com/users/1016343", "pm_score": 2, "selected": false, "text": "C:" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2208/" ]
54,207
<p>I have an internal enterprise app that currently consumes 10 different web services. They're consumed via old style "Web References" instead of using WCF.</p> <p>The problem I'm having is trying to work with the other teams in the company who are authoring the services I'm consuming. I found I needed to capture the exact SOAP messages that I'm sending and receiving. I did this by creating a new attribute that extends SoapExtensionAttribute. I then just add that attribute to the service method in the generated Reference.cs file. This works, but is painful for two reasons. First, it's a generated file so anything I do in there can be overwritten. Second, I have to remember to remove the attribute before checking in the file.</p> <p><strong>Is There a better way to capture the exact SOAP messages that I am sending and receiving?</strong></p>
[ { "answer_id": 54306, "author": "NotMyself", "author_id": 303, "author_profile": "https://Stackoverflow.com/users/303", "pm_score": 0, "selected": false, "text": "<System.Diagnostics.Conditional(\"DEBUG\")> _\n Private Sub CheckHTTPRequest(ByVal functionName As String)\n Dim e ...
2008/09/10
[ "https://Stackoverflow.com/questions/54207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2595/" ]
54,219
<p>I'm working on an editor for files that are used by an important internal testing tool we use. The tool itself is large, complicated, and refactoring or rewriting would take more resources than we are able to devote to it for the forseeable future, so my hands are tied when it comes to large modifications. I must use a .NET language.</p> <p>The files are XML serialized versions of four classes that are used by the tool (let's call them A, B, C, and D). The classes form a tree structure when all is well. Our editor works by loading a set of files, deserializing them, working out the relationships between them, and keeping track of any bad states it can find. The idea is for us to move away from hand-editing these files, which introduces tons of errors.</p> <p>For a particular type of error, I'd like to maintain a collection of all files that have the problem. All four classes can have the problem, and I'd like to reduce duplication of code as much as possible. An important requirement is the user needs to be able to get the items in sets; for example, they need to get all A objects with an error, and telling them to iterate over the whole collection and pick out what they want is unacceptable compared to a <code>GetAs()</code> method. So, my first thought was to make a generic item that related the deserialized object and some metadata to indicate the error:</p> <pre><code>public class ErrorItem&lt;T&gt; { public T Item { get; set; } public Metadata Metadata { get; set; } } </code></pre> <p>Then, I'd have a collection class that could hold all of the error items, with helper methods to extract the items of a specific class when the user needs them. This is where the trouble starts.</p> <p>None of the classes inherit from a common ancestor (other than <code>Object</code>). This was probably a mistake of the initial design, but I've spent a few days thinking about it and the classes really don't have much in common other than a GUID property that uniquely identifies each item so I can see why the original designer did not relate them through inheritance. This means that the unified error collection would need to store <code>ErrorItem&lt;Object&gt;</code> objects, since I don't have a base class or interface to restrict what comes in. However, this makes the idea of this unified collection a little sketchy to me:</p> <pre><code>Public Class ErrorCollection { public ErrorItem&lt;Object&gt; AllItems { get; set; } } </code></pre> <p>However, this has consequences on the public interface. What I really want is to return the appropriate <code>ErrorItem</code> generic type like this:</p> <pre><code>public ErrorItem&lt;A&gt;[] GetA() </code></pre> <p>This is impossible because I can only store <code>ErrorItem&lt;Object&gt;</code>! I've gone over some workarounds in my head; mostly they include creating a new <code>ErrorItem</code> of the appropriate type on-the-fly, but it just feels kind of ugly. Another thought has been using a <code>Dictionary</code> to keep items organized by type, but it still doesn't seem right.</p> <p>Is there some kind of pattern that might help me here? I know the easiest way to solve this is to add a base class that A, B, C, and D derive from, but I'm trying to have as small an impact on the original tool as possible. Is the cost of any workaround great enough that I should push to change the initial tool?</p>
[ { "answer_id": 54287, "author": "fryguybob", "author_id": 4592, "author_profile": "https://Stackoverflow.com/users/4592", "pm_score": 1, "selected": false, "text": "private List<ErrorItem<object>> _allObjects = new List<ErrorItem<object>>();\n\npublic IEnumerable<ErrorItem<A>> ItemsOfA\n...
2008/09/10
[ "https://Stackoverflow.com/questions/54219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2547/" ]
54,227
<p>I have an asp.net url path which is being generated in a web form, and is coming out something like "/foo/bar/../bar/path.aspx", and is coming out in the generated html like this too. It should be shortened to "/foo/bar/path.aspx". </p> <p>Path.Combine didn't fix it. Is there a function to clean this path up? </p>
[ { "answer_id": 54273, "author": "Compile This", "author_id": 4048, "author_profile": "https://Stackoverflow.com/users/4048", "pm_score": 3, "selected": true, "text": "public static class UriHelper\n{ \n public static string NormalizeRelativePath(string path)\n {\n UriB...
2008/09/10
[ "https://Stackoverflow.com/questions/54227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5599/" ]
54,237
<p>I want to link to bookmark on a page (mysite.com/mypage.htm#bookmark) AND visually highlight the item that was bookmarked (maybe having a red border). Naturally, there would be multiple items bookmarked. So that if someone clicked on #bookmark2 then <em>that</em> other area would be highlighted). </p> <p>I can see how to do that with .asp or .aspx but I'd like to do it more simply than that. I thought maybe there was a clever way to do it with CSS.</p> <p>WHY I'm interested: - I want to have our programs link to a shopping page that lists all the programs on it. I'm using a bookmark so they're jumping to the particular program area (site.com/shoppingpage#Programx) but just to make it <em>obvious</em> I'd like to actually highlight the page being linked to.</p>
[ { "answer_id": 54278, "author": "Kevin", "author_id": 2678, "author_profile": "https://Stackoverflow.com/users/2678", "pm_score": 2, "selected": false, "text": "jQuery(location.hash).addClass('highlight');\n" }, { "answer_id": 54326, "author": "Pat", "author_id": 238, ...
2008/09/10
[ "https://Stackoverflow.com/questions/54237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4906/" ]
54,255
<p>Using Vim I often want to replace a block of code with a block that I just yanked.</p> <p>But when I delete the block of code that is to be replaced, that block itself goes into the register which erases the block I just yanked. So I've got in the habit of yanking, then inserting, then deleting what I didn't want, but with large blocks of code this gets messy trying to keep the inserted block and the block to delete separate.</p> <p>So what is the slickest and quickest way to replace text in Vim?</p> <ul> <li>is there a way to delete text without putting it into the register?</li> <li>is there a way to say e.g. "replace next word" or "replace up to next paragraph"</li> <li>or is the best way to somehow use the multi-register feature?</li> </ul>
[ { "answer_id": 54265, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 3, "selected": false, "text": ":h d\n" }, { "answer_id": 54272, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stack...
2008/09/10
[ "https://Stackoverflow.com/questions/54255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
54,295
<p>I'd like to store a properties file as XML. Is there a way to sort the keys when doing this so that the generated XML file will be in alphabetical order? </p> <pre><code>String propFile = "/path/to/file"; Properties props = new Properties(); /*set some properties here*/ try { FileOutputStream xmlStream = new FileOutputStream(propFile); /*this comes out unsorted*/ props.storeToXML(xmlStream,""); } catch (IOException e) { e.printStackTrace(); } </code></pre>
[ { "answer_id": 54316, "author": "ScArcher2", "author_id": 1310, "author_profile": "https://Stackoverflow.com/users/1310", "pm_score": 2, "selected": false, "text": "public static void main(String[] args){\n String propFile = \"/tmp/test2.xml\";\n Properties props = new Prop...
2008/09/10
[ "https://Stackoverflow.com/questions/54295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5084/" ]
54,318
<p>I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository.</p> <p>One tool I know of is <a href="http://www.statsvn.org/" rel="noreferrer">statsvn</a> - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, some descriptive stats on LOC per file and folder/subfolder, etc.</p> <p>I would like to know code churn in order to get a better idea of the state of the project. Idea behind this inspired by the MS research: <a href="http://research.microsoft.com/research/pubs/view.aspx?type=Publication&amp;id=1359" rel="noreferrer">Use of Relative Code Churn Measures to Predict System Defect Density</a></p> <p>In a nutshell, the more that source code is churning (changing, whether adding new lines, deleting, changing,etc) the higher the probability that defects are being introduced into the system. The MS research paper says that the number of defects produced can be predicted based on a number of relative code churn measures.</p> <p>I wanted to know if there are any others that are maybe open source, extensible, etc.</p>
[ { "answer_id": 78183, "author": "James A. N. Stauffer", "author_id": 6770, "author_profile": "https://Stackoverflow.com/users/6770", "pm_score": 0, "selected": false, "text": "svn blame" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1341/" ]
54,334
<p>The following SQL:</p> <pre><code>SELECT notes + 'SomeText' FROM NotesTable a </code></pre> <p>Give the error:</p> <blockquote> <p>The data types nvarchar and text are incompatible in the add operator.</p> </blockquote>
[ { "answer_id": 54343, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 7, "selected": true, "text": "Select Cast(notes as nvarchar(4000)) + 'SomeText'\nFrom NotesTable a\n" }, { "answer_id": 57061, "author": "Scott...
2008/09/10
[ "https://Stackoverflow.com/questions/54334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2017/" ]
54,365
<p>This is probably <a href="http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/x13320.html" rel="noreferrer">a complex solution</a>.</p> <p>I am looking for a simple operator like ">>", but for prepending.</p> <p>I am afraid it does not exist. I'll have to do something like </p> <pre> mv myfile tmp cat myheader tmp > myfile </pre> <p>Anything smarter?</p>
[ { "answer_id": 54381, "author": "Jason Navarrete", "author_id": 3920, "author_profile": "https://Stackoverflow.com/users/3920", "pm_score": 7, "selected": false, "text": "echo \"text\" | cat - yourfile > /tmp/out && mv /tmp/out yourfile\n" }, { "answer_id": 54384, "author": "...
2008/09/10
[ "https://Stackoverflow.com/questions/54365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1277510/" ]
54,380
<p>I am adding a ADO.Net Data Service lookup feature to an existing web page. Everything works great when running from visual studio, but when I roll it out to IIS, I get the following error:</p> <blockquote> <p><strong>Request Error</strong><br>The server encountered an error processing the request. See server logs for more details.</p> </blockquote> <p>I get this even when trying to display the default page, i.e.:</p> <blockquote> <p><a href="http://server/FFLookup.svc" rel="noreferrer">http://server/FFLookup.svc</a></p> </blockquote> <p>I have 3.5 SP1 installed on the server.</p> <p>What am I missing, and which "Server Logs" is it refering to? I can't find any further error messages.</p> <p>There is nothing in the Event Viewer logs (System or Application), and nothing in the IIS logs other than the GET:</p> <blockquote> <p>2008-09-10 15:20:19 10.7.131.71 GET /FFLookup.svc - 8082 - 10.7.131.86 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US)+AppleWebKit/525.13+(KHTML,+like+Gecko)+Chrome/0.2.149.29+Safari/525.13 401 2 2148074254</p> </blockquote> <p>There is no stack trace returned. The only response I get is the "Request Error" as noted above.</p> <p>Thanks</p> <p>Patrick</p>
[ { "answer_id": 55557, "author": "Patrick Connelly", "author_id": 5431, "author_profile": "https://Stackoverflow.com/users/5431", "pm_score": 4, "selected": false, "text": " <system.diagnostics>\n <sources>\n <source name=\"System.ServiceModel.MessageLogging\" switchValue=\...
2008/09/10
[ "https://Stackoverflow.com/questions/54380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5431/" ]
54,401
<p>As I develop more with vim, I find myself wanting to copy in blocks of useful code, similar to "templates" in Eclipse. </p> <p>I was thinking of making a separate file for each code chunk and just reading them in with</p> <pre><code>:r code-fornext </code></pre> <p>but that just seems kind of primitive. Googling around I find vim macros mentioned and something about "maps" but nothing that seems straightforward.</p> <p>What I am looking for are e.g. something like Eclipse's "Templates" so I pop in a code chunk with the cursor sitting in the middle of it. Or JEdit's "Macros" which I can record doing complicated deletes and renaming on one line, then I can play it again on 10 other lines so it does the same to them.</p> <p>Does vim have anything like these two functionalities?</p>
[ { "answer_id": 54527, "author": "brian newman", "author_id": 3210, "author_profile": "https://Stackoverflow.com/users/3210", "pm_score": 4, "selected": true, "text": "q" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
54,418
<p>I need to retrieve all rows from a table where 2 columns combined are all different. So I want all the sales that do not have any other sales that happened on the same day for the same price. The sales that are unique based on day and price will get updated to an active status.</p> <p>So I'm thinking:</p> <pre><code>UPDATE sales SET status = 'ACTIVE' WHERE id IN (SELECT DISTINCT (saleprice, saledate), id, count(id) FROM sales HAVING count = 1) </code></pre> <p>But my brain hurts going any farther than that.</p>
[ { "answer_id": 54430, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 10, "selected": true, "text": "SELECT DISTINCT a,b,c FROM t\n" }, { "answer_id": 54557, "author": "Christian Berg", "author_id": 5035,...
2008/09/10
[ "https://Stackoverflow.com/questions/54418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4915/" ]
54,419
<p>I have a WCF application that has two Services that I am trying to host in a single Windows Service using net.tcp. I can run either of the services just fine, but as soon as I try to put them both in the Windows Service only the first one loads up. I have determined that the second services ctor is being called but the OnStart never fires. This tells me that WCF is finding something wrong with loading up that second service.</p> <p>Using net.tcp I know I need to turn on port sharing and start the port sharing service on the server. This all seems to be working properly. I have tried putting the services on different tcp ports and still no success.</p> <p>My service installer class looks like this:</p> <pre><code> [RunInstaller(true)] public class ProjectInstaller : Installer { private ServiceProcessInstaller _process; private ServiceInstaller _serviceAdmin; private ServiceInstaller _servicePrint; public ProjectInstaller() { _process = new ServiceProcessInstaller(); _process.Account = ServiceAccount.LocalSystem; _servicePrint = new ServiceInstaller(); _servicePrint.ServiceName = "PrintingService"; _servicePrint.StartType = ServiceStartMode.Automatic; _serviceAdmin = new ServiceInstaller(); _serviceAdmin.ServiceName = "PrintingAdminService"; _serviceAdmin.StartType = ServiceStartMode.Automatic; Installers.AddRange(new Installer[] { _process, _servicePrint, _serviceAdmin }); } } </code></pre> <p>and both services looking very similar</p> <pre><code> class PrintService : ServiceBase { public ServiceHost _host = null; public PrintService() { ServiceName = "PCTSPrintingService"; CanStop = true; AutoLog = true; } protected override void OnStart(string[] args) { if (_host != null) _host.Close(); _host = new ServiceHost(typeof(Printing.ServiceImplementation.PrintingService)); _host.Faulted += host_Faulted; _host.Open(); } } </code></pre>
[ { "answer_id": 90870, "author": "Wiren", "author_id": 2538222, "author_profile": "https://Stackoverflow.com/users/2538222", "pm_score": 5, "selected": true, "text": "internal class MyWCFService1\n{\n internal static System.ServiceModel.ServiceHost serviceHost = null;\n\n internal s...
2008/09/10
[ "https://Stackoverflow.com/questions/54419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5408/" ]
54,421
<p>If you are writing a program that is executable from the command line, you often want to offer the user several options or flags, along with possibly more than one argument. I have stumbled my way through this many times, but is there some sort of design pattern for looping through args and calling the appropriate handler functions?</p> <p>Consider:</p> <pre><code>myprogram -f filename -d directory -r regex </code></pre> <p>How do you organize the handler functions after you retrieve the arguments using whatever built-ins for your language? (language-specific answers welcomed, if that helps you articulate an answer)</p>
[ { "answer_id": 54690, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "while (current_argument = cli_parser_next()) {\n switch(current_argument) {\n case \"f\": //Parser strips t...
2008/09/10
[ "https://Stackoverflow.com/questions/54421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577/" ]
54,426
<p>Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can use to submit any visited URL to a 3rd party site when that's possible by URL. Suggestions?</p> <p>For example, I've been using </p> <pre><code>javascript:void(location.href="http://www.yacktrack.com/home?query="+encodeURI(location.href)) </code></pre> <p>so far but wonder if there's something more sophisticated I could use or better practice.</p>
[ { "answer_id": 54446, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 1, "selected": false, "text": "document.location = \"http://url_submitting_to.com?query_string_param=\" + window.location;\n" }, { "answer_id": 5...
2008/09/10
[ "https://Stackoverflow.com/questions/54426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5613/" ]
54,440
<p>I want to add the selected item from the <code>TreeView</code> to the <code>ListBox</code> control using <code>DataBinding</code> (If it can work with <code>DataBinding</code>). </p> <pre><code>&lt;TreeView HorizontalAlignment="Left" Margin="30,32,0,83" Name="treeView1" Width="133" &gt; &lt;/TreeView&gt; &lt;ListBox VerticalAlignment="Top" Margin="208,36,93,0" Name="listBox1" Height="196" &gt; &lt;/ListBox&gt; </code></pre> <p><code>TreeView</code> is populated from the code behind page with some dummy data. </p>
[ { "answer_id": 55830, "author": "Dylan", "author_id": 4580, "author_profile": "https://Stackoverflow.com/users/4580", "pm_score": 1, "selected": false, "text": "ItemsSource=\"{Binding SelectedItem, ElementName=treeView1}\"\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3797/" ]
54,475
<p>I've run into a problem where I make changes to a few JavaScript files that are referenced in an HTML file, but the browser doesn't see the changes. It holds onto the copy cached in the browser, even though the web server has a newer version.</p> <p>Not until I force the browser to clear the cache do I see the changes.</p> <p>Is this a web-server configuration? Do I need to set my JavaScript files to never cache? I've seen some interesting techniques in the <a href="http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&amp;s=google-web-toolkit-doc-1-5&amp;t=FAQ_GWTApplicationFiles" rel="noreferrer">Google Web Toolkit</a> where they actually create a <strong>new</strong> JavaScript file name any time an update is made. I believe this is to prevent proxies and browsers from keeping old versions of the JavaScript files with the same names.</p> <p>Is there a list of best practices somewhere?</p>
[ { "answer_id": 54486, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 6, "selected": true, "text": "<script src=\"MyScript.js?4.0.8243\">\n" }, { "answer_id": 54506, "author": "Chris Marasti-Georg", "author...
2008/09/10
[ "https://Stackoverflow.com/questions/54475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5079/" ]
54,482
<p>I need to enumerate all the user defined types created in a <code>SQL Server</code> database with <code>CREATE TYPE</code>, and/or find out whether they have already been defined.</p> <p>With tables or stored procedures I'd do something like this:</p> <pre><code>if exists (select * from dbo.sysobjects where name='foobar' and xtype='U') drop table foobar </code></pre> <p>However I can't find the equivalent (or a suitable alternative) for user defined types! I definitely can't see them anywhere in <code>sysobjects</code>. </p> <p>Can anyone enlighten me?</p>
[ { "answer_id": 54496, "author": "jwolly2", "author_id": 5202, "author_profile": "https://Stackoverflow.com/users/5202", "pm_score": 7, "selected": true, "text": "select * from sys.types\nwhere is_user_defined = 1\n" }, { "answer_id": 31549846, "author": "Ron Sanderson", "...
2008/09/10
[ "https://Stackoverflow.com/questions/54482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/886/" ]
54,487
<p>How can I format Floats in Java so that the float component is displayed only if it's not zero? For example:</p> <pre> 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 </pre> <p>Edit: I forgot to mention - I'm still on Java 1.4 - sorry!</p>
[ { "answer_id": 54502, "author": "ScArcher2", "author_id": 1310, "author_profile": "https://Stackoverflow.com/users/1310", "pm_score": 4, "selected": true, "text": " DecimalFormat format = new DecimalFormat(\"###.##\");\n\n double[] doubles = {123.45, 99.0, 23.2, 45.0};\n for(int i=...
2008/09/10
[ "https://Stackoverflow.com/questions/54487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
54,500
<p>Alright, so I'm working on an application which will use a Linux back-end running PostgreSQL to serve up images to a Windows box with the front end written in C#.NET, though the front-end should hardly matter. My question is:</p> <ul> <li><strong>What is the best way to deal with storing images in Postgres?</strong></li> </ul> <p>The images are around 4-6 megapixels each, and we're storing upwards of 3000. It might also be good to note: this is not a web application, there will at most be about two front-ends accessing the database at once.</p>
[ { "answer_id": 54561, "author": "Kris Erickson", "author_id": 3798, "author_profile": "https://Stackoverflow.com/users/3798", "pm_score": 5, "selected": false, "text": "//linuxserver/images/imagexxx.jpg\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
54,503
<p>I'm working on a .net post-commit hook to feed data into OnTime via their Soap SDK. My hook works on Windows fine, but on our production RHEL4 subversion server, it won't work when called from a shell script.</p> <pre> #!/bin/sh /usr/bin/mono $1/hooks/post-commit.exe "$@" </pre> <p>When I execute it with parameters from the command line, it works properly. When executed via the shell script, I get the following error: (looks like there is some problem with the process execution of SVN that I use to get the log data for the revision):</p> <pre> Unhandled Exception: System.InvalidOperationException: The process must exit before getting the requested information. at System.Diagnostics.Process.get_ExitCode () [0x0003f] in /tmp/monobuild/build/BUILD/mono-1.9.1/mcs/class/System/System.Diagnostics/Process.cs:149 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_ExitCode () at SVNLib.SVN.Execute (System.String sCMD, System.String sParams, System.String sComment, System.String sUserPwd, SVNLib.SVNCallback callback) [0x00000] at SVNLib.SVN.Log (System.String sUrl, Int32 nRevLow, Int32 nRevHigh, SVNLib.SVNCallback callback) [0x00000] at SVNLib.SVN.LogAsString (System.String sUrl, Int32 nRevLow, Int32 nRevHigh) [0x00000] at SVNCommit2OnTime.Program.Main (System.String[] args) [0x00000] </pre> <p>I've tried using <code>mkbundle</code> and <code>mkbundle2</code> to make a stand alone that could be named <code>post-commit</code>, but I get a different error message:</p> <pre> Unhandled Exception: System.ArgumentNullException: Argument cannot be null. Parameter name: Value cannot be null. at System.Guid.CheckNull (System.Object o) [0x00000] at System.Guid..ctor (System.String g) [0x00000] at SVNCommit2OnTime.Program.Main (System.String[] args) [0x00000] </pre> <p>Any ideas why it might be failing from a shell script or what might be wrong with the bundled version?</p> <p><b>Edit:</b> <a href="https://stackoverflow.com/questions/54503/problem-with-net-app-under-linux-doesnt-work-from-shell-script#54537">@Herms</a>, I've already tried it with an echo, and it looks right. As for the <code>$1/hooks/post-commit.exe</code>, I've tried the script with and without a full path to the .net assembly with the same results.</p> <p><b>Edit:</b> <a href="https://stackoverflow.com/questions/54503/problem-with-net-app-under-linux-doesnt-work-from-shell-script#54545">@Leon</a>, I've tried both <code>$1 $2</code> and <code>"$@"</code> with the same results. It is a subversion post commit hook, and it takes two parameters, so those need to be passed along to the .net assembly. The <code>"$@"</code> was what was recommended at the mono site for calling a .net assembly from a shell script. The shell script <i>is</i> executing the .net assembly and with the correct parameters, but it is throwing an exception that does not get thrown when run directly from the command line.</p> <p><b>Edit:</b> <a href="https://stackoverflow.com/questions/54503/problem-with-net-app-under-linux-doesnt-work-from-shell-script#54568">@Vinko</a>, I don't see any differences in the environment other than things like <code>BASH_LINENO</code> and <code>BASH_SOURCE</code></p> <p><b>Edit:</b> <a href="https://stackoverflow.com/questions/54503/problem-with-net-app-under-linux-doesnt-work-from-shell-script#54818">@Luke</a>, I tired it, but that makes no difference either. I first noticed the problem when testing from TortoiseSVN on my machine (when it runs as a sub-process of the subversion daemon), but also found that I get the same results when executing the script from the hooks directory (i.e. <code>./post-commit REPOS REV</code>, where <code>post-commit</code> is the above sh script. Doing <code>mono post-commit.exe REPOS REV</code> works fine. The main problem is that to execute, I need to have something of the name <code>post-commit</code> so that it will be called. But it does not work from a shell script, and as noted above, the <code>mkbundle</code> is not working with a different problem.</p>
[ { "answer_id": 54537, "author": "Herms", "author_id": 1409, "author_profile": "https://Stackoverflow.com/users/1409", "pm_score": 0, "selected": false, "text": "#!/bin/sh\necho /usr/bin/mono $1/hooks/post-commit.exe \"$@\"\n" }, { "answer_id": 54545, "author": "Leon Timmerman...
2008/09/10
[ "https://Stackoverflow.com/questions/54503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1441/" ]
54,512
<p>varchar(255), varchar(256), nvarchar(255), nvarchar(256), nvarchar(max), etc?</p> <p>256 seems like a nice, round, space-efficient number. But I've seen 255 used a lot. Why?</p> <p>What's the difference between varchar and nvarchar?</p>
[ { "answer_id": 54533, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 2, "selected": false, "text": "0 1 2 3 4 5 ... 255\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
54,522
<p>I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page.</p> <p>All the stuff on MSDN is about priting paragraphs of text. </p> <p>Thanks for any help you can give, Roberto</p>
[ { "answer_id": 54533, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 2, "selected": false, "text": "0 1 2 3 4 5 ... 255\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5648/" ]
54,536
<p>How do I create a windows application that does the following:</p> <ul> <li>it's a regular GUI app when invoked with no command line arguments</li> <li>specifying the optional "--help" command line argument causes the app to write usage text to stdout then terminate</li> <li>it must be a single executable. No cheating by making a console app exec a 2nd executable.</li> <li>assume the main application code is written in C/C++</li> <li>bonus points if no GUI window is created when "--help" is specified. (i.e., no flicker from a short-lived window)</li> </ul> <p>In my experience the standard visual studio template for console app has no GUI capability, and the normal win32 template does not send its stdout to the parent cmd shell.</p>
[ { "answer_id": 113032, "author": "Hugh Allen", "author_id": 15069, "author_profile": "https://Stackoverflow.com/users/15069", "pm_score": 5, "selected": false, "text": "cmd.exe" }, { "answer_id": 26087606, "author": "Dmitry Markin", "author_id": 1675481, "author_profi...
2008/09/10
[ "https://Stackoverflow.com/questions/54536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5429/" ]
54,539
<p>So the SMEs at my current place of employment want to try and disable the back button for certain pages. We have a page where the user makes some selections and submits them to be processed. In some instances they have to enter a comment on another page. </p> <p>What the users have figured out is that they don't have to enter a comment if they submit the information and go to the page with the comment and then hit the back button to return to the previous page. </p> <p>I know there are several different solutions to this (and many of them are far more elegant then disabling the back button), but this is what I'm left with. Is it possible to prevent someone from going back to the previous page through altering the behavior of the back button. (like a submit -> return false sorta thing). </p> <p>Due to double posting information I can't have it return to the previous page and then move to the current one. I can only have it not direct away from the current page. I Googled it, but I only saw posts saying that it will always return to the previous page. I was hoping that someone has some mad kung foo js skills that can make this possible.</p> <p>I understand that everyone says this is a bad idea, and I agree, but sometimes you just have to do what you're told.</p>
[ { "answer_id": 54571, "author": "David Mohundro", "author_id": 4570, "author_profile": "https://Stackoverflow.com/users/4570", "pm_score": 2, "selected": false, "text": "window.onBack = history.forward();\n" }, { "answer_id": 5881224, "author": "Yossi Shasho", "author_id"...
2008/09/10
[ "https://Stackoverflow.com/questions/54539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942/" ]
54,546
<p>Assemblies A and B are privately deployed and strongly named. Assembly A contains references to Assembly B. There are two versions of Assembly B: B1 and B2. I want to be able to indicate for Assembly A that it may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself. What are my options?</p> <p>I'm somewhat familiar with versioning policy and the way it applies to the GAC, but I don't want to be dependent on these assemblies being in the GAC.</p>
[ { "answer_id": 54553, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 1, "selected": false, "text": "Assembly.LoadFrom()" }, { "answer_id": 55560, "author": "Adrian Clark", "author_id": 148, "author_p...
2008/09/10
[ "https://Stackoverflow.com/questions/54546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/533/" ]
54,566
<p>So I'm refactoring my code to implement more OOP. I set up a class to hold page attributes.</p> <pre><code>class PageAtrributes { private $db_connection; private $page_title; public function __construct($db_connection) { $this-&gt;db_connection = $db_connection; $this-&gt;page_title = ''; } public function get_page_title() { return $this-&gt;page_title; } public function set_page_title($page_title) { $this-&gt;page_title = $page_title; } } </code></pre> <p>Later on I call the set_page_title() function like so</p> <pre><code>function page_properties($objPortal) { $objPage-&gt;set_page_title($myrow['title']); } </code></pre> <p>When I do I receive the error message:</p> <blockquote> <p>Call to a member function set_page_title() on a non-object</p> </blockquote> <p>So what am I missing?</p>
[ { "answer_id": 54572, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 7, "selected": true, "text": "$objPage" }, { "answer_id": 9621419, "author": "Steve Breese", "author_id": 1257523, "author_profil...
2008/09/10
[ "https://Stackoverflow.com/questions/54566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863/" ]
54,567
<p>I've got an <code>JComboBox</code> with a custom <code>inputVerifyer</code> set to limit MaxLength when it's set to editable.</p> <p>The verify method never seems to get called.<br> The same verifyer gets invoked on a <code>JTextField</code> fine.</p> <p>What might I be doing wrong?</p>
[ { "answer_id": 54614, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 1, "selected": false, "text": "package inputverifier;\n\nimport javax.swing.*;\n\n class Go {\n public static void main(String[] args) {...
2008/09/10
[ "https://Stackoverflow.com/questions/54567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
54,578
<p>How do I capture the output of "%windir%/system32/pnputil.exe -e"? (assume windows vista 32-bit)</p> <p>Bonus for technical explanation of why the app normally writes output to the cmd shell, but when stdout and/or stderr are redirected then the app writes nothing to the console or to stdout/stderr?</p> <pre> C:\Windows\System32>PnPutil.exe --help Microsoft PnP Utility {...} C:\Windows\System32>pnputil -e > c:\foo.txt C:\Windows\System32>type c:\foo.txt C:\Windows\System32>dir c:\foo.txt Volume in drive C has no label. Volume Serial Number is XXXX-XXXX Directory of c:\ 09/10/2008 12:10 PM 0 foo.txt 1 File(s) 0 bytes </pre>
[ { "answer_id": 54588, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 0, "selected": false, "text": "svn status | find \"? \"\n" }, { "answer_id": 46796987, "author": "Tim LaGrange", "author_id": 8791813, "...
2008/09/10
[ "https://Stackoverflow.com/questions/54578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5429/" ]