qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
94,331
<p>I use the recent Ganymede release of Eclipse, specifically the distro for Java EE and web developers. I have installed a few additional plugins (e.g. Subclipse, Spring, FindBugs) and removed all the Mylyn plugins. </p> <p>I don't do anything particularly heavy-duty within Eclipse such as starting an app server or connecting to databases, yet for some reason, after several hours use I see that Eclipse is using close to 500MB of memory.</p> <p>Does anybody know why Eclipse uses so much memory (leaky?), and more importantly, if there's anything I can do to improve this?</p>
[ { "answer_id": 101193, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": false, "text": "C:\\[jdk1.6.0_0x path]\\bin\\jconsole.exe\n" }, { "answer_id": 101995, "author": "GKelly", "author_id": 18744, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
94,342
<p>I have a string which contain tags in the form <code>&lt; tag &gt;</code>. Is there an easy way for me to programmatically replace instances of these tags with special ascii characters? e.g. replace a tag like <code>"&lt; tab &gt;"</code> with the ascii equivelent of <code>'/t'</code>?</p>
[ { "answer_id": 94366, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 5, "selected": true, "text": "string s = \"...<tab>...\";\ns = s.Replace(\"<tab>\", \"\\t\");\n" }, { "answer_id": 94367, "author": "Burkhard"...
2008/09/18
[ "https://Stackoverflow.com/questions/94342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
94,361
<p>What are the best practices for using Java's <code>@Override</code> annotation and why? </p> <p>It seems like it would be overkill to mark every single overridden method with the <code>@Override</code> annotation. Are there certain programming situations that call for using the <code>@Override</code> and others that should never use the <code>@Override</code>? </p>
[ { "answer_id": 94386, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 5, "selected": false, "text": "tostring()" }, { "answer_id": 94388, "author": "Greg Mattes", "author_id": 13940, "author_profile": "https...
2008/09/18
[ "https://Stackoverflow.com/questions/94361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
94,372
<p>I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?</p>
[ { "answer_id": 94427, "author": "Brian", "author_id": 1750627, "author_profile": "https://Stackoverflow.com/users/1750627", "pm_score": 3, "selected": true, "text": "var nStart:Number = new Date().time;\n\n// Some time passes\n\nvar nMillisElapsed:Number = new Date().time - nStart;\n\nva...
2008/09/18
[ "https://Stackoverflow.com/questions/94372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16458/" ]
94,382
<p>I'm using gvim on Windows.</p> <p>In my _vimrc I've added:</p> <pre><code>set shell=powershell.exe set shellcmdflag=-c set shellpipe=&gt; set shellredir=&gt; function! Test() echo system("dir -name") endfunction command! -nargs=0 Test :call Test() </code></pre> <p>If I execute this function (:Test) I see nonsense characters (non number/letter ASCII characters).</p> <p>If I use cmd as the shell, it works (without the -name), so the problem seems to be with getting output from powershell into vim. </p> <p>Interestingly, this works great:</p> <pre><code>:!dir -name </code></pre> <p>As does this:</p> <pre><code>:r !dir -name </code></pre> <p><strong>UPDATE:</strong> confirming behavior mentioned by <a href="https://stackoverflow.com/questions/94382/vim-with-powershell#101743">David</a></p> <p>If you execute the set commands mentioned above in the _vimrc, :Test outputs nonsense. However, if you execute them directly in vim instead of in the _vimrc, :Test works as expected.</p> <p>Also, I've tried using iconv in case it was an encoding problem:</p> <pre><code>:echo iconv( system("dir -name"), "unicode", &amp;enc ) </code></pre> <p>But this didn't make any difference. I could be using the wrong encoding types though.</p> <p>Anyone know how to make this work?</p>
[ { "answer_id": 94697, "author": "Mark Schill", "author_id": 9482, "author_profile": "https://Stackoverflow.com/users/9482", "pm_score": 2, "selected": false, "text": "\"dir \\*vim\\*\"\n" }, { "answer_id": 101743, "author": "David Mohundro", "author_id": 4570, "author...
2008/09/18
[ "https://Stackoverflow.com/questions/94382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4407/" ]
94,410
<p>I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site.</p> <p>Does anyone have any thoughts/experience with doing this?</p> <p>Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCacheD or Velocity (or another distributed cache) for the caching itself.</p>
[ { "answer_id": 26620863, "author": "Jakob", "author_id": 1809290, "author_profile": "https://Stackoverflow.com/users/1809290", "pm_score": 0, "selected": false, "text": "var container = new WindsorContainer();\ncontainer.Register(Component.For<CacheInterceptor>()\n .Instance(new CacheIn...
2008/09/18
[ "https://Stackoverflow.com/questions/94410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17824/" ]
94,420
<p>So I have a form that uses infopath services via sharepoint, and after multiple attempts at attempting to fix a rendering problem (tables appear WAY too wide to be readable), I think I have found the problem : date controls.</p> <p>It seems date controls within Infopath 2007 screw with rendering somehow. To test, I made 2 variations of a VERY simple form - one with a date control, one with a text control - and placed them inside a table.</p> <p>When emailed, the one with the date control rendered incorrectly.</p> <p>My question is - has anyone experienced this before? If you have time, test it out. I think it is a bug or something, but not exactly sure.</p> <p>I am using Infopath 2007, Sharepoint 2007, and Outlook 2007.</p> <hr> <h2><strong>Updated Sept 19, 2008</strong></h2> <p>Yes, web form capability is checked. Web compatible date controls? I think so - everything looks perfect in the browser... only the email messes up. and yes you are correct. My mistake this is Sharepoint 2007. I fixed it above.</p> <p>If anyone has the time, try it out - it's very frustrating to have to use text boxes for dates. Especially with the 'talent' we have here. lol</p>
[ { "answer_id": 26620863, "author": "Jakob", "author_id": 1809290, "author_profile": "https://Stackoverflow.com/users/1809290", "pm_score": 0, "selected": false, "text": "var container = new WindsorContainer();\ncontainer.Register(Component.For<CacheInterceptor>()\n .Instance(new CacheIn...
2008/09/18
[ "https://Stackoverflow.com/questions/94420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13959/" ]
94,445
<p>I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL:</p> <blockquote> <p>unable to write 'random state'</p> </blockquote> <p>What does this mean?</p> <p>This is on an Ubuntu server. I have upgraded libssl to fix <a href="http://www.ubuntu.com/usn/usn-612-1">the recent security vulnerability</a>.</p>
[ { "answer_id": 94458, "author": "Ville Laurikari", "author_id": 7446, "author_profile": "https://Stackoverflow.com/users/7446", "pm_score": 10, "selected": true, "text": "sudo rm ~/.rnd\n" }, { "answer_id": 6484589, "author": "Jusuf", "author_id": 816211, "author_prof...
2008/09/18
[ "https://Stackoverflow.com/questions/94445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17965/" ]
94,456
<p>I have an instance of a <code>System.Drawing.Bitmap</code> and would like to make it available to my WPF app in the form of a <code>System.Windows.Media.Imaging.BitmapImage</code>.</p> <p>What would be the best approach for this?</p>
[ { "answer_id": 96470, "author": "Kevin", "author_id": 2723, "author_profile": "https://Stackoverflow.com/users/2723", "pm_score": 7, "selected": true, "text": "ScreenCapture = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(\n bmp.GetHbitmap(), \n IntPtr.Zero, \n Syste...
2008/09/18
[ "https://Stackoverflow.com/questions/94456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2723/" ]
94,488
<p>More specifically, when the exception contains custom objects which may or may not themselves be serializable.</p> <p>Take this example:</p> <pre><code>public class MyException : Exception { private readonly string resourceName; private readonly IList&lt;string&gt; validationErrors; public MyException(string resourceName, IList&lt;string&gt; validationErrors) { this.resourceName = resourceName; this.validationErrors = validationErrors; } public string ResourceName { get { return this.resourceName; } } public IList&lt;string&gt; ValidationErrors { get { return this.validationErrors; } } } </code></pre> <p>If this Exception is serialized and de-serialized, the two custom properties (<code>ResourceName</code> and <code>ValidationErrors</code>) will not be preserved. The properties will return <code>null</code>.</p> <p><strong>Is there a common code pattern for implementing serialization for custom exception?</strong></p>
[ { "answer_id": 94625, "author": "Adrian Clark", "author_id": 148, "author_profile": "https://Stackoverflow.com/users/148", "pm_score": 5, "selected": false, "text": "GetObjectData" }, { "answer_id": 100369, "author": "Daniel Fortunov", "author_id": 5975, "author_profi...
2008/09/18
[ "https://Stackoverflow.com/questions/94488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975/" ]
94,490
<p>I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory).</p> <p>I've already written the code and it works, and I'm answering this myself so I can search for it later. But since evidence suggests that I'm one of the dumber participants on Stackoverflow, I'm sure there's room for improvement.</p>
[ { "answer_id": 94491, "author": "Marcel Levy", "author_id": 676, "author_profile": "https://Stackoverflow.com/users/676", "pm_score": 4, "selected": true, "text": "import urllib2, cStringIO, zipfile\n\ntry:\n remotezip = urllib2.urlopen(url)\n zipinmemory = cStringIO.StringIO(remot...
2008/09/18
[ "https://Stackoverflow.com/questions/94490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/676/" ]
94,502
<p>I have a simple database table called "Entries":</p> <pre><code>class CreateEntries &lt; ActiveRecord::Migration def self.up create_table :entries do |t| t.string :firstName t.string :lastName #etc. t.timestamps end end def self.down drop_table :entries end end </code></pre> <p>How do I write a handler that will return the contents of the Entries table as a CSV file (ideally in a way that it will automatically open in Excel)?</p> <pre><code>class EntriesController &lt; ApplicationController def getcsv @entries = Entry.find( :all ) # ??? NOW WHAT ???? end end </code></pre>
[ { "answer_id": 94520, "author": "kch", "author_id": 13989, "author_profile": "https://Stackoverflow.com/users/13989", "pm_score": 3, "selected": false, "text": "gem install fastercsv\ngem install spreadsheet-excel\n" }, { "answer_id": 94577, "author": "JasonTrue", "author...
2008/09/18
[ "https://Stackoverflow.com/questions/94502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4540/" ]
94,528
<p>In other words may one use <code>/&lt;tag[^&gt;]*&gt;.*?&lt;\/tag&gt;/</code> regex to match the <code>tag</code> html element which does not contain nested <code>tag</code> elements?</p> <p>For example (lt.html):</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;greater than sign in attribute value&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt;1&lt;/div&gt; &lt;div title="&gt;"&gt;2&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Regex:</p> <pre><code>$ perl -nE"say $1 if m~&lt;div[^&gt;]*&gt;(.*?)&lt;/div&gt;~" lt.html </code></pre> <p>And screen-scraper:</p> <pre><code>#!/usr/bin/env python import sys import BeautifulSoup soup = BeautifulSoup.BeautifulSoup(sys.stdin) for div in soup.findAll('div'): print div.string $ python lt.py &lt;lt.html </code></pre> <p>Both give the same output:</p> <pre><code>1 "&gt;2 </code></pre> <p>Expected output:</p> <pre><code>1 2 </code></pre> <p><a href="http://www.w3.org/TR/html5/syntax.html#attributes2" rel="noreferrer" title="html attribute syntax">w3c</a> says:</p> <blockquote> <p>Attribute values are a mixture of text and character references, except with the additional restriction that the text cannot contain an ambiguous ampersand.</p> </blockquote>
[ { "answer_id": 94544, "author": "Per Hornshøj-Schierbeck", "author_id": 11619, "author_profile": "https://Stackoverflow.com/users/11619", "pm_score": 0, "selected": false, "text": "yeah except /<tag[^>]*>.*?<\\/tag>/\n" }, { "answer_id": 94559, "author": "Jim", "author_id...
2008/09/18
[ "https://Stackoverflow.com/questions/94528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4279/" ]
94,542
<p>I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it.</p> <p>I'd like to have a modelContext.xml file and another for my ui.xml, etc.</p> <p>Can I do this?</p>
[ { "answer_id": 94586, "author": "enricopulatzo", "author_id": 9883, "author_profile": "https://Stackoverflow.com/users/9883", "pm_score": 2, "selected": false, "text": "<import resource=\"services.xml\"/>\n" }, { "answer_id": 94588, "author": "Nicholas Trandem", "author_i...
2008/09/18
[ "https://Stackoverflow.com/questions/94542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
94,556
<p>We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the lines of code that were hit by the unit tests. </p> <p>We are using mvn 2.0.8. I have tried running <code>mvn clean site</code>, <code>mvn clean site:stage</code> and <code>mvn clean package site</code>. I know the tests are running, they show up in the surefire reports (both the txt/xml and site reports). Am I missing something in the configuration? Does Cobertura not work right with multiprojects?</p> <p>This is in the parent .pom:</p> <pre><code>&lt;build&gt; &lt;pluginManagement&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;inherited&gt;true&lt;/inherited&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;clean&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;clean&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/pluginManagement&gt; &lt;/build&gt; &lt;reporting&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;inherited&gt;true&lt;/inherited&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/reporting&gt; </code></pre> <p>I've tried running it with and without the following in the child .poms:</p> <pre><code> &lt;reporting&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/reporting&gt; </code></pre> <p>I get this in the output of the build:</p> <pre><code>... [INFO] [cobertura:instrument] [INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Instrumenting 3 files to C:\workspaces\sandbox\CommonJsf\target\generated-classes\cobertura Cobertura: Saved information on 3 classes. Instrument time: 186ms [INFO] Instrumentation was successful. ... [INFO] Generating "Cobertura Test Coverage" report. [INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file Cobertura: Loaded information on 3 classes. Report time: 481ms [INFO] Cobertura Report generation was successful. </code></pre> <p>And the report looks like this: <img src="https://i.stack.imgur.com/D7yiM.png" alt="cobertura report"></p>
[ { "answer_id": 94586, "author": "enricopulatzo", "author_id": 9883, "author_profile": "https://Stackoverflow.com/users/9883", "pm_score": 2, "selected": false, "text": "<import resource=\"services.xml\"/>\n" }, { "answer_id": 94588, "author": "Nicholas Trandem", "author_i...
2008/09/18
[ "https://Stackoverflow.com/questions/94556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/765/" ]
94,582
<p>Say I have some javascript that if run in a browser would be typed like this...</p> <pre><code>&lt;script type="text/javascript" src="http://someplace.net/stuff.ashx"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var stuff = null; stuff = new TheStuff('myStuff'); &lt;/script&gt; </code></pre> <p>... and I want to use the javax.script package in java 1.6 to run this code within a jvm (not within an applet) and get the stuff. How do I let the engine know the source of the classes to be constructed is found within the remote .ashx file?</p> <p>For instance, I know to write the java code as...</p> <pre><code>ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); engine.eval( "stuff = new TheStuff('myStuff');" ); Object obj = engine.get("stuff"); </code></pre> <p>...but the "JavaScript" engine doesn't know anything by default about the TheStuff class because that information is in the remote .ashx file. Can I make it look to the above src string for this?</p>
[ { "answer_id": 96911, "author": "Stephen Deken", "author_id": 7154, "author_profile": "https://Stackoverflow.com/users/7154", "pm_score": 2, "selected": false, "text": "ScriptEngine" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/94582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17978/" ]
94,591
<p>I can never remember the number. I need a memory rule.</p>
[ { "answer_id": 94645, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 4, "selected": false, "text": "Console.WriteLine(Int32.MaxValue);\n" }, { "answer_id": 94646, "author": "Adrian Clark", "author_id": 148, "aut...
2008/09/18
[ "https://Stackoverflow.com/questions/94591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15054/" ]
94,592
<p>Sometimes it might be useful, but mostly just looking cool or impressive to visualize log files (anything from http requests and to bandwith usage to cups of coffee drunk per day). I know about <a href="http://www.visitorville.com/" rel="noreferrer">Visitorville</a> which I think look a bit silly, and then there's <a href="http://www.fudgie.org/" rel="noreferrer">gltail</a>. </p> <p>How do you "visualize" your log files in realtime?</p>
[ { "answer_id": 16763271, "author": "sdaau", "author_id": 277826, "author_profile": "https://Stackoverflow.com/users/277826", "pm_score": 2, "selected": false, "text": "matplotlib" }, { "answer_id": 17211281, "author": "Lloyd", "author_id": 1029644, "author_profile": "...
2008/09/18
[ "https://Stackoverflow.com/questions/94592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17542/" ]
94,594
<p>I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. <strong>not UDP</strong>). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, <code>sendto</code> fails unless the client is bound too. (the common error is <code>Transport endpoint is not connected</code>).</p> <p>Binding to some random name (filesystem-based or abstract) works. But I'd like to avoid that: who am I to guarantee the names I picked won't collide?</p> <p>The unix sockets' stream mode documentation tell us that an abstract name will be assigned to them at <code>connect</code> time if they don't have one already. Is such a feature available for datagram oriented sockets?</p>
[ { "answer_id": 95090, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": -1, "selected": false, "text": "from socket import *\nimport time\nclass Listener:\n def __init__(self, port):\n self.port = port\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/94594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12274/" ]
94,610
<p>I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect. The problem is, I don't know how to catch this exception.</p> <ul> <li><p>Because it is an asynchronous call, I can't wrap my begin call with a try/catch block and have it pick up an exception that happens after the program has moved on from that point.</p></li> <li><p>Because the service proxy is automatically generated, I can't put a try/catch block on each and every generated function that calls EndInvoke (where the exception actually shows up). These generated functions are also surrounded by External Code in the call stack, so there's nowhere else in the stack to put a try/catch either.</p></li> <li><p>I can't put the try/catch in my callback functions, because the exception occurs before they would get called.</p></li> <li><p>There is an Application_UnhandledException function in my App.xaml.cs, which captures all unhandled exceptions. I could use this, but it seems like a messy way to do it. I'd rather reserve this function for the truly unexpected errors (aka bugs) and not end up with code in this function for every circumstance I'd like to deal with in a specific way.</p></li> </ul> <p>Am I missing an obvious solution? Or am I stuck using Application_UnhandledException?</p> <p>[Edit]<br> As mentioned below, the Error property is exactly what I was looking for. What is throwing me for a loop is that the fact that the exception is thrown and appears to be uncaught, yet execution is able to continue. It triggers the Application_UnhandledException event and causes VS2008 to break execution, but continuing in the debugger allows execution to continue. It's not really a problem, it just seems odd.</p>
[ { "answer_id": 636512, "author": "Braulio", "author_id": 76922, "author_profile": "https://Stackoverflow.com/users/76922", "pm_score": 0, "selected": false, "text": "Braulio\n" }, { "answer_id": 637612, "author": "Community", "author_id": -1, "author_profile": "https:...
2008/09/18
[ "https://Stackoverflow.com/questions/94610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17986/" ]
94,612
<p>To elaborate .. a) A table (BIGTABLE) has a capacity to hold a million rows with a primary Key as the ID. (random and unique) b) What algorithm can be used to arrive at an ID that has not been used so far. This number will be used to insert another row into table BIGTABLE.</p> <p>Updated the question with more details.. C) This table already has about 100 K rows and the primary key is not an set as identity. d) Currently, a random number is generated as the primary key and a row inserted into this table, if the insert fails another random number is generated. the problem is sometimes it goes into a loop and the random numbers generated are pretty random, but unfortunately, They already exist in the table. so if we re try the random number generation number after some time it works. e) The sybase rand() function is used to generate the random number.</p> <p>Hope this addition to the question helps clarify some points.</p>
[ { "answer_id": 94666, "author": "John Meagher", "author_id": 3535, "author_profile": "https://Stackoverflow.com/users/3535", "pm_score": 2, "selected": false, "text": "int id;\ndo {\n id = generateRandomId();\n} while (doesIdAlreadyExist(id));\ndoSomethingWithNewId(id); \n" }, { ...
2008/09/18
[ "https://Stackoverflow.com/questions/94612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17987/" ]
94,667
<p>How can I bind an array parameter in the HQL editor of the HibernateTools plugin? The query parameter type list does not include arrays or collections.</p> <p>For example:<br> <code>Select * from Foo f where f.a in (:listOfValues)</code>.<br> How can I bind an array to that listOfValues?</p>
[ { "answer_id": 119294, "author": "boutta", "author_id": 15108, "author_profile": "https://Stackoverflow.com/users/15108", "pm_score": 1, "selected": false, "text": "select * from Foo f where f.a in f.list\n" }, { "answer_id": 6833770, "author": "Shaun Stone", "author_id":...
2008/09/18
[ "https://Stackoverflow.com/questions/94667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12905/" ]
94,674
<p>How come this doesn't work (operating on an empty select list <code>&lt;select id="requestTypes"&gt;&lt;/select&gt;</code></p> <pre><code>$(function() { $.getJSON("/RequestX/GetRequestTypes/", showRequestTypes); } ); function showRequestTypes(data, textStatus) { $.each(data, function() { var option = new Option(this.RequestTypeName, this.RequestTypeID); // Use Jquery to get select list element var dropdownList = $("#requestTypes"); if ($.browser.msie) { dropdownList.add(option); } else { dropdownList.add(option, null); } } ); } </code></pre> <p>But this does:</p> <ul> <li><p>Replace:</p> <p><code>var dropdownList = $("#requestTypes");</code></p></li> <li><p>With plain old javascript:</p> <p><code>var dropdownList = document.getElementById("requestTypes");</code></p></li> </ul>
[ { "answer_id": 94686, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 3, "selected": false, "text": " var dropdownList = $(\"#requestTypes\")[0];\n" }, { "answer_id": 94716, "author": "Jim", "author_id": 8...
2008/09/18
[ "https://Stackoverflow.com/questions/94674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17729/" ]
94,684
<p>We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test script project and source files, etc).</p> <p>Basically we can open the TestComplete project manually and run the tests.</p> <p>Now we want to automate that process, so how do you do it? Or how do you think would be the simplest and best way to make this automation?</p> <p>Keeping it short, we want to automate the process of opening TestComplete after each build, run all the tests and send an email with the test results.</p> <p>Anyone can share some experience about this?</p> <p>Thanks.</p>
[ { "answer_id": 258000, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "Set wshShell = CreateObject(\"WScript.Shell\")\nwshShell.Run(\"\"\"C:\\Program Files\\Automated QA\\TestComplete 6\\Bin\\TestC...
2008/09/18
[ "https://Stackoverflow.com/questions/94684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727/" ]
94,689
<p>I am new to asp and have a deadline in the next few days. i receive the following xml from within a webservice response.</p> <pre><code>print("&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;user_data&gt; &lt;execution_status&gt;0&lt;/execution_status&gt; &lt;row_count&gt;1&lt;/row_count&gt; &lt;txn_id&gt;stuetd678&lt;/txn_id&gt; &lt;person_info&gt; &lt;attribute name="firstname"&gt;john&lt;/attribute&gt; &lt;attribute name="lastname"&gt;doe&lt;/attribute&gt; &lt;attribute name="emailaddress"&gt;john.doe@johnmail.com&lt;/attribute&gt; &lt;/person_info&gt; &lt;/user_data&gt;"); </code></pre> <p>How can i parse this xml into asp attributes?</p> <p>Any help is greatly appreciated</p> <p>Thanks Damien</p> <p>On more analysis, some soap stuff is also returned as the aboce response is from a web service call. can i still use lukes code below?</p>
[ { "answer_id": 94712, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 4, "selected": true, "text": "Dim oXML, oNode, sKey, sValue\n\nSet oXML = Server.CreateObject(\"MSXML2.DomDocument.6.0\") 'creating the parser objec...
2008/09/18
[ "https://Stackoverflow.com/questions/94689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11612/" ]
94,696
<p>I know it happens sometime before Load, but during what event exactly?</p>
[ { "answer_id": 21776865, "author": "Liam", "author_id": 542251, "author_profile": "https://Stackoverflow.com/users/542251", "pm_score": 3, "selected": false, "text": "LoadViewState" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/94696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9991/" ]
94,747
<p>What would be a good offline alternative of the online <a href="http://www.lipsum.com/feed/html" rel="noreferrer">Lipsum generator</a>? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.</p>
[ { "answer_id": 94785, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 1, "selected": false, "text": "{% lorem %}" }, { "answer_id": 94798, "author": "shadit", "author_id": 9925, "author_profile": "https://Stack...
2008/09/18
[ "https://Stackoverflow.com/questions/94747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1897/" ]
94,755
<p>What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-than-linear lookup to find the location of an object. I'd rather avoid duplication of data, so having each object maintain it's own coordinate and have to move itself in the map would be bad (not to mention that moving your own object may indirectly call your destructor whilst in a member function!). I would rather some container that maintains an index both by object pointer and coordinate, and that the objects themselves guarantee stable references/pointers. Then each object could store an iterator to the index (including the coordinate), sufficiently abstracted, and know where it is. Boost.MultiIndex seems like the best idea, but it's very scary and I don't wany my actual objects to need to be const.</p> <p>What would you recommend?</p> <p>EDIT: Boost Bimap seems nice, but does it provide stable indexing? That is, if I change the coordinate, references to other elements must remain valid. The reason I want to use pointers for indexing is because objects have otherwise no intrinsic ordering, and a pointer can remain constant while the object changes (allowing its use in a Boost MultiIndex, which, IIRC, does provide stable indexing).</p>
[ { "answer_id": 94979, "author": "Commodore Jaeger", "author_id": 4659, "author_profile": "https://Stackoverflow.com/users/4659", "pm_score": 4, "selected": true, "text": "std::multimap<Key, Object *>" }, { "answer_id": 95251, "author": "Matt Price", "author_id": 852, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16855/" ]
94,757
<p>I have a web application where there are number of Ajax components which refresh themselves every so often inside a page (it's a dashboard of sorts).</p> <p>Now, I want to add functionality to the page so that when there is no Internet connectivity, the current content of the page doesn't change and a message appears on the page saying that the page is offline (currently, as these various gadgets on the page try to refresh themselves and find that there is no connectivity, their old data vanishes).</p> <p>So, what is the best way to go about this?</p>
[ { "answer_id": 94808, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 4, "selected": false, "text": "navigator.onLine\n" }, { "answer_id": 94901, "author": "Jim", "author_id": 8427, "author_profile": "https:/...
2008/09/18
[ "https://Stackoverflow.com/questions/94757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380/" ]
94,767
<p>I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like regular text files and open up the JSON in the current tab?</p> <p>Thanks.</p>
[ { "answer_id": 815578, "author": "Tarnay Kálmán", "author_id": 55267, "author_profile": "https://Stackoverflow.com/users/55267", "pm_score": 4, "selected": false, "text": "\"application/json\"" }, { "answer_id": 8889271, "author": "Robert I. Jr.", "author_id": 1153091, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10333/" ]
94,779
<p>I am working on a client proposal and they will need to upgrade their network infrastructure to support hosting an ASP.NET application. Essentially, I need to estimate peak usage for a system with a known quantity of users (currently 250). A simple answer like "you'll need a dedicated T1 line" would probably suffice, but I'd like to have data to back it up.</p> <p><a href="https://stackoverflow.com/questions/54184/best-tool-to-monitor-network-connection-bandwidth#54245">Another question</a> referenced NetLimiter, which looks pretty slick for getting a sense of what's being used.</p> <p>My general thought is that I'll fire the web app up and use the system like I would anticipate it be used at the customer, really at a leisurely pace, over a certain time span, and then multiply the bandwidth usage by the number of users and divide by the time. </p> <p>This doesn't seem very scientific. It may be good enough for a proposal, but I'd like to see if there's a better way.</p> <p>I know there are load tools available for testing web application performance, but it seems like these would not accurately simulate peak user load for bandwidth testing purposes (too much at once).</p> <p>The platform is Windows/ASP.NET and the application is hosted within SharePoint (MOSS 2007).</p>
[ { "answer_id": 815578, "author": "Tarnay Kálmán", "author_id": 55267, "author_profile": "https://Stackoverflow.com/users/55267", "pm_score": 4, "selected": false, "text": "\"application/json\"" }, { "answer_id": 8889271, "author": "Robert I. Jr.", "author_id": 1153091, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7301/" ]
94,794
<p>Compared to </p> <ul> <li>Simple memory access</li> <li>Disk access</li> <li>Memory access on another computer(on the same network)</li> <li>Disk access on another computer(on the same network)</li> </ul> <p>in C++ on windows.</p>
[ { "answer_id": 2382542, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": " for (int i = 0; i < iMax; i++)\n {\n //gives about 5.94 seconds to do a billion loops, \n ...
2008/09/18
[ "https://Stackoverflow.com/questions/94794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15054/" ]
94,809
<p>I want to log on to a server inside my program using Windows authentication of the current user logged in. I thought that perhaps I could use </p> <p>System.Security.Principal.WindowsIdentity.GetCurrent().Name</p> <p>but while that does give a name, I do not see how I can find out the password of the user to enter it.</p>
[ { "answer_id": 94839, "author": "Doug Moore", "author_id": 13179, "author_profile": "https://Stackoverflow.com/users/13179", "pm_score": 1, "selected": false, "text": " <system.web>\n <authentication mode=\"Windows\" />\n <identity impersonate=\"true\"/>\n </system>\n" ...
2008/09/18
[ "https://Stackoverflow.com/questions/94809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
94,860
<p>I have searched the forum, and google for this topic. Most of the articles are talking about using JSON to call the controller/action on the server and do ajax effect on the result.</p> <p>I am trying to use some very basic JQuery features, like the JQuery UI/Tabs, and JQuery UI/Block for a dialog window. I cannot get these simple samples to work in my MVC project. Any ideas how I should modify these samples? I only need these basic feature now and I can go from here.</p> <p>Thanks!</p>
[ { "answer_id": 423576, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": " public static string Script(this HtmlHelper html, string path)\n {\n var filePath = VirtualPathUtility....
2008/09/18
[ "https://Stackoverflow.com/questions/94860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
94,884
<p>The system I work on here was written before .net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as objects. </p> <p>From performance perspective, how important change the code to using generics? I know from a perfomance perspective, boxing and unboxing etc., it is inefficient, but how much of a performance gain will there really be from changing it? Are generics something to use on a go forward basis, or it there enough of a performance change that a conscience effort should be made to update old code?</p>
[ { "answer_id": 95753, "author": "torial", "author_id": 13990, "author_profile": "https://Stackoverflow.com/users/13990", "pm_score": 3, "selected": false, "text": "Public Sub Run(ByVal strToProcess As String) Implements IPerfStub.Run\n Dim genList As New ArrayList\n\n For Each ch A...
2008/09/18
[ "https://Stackoverflow.com/questions/94884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942/" ]
94,906
<p>I'm running a SQL query on SQL Server 2005, and in addition to 2 columns being queried from the database, I'd also like to return 1 column of random numbers along with them. I tried this:</p> <pre><code>select column1, column2, floor(rand() * 10000) as column3 from table1 </code></pre> <p>Which kinda works, but the problem is that this query returns the same random number on every row. It's a different number each time you run the query, but it doesn't vary from row to row. How can I do this and get a new random number for each row?</p>
[ { "answer_id": 94951, "author": "Adam", "author_id": 13320, "author_profile": "https://Stackoverflow.com/users/13320", "pm_score": 1, "selected": false, "text": "CREATE VIEW vRandNumber\nAS\nSELECT RAND() as RandNumber\n" }, { "answer_id": 94995, "author": "Jonas Lincoln", ...
2008/09/18
[ "https://Stackoverflow.com/questions/94906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8409/" ]
94,912
<p>We currently have code like this:</p> <pre><code>Dim xDoc = XDocument.Load(myXMLFilePath) </code></pre> <p>The only way we know how to do it currently is by using a file path and impersonation (since this file is on a secured network path).</p> <p>I've looked at <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.load.aspx" rel="nofollow noreferrer">XDocument.Load on MSDN</a>, but I don't see anything.</p>
[ { "answer_id": 94993, "author": "Domenic", "author_id": 3191, "author_profile": "https://Stackoverflow.com/users/3191", "pm_score": 2, "selected": false, "text": "XDocument.Load" }, { "answer_id": 9182657, "author": "Shawinder Sekhon", "author_id": 823800, "author_pro...
2008/09/18
[ "https://Stackoverflow.com/questions/94912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7072/" ]
94,930
<p>I have a table with game scores, allowing multiple rows per account id: <code>scores (id, score, accountid)</code>. I want a list of the top 10 scorer ids and their scores.</p> <p>Can you provide an sql statement to select the top 10 scores, but only one score per account id? </p> <p>Thanks!</p>
[ { "answer_id": 94958, "author": "Danimal", "author_id": 2757, "author_profile": "https://Stackoverflow.com/users/2757", "pm_score": 2, "selected": false, "text": "select top 10 username, \n max(score) \nfrom usertable \ngroup by username \norder by max(score) desc\n" }, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13636/" ]
94,932
<p>Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. </p> <p>We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage has occurred again.</p> <p>I am looking for suggestions for diagnosing and fixing this issue.</p> <ul> <li>CF 8 standard </li> <li>Win2k3</li> </ul> <p>Added:</p> <ul> <li>There are no errors in the mail log at the time the queue fails</li> <li>We have not tried to run this without using the queue, due to the large amount of mail we send</li> </ul> <p>Added 2:</p> <ul> <li>It does not seem to be a problem with any of the files in the spool folder. When we restart the mail queue, they all seem to process correctly.</li> </ul> <p>Added 3:</p> <ul> <li>We are not using attachments.</li> </ul>
[ { "answer_id": 528530, "author": "Ben Doom", "author_id": 12267, "author_profile": "https://Stackoverflow.com/users/12267", "pm_score": 5, "selected": true, "text": "<cfdirectory action=\"list\" directory=\"c:\\coldfusion8\\mail\\spool\\\" name=\"spool\" sort=\"datelastmodified\">\n<cfse...
2008/09/18
[ "https://Stackoverflow.com/questions/94932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12267/" ]
94,934
<p>I'd like to create a &quot;universal&quot; debug logging function that inspects the JS namespace for well-known logging libraries.</p> <p>For example, currently, it supports Firebug's console.log:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> var console = window['console']; if (console &amp;&amp; console.log) { console.log(message); }</code></pre> </div> </div> </p> <p>Obviously, this only works in Firefox if Firebug is installed/enabled (it'll also work on other browsers with <a href="http://getfirebug.com/lite.html" rel="nofollow noreferrer">Firebug Lite</a>). Basically, I will be providing a JS library which I don't know what environment it will be pulled into, and I'd like to be able to figure out if there is a way to report debug output to the user.</p> <p>So, perhaps jQuery provides something - I'd check that jQuery is present and use it. Or maybe there are well-known IE plugins that work that I can sniff for. But it has to be fairly well-established and used machinery. I can't check for every obscure log function that people create.</p> <p>Please, only one library/technology per answer, so they can get voted ranked. Also, using alert() is a good short-term solution but breaks down if you want robust debug logging or if blocking the execution is a problem.</p>
[ { "answer_id": 94944, "author": "Teifion", "author_id": 1384652, "author_profile": "https://Stackoverflow.com/users/1384652", "pm_score": -1, "selected": false, "text": "alert('Some message/variables');\n" }, { "answer_id": 94996, "author": "dgvid", "author_id": 9897, ...
2008/09/18
[ "https://Stackoverflow.com/questions/94934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
94,935
<p>Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about</p> <pre><code>for i in range(0, 20): for i in xrange(0, 20): </code></pre>
[ { "answer_id": 94953, "author": "Oko", "author_id": 9402, "author_profile": "https://Stackoverflow.com/users/9402", "pm_score": -1, "selected": false, "text": "range" }, { "answer_id": 94962, "author": "Charles", "author_id": 18031, "author_profile": "https://Stackove...
2008/09/18
[ "https://Stackoverflow.com/questions/94935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
94,975
<p>I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle".</p> <p>Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms?</p> <p>If I were to treat each node in the graph as a game state then wouldn't that tree become quite large? Or is that just the way to do it?</p>
[ { "answer_id": 9990636, "author": "satnhak", "author_id": 323316, "author_profile": "https://Stackoverflow.com/users/323316", "pm_score": 2, "selected": false, "text": "n x n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/94975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
94,977
<p>In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile:</p> <pre><code>try { String s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } </code></pre> <p>In this code, a compile-time error occurs on the reference to s in the catch block, because s is only in scope in the try block. (In Java, the compile error is "s cannot be resolved"; in C#, it's "The name 's' does not exist in the current context".)</p> <p>The general solution to this issue seems to be to instead declare variables just before the try block, instead of within the try block:</p> <pre><code>String s; try { s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } </code></pre> <p>However, at least to me, (1) this feels like a clunky solution, and (2) it results in the variables having a larger scope than the programmer intended (the entire remainder of the method, instead of only in the context of the try-catch-finally).</p> <p>My question is, what were/are the rationale(s) behind this language design decision (in Java, in C#, and/or in any other applicable languages)? </p>
[ { "answer_id": 95015, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 2, "selected": false, "text": "try\n dim i as integer = 10 / 0 ''// Throw an exception\n dim s as string = \"hi\"\ncatch (e)\n console.writel...
2008/09/18
[ "https://Stackoverflow.com/questions/94977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12484/" ]
94,997
<p>Suppose you have a program which reads from a socket. How do you keep the download rate below a certain given threshold?</p>
[ { "answer_id": 95058, "author": "Branan", "author_id": 13894, "author_profile": "https://Stackoverflow.com/users/13894", "pm_score": 1, "selected": false, "text": "ReadFixedRate() {\n while(Data_Exists()) {\n t = GetTime();\n ReadBlock();\n while(t + delay > GetTime()) {\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/94997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9107/" ]
95,007
<p>I've been mystified by the R quantile function all day. </p> <p>I have an intuitive notion of how quantiles work, and an M.S. in stats, but boy oh boy, the documentation for it is confusing to me. </p> <p>From the docs:</p> <blockquote> <p>Q[i](p) = (1 - gamma) x[j] + gamma x[j+1],</p> </blockquote> <p>I'm with it so far. For a type <em>i</em> quantile, it's an interpolation between x[j] and x [j+1], based on some mysterious constant <em>gamma</em></p> <blockquote> <p>where 1 &lt;= i &lt;= 9, (j-m)/n &lt;= p &lt; (j-m+1)/ n, x[j] is the jth order statistic, n is the sample size, and m is a constant determined by the sample quantile type. Here gamma depends on the fractional part of g = np+m-j. </p> </blockquote> <p>So, how calculate j? m?</p> <blockquote> <p>For the continuous sample quantile types (4 through 9), the sample quantiles can be obtained by linear interpolation between the kth order statistic and p(k): </p> <p>p(k) = (k - alpha) / (n - alpha - beta + 1), where α and β are constants determined by the type. Further, m = alpha + p(1 - alpha - beta), and gamma = g.</p> </blockquote> <p>Now I'm really lost. p, which was a constant before, is now apparently a function. </p> <p>So for Type 7 quantiles, the default...</p> <blockquote> <p>Type 7</p> <p>p(k) = (k - 1) / (n - 1). In this case, p(k) = mode[F(x[k])]. This is used by S. </p> </blockquote> <p>Anyone want to help me out? In particular I'm confused by the notation of p being a function and a constant, what the heck <em>m</em> is, and now to calculate j for some particular <em>p</em>. </p> <p>I hope that based on the answers here, we can submit some revised documentation that better explains what is going on here. </p> <p><a href="https://svn.r-project.org/R/trunk/src/library/stats/R/quantile.R" rel="noreferrer">quantile.R source code</a> or type: quantile.default</p>
[ { "answer_id": 1463249, "author": "AFoglia", "author_id": 79513, "author_profile": "https://Stackoverflow.com/users/79513", "pm_score": 7, "selected": true, "text": "j = int(pn+m)" }, { "answer_id": 58754784, "author": "Michael Roswell", "author_id": 8400969, "author_...
2008/09/18
[ "https://Stackoverflow.com/questions/95007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842/" ]
95,061
<p>How can I tell Activerecord to not load blob columns unless explicitly asked for? There are some pretty large blobs in my legacy DB that must be excluded for 'normal' Objects.</p>
[ { "answer_id": 95413, "author": "Mike Tunnicliffe", "author_id": 13956, "author_profile": "https://Stackoverflow.com/users/13956", "pm_score": 2, "selected": false, "text": "MyModel.find(id, :select => 'every, attribute, except, the, blobs')\n" }, { "answer_id": 1354650, "aut...
2008/09/18
[ "https://Stackoverflow.com/questions/95061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,074
<p>I have noticed that setting row height in DataGridView control is slow. Is there a way to make it faster?</p>
[ { "answer_id": 95362, "author": "ImJustPondering", "author_id": 17940, "author_profile": "https://Stackoverflow.com/users/17940", "pm_score": 0, "selected": false, "text": " // my test to specify a size for a datagridview row\n dataGridView1.Columns.Add(new DataGridViewText...
2008/09/18
[ "https://Stackoverflow.com/questions/95074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18046/" ]
95,077
<p>What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record that those other records need to be related to. So I'll just be storing them temporarily until the user submits the form.</p>
[ { "answer_id": 101205, "author": "rohancragg", "author_id": 5351, "author_profile": "https://Stackoverflow.com/users/5351", "pm_score": 0, "selected": false, "text": "Dictionary<int, string> myValues = new Dictionary<int, string>();\nmyValues.Add(1, \"Apple\");\nmaValues.Add(2, \"Pear\")...
2008/09/18
[ "https://Stackoverflow.com/questions/95077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16891/" ]
95,089
<p>Trying the easy approach:</p> <blockquote> <p>sqlite2 mydb.db .dump | sqlite3 mydb-new.db</p> </blockquote> <p>I got this error:</p> <blockquote> <p>SQL error near line 84802: no such column: Ð</p> </blockquote> <p>In that line the script is this:</p> <blockquote> <p>INSERT INTO vehiculo VALUES(127548,'21K0065217',<strong>Ñ</strong>,'PA007808',65217,279,1989,3,468,'1998-07-30 00:00:00.000000','14/697/98-07',2,'',1);</p> </blockquote> <p>My guess is that <strong>the 'Ñ' without quotes is the problem</strong>.</p> <p>any idea?</p> <p>PD: I'm under Windows right now and I would like to use the command-line so it can be automatized (this process will be done on daily basis by a server).</p>
[ { "answer_id": 548310, "author": "Kyle Brantley", "author_id": 66329, "author_profile": "https://Stackoverflow.com/users/66329", "pm_score": 2, "selected": false, "text": "$ sqlite3 v2database.db\nsqlite> .quit\n$\n" }, { "answer_id": 1193101, "author": "ygrek", "author_i...
2008/09/18
[ "https://Stackoverflow.com/questions/95089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7946/" ]
95,098
<p>Using the method <code>Application.Restart()</code> in C# should restart the current application: but it seems that this is not always working.</p> <p>Is there a reason for this Issue, can somebody tell me, why it doesn't work all the time?</p>
[ { "answer_id": 95239, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 2, "selected": false, "text": "Context.Application.Lock();\nContext.Session.Abandon();\nContext.Application.RemoveAll();\nContext.Application.Restart();\nCont...
2008/09/18
[ "https://Stackoverflow.com/questions/95098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17558/" ]
95,105
<p>Convert.ToString() only allows base values of 2, 8, 10, and 16 for some odd reason; is there some obscure way of providing any base between 2 and 16?</p>
[ { "answer_id": 95116, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": -1, "selected": false, "text": "string foo = Convert.ToString(myint,base);\n" }, { "answer_id": 95331, "author": "Guvante", "author_id": 168...
2008/09/18
[ "https://Stackoverflow.com/questions/95105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9913/" ]
95,106
<p>Is there a Vim shortcut for jumping to the argument list of the current function? I often find myself needing to mess with the argument list of a function, and it's kind of annoying to have to do ?def or ?function or 10k or what-have-you until I finally get to it, then /( or t( or 5e to get to the right position in the argument list, and so on. It would be great if I could just hit ,a for example and instantly get put into insert mode at the end/beginning of the argument list.</p> <p>Possible approaches:</p> <ul> <li>Folding</li> <li>Tag support (ctags)</li> </ul> <p>Also, I'm using Python, so solutions based on curly braces unfortunately won't work.</p> <p>If no such shortcut exists, I'll just write one and post it here as an answer. :-)</p>
[ { "answer_id": 95745, "author": "Luc Hermitte", "author_id": 15934, "author_profile": "https://Stackoverflow.com/users/15934", "pm_score": 2, "selected": false, "text": " :nnoremap <buffer> [m :call search('def\\|function', 'b')<cr>f(\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16034/" ]
95,112
<p>I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait?</p> <p>Trivial example:</p> <pre><code>Call ExternalLongRunningProcess Call DoOtherStuff </code></pre> <p>How do I delay 'DoOtherStuff'?</p>
[ { "answer_id": 95142, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 5, "selected": true, "text": "Do\n If isSomeCheckCondition() Then Exit Do\n DoEvents\nLoop\n" }, { "answer_id": 102685, "author": "Kris...
2008/09/18
[ "https://Stackoverflow.com/questions/95112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
95,134
<p>I'm using the following code to query a database from my jsp, but I'd like to know more about what's happening behind the scenes.</p> <p>These are my two primary questions.</p> <p>Does the tag access the ResultSet directly, or is the query result being stored in a datastructure in memory?</p> <p>When is the connection closed?</p> <pre><code>&lt;%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %&gt; &lt;sql:query var="query" dataSource="${ds}" sql="${listQuery}"&gt;&lt;/sql:query&gt; &lt;c:forEach var="row" items="${query.rows}" begin="0"&gt; ${row.data } ${row.more_data } &lt;/c:forEach&gt; </code></pre> <p>Note: I've always been against running queries in the jsp, but my result set is too large to store in memory between my action and my jsp. Using this tag library looks like the easiest solution.</p>
[ { "answer_id": 95813, "author": "Will Hartung", "author_id": 13663, "author_profile": "https://Stackoverflow.com/users/13663", "pm_score": 1, "selected": false, "text": "\npublic class ResultSetIterator implements Iterator {" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1310/" ]
95,163
<p>I'm new to .Net and I'm trying to understand the basics first. What is the difference between MSIL and Java bytecode?</p>
[ { "answer_id": 96028, "author": "Motti", "author_id": 3848, "author_profile": "https://Stackoverflow.com/users/3848", "pm_score": 6, "selected": false, "text": "struct" }, { "answer_id": 9155197, "author": "Justin", "author_id": 332026, "author_profile": "https://Stac...
2008/09/18
[ "https://Stackoverflow.com/questions/95163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18055/" ]
95,181
<p>I have:</p> <pre><code>class MyClass extends MyClass2 implements Serializable { //... } </code></pre> <p>In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object?</p> <p>Correction: MyClass2 is, of course, not an interface but a class.</p>
[ { "answer_id": 95208, "author": "Mike Deck", "author_id": 1247, "author_profile": "https://Stackoverflow.com/users/1247", "pm_score": 5, "selected": false, "text": "private transient Foo foo;\n" }, { "answer_id": 95224, "author": "sk.", "author_id": 16399, "author_pro...
2008/09/18
[ "https://Stackoverflow.com/questions/95181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12860/" ]
95,183
<p>How do I create an index on the date part of DATETIME field?</p> <pre><code>mysql&gt; SHOW COLUMNS FROM transactionlist; +-------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+------------------+------+-----+---------+----------------+ | TransactionNumber | int(10) unsigned | NO | PRI | NULL | auto_increment | | WagerId | int(11) | YES | MUL | 0 | | | TranNum | int(11) | YES | MUL | 0 | | | TranDateTime | datetime | NO | | NULL | | | Amount | double | YES | | 0 | | | Action | smallint(6) | YES | | 0 | | | Uid | int(11) | YES | | 1 | | | AuthId | int(11) | YES | | 1 | | +-------------------+------------------+------+-----+---------+----------------+ 8 rows in set (0.00 sec) </code></pre> <p>TranDateTime is used to save the date and time of a transaction as it happens</p> <p>My Table has over 1,000,000 records in it and the statement </p> <pre><code>SELECT * FROM transactionlist where date(TranDateTime) = '2008-08-17' </code></pre> <p>takes a long time.</p> <p>EDIT: </p> <p>Have a look at this blog post on "<a href="http://billauer.co.il/blog/2009/03/mysql-datetime-epoch-unix-time/" rel="noreferrer">Why MySQL’s DATETIME can and should be avoided</a>"</p>
[ { "answer_id": 95252, "author": "Clinton Pierce", "author_id": 8173, "author_profile": "https://Stackoverflow.com/users/8173", "pm_score": 3, "selected": false, "text": " select * from translist \n where TranDateTime > '2008-08-16 23:59:59'\n and TranDateTime < '2008-08-18 00:...
2008/09/18
[ "https://Stackoverflow.com/questions/95183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
95,192
<p>Our CruiseControl system checks out from starteam. I've noticed that it is sometimes not checking out new versions of files, only added files.</p> <p>Does anyone know why this is?</p>
[ { "answer_id": 95353, "author": "dgvid", "author_id": 9897, "author_profile": "https://Stackoverflow.com/users/9897", "pm_score": 1, "selected": false, "text": "delete-local -q -p &quot;${starteam_project_root}&quot; -is -filter &quot;N&quot; -cfgd &quot;${exec_time}&quot;\n" }, { ...
2008/09/18
[ "https://Stackoverflow.com/questions/95192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
95,211
<p>I want to generate a Makefile from an existing Xcode project on the Mac. Specifically, an existing iPhone, Objective-C program on the Mac.</p> <p>I found <a href="http://members.bellatlantic.net/%7Evze35xda/software.html" rel="noreferrer">PBToMake</a>, but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project.</p>
[ { "answer_id": 95653, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 1, "selected": false, "text": "xcodebuild" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5284/" ]
95,213
<p>Simple example: I want to have some items on a page (like divs or table rows), and I want to let the user click on them to select them. That seems easy enough in jQuery. To save which items a user clicks on with no server-side post backs, I was thinking a cookie would be a simple way to get this done.</p> <ol> <li>Is this assumption that a cookie is OK in this case, correct?</li> <li>If it is correct, does the jQuery API have some way to read/write cookie information that is nicer than the default JavaScript APIs?</li> </ol>
[ { "answer_id": 95351, "author": "Steve Moyer", "author_id": 17008, "author_profile": "https://Stackoverflow.com/users/17008", "pm_score": 4, "selected": false, "text": "$.cookie('cookie_name', 'cookie_value')" }, { "answer_id": 2210411, "author": "adam", "author_id": 1167...
2008/09/18
[ "https://Stackoverflow.com/questions/95213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5619/" ]
95,218
<p>Here's something I haven't been able to fix, and I've looked <strong>everywhere</strong>. Perhaps someone here will know!</p> <p>I have a table called dandb_raw, with three columns in particular: dunsId (PK), name, and searchName. I also have a trigger that acts on this table:</p> <pre><code>SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dandb_raw_searchNames] ON [dandb_raw] FOR INSERT, UPDATE AS SET NOCOUNT ON select dunsId, name into #magic from inserted UPDATE dandb SET dandb.searchName = company_generateSearchName(dandb.name) FROM (select dunsId, name from #magic) i INNER JOIN dandb_raw dandb on i.dunsId = dandb.dunsId --Add new search matches SELECT c.companyId, dandb.dunsId INTO #newMatches FROM dandb_raw dandb INNER JOIN (select dunsId, name from #magic) a on a.dunsId = dandb.dunsId INNER JOIN companies c ON dandb.searchName = c.searchBrand --avoid url matches that are potentially wrong AND (lower(dandb.url) = lower(c.url) OR dandb.url = '' OR c.url = '' OR c.url is null) INSERT INTO #newMatches (companyId, dunsId) SELECT c.companyId, max(dandb.dunsId) dunsId FROM dandb_raw dandb INNER JOIN ( select case when charindex('/',url) &lt;&gt; 0 then left(url, charindex('/',url)-1) else url end urlMatch, * from companies ) c ON dandb.url = c.urlMatch where subsidiaryOf = 1 and isReported = 1 and dandb.url &lt;&gt; '' and c.companyId not in (select companyId from #newMatches) group by companyId having count(dandb.dunsId) = 1 UPDATE cd SET cd.dunsId = nm.dunsId FROM companies_dandb cd INNER JOIN #newMatches nm ON cd.companyId = nm.companyId GO </code></pre> <p>The trigger causes inserts to fail:</p> <pre><code>insert into [dandb_raw](dunsId, name) select 3442355, 'harper' union all select 34425355, 'har 466per' update [dandb_raw] set name ='grap6767e' </code></pre> <p>With this error:</p> <pre><code>Msg 213, Level 16, State 1, Procedure companies_contactInfo_updateTerritories, Line 20 Insert Error: Column name or number of supplied values does not match table definition. </code></pre> <p>The most curious thing about this is that each of the individual statements in the trigger works on its own. It's almost as though inserted is a one-off table that infects temporary tables if you try to move inserted into one of them.</p> <p>So what causes the trigger to fail? How can it be stopped?</p>
[ { "answer_id": 95768, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 1, "selected": false, "text": "CREATE TABLE #newMatches\n(\n CompanyID int PRIMARY KEY,\n DunsID int\n)\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40352/" ]
95,222
<p>I found this link <a href="http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/" rel="noreferrer">http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/</a>, but there isn't a lot of description around it, aside that it's "simple".</p> <p>Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode.</p> <p>If there isn't one, any good elisp references to help me get started writing it myself would be greatly appreciated.</p> <p>EDIT: David's response prompted me to take a closer look at glsl-mode.el, and it is in fact based on cc-mode, so it's exactly what I was looking for in the first place.</p>
[ { "answer_id": 95494, "author": "David Nehme", "author_id": 14167, "author_profile": "https://Stackoverflow.com/users/14167", "pm_score": 5, "selected": true, "text": "(autoload 'glsl-mode \"glsl-mode\" nil t)\n(add-to-list 'auto-mode-alist '(\"\\\\.vert\\\\'\" . glsl-mode))\n(add-to-lis...
2008/09/18
[ "https://Stackoverflow.com/questions/95222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13894/" ]
95,257
<p>I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark missing days with a 0</p>
[ { "answer_id": 95517, "author": "digiguru", "author_id": 5055, "author_profile": "https://Stackoverflow.com/users/5055", "pm_score": 0, "selected": false, "text": "Declare @FromDate datetime, \n @ToDate datetime \nDeclare @tmpDates table \n (StatsDate datetime)\nSet...
2008/09/18
[ "https://Stackoverflow.com/questions/95257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5055/" ]
95,277
<p>I'd like to be able to create a parameterized query in MS Access 2003 and feed the values of certain form elements to that query and then get the corresponding resultset back and do some basic calculations with them. I'm coming up short in figuring out how to get the parameters of the query to be populated by the form elements. If I have to use VBA, that's fine.</p>
[ { "answer_id": 96047, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 1, "selected": false, "text": "Set db = CurrentDb\n\nSet qdf = db.QueryDefs(\"AddHospital\")\nqdf.Parameters!txtHospital = Trim(Me.HospName)\nqdf.ReturnsR...
2008/09/18
[ "https://Stackoverflow.com/questions/95277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16562/" ]
95,286
<p>I have the following configuration, but I have not able to find any documentation on how to set a maximum backup files on date rolling style. I know that you can do this with size rolling style by using the maxSizeRollBackups.</p> <pre><code>&lt;appender name="AppLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt; &lt;file value="mylog.log" /&gt; &lt;appendToFile value="true" /&gt; &lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&gt; &lt;rollingStyle value="Date" /&gt; &lt;datePattern value=".yyMMdd.'log'" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%d %-5p %c - %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; </code></pre>
[ { "answer_id": 95390, "author": "wcm", "author_id": 2173, "author_profile": "https://Stackoverflow.com/users/2173", "pm_score": 2, "selected": false, "text": " <appender name=\"RollingFile\" type=\"log4net.Appender.RollingFileAppender\">\n <param name=\"File\" value=\"App_Data\\log\"...
2008/09/18
[ "https://Stackoverflow.com/questions/95286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4191/" ]
95,305
<p>Most of my users have email addresses associated with their profile in <code>/etc/passwd</code>. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field.</p> <p>Can somebody give me a <strong>regex to grab just the email address</strong> (delimeted by commas) from a line in this file? (I will be using grep and sed from a bash script)</p> <p>Sample lines from file:</p> <pre><code>user1:x:1147:5005:User One,Department,,,email@domain.org:/home/directory:/bin/bash user2:x:1148:5002:User Two,Department2,email2@gmail.com,:/home/directory:/bin/bash </code></pre>
[ { "answer_id": 95344, "author": "UnkwnTech", "author_id": 115, "author_profile": "https://Stackoverflow.com/users/115", "pm_score": -1, "selected": false, "text": "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]...
2008/09/18
[ "https://Stackoverflow.com/questions/95305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764/" ]
95,361
<p>I'm programming in C++ on Visual Studio 2005. My question deals with .rc files. You can manually place include directives like (#include "blah.h"), at the top of an .rc file. But that's bad news since the first time someone opens the .rc file in the resource editor, it gets overwritten. I know there is a place to make these defines so that they don't get trashed but I can't find it and googling hasn't helped. Anyone know?</p>
[ { "answer_id": 95718, "author": "dgvid", "author_id": 9897, "author_profile": "https://Stackoverflow.com/users/9897", "pm_score": 4, "selected": true, "text": "2 TEXTINCLUDE\nBEGIN\n \"#include \"\"windows.h\"\"\\r\\n\"\n \"#include \"\"blah.h\\r\\n\"\n \"\\0\"\n END\n" }, ...
2008/09/18
[ "https://Stackoverflow.com/questions/95361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,364
<p>I have a LINQ to SQL generated class with a readonly property:</p> <pre><code>&lt;Column(Name:="totalLogins", Storage:="_TotalLogins", DbType:="Int", UpdateCheck:=UpdateCheck.Never)&gt; _ Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer) Get Return Me._TotalLogins End Get End Property </code></pre> <p>This prevents it from being changed externally, but I would like to update the property from within my class like below:</p> <pre><code>Partial Public Class User ... Public Shared Sub Login(Username, Password) ValidateCredentials(UserName, Password) Dim dc As New MyDataContext() Dim user As User = (from u in dc.Users select u where u.UserName = Username)).FirstOrDefault() user._TotalLogins += 1 dc.SubmitChanges() End Sub ... End Class </code></pre> <p>But the call to user._TotalLogins += 1 is not being written to the database? Any thoughts on how to get LINQ to see my changes?</p>
[ { "answer_id": 96076, "author": "chrissie1", "author_id": 2936, "author_profile": "https://Stackoverflow.com/users/2936", "pm_score": 0, "selected": false, "text": "Make a second property that is protected or internal(?) \n\n<Column(Name:=\"totalLogins\", Storage:=\"_TotalLogins\", DbTyp...
2008/09/18
[ "https://Stackoverflow.com/questions/95364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11991/" ]
95,378
<p>What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files?</p> <p>The spell check should be <em>source code aware</em> meaning that it would stick to checking string literals in the code and not the code itself. Bonus points if the spell checker understands common resource file formats, for example text files containing name-value pairs (only check the values). Super-bonus points if you can tell it which parts of an XML DTD or Schema should be checked and which should be ignored.</p> <p>Many IDEs can do this for the file you are currently working with. The difference in what I am looking for is something that can operate upon a whole source code base at once.</p> <p>Something like a Findbugs or PMD type tool for mis-spellings would be ideal.</p>
[ { "answer_id": 96076, "author": "chrissie1", "author_id": 2936, "author_profile": "https://Stackoverflow.com/users/2936", "pm_score": 0, "selected": false, "text": "Make a second property that is protected or internal(?) \n\n<Column(Name:=\"totalLogins\", Storage:=\"_TotalLogins\", DbTyp...
2008/09/18
[ "https://Stackoverflow.com/questions/95378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9925/" ]
95,419
<p>Had a conversation with a coworker the other day about this.</p> <p>There's the obvious using a constructor, but what are the other ways there?</p>
[ { "answer_id": 95448, "author": "John Meagher", "author_id": 3535, "author_profile": "https://Stackoverflow.com/users/3535", "pm_score": 2, "selected": false, "text": "someClass.newInstance();\n" }, { "answer_id": 2103107, "author": "Thomas Lötzer", "author_id": 3587, ...
2008/09/18
[ "https://Stackoverflow.com/questions/95419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1247/" ]
95,432
<p>I'd like to create a hotkey to search for files <strong>under a specific folder</strong> in Windows XP; I'm using AutoHotkey to create this shortcut.</p> <p>Problem is that I need to know a command-line statement to run in order to open the standard Windows "Find Files/Folders" dialog. I've googled for a while and haven't found any page indicating how to do this.</p> <p>I'm assuming that if I know the command-line statement for bringing up this prompt, it will allow me to pass in a parameter for what folder I want to be searching under. I know you can do this by right-clicking on a folder in XP, so I assume there's some way I could do it on the command line...?</p>
[ { "answer_id": 95502, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 0, "selected": false, "text": "Win+f" }, { "answer_id": 95580, "author": "Charles Roper", "author_id": 1944, "author_profile": "https://Stac...
2008/09/18
[ "https://Stackoverflow.com/questions/95432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1766670/" ]
95,492
<p>Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT?</p> <p>Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?</p>
[ { "answer_id": 95539, "author": "dreeves", "author_id": 4234, "author_profile": "https://Stackoverflow.com/users/4234", "pm_score": 6, "selected": true, "text": "use Time::Local;\ntimelocal($second,$minute,$hour,$day,$month-1,$year);\n" }, { "answer_id": 95629, "author": "ral...
2008/09/18
[ "https://Stackoverflow.com/questions/95492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
95,500
<p>While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure:</p> <pre><code>#define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) </code></pre> <p>Very useful as it is but can it be converted into an inline function or template?</p> <p>OK, ARRAYSIZE would be a better name but this is legacy code (no idea where it came from, it's at least 15 years old) so I pasted it 'as is'.</p>
[ { "answer_id": 95518, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 1, "selected": false, "text": "template <typename T>\nuint32_t StructSize() // This might get inlined to a constant at compile time\n{\n return sizeof(T)/siz...
2008/09/18
[ "https://Stackoverflow.com/questions/95500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
95,510
<p>I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?</p>
[ { "answer_id": 95605, "author": "Philip Rieck", "author_id": 12643, "author_profile": "https://Stackoverflow.com/users/12643", "pm_score": 5, "selected": true, "text": "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\n" }, { "answer_id": 95646, "author": ...
2008/09/18
[ "https://Stackoverflow.com/questions/95510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17037/" ]
95,525
<p>I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\Dev</p> <p><a href="http://www.vistax64.com/vista-installation-setup/138053-vista-asks-permission-run-installed-programs.html" rel="nofollow noreferrer">This response</a> made no sense to me as a solution to the problem.</p>
[ { "answer_id": 96033, "author": "AlanKley", "author_id": 8761, "author_profile": "https://Stackoverflow.com/users/8761", "pm_score": 1, "selected": false, "text": "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n <security>\n <requestedPrivileges>\n <requestedExecu...
2008/09/18
[ "https://Stackoverflow.com/questions/95525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8761/" ]
95,547
<p>Should I catch exceptions for logging purposes?</p> <pre> public foo(..) { try { ... } catch (Exception ex) { Logger.Error(ex); throw; } } </pre> <p>If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times.</p> <p>Does it make sense to do so if my layers are in separate projects and only the public interfaces have try/catch in them? Why? Why not? Is there a different approach I could use?</p>
[ { "answer_id": 95667, "author": "MADMap", "author_id": 17558, "author_profile": "https://Stackoverflow.com/users/17558", "pm_score": 0, "selected": false, "text": "public foo(..)\n{\n try\n {\n ...\n }\n catch (NullReferenceException ex) {\n DoSmth(e);\n }\n catch (Ar...
2008/09/18
[ "https://Stackoverflow.com/questions/95547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15771/" ]
95,554
<p>I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions?</p> <p>Thanks.</p>
[ { "answer_id": 95863, "author": "Mike Tunnicliffe", "author_id": 13956, "author_profile": "https://Stackoverflow.com/users/13956", "pm_score": 2, "selected": false, "text": "render :json => var_containing_my_json, :content_type => 'text/x-json'\n" }, { "answer_id": 95968, "au...
2008/09/18
[ "https://Stackoverflow.com/questions/95554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10333/" ]
95,578
<ul> <li>I have an Oracle database backup file (.dmp) that was created with <code>expdp</code>.</li> <li>The .dmp file was an export of an entire database.</li> <li>I need to restore 1 of the schemas from within this dump file.</li> <li>I don't know the names of the schemas inside this dump file.</li> <li>To use <code>impdp</code> to import the data I need the name of the schema to load.</li> </ul> <p>So, I need to inspect the .dmp file and list all of the schemas in it, how do I do that?</p> <hr /> <p><em>Update (2008-09-18 13:02) - More detailed information:</em></p> <p>The impdp command i'm current using is:</p> <pre><code>impdp user/password@database directory=DPUMP_DIR dumpfile=EXPORT.DMP logfile=IMPORT.LOG </code></pre> <p>And the DPUMP_DIR is correctly configured.</p> <pre><code>SQL&gt; SELECT directory_path 2 FROM dba_directories 3 WHERE directory_name = 'DPUMP_DIR'; DIRECTORY_PATH ------------------------- D:\directory_path\dpump_dir\ </code></pre> <p>And yes, the EXPORT.DMP file is in fact in that folder.</p> <p>The error message I get when I run the <code>impdp</code> command is:</p> <pre><code>Connected to: Oracle Database 10g Enterprise Edition ... ORA-31655: no data or metadata objects selected for the job ORA-39154: Objects from foreign schemas have been removed from import </code></pre> <p>This error message is mostly expected. I need the <code>impdp</code> command be:</p> <pre><code>impdp user/password@database directory=DPUMP_DIR dumpfile=EXPORT.DMP SCHEMAS=SOURCE_SCHEMA REMAP_SCHEMA=SOURCE_SCHEMA:MY_SCHEMA </code></pre> <p>But to do that, I need the source schema.</p>
[ { "answer_id": 103454, "author": "KyleLanser", "author_id": 12923, "author_profile": "https://Stackoverflow.com/users/12923", "pm_score": 4, "selected": false, "text": "<OWNER_NAME>SOURCE_SCHEMA</OWNER_NAME>" }, { "answer_id": 6708618, "author": "Factor Mystic", "author_i...
2008/09/18
[ "https://Stackoverflow.com/questions/95578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12923/" ]
95,600
<p>The documentation indicates that the error: option function will make available: XHR instance, a status message string (in this case always error) and an optional exception object returned from the XHR instance (Book: JQuery in Action)</p> <p>Using the following (in the $.ajax call) I was able to determine I had a "parsererror" and a "timeout" (since I added the timeout: option) error</p> <pre><code>error: function(request, error){} </code></pre> <p>What are other things you evaluate in the error option? do you include the optional exception object?</p> <p><strong>EDIT:</strong> one of the answers indicates all the return errors...learning more about what is of value (for debugging) in the XHR instance and exception object would be helpful</p> <p>This is a complete $.ajax call:</p> <pre><code>$.ajax({ type: "post", url: "http://myServer/cgi-bin/broker" , dataType: "text", data: { '_service' : 'myService', '_program' : 'myProgram', 'start' : start, 'end' : end }, beforeSend: function() { $("#loading").removeClass("hide"); }, timeout: 5000, error: function(request,error) { $("#loading").addClass("hide"); if (error == "timeout") { $("#error").append("The request timed out, please resubmit"); } else { $("#error").append("ERROR: " + error); } }, success: function(request) { $("#loading").addClass("hide"); var t = eval( "(" + request + ")" ) ; } // End success }); // End ajax method </code></pre> <p>Thanks for the input</p>
[ { "answer_id": 95947, "author": "Tomasz Tybulewicz", "author_id": 17405, "author_profile": "https://Stackoverflow.com/users/17405", "pm_score": 0, "selected": false, "text": "var t = eval( \"(\" + request + \")\" ) ;" }, { "answer_id": 1682211, "author": "davegurnell", "a...
2008/09/18
[ "https://Stackoverflow.com/questions/95600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
95,606
<p>In XNA, how do I load in a texture or mesh from a file without using the content pipeline?</p>
[ { "answer_id": 6951962, "author": "Aranda", "author_id": 858350, "author_profile": "https://Stackoverflow.com/users/858350", "pm_score": 0, "selected": false, "text": "Xna.Framework.Graphics.Model" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632/" ]
95,625
<p>Basically, we have a rule setup to run a script when a code word is detected in the body of an incoming message. The script will append the current subject header with a word in front. For example, Before: "Test Message", After: "Dept - Test Message". Any ideas?</p>
[ { "answer_id": 95695, "author": "Matt", "author_id": 17849, "author_profile": "https://Stackoverflow.com/users/17849", "pm_score": 0, "selected": false, "text": "mailItem.Subject = \"Dept - \" & mailItem.Subject\nmailItem.Save \n" }, { "answer_id": 95746, "author": "Matt", ...
2008/09/18
[ "https://Stackoverflow.com/questions/95625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,631
<p>Suppose I want to open a file in an existing Emacs session using <code>su</code> or <code>sudo</code>, without dropping down to a shell and doing <code>sudoedit</code> or <code>sudo emacs</code>. One way to do this is</p> <pre><code>C-x C-f /sudo::/path/to/file </code></pre> <p>but this requires an expensive <a href="http://www.gnu.org/software/tramp/" rel="noreferrer">round-trip through SSH</a>. Is there a more direct way?</p> <p>[EDIT] @JBB is right. I want to be able to invoke <code>su</code>/<code>sudo</code> to save as well as open. It would be OK (but not ideal) to re-authorize when saving. What I'm looking for is variations of <code>find-file</code> and <code>save-buffer</code> that can be "piped" through <code>su</code>/<code>sudo</code>.</p>
[ { "answer_id": 29255604, "author": "anquegi", "author_id": 1900722, "author_profile": "https://Stackoverflow.com/users/1900722", "pm_score": 2, "selected": false, "text": "(defadvice ido-find-file (after find-file-sudo activate)\n \"Find file as root if necessary.\"\n (unless (and buff...
2008/09/18
[ "https://Stackoverflow.com/questions/95631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
95,635
<p>What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?</p>
[ { "answer_id": 35664946, "author": "Anands23", "author_id": 4643764, "author_profile": "https://Stackoverflow.com/users/4643764", "pm_score": 3, "selected": false, "text": "while(i<10){\n // ...\n a=a+i;\n // ...\n }\n" }, { "answer_id": 52523015, "author": "Willem v...
2008/09/18
[ "https://Stackoverflow.com/questions/95635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6264/" ]
95,642
<p>Long story short, I have a substantial Python application that, among other things, does outcalls to "losetup", "mount", etc. on Linux. Essentially consuming system resources that must be released when complete.</p> <p>If my application crashes, I want to ensure these system resources are properly released.</p> <p>Does it make sense to do something like the following?</p> <pre><code>def main(): # TODO: main application entry point pass def cleanup(): # TODO: release system resources here pass if __name__ == "__main__": try: main() except: cleanup() raise </code></pre> <p>Is this something that is typically done? Is there a better way? Perhaps the destructor in a singleton class?</p>
[ { "answer_id": 98085, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 2, "selected": false, "text": "try:\n main()\nfinally:\n cleanup()\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9188/" ]
95,683
<p>I have a .NET 3.5 (target framework) web application. I have some code that looks like this:</p> <pre><code>public string LogPath { get; private set; } public string ErrorMsg { get; private set; } </code></pre> <p>It's giving me this compilation error for these lines:</p> <pre><code>"must declare a body because it is not marked abstract or extern." </code></pre> <p>Any ideas? My understanding was that this style of property was valid as of .NET 3.0.</p> <p>Thanks!</p> <hr> <p>The problem turned out to be in my .sln file itself. Although I was changing the target version in my build options, in the .sln file, I found this:</p> <pre><code>TargetFramework = "3.0" </code></pre> <p>Changing that to "3.5" solved it. Thanks, guys!</p>
[ { "answer_id": 95716, "author": "Nikki9696", "author_id": 456669, "author_profile": "https://Stackoverflow.com/users/456669", "pm_score": -1, "selected": false, "text": "public abstract string LogPath { get; private set; }\npublic abstract string ErrorMsg { get; private set; }\n" }, ...
2008/09/18
[ "https://Stackoverflow.com/questions/95683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13348/" ]
95,700
<p>I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look at and play with the source of a <em>VERY</em> simple multi-threaded application for VS 2008?</p> <p>Thanks!</p>
[ { "answer_id": 95721, "author": "nathaniel", "author_id": 11947, "author_profile": "https://Stackoverflow.com/users/11947", "pm_score": 2, "selected": false, "text": "Dim t As Thread\nt = New Thread(AddressOf Me.BackgroundProcess)\nt.Start()\n\nPrivate Sub BackgroundProcess()\n Dim i A...
2008/09/18
[ "https://Stackoverflow.com/questions/95700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14728/" ]
95,715
<p>What causes Firefox to follow a POST request with a GET request when submitting a form via the POST method? The GET method is sent to the same url as the POST method but without the request parameters.</p> <p>If you change the form method to GET, it will result in two identical GET requests.</p>
[ { "answer_id": 95762, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<img src=\"\"/>" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,727
<p>Let's say we have <code>0.33</code>, we need to output <code>1/3</code>. <br /> If we have <code>0.4</code>, we need to output <code>2/5</code>.</p> <p>The idea is to make it human-readable to make the user understand "<strong>x parts out of y</strong>" as a better way of understanding data.</p> <p>I know that percentages is a good substitute but I was wondering if there was a simple way to do this?</p>
[ { "answer_id": 95778, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 4, "selected": false, "text": "3.141592 * 1000000 = 3141592\n" }, { "answer_id": 95785, "author": "devinmoore", "author_id": 15950, "aut...
2008/09/18
[ "https://Stackoverflow.com/questions/95727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4869/" ]
95,731
<p>Ran into this problem today, posting in case someone else has the same issue.</p> <pre><code>var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value", "Execute"); execBtn.setAttribute("onclick", "runCommand();"); </code></pre> <p>Turns out to get IE to run an onclick on a dynamically generated element, we can't use setAttribute. Instead, we need to set the onclick property on the object with an anonymous function wrapping the code we want to run.</p> <pre><code>execBtn.onclick = function() { runCommand() }; </code></pre> <p><strong>BAD IDEAS:</strong></p> <p>You can do </p> <pre><code>execBtn.setAttribute("onclick", function() { runCommand() }); </code></pre> <p>but it will break in IE in non-standards mode according to @scunliffe.</p> <p>You can't do this at all </p> <pre><code>execBtn.setAttribute("onclick", runCommand() ); </code></pre> <p>because it executes immediately, and sets the result of runCommand() to be the onClick attribute value, nor can you do</p> <pre><code>execBtn.setAttribute("onclick", runCommand); </code></pre>
[ { "answer_id": 96018, "author": "kch", "author_id": 13989, "author_profile": "https://Stackoverflow.com/users/13989", "pm_score": 1, "selected": false, "text": "<div class=''>" }, { "answer_id": 561099, "author": "Shaike Katz", "author_id": 36899, "author_profile": "h...
2008/09/18
[ "https://Stackoverflow.com/questions/95731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13289/" ]
95,760
<p>In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies is for a given m-file. Is there a built-in/freely downloadable way to do this?</p> <p>Specifically I am interested in solutions for MATLAB 7.4.0 (R2007a), but if there is a different way to do it in older versions, by all means please add them here. </p>
[ { "answer_id": 97072, "author": "Azim J", "author_id": 4612, "author_profile": "https://Stackoverflow.com/users/4612", "pm_score": 6, "selected": true, "text": ">> profile on % turn profiling on\n>> foo; % entry point to your matlab function or script\n>> profile off % turn pr...
2008/09/18
[ "https://Stackoverflow.com/questions/95760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17231/" ]
95,767
<p>We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.</p>
[ { "answer_id": 97176, "author": "shemnon", "author_id": 8020, "author_profile": "https://Stackoverflow.com/users/8020", "pm_score": 4, "selected": true, "text": "class AWTExceptionHandler {\n\n public void handle(Throwable t) {\n try {\n // insert your exception handling code he...
2008/09/18
[ "https://Stackoverflow.com/questions/95767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18117/" ]
95,820
<p>Let's say I have an array, and I know I'm going to be doing a lot of "Does the array contain X?" checks. The efficient way to do this is to turn that array into a hash, where the keys are the array's elements, and then you can just say <pre>if($hash{X}) { ... }</pre></p> <p>Is there an easy way to do this array-to-hash conversion? Ideally, it should be versatile enough to take an anonymous array and return an anonymous hash.</p>
[ { "answer_id": 95826, "author": "raldi", "author_id": 7598, "author_profile": "https://Stackoverflow.com/users/7598", "pm_score": 8, "selected": true, "text": "%hash = map { $_ => 1 } @array;\n" }, { "answer_id": 95888, "author": "skiphoppy", "author_id": 18103, "auth...
2008/09/18
[ "https://Stackoverflow.com/questions/95820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
95,821
<p>I have been playing with Haml recently and really like the way the resulting code looks to me...the developer. I'm also not too worried about a designer being able to consume or change it...we're a small team. </p> <p>That said, beginning work on a project we believe will generate quite a bit of traffic (who doesn't?). I'm concerned that there are things I just don't know about haml. Is there anything erb can do that haml can't? Does haml have a negative effect as a project grows? Are there other things that should be considered?</p> <p>And finally...how does Haml compare speedwise to erubis? I see that it supposedly beats erb and eruby now...</p> <p>Thanks!</p>
[ { "answer_id": 98591, "author": "outcassed", "author_id": 18424, "author_profile": "https://Stackoverflow.com/users/18424", "pm_score": 6, "selected": false, "text": "Haml::Template::options[:ugly] = true" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/95821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,824
<p>I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this:</p> <pre><code>\replace{File,New} </code></pre> <p>and that would generate something like</p> <pre><code>\textbf{File}$\rightarrow$\textbf{New} </code></pre> <p>This is a simple example, but I'd like to be able to put formatting/structure in a single command rather than everywhere in the document. I know that I could build several commands that take increasing numbers of parameters, but I'm hoping that there is an easier way. </p> <p><strong>Edit for clarification</strong></p> <p>I'm looking for an equivalent of </p> <pre><code>string.replace(",", "$\rightarrow$) </code></pre> <p>something that can take an arbitrary string, and replace a substring with another substring.</p> <p>So I could call the command with \replace{File}, \replace{File,New}, \replace{File,Options,User}, etc., wrap the words with bold formatting, and replace any commas with the right arrow command. Even if the "wrapping with bold" bit is too difficult (as I think it might be), just the replace part would be helpful.</p>
[ { "answer_id": 95959, "author": "Brent.Longborough", "author_id": 9634, "author_profile": "https://Stackoverflow.com/users/9634", "pm_score": -1, "selected": false, "text": "\\newcommand{\\replace}[2]{\\textbf{#1}$\\rightarrow$\\textbf{#2}} \n\\replace{File}{New} \n" }, { "answ...
2008/09/18
[ "https://Stackoverflow.com/questions/95824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1322/" ]
95,834
<p>I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM.</p> <p>I'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(). However, if my Workflow fails, the Dispose() method isn't being called and the Word or Excel handles stay open and my application hangs.</p> <p>The solution to this problem is pretty straightforward, but rather than just solve it, I'd like to learn something and gain insight into the right way to work with COM. I'm looking for the "best" or most efficient and safest way to handle the lifecycle of the classes that own the COM handles. Patterns, best practices, or sample code would be helpful.</p>
[ { "answer_id": 96672, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 2, "selected": true, "text": " class Program\n {\n static void Main(string[] args)\n {\n using(WorkflowRuntime workflowRuntime ...
2008/09/18
[ "https://Stackoverflow.com/questions/95834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7565/" ]
95,842
<p>The name of a temporary table such as #t1 can be determined using </p> <pre><code>select @TableName = [Name] from tempdb.sys.tables where [Object_ID] = object_id('tempDB.dbo.#t1') </code></pre> <p>How can I find the name of a table valued variable, i.e. one declared by</p> <pre><code>declare @t2 as table (a int) </code></pre> <p>the purpose is to be able to get meta-information about the table, using something like</p> <pre><code>select @Headers = dbo.Concatenate('[' + c.[Name] + ']') from sys.all_columns c inner join sys.tables t on c.object_id = t.object_id where t.name = @TableName </code></pre> <p>although for temp tables you have to look in <code>tempdb.sys.tables</code> instead of <code>sys.tables</code>. where do you look for table valued variables?</p> <hr> <p>I realize now that I can't do what I wanted to do, which is write a generic function for formatting table valued variables into html tables. For starters, in sql server 2005 you can't pass table valued parameters:</p> <p><a href="http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters" rel="nofollow noreferrer">http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters</a></p> <p>moreover, in sql server 2008, the parameters have to be strongly typed, so you will always know the number and type of columns.</p>
[ { "answer_id": 215844, "author": "6eorge Jetson", "author_id": 23422, "author_profile": "https://Stackoverflow.com/users/23422", "pm_score": -1, "selected": false, "text": "CREATE FUNCTION [dbo].[udtShredXmlInputBondIdList] \n( \n-- Add the parameters for the function here\n@xmlInputBon...
2008/09/18
[ "https://Stackoverflow.com/questions/95842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18116/" ]
95,850
<p>I'm looking for the total <a href="http://en.wikipedia.org/wiki/Commit_charge" rel="nofollow noreferrer">commit charge</a>.</p>
[ { "answer_id": 96094, "author": "JustinD", "author_id": 12063, "author_profile": "https://Stackoverflow.com/users/12063", "pm_score": 1, "selected": false, "text": "strComputer = \".\"\n\nSet objSWbemServices = GetObject(\"winmgmts:\\\\\" & strComputer)\nSet colSWbemObjectSet = _\n objSW...
2008/09/18
[ "https://Stackoverflow.com/questions/95850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
95,858
<p>I have a web application that is dynamically loading PDF files for viewing in the browser. Currently, it uses "innerHTML" to replace a div with the PDF Object. This works.</p> <p>But, is there a better way to get the ID of the element and set the "src" or "data" parameter for the Object / Embed and have it instantly load up a new document? I'm hoping the instance of Adobe Acrobat Reader will stay on the screen, but the new document will load into it.</p> <p>Here is a JavaScript example of the object:</p> <pre><code>document.getElementById(`divPDF`).innerHTML = `&lt;OBJECT id='objPDF' DATA="'+strFilename+'" TYPE="application/pdf" TITLE="IMAGING" WIDTH="100%" HEIGHT="100%"&gt;&lt;/object&gt;`; </code></pre> <p>Any insight is appreciated.</p>
[ { "answer_id": 96296, "author": "Lark", "author_id": 8804, "author_profile": "https://Stackoverflow.com/users/8804", "pm_score": 1, "selected": false, "text": "$(\"objPDF\").attr({\n data: \"dir/to/newPDF\"\n});\n" }, { "answer_id": 97306, "author": "Shinhan", "author_...
2008/09/18
[ "https://Stackoverflow.com/questions/95858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,866
<p>I have a simple table comments <code>(id INT, revision INT, comment VARCHAR(140))</code> with some content like this:</p> <pre><code>1|1|hallo1| 1|2|hallo2| 1|3|hallo3| 2|1|hallo1| 2|2|hallo2| </code></pre> <p>I'm searching for an SQL statement which will return each comment with the highest revision:</p> <pre><code>1|3|hallo3| 2|2|hallo2| </code></pre> <p>I've come up with this solution:</p> <pre><code>select id, revision, comment from comments where revision = ( select max(revision) from comments as f where f.id = comments.id ); </code></pre> <p>but it is very slow on large data sets. Are there any better queries to accomplish this?</p>
[ { "answer_id": 95914, "author": "nathaniel", "author_id": 11947, "author_profile": "https://Stackoverflow.com/users/11947", "pm_score": 3, "selected": false, "text": "SELECT c.* \n FROM comments c\n INNER JOIN (\n SELECT id,max(revision) AS maxrev \n FROM comments \n ...
2008/09/18
[ "https://Stackoverflow.com/questions/95866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
95,875
<p>How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following?</p> <pre><code>if (!isObjectLoaded(someVar)) { someVar= loadObject(); } </code></pre>
[ { "answer_id": 95898, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": 1, "selected": false, "text": "typeof(obj)" }, { "answer_id": 95901, "author": "Tom Ritter", "author_id": 8435, "author_profile": "h...
2008/09/18
[ "https://Stackoverflow.com/questions/95875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]