qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
298,782
<p>I have the following Python code: </p> <pre><code>import xml.dom.minidom import xml.parsers.expat try: domTree = ml.dom.minidom.parse(myXMLFileName) except xml.parsers.expat.ExpatError, e: return e.args[0] </code></pre> <p>which I am using to parse an XML file. Although it quite happily spots simple XML errors like mismatched tags, it completely ignores the DTD specified at the top of the XML file: </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt; &lt;!DOCTYPE ServerConfig SYSTEM "ServerConfig.dtd"&gt; </code></pre> <p>so it doesn't notice when mandatory elements are missing, for example. How can I switch on DTD checking?</p>
[ { "answer_id": 299278, "author": "Charles Anderson", "author_id": 11677, "author_profile": "https://Stackoverflow.com/users/11677", "pm_score": 2, "selected": false, "text": "from lxml import etree\n\ntry:\n parser = etree.XMLParser(dtd_validation=True)\n domTree = etree.parse(myXM...
2008/11/18
[ "https://Stackoverflow.com/questions/298782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11677/" ]
298,786
<p>I have a header </p> <pre><code>&lt;h1&gt;My Header&lt;/h1&gt; </code></pre> <p>It has a height of <code>150px</code> and a <code>font-size</code> of say <code>1.3em;</code> How can I make the header text vertically centered with CSS. I would rather not wrap it in a container DIV (wrapping divs really defeat the whole CSS idea).</p>
[ { "answer_id": 299278, "author": "Charles Anderson", "author_id": 11677, "author_profile": "https://Stackoverflow.com/users/11677", "pm_score": 2, "selected": false, "text": "from lxml import etree\n\ntry:\n parser = etree.XMLParser(dtd_validation=True)\n domTree = etree.parse(myXM...
2008/11/18
[ "https://Stackoverflow.com/questions/298786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
298,788
<p>Since Terminal appeared I've saved as ~/mySrvr.term a modified stock .term file which opens to execute an ssh to a remote server and to modify the appearance. I have NOT been able to save "use option key as meta" for emacs-ery; there's no slot for it in the term file and I'm reluctant to wrestle with a keyboard dictionary file. Am I missing something simple? How do I get option-as-meta to stick between sessions?</p> <p>Thanks</p>
[ { "answer_id": 298891, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 0, "selected": false, "text": "<key>useOptionAsMetaKey</key>\n<true/>\n" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/298788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
298,791
<p>I have an IIS located on serverA</p> <p>I have userA at locationA who has opened a content management system site, hosted on serverA.</p> <p>One of the features of the system is that it allows the user to move a file to LocationB, all within the same network. Now when this move occurs and due to bandwidth restrictions, would this file move from LocationA to serverA to LocationB or is there a way for me to move the file from LocationA to LocationB without going through serverA, i.e using local memory on serverA</p> <p>I am not using BITS at the moment.</p>
[ { "answer_id": 298822, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 0, "selected": false, "text": "scp" }, { "answer_id": 299297, "author": "Ian Oxley", "author_id": 1904, "author_profile": "https://Stack...
2008/11/18
[ "https://Stackoverflow.com/questions/298791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38230/" ]
298,799
<p>Somebody <strong>please</strong> tell me it is possible to recover Visual Studio source after VS crashes!</p> <p>I have just spent 5 hours writing a new utility app, and running it with the "Save before Build" option turned on, as well as AutoRecover every 5-mins. But after VS crashed I am unabled to find anything other than an empty project folder!!! I can't believe that files are only "saved" to memory?!? That can't be right! That 5 hours of work has to be <strong>somewhere</strong> on the disk?</p> <p>I attempted to reproduce the scenario by creating a Junk project, running it, and then killing VS using Task Manager. It wasn't quite the same situation as a dialog box actually popped up asking to save the project. I ignored this and continued the kill. I was then able to find the Junk source in C:\Users{Username}\AppData\Local\Temporary Projects as advised - but not my earlier project.</p> <p>I think it's gone.</p>
[ { "answer_id": 298817, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 2, "selected": false, "text": "C:\\Users\\{Username}\\AppData\\Local\\Temporary Projects\n" }, { "answer_id": 677265, "author": "Klas Mell...
2008/11/18
[ "https://Stackoverflow.com/questions/298799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1885/" ]
298,812
<p>I have two Tables.</p> <p>Order - With Columns OrderID, OrderStatusID<br /> OrderStatus - With Columns OrderStatusID, Description</p> <p>I have an Order Object which calls to the database and fills its properties for use in my code. Right now I have access to Order.OrderStatusID, but in my application I really need access to the "Description" field.</p> <p>How do you handle this elegantly with good OO design?</p>
[ { "answer_id": 298845, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 0, "selected": false, "text": "Select O.OrderId, O.OrderStatusId, S.Descriptiuon\nFrom Order O\n Join OrderStatus S \n On S.OrderStatus...
2008/11/18
[ "https://Stackoverflow.com/questions/298812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37347/" ]
298,830
<p>I have a single string that contains the command-line parameters to be passed to another executable and I need to extract the string[] containing the individual parameters in the same way that C# would if the commands had been specified on the command-line. The string[] will be used when executing another assemblies entry-point via reflection.</p> <p>Is there a standard function for this? Or is there a preferred method (regex?) for splitting the parameters correctly? It must handle '"' delimited strings that may contain spaces correctly, so I can't just split on ' '.</p> <p>Example string:</p> <pre><code>string parameterString = @"/src:""C:\tmp\Some Folder\Sub Folder"" /users:""abcdefg@hijkl.com"" tasks:""SomeTask,Some Other Task"" -someParam foo"; </code></pre> <p>Example result:</p> <pre><code>string[] parameterArray = new string[] { @"/src:C:\tmp\Some Folder\Sub Folder", @"/users:abcdefg@hijkl.com", @"tasks:SomeTask,Some Other Task", @"-someParam", @"foo" }; </code></pre> <p>I do not need a command-line parsing library, just a way to get the String[] that should be generated.</p> <p><strong>Update</strong>: I had to change the expected result to match what is actually generated by C# (removed the extra "'s in the split strings)</p>
[ { "answer_id": 298838, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": -1, "selected": false, "text": "Split()" }, { "answer_id": 298852, "author": "Israr Khan", "author_id": 37280, "author_profil...
2008/11/18
[ "https://Stackoverflow.com/questions/298830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341413/" ]
298,840
<p>I have a .NET Web app which consumes a Java-based Web service. One of the objects, named Optional, contains search criteria fields. The schema is the following:</p> <pre><code>&lt;xsd:complexType name="Optional"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="FromAmount" nillable="true" type="xsd:float" minOccurs="0" /&gt; &lt;xsd:element name="ToAmount" nillable="true" type="xsd:float" minOccurs="0" /&gt; &lt;xsd:element name="FromDate" nillable="true" type="xsd:dateTime" minOccurs="0" /&gt; &lt;xsd:element name="ToDate" nillable="true" type="xsd:dateTime" minOccurs="0" /&gt; &lt;xsd:element name="FromCheckNumber" nillable="true" type="xsd:long" minOccurs="0" /&gt; &lt;xsd:element name="ToCheckNumber" nillable="true" type="xsd:long" minOccurs="0" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; </code></pre> <p>The problem that I am running into is that the child elements will not serialize even when a value is assigned to them in the Web app. If I remove the minOccurs attribute, then all is well.</p> <p>How do I get these elements to be optional, but to serialize when a value is assigned to them?</p> <p>Thanks in advance for your help.</p>
[ { "answer_id": 300992, "author": "Dimitre Novatchev", "author_id": 36305, "author_profile": "https://Stackoverflow.com/users/36305", "pm_score": 0, "selected": false, "text": "<Optional/>" }, { "answer_id": 324517, "author": "superfell", "author_id": 41455, "author_pr...
2008/11/18
[ "https://Stackoverflow.com/questions/298840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15883/" ]
298,841
<p>Is there a way to read the properties inside an <a href="https://en.wikipedia.org/wiki/Windows_Installer" rel="nofollow noreferrer">MSI</a> file?</p> <p>For example, given a MSI file named <em>Testpackage.msi</em>, I need to find</p> <pre><code>productName PackageCode version </code></pre> <p>This I am going to use it with WMI uninstall</p> <pre><code>string objPath = string.Format(&quot;Win32_Product.IdentifyingNumber='{0}', Name='{1}', Version='{2}'&quot;, &quot;{AC9C1263-2BA8-4863-BE18-01232375CE42}&quot;, &quot;testproduct&quot;, &quot;10.0.0.0&quot;); </code></pre> <p>Using <a href="http://msdn.microsoft.com/en-us/library/aa370557(v=vs.85).aspx" rel="nofollow noreferrer">Orca</a> is a great option, if this can be achieved programmatically. Then I can use this to generate automatic release notes. And in un-installing program too.</p>
[ { "answer_id": 328710, "author": "Arnout", "author_id": 3496, "author_profile": "https://Stackoverflow.com/users/3496", "pm_score": 4, "selected": true, "text": "Function GetVersion(ByVal msiName)\n\n Const msiOpenDatabaseModeReadOnly = 0\n Dim msi, db, view\n\n Set msi = Create...
2008/11/18
[ "https://Stackoverflow.com/questions/298841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32670/" ]
298,850
<p>I have a 5 ASPX page <code>wizard</code>. Each one contains a <code>SaveAndExit</code> button that executes a C# function on a common static class. After saving, the C# code redirects to another page.</p> <p>Is there a way for running <code>javascript: alert('Data Saved');</code> after the saving, and before new page is Loaded.</p>
[ { "answer_id": 299456, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "if" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/298850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
298,867
<p>How do I export all of the names and email addresses from a distribution list in Outlook using code? I have access to an Outlook 2000 or Outlook 2007 client. Ideally I would like the code to be in C#.</p>
[ { "answer_id": 299034, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 1, "selected": false, "text": "Const olFolderContacts = 10\n\nSet objOutlook = CreateObject(\"Outlook.Application\")\nSet objNamespace = objOutlook.GetNa...
2008/11/18
[ "https://Stackoverflow.com/questions/298867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/636/" ]
298,873
<p>I'm wondering what good ways there would be make assertions about synchronization or something so that I could detect synchronization violations (while testing).</p> <p>That would be used for example for the case that I'd have a class that is not thread-safe and that isn't going to be thread-safe. With some way I would have some assertion that would inform me (log or something) if some method(s) of it was called from multiple threads.</p> <p>I'm longing for something similar that could be made for AWT dispatch thread with the following:</p> <pre><code>public static void checkDispatchThread() { if(!SwingUtilities.isEventDispatchThread()) { throw new RuntimeException("GUI change made outside AWT dispatch thread"); } } </code></pre> <p>I'd only want something more general. The problem description isn't so clear but I hope somebody has some good approaches =)</p>
[ { "answer_id": 299197, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 1, "selected": false, "text": "class Foo {\n\n private final Thread owner = Thread.currentThread();\n\n void x() {\n assert Thread.currentThread() ==...
2008/11/18
[ "https://Stackoverflow.com/questions/298873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28482/" ]
298,886
<p>Does .NET have a way to pull email from a POP3 server out of the box or you have to code/buy a 3rd party component?</p>
[ { "answer_id": 669697, "author": "Pawel Lesnikowski", "author_id": 80894, "author_profile": "https://Stackoverflow.com/users/80894", "pm_score": 2, "selected": false, "text": "using(Pop3 pop3 = new Pop3())\n{\n pop3.Connect(\"mail.host.com\"); // Connect to server\n pop3.Login...
2008/11/18
[ "https://Stackoverflow.com/questions/298886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
298,897
<p>I've been putting together a small web form for our technicians to use from their phones out in the field. However I'm having a lot of trouble getting things working using ASP.NET Mobile, and there seems to be few resources out there to help learn this stuff. I'm also having trouble <a href="https://stackoverflow.com/questions/291638/how-do-you-get-the-value-of-a-bound-mobilelistitem" title="Getting Help">getting help</a>. </p> <p>So the thing is, do I really need to use the mobile controls? The phones will all have web browsers, so I'm thinking if I'm careful with the interface I can get as good or better results than using the mobile controls. </p> <p>The only thing I would like from the mobile controls is the PhoneCall control... so the follow up question would be: Can I get the functionality of the PhoneCall control without using it?</p>
[ { "answer_id": 299244, "author": "fravelgue", "author_id": 22055, "author_profile": "https://Stackoverflow.com/users/22055", "pm_score": 0, "selected": false, "text": "<a ref=\"wtai://wp/mc;34123456789\">Call</a>" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/298897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17145/" ]
298,909
<p>I'm wondering why the <code>assert</code> keyword is so underused in Java? I've almost never seen them used, but I think they're a great idea. I certainly much prefer the brevity of:</p> <pre><code>assert param != null : "Param cannot be null"; </code></pre> <p>to the verbosity of:</p> <pre><code>if (param == null) { throw new IllegalArgumentException("Param cannot be null"); } </code></pre> <p>My suspicion is that they're underused because</p> <ul> <li>They arrived relatively late (Java 1.4), by which time many people had already established their Java programming style/habit</li> <li>They are turned off at runtime by default</li> </ul>
[ { "answer_id": 298929, "author": "Denis R.", "author_id": 32015, "author_profile": "https://Stackoverflow.com/users/32015", "pm_score": 0, "selected": false, "text": "if" }, { "answer_id": 298973, "author": "Adam Jaskiewicz", "author_id": 35322, "author_profile": "htt...
2008/11/18
[ "https://Stackoverflow.com/questions/298909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
298,926
<p>In vb.net / winforms, how can a hashtable be bound to a drop down list or any other datasource-driven control?</p>
[ { "answer_id": 298935, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 2, "selected": false, "text": " DropDownList dd = new DropDownList();\n Hashtable mycountries = New Hashtable();\n mycountries.Add(\"N\",\"...
2008/11/18
[ "https://Stackoverflow.com/questions/298926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3259/" ]
298,962
<p>Clearly separation of concerns is a desirable trait in our code and the first obvious step most people take is to separate data access from presentation. In my situation, LINQ To SQL is being used within data access objects for the data access.</p> <p>My question is, where should the use of the entity object stop? To clarify, I could pass the entity objects up to the domain layer but I feel as though an entity object is more than just a data object - it's like passing a bit of the DAL up to the next layer too.</p> <p>Let's say I have a UserDAL class, should it expose an entity User object to the domain when a method GetByID() is called, or should it spit out a plain data object purely for storing the data and nothing more? (seems like wasteful duplication in this case)</p> <p>What have you guys done in this same situation? Is there an alternative method to this?</p> <p>Hope that wasn't too vague.</p> <p>Thanks a lot,</p> <p>Martin.</p>
[ { "answer_id": 299008, "author": "Codewerks", "author_id": 17729, "author_profile": "https://Stackoverflow.com/users/17729", "pm_score": 3, "selected": false, "text": " IQueryable<MyObjects.Product> products = from p in linqDataContext.Products \n ...
2008/11/18
[ "https://Stackoverflow.com/questions/298962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
298,972
<p>I am using a query like this on my postgres database:</p> <pre><code>SELECT TableA.id FROM TableA , TableB WHERE TableA.id = 100; </code></pre> <p>Each TableA.id is unique (it's an autoincrement), I am getting more than 1 result. Am I missing something in here?</p>
[ { "answer_id": 298983, "author": "Ben McEvoy", "author_id": 15234, "author_profile": "https://Stackoverflow.com/users/15234", "pm_score": 3, "selected": false, "text": "SELECT TableA.ID from TableA\nINNER JOIN TableB \nON TableB.TableAID = TableA.ID \nWHERE TableA.ID = 100\n" }, { ...
2008/11/18
[ "https://Stackoverflow.com/questions/298972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2220518/" ]
298,976
<p>Seeing as C# can't <code>switch</code> on a Type (which I gather wasn't added as a special case because <code>is</code> relationships mean that more than one distinct <code>case</code> might apply), is there a better way to simulate switching on type other than this?</p> <pre><code>void Foo(object o) { if (o is A) { ((A)o).Hop(); } else if (o is B) { ((B)o).Skip(); } else { throw new ArgumentException("Unexpected type: " + o.GetType()); } } </code></pre>
[ { "answer_id": 298994, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": false, "text": "Type" }, { "answer_id": 299001, "author": "Zachary Yates", "author_id": 8360, "author_profile": "htt...
2008/11/18
[ "https://Stackoverflow.com/questions/298976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82/" ]
298,981
<p>I'm trying to have an XSLT that copies most of the tags but removes empty "<code>&lt;b/&gt;</code>" tags. That is, it should copy as-is "<code>&lt;b&gt; &lt;/b&gt;</code>" or "<code>&lt;b&gt;toto&lt;/b&gt;</code>" but completely remove "<code>&lt;b/&gt;</code>".</p> <p>I think the template would look like :</p> <pre><code>&lt;xsl:template match="b"&gt; &lt;xsl:if test=".hasChildren()"&gt; &lt;xsl:element name="b"&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:element&gt; &lt;/xsl:if&gt; &lt;/xsl:template&gt; </code></pre> <p>But of course, the "<code>hasChildren()</code>" part doesn't exist ... Any idea ?</p>
[ { "answer_id": 298997, "author": "Darren Steinweg", "author_id": 418, "author_profile": "https://Stackoverflow.com/users/418", "pm_score": 3, "selected": true, "text": "<xsl:template match=\"b\">\n <xsl:if test=\"b/text()\">\n ...\n" }, { "answer_id": 299031, "author": "G...
2008/11/18
[ "https://Stackoverflow.com/questions/298981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23704/" ]
299,002
<p>Is there anybody who has successfully accessed a Web service from an Oracle stored procedure? If so, was it a Java stored procedure? A PL/SQL stored procedure?</p> <p>Is there any reason why I should not be trying to access a WS from a stored proc?</p> <p>Here are a couple refs that I found so far</p> <ul> <li><a href="http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/chtwelve.htm#CBBEFCHI" rel="noreferrer">Database Web Services</a></li> <li><a href="http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html" rel="noreferrer">Calling external Web Service from a Java Stored Procedure</a></li> </ul> <p><em>..Just to clarify, this is for SOAP calls</em></p>
[ { "answer_id": 430042, "author": "kurosch", "author_id": 30153, "author_profile": "https://Stackoverflow.com/users/30153", "pm_score": 3, "selected": false, "text": "FUNCTION post\n(\n p_url IN VARCHAR2,\n p_data IN CLOB,\n p_timeout IN BINARY_INTEGER DEFAULT 60\n) \n ...
2008/11/18
[ "https://Stackoverflow.com/questions/299002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25502/" ]
299,011
<p>I am getting a lot of errors when starting RAD7. The server doesn't respond to class changes. Sometimes the server won't start. Sometimes RAD will not acknowledge modules that I added to the server. It is kind of buggy.</p> <p>I know there is metadata in the workspace, are there safe ways to clean the metadata or RAD in general?</p> <p>Where RAD = Rational Application Developer</p>
[ { "answer_id": 324672, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 1, "selected": false, "text": ".metadata" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10522/" ]
299,027
<p>I'm not sure what this practice is actually called, so perhaps someone can edit the title to more accurately reflect my question.</p> <p>Let's say we have a site that stores objects of different types. Each type of object has its own database (a database of books and assorted information with its tables, a database of CDs and information with its tables, and so on). However, all of the objects have keywords and the keywords should be uniform across all objects, regardless of type. A new database with a few tables is made to store keywords, however each object database is responsible for mapping the object ID to a keyword.</p> <p>Is that a good practice?</p>
[ { "answer_id": 299069, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 4, "selected": true, "text": "GENERIC_OBJECT" }, { "answer_id": 299085, "author": "BradC", "author_id": 21398, "author_profile": "https:...
2008/11/18
[ "https://Stackoverflow.com/questions/299027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
299,068
<p>Question: Is exception handling in Java actually slow?</p> <p>Conventional wisdom, as well as a lot of Google results, says that exceptional logic shouldn't be used for normal program flow in Java. Two reasons are usually given,</p> <ol> <li>it is really slow - even an order of magnitude slower than regular code (the reasons given vary), </li> </ol> <p>and </p> <ol start="2"> <li>it is messy because people expect only errors to be handled in exceptional code. </li> </ol> <p>This question is about #1.</p> <p>As an example, <a href="http://leepoint.net/notes-java/flow/exceptions/03exceptions.html" rel="noreferrer">this page</a> describes Java exception handling as "very slow" and relates the slowness to the creation of the exception message string - "this string is then used in creating the exception object that is thrown. This is not fast." The article <a href="http://adtmag.com/articles/2000/08/22/effective-exception-handling-in-java.aspx" rel="noreferrer">Effective Exception Handling in Java</a> says that "the reason for this is due to the object creation aspect of exception handling, which thereby makes throwing exceptions inherently slow". Another reason out there is that the stack trace generation is what slows it down.</p> <p>My testing (using Java 1.6.0_07, Java HotSpot 10.0, on 32 bit Linux), indicates that exception handling is no slower than regular code. I tried running a method in a loop that executes some code. At the end of the method, I use a boolean to indicate whether to <em>return</em> or <em>throw</em>. This way the actual processing is the same. I tried running the methods in different orders and averaging my test times, thinking it may have been the JVM warming up. In all my tests, the throw was at least as fast as the return, if not faster (up to 3.1% faster). I am completely open to the possibility that my tests were wrong, but I haven't seen anything out there in the way of the code sample, test comparisons, or results in the last year or two that show exception handling in Java to actually be slow.</p> <p>What leads me down this path was an API I needed to use that threw exceptions as part of normal control logic. I wanted to correct them in their usage, but now I may not be able to. Will I instead have to praise them on their forward thinking?</p> <p>In the paper <a href="http://portal.acm.org/citation.cfm?id=337453" rel="noreferrer">Efficient Java exception handling in just-in-time compilation</a>, the authors suggest that the presence of exception handlers alone, even if no exceptions are thrown, is enough to prevent the JIT compiler from optimizing the code properly, thus slowing it down. I haven't tested this theory yet.</p>
[ { "answer_id": 299214, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 2, "selected": false, "text": "fillInStackTrace" }, { "answer_id": 299315, "author": "Mecki", "author_id": 15809, "author...
2008/11/18
[ "https://Stackoverflow.com/questions/299068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69572/" ]
299,080
<p>I want to create a trace on a database server from my C# app, like what you do in SQL Server Profiler. I have found stored procedures (sys.sp_trace_create etc...) that dont seem to work for my SQL management studio. I was wondering if anyone could help with the coding, or where i would start to do this?!</p>
[ { "answer_id": 13794798, "author": "brian beuning", "author_id": 1862101, "author_profile": "https://Stackoverflow.com/users/1862101", "pm_score": 2, "selected": false, "text": "public void FileToTable()\n{\n TraceServer reader = new TraceServer();\n\n ConnectionInfoBase ci = new S...
2008/11/18
[ "https://Stackoverflow.com/questions/299080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36243/" ]
299,086
<p>I'm working with a WinForm app in C#, after I type something in a textbox I want to hit the Enter key but the textbox still has focus (flashing cursor is still in textbox), how can I achieve this?</p>
[ { "answer_id": 299093, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": false, "text": " TextBox tb = new TextBox();\n Button btn = new Button { Dock = DockStyle.Bottom };\n btn.Click += delegate ...
2008/11/18
[ "https://Stackoverflow.com/questions/299086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,094
<p>i want the result of an equation rounded to the nearest integer. e.g. </p> <pre><code>137 * (3/4) = 103 </code></pre> <p>Consider the following incorrect code. </p> <pre><code>int width1 = 4; int height1 = 3; int width2 = 137; int height2 = width2 * (height1 / width1); </code></pre> <p>What is the proper way to perform "integer" math in C#?</p> <p>Do i really have to do:</p> <pre><code>int height2 = (int)Math.Round( (float)width2 * ((float)height1 / (float)width1) ); </code></pre>
[ { "answer_id": 299102, "author": "Jeffrey L Whitledge", "author_id": 10174, "author_profile": "https://Stackoverflow.com/users/10174", "pm_score": 2, "selected": false, "text": "int height2 = (width2 * height1) / width1;\n" }, { "answer_id": 299143, "author": "Aaron", "au...
2008/11/18
[ "https://Stackoverflow.com/questions/299094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
299,095
<p>Is there a way to turn off the automatic selection of the first row in the built-in DataGrid in Silverlight?</p> <p>We build a lot of functionality based off the user selecting a row in a data grid. The automatic firing of SelectionChanged when databinding or sorting is really causing us issues. We have tried to put some guards around the selection, but can't seem get all problems covered.</p> <p>For example, if you have DataGrid in a tab of a TabControl that is not shown when loading the screen and the DataGrid has a binding to a property of the DataContext that is a list of objects. The grid is not databound until the tab is shown. Is there an event telling us that the grid is databinding? Shouldn't the default behavior of databinding be not to select a row?</p> <p>Thanks Mike</p>
[ { "answer_id": 413410, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": " int LastSelectedIndex = -1;\n bool JustRefreshed = false;\n\n private void dataGrid_SelectionChanged(object sender, Se...
2008/11/18
[ "https://Stackoverflow.com/questions/299095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4231/" ]
299,097
<p>I'm currently monitoring a large network with Hobbit and have been tasked with lowering the amount of false (or at least irrelevant) alarms. At the top of my list are the tests "http" and "conn", initiated by bbtest-net. This command checks ping, ssh, etc, and if for instance a ping times out, it immediately sets the status to red. One minute later, the bbretest command kicks in, checks all the newly reddened hosts, and finds it to be green again. This happens <strong>all the time</strong>, and it clutters up my log. </p> <p>Is there any way for me to make Hobbit report a red status AFTER bbretest has been run the first time? </p>
[ { "answer_id": 438436, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<ip> <hostname> # noconn \n" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18673/" ]
299,106
<p>I have a following xslt code :</p> <pre><code>&lt;xsl:template match="table_terms_and_abbr"&gt; &lt;informaltable frame='none' colsep='none' rowsep='none'&gt; &lt;tgroup cols='2' align='left'&gt; &lt;colspec colnum="1" colwidth='1*'/&gt; &lt;colspec colnum="2" colwidth='1*'/&gt; &lt;xsl:apply-templates/&gt; &lt;/tgroup&gt; &lt;/informaltable&gt; &lt;/xsl:template&gt; </code></pre> <p>and the following xml that it's processing : </p> <pre><code>&lt;table_terms_and_abbr&gt; &lt;tblrow_hdr&gt;Name ,, Description&lt;/tblrow_hdr&gt; &lt;tbody&gt; &lt;tblrow_bold_first&gt; BOT ,, &amp;j_bot;&lt;/tblrow_bold_first&gt; ... &lt;/tbody&gt; &lt;/table_terms_and_abbr&gt; </code></pre> <p>Now i want to improve the xslt by moving following lines inside the <code>table_terms_and_abbr</code>:</p> <pre><code>&lt;tblrow_hdr&gt;Name ,, Description&lt;/tblrow_hdr&gt; &lt;tbody&gt; &lt;/tbody&gt; </code></pre> <p>So i will have something like : </p> <pre><code>&lt;xsl:template match="table_terms_and_abbr"&gt; &lt;informaltable frame='none' colsep='none' rowsep='none'&gt; &lt;tgroup cols='2' align='left'&gt; &lt;colspec colnum="1" colwidth='1*'/&gt; &lt;colspec colnum="2" colwidth='1*'/&gt; &lt;xsl:call-template name="tblrow_hdr"&gt; BOT ,, &amp;j_bot; * ???? * &lt;/xsl:call-template&gt; &lt;tbody&gt; &lt;xsl:apply-templates/&gt; &lt;/tbody&gt; &lt;/tgroup&gt; &lt;/informaltable&gt; &lt;/xsl:template&gt; </code></pre> <p>The line marked with * ???? * does not work. I using saxon9 (xslt 2.0 stylesheet) on linux platform and got this error: </p> <p><em>XTSE0010: No character data is allowed within xsl:call-template</em></p> <p>I know how to pass the attributes to the template i.e: </p> <pre><code>&lt;xsl:with-param name="is_make_first_bold" select = "1" as="xs:integer"/&gt; </code></pre> <p>but how to pass free text ? </p> <p>The idea is move to the template all static data and in xml only use variable data i.e </p> <pre><code>&lt;table_terms_and_abbr&gt; &lt;tblrow_bold_first&gt; BOT ,, &amp;j_bot;&lt;/tblrow_bold_first&gt; ... &lt;/table_terms_and_abbr&gt; </code></pre> <p><strong>More Info</strong><br> My requirement was to create a simplified syntax for defining repeatable tables for our DocBook documentation. For that i created a general named template <code>tblrow</code> that will split the line delimited by ",," to separate entities and will create a list of entries in the table row.<br> Each entry can be a simple string, an ENTITY or another template. Since the parameter numbers are undefined (the tables can have different number of cells) i can't use a standard parameters for the templates and used delimited string. If i want to have one of the table entries to contain a link to some place in the document i can't use the parameters again since i can't pass xref template as a parameter.<br> The main reason not to change the <code>tblrow</code> template is that it's working :) and it's kind of complex. It's took me ages to achieve this and I'm not completely understand how it's working :). </p> <p>Now on top of this i have a few variables that can control the displayed output like <code>tblrow_hdr</code> that will underline and bold the text in each entry. Since <code>tblrow_hdr</code> is common for all <code>table_terms_and_abbr</code> tables it just sounds logical to me not having this in xml rather put the call to the <code>tblrow_hdr</code> inside the <code>table_terms_and_abbr</code> template and here i stuck. </p>
[ { "answer_id": 299145, "author": "ddaa", "author_id": 11549, "author_profile": "https://Stackoverflow.com/users/11549", "pm_score": 2, "selected": false, "text": "<xsl:with-param name=\"is_make_first_bold\" select = \"1\" as=\"xs:integer\"/>\n" }, { "answer_id": 300698, "auth...
2008/11/18
[ "https://Stackoverflow.com/questions/299106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6807/" ]
299,117
<p>Everything I can find in linq for aggregation has a "group by" clause. How would I write this query in LINQ? I have a list of date-value pairs, and I want to take the average of the values:</p> <pre><code>SELECT AVG(MySuff.Value) AS AvgValue FROM MyStuff </code></pre>
[ { "answer_id": 299123, "author": "Alan", "author_id": 37843, "author_profile": "https://Stackoverflow.com/users/37843", "pm_score": 2, "selected": false, "text": "int count = (from a in myContext.MyStuff\n select a).Count();\n" }, { "answer_id": 299139, "author": "...
2008/11/18
[ "https://Stackoverflow.com/questions/299117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7311/" ]
299,128
<p>Is there an easy way to chase down table/stored procedure/function dependencies in SQL Server 2005+? I've inherited a giant application with lots of tables and even more stored procedures and functions that are long and interlinked. </p> <p>At the end of the day is there a way to build a dependency tree? Ideally what I'm looking for goes in both directions:</p> <p><strong>For a table/procedure - what depends ON it?</strong>: Show me all the stored procedures that eventually reference it (ideally in a tree view such that sub procedures nest out to the bigger procedures that call them)</p> <p><strong>For a procedure - what does IT depend on?</strong>: Show me all the procedures and tables that a given procedure will (or could) touch when running.</p> <p>It seems this tool shouldn't be that hard to make and would be incredibly useful for DB maintenance generally. Is anyone aware of such a thing? If this doesn't exist, why the heck not?</p> <p>The built-in functionality in Management Studio is nice but the information does not appear to be complete at all.</p>
[ { "answer_id": 299137, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "View Dependencies" }, { "answer_id": 538287, "author": "Jeremy S", "author_id": 65228, "author_pro...
2008/11/18
[ "https://Stackoverflow.com/questions/299128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8207/" ]
299,129
<p>im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using.</p> <pre><code>executorService.execute(new Runnable() { public void run() { System.out.println("Inside run ()method.."); } }); ANY IDEAS? </code></pre>
[ { "answer_id": 299177, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "executorService" }, { "answer_id": 299218, "author": "cdugga", "author_id": 24481, "author_profile": ...
2008/11/18
[ "https://Stackoverflow.com/questions/299129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24481/" ]
299,135
<p>Let's say I have <strong>a <code>List</code> object</strong> and <strong>an iterator</strong> for that list.</p> <p>Now I sort the list with <code>java.util.Collections.sort()</code></p> <ul> <li>What happens to the iterator? </li> <li>Is its behavior still defined and can it still be used? </li> <li>If not, can I prevent destroying the iterators for the list?</li> </ul> <p>I know, this problem could be circumvented by changing the program design, cloning the list for example, but I specificly want to know the "official" behavior of Java.</p>
[ { "answer_id": 299151, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "ListIterator" }, { "answer_id": 299169, "author": "Tom Hawtin - tackline", "author_id": 4725, "autho...
2008/11/18
[ "https://Stackoverflow.com/questions/299135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23368/" ]
299,142
<p>I've been reading up on branching/merging with Subversion 1.5 using the excellent and free <a href="http://svnbook.red-bean.com/" rel="noreferrer">Version Control with Subversion</a> book. I think that I understand how to use the Subversion command line client to perform the actions that I need most often, which are:</p> <p><strong>Update Branch with Changes from Trunk</strong></p> <p>From the branch's working directory run: </p> <blockquote> <p>svn merge <a href="http://svn.myurl.com/proj/trunk" rel="noreferrer">http://svn.myurl.com/proj/trunk</a></p> </blockquote> <p><strong>Merge Branch into Trunk</strong></p> <p>From the trunk's working directory run:</p> <blockquote> <p>svn merge --reintegrate <a href="http://svn.myurl.com/proj/branches/mybranch" rel="noreferrer">http://svn.myurl.com/proj/branches/mybranch</a></p> </blockquote> <p>However, we are using TortoiseSVN 1.5 as our interface to Subversion. I would like to know how best to perform these operations with TortoiseSVN. The new dialog provides three different options on the main menu. </p> <ol> <li>Merge a range of revisions</li> <li>Reintegrate a branch</li> <li>Merge two different trees</li> </ol> <p>From what I can gather, TortoiseSVN always executes svn with the following syntax.</p> <blockquote> <p>svn merge [--dry-run] --force From_URL@revN To_URL@revM PATH</p> </blockquote> <p>Additionally, reintegrate a branch often fails with a message stating that some targets have not been merged and so it cannot continue, and so I had to use option #3.</p> <p>My questions are:</p> <ol> <li>How do I use TortoiseSVN 1.5 to merge changes from the trunk to a branch?</li> <li>How do I use TortoiseSVN 1.5 to merge the branch to the trunk, with and without the reintegrate method?</li> <li>Which of the above options should I use for each, and why?</li> </ol> <hr> <p><strong>EDIT</strong></p> <p>Through "dry run" testing I have found that the command line Subversion operation</p> <blockquote> <p>svn merge <a href="http://svn.myurl.com/proj/trunk" rel="noreferrer">http://svn.myurl.com/proj/trunk</a></p> </blockquote> <p>is analogous to option #1 (Merge a Range of Revisions) in TortoiseSVN, as long as I leave the revision range blank.</p>
[ { "answer_id": 15658849, "author": "icc97", "author_id": 327074, "author_profile": "https://Stackoverflow.com/users/327074", "pm_score": 8, "selected": false, "text": "trunk -> branch" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19977/" ]
299,148
<p>I'm playing with <a href="http://www.dncompute.com/blog/2007/03/19/seed-based-pseudorandom-number-generator-in-actionscript.html" rel="nofollow noreferrer">this ActionScript</a> which generates a random 'squiggle'.</p> <p>Each time a 'squiggle' is placed, it appears within a sprite with a white background.</p> <p>If I change the background colour of the flash file to pink for example, it would still show up as white.</p> <p>Does anybody know how I might make the sprite background transparent? Thanks.</p>
[ { "answer_id": 299544, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 0, "selected": false, "text": "bitmapData.draw(paintSurface);\n" }, { "answer_id": 299552, "author": "Iain", "author_id": 11911, "aut...
2008/11/18
[ "https://Stackoverflow.com/questions/299148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25773/" ]
299,158
<p>What does the SQL Action keyword do? Can I use this keyword in a trigger and determine if the trigger was called by an Insert, Delete or Update?</p>
[ { "answer_id": 299187, "author": "Kevin Fairchild", "author_id": 3743, "author_profile": "https://Stackoverflow.com/users/3743", "pm_score": 1, "selected": false, "text": "If exists (select * from inserted) and exists (select * from deleted)\n --Update happened\nIf exists (select * fr...
2008/11/18
[ "https://Stackoverflow.com/questions/299158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38613/" ]
299,160
<p>Just started getting into jQuery and have an issue with a jQuery Post call working perfectly on my local dev box (VS 2008 built-in web server), but failing when I deploy to a windows 2003 server (IIS 6) box.</p> <p>The post works and the page being posted to process things correctly, but a response is never received by the calling Post function. The submitting page just reloads with no changes.</p> <p>Here is my Post function (it is enclosed in the <code>$(document).ready(function() {...</code></p> <p>The alert in the response function never fires:</p> <pre><code> $('.nextButton').click(function() { var idString = ''; $("div.dropZone &gt; div").each(function(n) { idString += this.id + '|'; }); $.post('CustomPostHandler.aspx?step=criteria', { selected: idString }, function(data) { alert(data); }); }); </code></pre> <p>The post handler page does receive the idString variable fine, after some processing it attempts to write back a response:</p> <pre><code> // Return dummy response to caller Response.Clear(); Response.ContentType = "text/plain"; Response.Write("success"); Response.End(); </code></pre> <p>I've checked the deployment server environment and don't see anything missing (this is running against the 3.5 SP1 framework). Anyone have any ideas or am I missing something?</p>
[ { "answer_id": 299204, "author": "Eduardo Molteni", "author_id": 2385, "author_profile": "https://Stackoverflow.com/users/2385", "pm_score": 1, "selected": false, "text": "$.post('CustomPostHandler.aspx?step=criteria&random=' + Math.random().toString(), { \n selected: idString...
2008/11/18
[ "https://Stackoverflow.com/questions/299160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38615/" ]
299,168
<p>I need to style links for a Blackberry browser that has disabled CSS.</p> <p>The following is what I try to achieve: </p> <pre><code>&lt;style type="text/css"&gt; a.hover { border:0; } a { text-decoration: none; } &lt;/style&gt; </code></pre> <p>Is it even possible, just using html?</p>
[ { "answer_id": 299202, "author": "Mecki", "author_id": 15809, "author_profile": "https://Stackoverflow.com/users/15809", "pm_score": 4, "selected": true, "text": "<body link=\"XXX\" alink=\"YYY\" vlink=\"ZZZ\"> \n" }, { "answer_id": 838807, "author": "Community", "author_...
2008/11/18
[ "https://Stackoverflow.com/questions/299168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532/" ]
299,176
<p>I've been running into some problems duplicating some old ASP files into some newer .NET 2.0 code. One of the tasks is to merge the 4-5 SQL statements into one. While I have done this and had some success in performance boosts, Oracle is a new bag for me. This problem however surpasses my own SQL skills as I haven't done this before.</p> <p>Basically, I have a QUANTITY in one table from a bunch of Sales. Each sale has an integer value. Each sale also has an ITEM attached to it. Each ITEM has a CONVERSION factor as in if I sell 1 bag of something = 10 bundles of something. So, when I run a report and want to find out the end value, I need to take each sale and its quantity and multiple it by its conversion factor. Most are simple 1 to 1, so it's basically doing 25 * 1, 30 * 1 etc.</p> <p>My problem is that there are past sales in my records in which the ITEM has been removed from our system, therefore the CONVERSION factor does not exist. Those records get dropped from my query because the FACTOR is gone.</p> <pre><code>SELECT rth.CODE, rth.NUMBER, rth.QUANTITY, rth.sale_code FROM salesdetails rth, salesheader rsh WHERE rsh.number = rth.number(+) AND rsh.customer_code = '05' AND rsh.r_code = '01' AND rsh.location_code = '12' AND rth.sale_code IN('ITEM07') AND rth.c_code = 'WLMT' AND rsh.year = '2008' </code></pre> <p>This is my first QUERY. If I add the conversion in:</p> <pre><code>SELECT rth.CODE, rth.NUMBER, rth.QUANTITY, rth.sale_code, rth.quantity * cf.conversion FROM salesdetails rth, salesheader rsh, conversionfactor cf WHERE rsh.number = rth.number(+) AND rsh.customer_code = '05' AND rsh.r_code = '01' AND rsh.location_code = '12' AND rth.sale_code IN('ITEM07') AND rth.c_code = 'WLMT' AND rsh.year = '2008' AND cf.item_code = rth.item_code and cf.code = '01' and cf.loc_code = '00001' </code></pre> <p>This works to an extent. It lists all the same records, but it is missing any records in which the CONVERSION factor did not exist. Is there anyway I can still include those records where the FACTOR didn't exist in the second query, short from going line by line and doing the conversion that way.</p>
[ { "answer_id": 299220, "author": "Dheer", "author_id": 17266, "author_profile": "https://Stackoverflow.com/users/17266", "pm_score": 0, "selected": false, "text": "SELECT rth.CODE, rth.NUMBER, rth.QUANTITY, rth.sale_code, rth.quantity * cf.conversion\nFROM salesdetails rth, salesheader r...
2008/11/18
[ "https://Stackoverflow.com/questions/299176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,198
<p>I am looking for good ideas for implementing a generic way to have a single line (or anonymous delegate) of code execute with a timeout.</p> <pre><code>TemperamentalClass tc = new TemperamentalClass(); tc.DoSomething(); // normally runs in 30 sec. Want to error at 1 min </code></pre> <p>I'm looking for a solution that can elegantly be implemented in many places where my code interacts with temperamental code (that I can't change).</p> <p>In addition, I would like to have the offending "timed out" code stopped from executing further if possible.</p>
[ { "answer_id": 299212, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": " static void Main()\n {\n DoWork(OK, 5000);\n DoWork(Nasty, 5000);\n }\n static void OK()\n...
2008/11/18
[ "https://Stackoverflow.com/questions/299198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28736/" ]
299,200
<p>Topic: Programmatically manipulate web browser in OS X 10.4.x+ Tiger/Leopard. Subjects: Webkit, Safari, Firefox, APIs, Applescript, Automator, Javascript, Ruby, Ruby on Rails, OS X, Tiger Goal: Collect/Read/Extract URLs from Safari into text (Ruby on Rails code) file. Note: A solution that uses FF would be very appreciated, too. I use Safari (v. 3.x, OS X 10.4.x) more and much prefer a solution that works in Safari.</p> <p>At times, I use the web browser to find/display multiple site pages that I 1) want to visit again later and 2) the URLs of which I want to group together in a text file for a) future reference and/or b) programmatically manipulate.</p> <p>For example: In today's NYT I find seven NYT articles I want to post to my del.icio.us acct. and share via email in their "printer friendly" format long after they are headlined in that day's online edition. I open each one in a browser window's tap, then Presto! their URLs automagically are wooshed into a file where a (custom) Ruby on Rails app sends the print versions' URLs to email addresses and my Del.icio.us acct.</p> <p>I figure there's a way to do the URL extracting step from the OS using Applescript or Automator. I figure there MAY be a way to do it with Javascript.</p> <p>My Question: How to read the web browser's tabs' location field and collate these strings into a text file (either within my OS or over the wire to a web app.)?</p> <p>Much appreciated.</p>
[ { "answer_id": 1369382, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "function getGetDocData(){\nvar wm = Components.classes[\"@mozilla.org/appshell/window-mediator;1\"]\n .getServi...
2008/11/18
[ "https://Stackoverflow.com/questions/299200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23306/" ]
299,209
<p>i'm a long-time newbie to c#, and this question may be too obvious, so please forgive if i'm "doing it wrong."</p> <p>Using Visual Studio 2005 Pro, C#, SQL Server 2000 EE SP3.</p> <p>I have a stored proc that takes one input param and returns several output params pertaining to that input. I am also calling it successfully, and String.Format-ing the outputs into a RichTextBox. I'd like to call this proc periodically and each time stick the output params into a DataGridView row, so the results accumulate over time.</p> <ul> <li>What's the simplest/most elegant way to do get those parameters into the DataGridView? I'd prefer code instead of some GUI builder solution.</li> <li>Am i overlooking some better approach, such as a more appropriate control?</li> </ul> <p>Thanks!</p>
[ { "answer_id": 299228, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": true, "text": "//set up the datatable\nDataTable dt = new DataTable(\"parms\");\ndt.Columns.Add(\"ParmName\",typeof(string));\ndt.Col...
2008/11/18
[ "https://Stackoverflow.com/questions/299209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4126/" ]
299,217
<p>I am trying to monitor my outlook inbox so whenever new emails come in with attachments I save the attachment to some other location. Can anyone help me out?</p>
[ { "answer_id": 299234, "author": "Adam Davis", "author_id": 2915, "author_profile": "https://Stackoverflow.com/users/2915", "pm_score": 1, "selected": false, "text": "using Outlook;\n\n Outlook.Application oOutlook;\n Outlook.NameSpace oNs;\n Outlook.MAPIFolder oFldr;\n long iAttachCnt;\...
2008/11/18
[ "https://Stackoverflow.com/questions/299217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,249
<p>I am familiar with using the <em>os.system</em> to run from the command line. However, I would like to be able to run a jar file from inside of a specific folder, eg. my 'test' folder. This is because my jar (located in my 'test' folder) requires a file inside of my 'test' folder. So, how would I write a function in my script that does the following: <code>c:\test&gt;java -jar run_this.jar required_parameter.ext</code> ? I'm a python newbie so details are greatly appreciated. Thanks in advance. </p>
[ { "answer_id": 299377, "author": "grieve", "author_id": 34329, "author_profile": "https://Stackoverflow.com/users/34329", "pm_score": 4, "selected": true, "text": "import os\n\nif __name__ == \"__main__\":\n startingDir = os.getcwd() # save our current directory\n testDir = \"\\\\tes...
2008/11/18
[ "https://Stackoverflow.com/questions/299249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37804/" ]
299,251
<p>I am attempting to write a component in C# to be consumed by classic ASP that allows me to access the indexer of the component (aka default property).</p> <p>For example:<br> C# component:</p> <pre><code>public class MyCollection { public string this[string key] { get { /* return the value associated with key */ } } public void Add(string key, string value) { /* add a new element */ } } </code></pre> <p>ASP consumer:</p> <pre><code>Dim collection Set collection = Server.CreateObject("MyCollection ") Call collection.Add("key", "value") Response.Write(collection("key")) ' should print "value" </code></pre> <p>Is there an attribute I need to set, do I need to implement an interface or do I need to do something else? Or this not possible via COM Interop?</p> <p>The purpose is that I am attempting to create test doubles for some of the built-in ASP objects such as Request, which make use of collections using these default properties (such as <code>Request.QueryString("key")</code>). Alternative suggestions are welcome.</p> <p>Update: I asked a follow-up question: <a href="https://stackoverflow.com/questions/317759/why-is-the-indexer-on-my-net-component-not-always-accessible-from-vbscript">Why is the indexer on my .NET component not always accessible from VBScript?</a></p>
[ { "answer_id": 301260, "author": "Mike Henry", "author_id": 14934, "author_profile": "https://Stackoverflow.com/users/14934", "pm_score": 0, "selected": false, "text": "[DispId(0)]\npublic string Item(string key) {\n return this[key];\n}\n" }, { "answer_id": 311946, "autho...
2008/11/18
[ "https://Stackoverflow.com/questions/299251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14934/" ]
299,254
<p>In essence I'd like to store some rows in a temporary variable for the life of a procedure in MySQL.</p> <p>My procedure will grab a column of foreign keys at the beginning of the procedure. Once I'm done working with them I want to update the table to indicate that they have been processed. There may be inserts into this table while my procedure is working on it's set of data so I don't want to erroneously mark these new rows as processed. I also do not want to lock this table and hold up the thread that is making the inserts. </p> <p>Is a temporary table the best solution?</p>
[ { "answer_id": 301260, "author": "Mike Henry", "author_id": 14934, "author_profile": "https://Stackoverflow.com/users/14934", "pm_score": 0, "selected": false, "text": "[DispId(0)]\npublic string Item(string key) {\n return this[key];\n}\n" }, { "answer_id": 311946, "autho...
2008/11/18
[ "https://Stackoverflow.com/questions/299254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21906/" ]
299,255
<p>I'm starting to try and test my Doctrine objects with PHPUnit, and would like to reload the DB from my model objects afresh each time.</p> <p>My first attempt looks something like this:</p> <pre><code>class Tests_User extends PHPUnit_Framework_TestCase { public function setUp() { Doctrine_Manager::connection('mysql://user:pass@localhost/testdb'); Doctrine::createDatabases(); Doctrine::createTablesFromModels('../../application/models'); } public function testSavingWorks() { $user = new User(); $user-&gt;save(); } public function testSavingWorksAgain() { $user = new User(); $user-&gt;save(); } public function tearDown() { Doctrine::dropDatabases(); } } </code></pre> <p>The problem is that when setUp() is called again for the second test, createTablesFromModels() fails, so I get an error because none of the tables are present.</p> <p>I'd really appreciate an example of how someone else has reinitialised a Doctrine connection for PHPUnit or other unit testing purposes.</p>
[ { "answer_id": 301260, "author": "Mike Henry", "author_id": 14934, "author_profile": "https://Stackoverflow.com/users/14934", "pm_score": 0, "selected": false, "text": "[DispId(0)]\npublic string Item(string key) {\n return this[key];\n}\n" }, { "answer_id": 311946, "autho...
2008/11/18
[ "https://Stackoverflow.com/questions/299255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34024/" ]
299,267
<p>What is the best way to scale a 2D image array? For instance, suppose I have an image of 1024 x 2048 bytes, with each byte being a pixel. Each pixel is a grayscale level from 0 to 255. I would like to be able to scale this image by an arbitrary factor and get a new image. So, if I scale the image by a factor of 0.68, I should get a new image of size 0.68*1024 x 0.68*2048. some pixels will be collapsed onto each other. And, if I scale by a factor of say 3.15, I would get a larger image with pixels being duplicated. So, what's the best way to accomplish this?</p> <p>Next, I would like to be able to rotate an image by an arbitrary angle, in the range of 0 to 360 degrees (0 - 2Pi). Cropping of the image after rotating isn't an issue. What would be the best way to do this?</p>
[ { "answer_id": 299305, "author": "Skizz", "author_id": 1898, "author_profile": "https://Stackoverflow.com/users/1898", "pm_score": 4, "selected": false, "text": "dest[dx,dy] = src[dx*src_width/dest_width,dy*src_height/dest_height]\n" }, { "answer_id": 299383, "author": "Mark ...
2008/11/18
[ "https://Stackoverflow.com/questions/299267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22371/" ]
299,272
<p>Assuming I have a tree structure</p> <pre><code>UL --LI ---INPUT (checkbox) </code></pre> <p>And I want to grab the checked inputs, I would select </p> <pre><code>$('ul li input:checked') </code></pre> <p>However, I want to select the checked inputs of a specific object $myUL that doesn't have an ID.</p> <pre><code>$myUL.children('li input:checked') </code></pre> <p>returns all li's since children filters immediate children - the checked filter has no impact. </p> <p>Is there another way around this? Another descendant filter?</p>
[ { "answer_id": 299302, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 2, "selected": true, "text": "$myUL.find('li>input:checked')" }, { "answer_id": 3108313, "author": "Thach Lockevn", "author_id": 161471, ...
2008/11/18
[ "https://Stackoverflow.com/questions/299272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37731/" ]
299,291
<p>Does anyone know if its possible to create a new property on an existing Entity Type which is based on 2 other properties concatenated together?</p> <p>E.g. My Person Entity Type has these fields "ID", "Forename", "Surname", "DOB"</p> <p>I want to create a new field called "Fullname" which is </p> <pre><code>Forenames + " " + Surname </code></pre> <p>So i end up with "ID", "Forename", "Surname", "DOB", "Fullname".</p> <p>I know i can do this using Linq programmatically i.e.</p> <pre><code>var results = from p in db.People select new { ID = p.ID, Forename = p.Forename, Surname = p.Surname, DOB = p.DOB, Fullname = p.Forename+ " " + p.Surname }; </code></pre> <p>Then calling something like</p> <pre><code>var resultsAfterConcat = from q in results where q.Fullname.Contains(value) select q; </code></pre> <p>However i'd really like to use Linq to Entities to do this work for me at the Conceptual Model level.</p>
[ { "answer_id": 301894, "author": "CraftyFella", "author_id": 30317, "author_profile": "https://Stackoverflow.com/users/30317", "pm_score": 0, "selected": false, "text": "SELECT \n1 AS [C1], \n[Extent1].[PeopleID] AS [PeopleID], \n[Extent1].[Forenames] AS [Forenames], \n[Extent1].[Surname...
2008/11/18
[ "https://Stackoverflow.com/questions/299291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30317/" ]
299,296
<p>Since yesterday, I am analyzing one of our project with <a href="http://www.ndepend.com/" rel="nofollow noreferrer">Ndepend</a> (free for most of its features) and more I am using it, and more I have doubt about the real value of this type of software (code-analysis software).</p> <p>Let me explain, The system build a report about the health of the system and class by Rank every metric. I thought it would be a good starting point to do modifications but most of the top result are here because they have over 100 lines inside the class (we have big headers and we do use VS comments styles) so it's not a big deal... than the number of Afferent Coupling level (CA) is always too high and this is almost very true for Interface that we used a lot... so at this moment I do not see something wrong but NDepend seem to do not like it (if you have suggestion to improve that tell me because I do not see the need for). It's the samething for the metric called "NOC" for Number of children that most of my Interface are too high...</p> <p>For the moment, the only very useful metric is the Cyclomatic Complexity...</p> <p><strong>My question is</strong> : Do you find is worth it to analyse code with Automatic Code Analyser like NDepend? If yes, how do you filter all information that I have mentionned that doesn't really show the real health of the system?</p>
[ { "answer_id": 301894, "author": "CraftyFella", "author_id": 30317, "author_profile": "https://Stackoverflow.com/users/30317", "pm_score": 0, "selected": false, "text": "SELECT \n1 AS [C1], \n[Extent1].[PeopleID] AS [PeopleID], \n[Extent1].[Forenames] AS [Forenames], \n[Extent1].[Surname...
2008/11/18
[ "https://Stackoverflow.com/questions/299296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
299,304
<p>Per the Java documentation, the <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html#hashCode()" rel="noreferrer">hash code</a> for a <code>String</code> object is computed as:</p> <blockquote> <pre><code>s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] </code></pre> <p>using <code>int</code> arithmetic, where <code>s[i]</code> is the <i>i</i>th character of the string, <code>n</code> is the length of the string, and <code>^</code> indicates exponentiation.</p> </blockquote> <p>Why is 31 used as a multiplier?</p> <p>I understand that the multiplier should be a relatively large prime number. So why not 29, or 37, or even 97?</p>
[ { "answer_id": 299385, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 6, "selected": false, "text": "RSB r1, r0, r0, ASL #5 ; r1 := - r0 + (r0<<5)\n" }, { "answer_id": 299748, "author": "mat...
2008/11/18
[ "https://Stackoverflow.com/questions/299304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1318/" ]
299,326
<p>I'm looking for an implementation of the <a href="http://en.wikipedia.org/wiki/Logo_programming_language" rel="nofollow noreferrer">LOGO</a> programming language that supports 'dynaturtles' - animated turtles that can programmatically change shape, speed and direction as well as detect collisions with each other or other objects in the environment.</p> <p>Back in the mists of time when the earth was new and 8 bit micros ruled supreme, <a href="http://en.wikipedia.org/wiki/Atari_LOGO" rel="nofollow noreferrer">Atari LOGO</a> did this famously well. One could create all sorts of small games and simulated environments using this technique very easily as that implementation of the language had a very well thought out, elegant syntax.</p> <p>I know about LCSI's <a href="http://www.microworlds.com/" rel="nofollow noreferrer">Microworlds</a> but I'm looking for something I can use to get some friends and their kids involved in programming without breaking my budget.</p>
[ { "answer_id": 831097, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "PR test\n ;* ##### Startdatei ######\n SETZE \"sprung.x\" 0\n SETZE \"sprung.y\" 0\n flug\nENDE\n\nPR flug\n sprun...
2008/11/18
[ "https://Stackoverflow.com/questions/299326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32514/" ]
299,332
<p>I'm doing a basic homework assignment which looks like this:</p> <pre><code> While input &lt;&gt; -1 input = CDbl(InputBox("Enter numbers to add, enter -1 to stop")) values = values + input End While </code></pre> <p>It works fine until I press 'cancel' on the input box. Then the string input is "", and I get the following error:</p> <pre><code>System.InvalidCastException {"Conversion from string "" to type 'Double' is not valid."} </code></pre> <p>I think I understand the error, I'm trying to convert using CDbl a non-numeric value. My question is what would be a more proper way to write this code? Is it the code, or just a lack of error handling?</p>
[ { "answer_id": 299353, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 3, "selected": true, "text": "Dim value as Double = Nothing\nIf Double.TryParse(InputBox(\"Enter numbers...\"), value) Then\n values = values + value\nEnd If\n"...
2008/11/18
[ "https://Stackoverflow.com/questions/299332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28658/" ]
299,342
<p>I have a web service which has a generic function that returns a dataset from results of stored procedures... Some of the stored procedures have optional parameters where the value can be null but not all the time.</p> <p>Anyhow I am trying to pass in a parameter which has a value of DBNull.Value</p> <p>and I get this <strong>There was an error generating the XML document.</strong> back from the web service when doing so</p> <p>If I leave this parameter out it works fine... but really would like to know why DBNull.Value causes this problem.</p>
[ { "answer_id": 7518178, "author": "markhazleton", "author_id": 479571, "author_profile": "https://Stackoverflow.com/users/479571", "pm_score": 0, "selected": false, "text": "Using dtResult as New DataTable \n Using cn as SqlConnection = New SqlConnection (\"ConnectionString\") \n Usi...
2008/11/18
[ "https://Stackoverflow.com/questions/299342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22093/" ]
299,370
<p>I'm trying to use <code>SetWindowsHookEx</code> to set up a <code>WH_SHELL</code> hook to get notified of system-wide <code>HSHELL_WINDOWCREATED</code> and <code>HSHELL_WINDOWDESTROYED</code> events. I pass 0 for the final <code>dwThreadId</code> argument which, according to <a href="http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx" rel="noreferrer">the docs</a>, should "associate the hook procedure with all existing threads running in the same desktop as the calling thread". I also pass in the handle to my DLL (<code>HInstance</code> in Delphi) for the <code>hMod</code> parameter as did all the examples I looked at.</p> <p>Yet, I only ever get notified of windows created by my own app and - more often than not - my tests result in the desktop process going down in flames once I close down my app. Before you ask, I do call <code>UnhookWindowsHookEx</code>. I also always call <code>CallNextHookEx</code> from within my handler.</p> <p>I am running my test app from a limited user account but so far I haven't found any hints indicating that this would play a role... (though that actually surprises me)</p> <p>AFAICT, I did everything by the book (obviously I didn't but so far I fail to see where).</p> <p>I'm using Delphi (2007) but that shouldn't really matter I think.</p> <p><strong>EDIT:</strong> Maybe I should have mentioned this before: I did download and try a couple of examples (though there are unfortunately not that many available for Delphi - especially none for <code>WH_SHELL</code> or <code>WH_CBT</code>). While they do not crash the system like my test app does, they still do not capture events from other processes (even though I can verify with ProcessExplorer that they get loaded into them alright). So it seems there is either something wrong with my system configuration or the examples are wrong or it is simply not possible to capture events from other processes. Can anyone enlighten me?</p> <p><strong>EDIT2:</strong> OK, here's the source of my test project.</p> <p>The DLL containing the hook procedure:</p> <pre><code>library HookHelper; uses Windows; {$R *.res} type THookCallback = procedure(ACode, AWParam, ALParam: Integer); stdcall; var WndHookCallback: THookCallback; Hook: HHook; function HookProc(ACode, AWParam, ALParam: Integer): Integer; stdcall; begin Result := CallNextHookEx(Hook, ACode, AWParam, ALParam); if ACode &lt; 0 then Exit; try if Assigned(WndHookCallback) // and (ACode in [HSHELL_WINDOWCREATED, HSHELL_WINDOWDESTROYED]) then and (ACode in [HCBT_CREATEWND, HCBT_DESTROYWND]) then WndHookCallback(ACode, AWParam, ALParam); except // plop! end; end; procedure InitHook(ACallback: THookCallback); register; begin // Hook := SetWindowsHookEx(WH_SHELL, @HookProc, HInstance, 0); Hook := SetWindowsHookEx(WH_CBT, @HookProc, HInstance, 0); if Hook = 0 then begin // ShowMessage(SysErrorMessage(GetLastError)); end else begin WndHookCallback := ACallback; end; end; procedure UninitHook; register; begin if Hook &lt;&gt; 0 then UnhookWindowsHookEx(Hook); WndHookCallback := nil; end; exports InitHook, UninitHook; begin end. </code></pre> <p>And the main form of the app using the hook:</p> <pre><code>unit MainFo; interface uses Windows, SysUtils, Forms, Dialogs, Classes, Controls, Buttons, StdCtrls; type THookTest_Fo = class(TForm) Hook_Btn: TSpeedButton; Output_Lbx: TListBox; Test_Btn: TButton; procedure Hook_BtnClick(Sender: TObject); procedure Test_BtnClick(Sender: TObject); public destructor Destroy; override; end; var HookTest_Fo: THookTest_Fo; implementation {$R *.dfm} type THookCallback = procedure(ACode, AWParam, ALParam: Integer); stdcall; procedure InitHook(const ACallback: THookCallback); register; external 'HookHelper.dll'; procedure UninitHook; register; external 'HookHelper.dll'; procedure HookCallback(ACode, AWParam, ALParam: Integer); stdcall; begin if Assigned(HookTest_Fo) then case ACode of // HSHELL_WINDOWCREATED: HCBT_CREATEWND: HookTest_Fo.Output_Lbx.Items.Add('created handle #' + IntToStr(AWParam)); // HSHELL_WINDOWDESTROYED: HCBT_DESTROYWND: HookTest_Fo.Output_Lbx.Items.Add('destroyed handle #' + IntToStr(AWParam)); else HookTest_Fo.Output_Lbx.Items.Add(Format('code: %d, WParam: $%x, LParam: $%x', [ACode, AWParam, ALParam])); end; end; procedure THookTest_Fo.Test_BtnClick(Sender: TObject); begin ShowMessage('Boo!'); end; destructor THookTest_Fo.Destroy; begin UninitHook; // just to make sure inherited; end; procedure THookTest_Fo.Hook_BtnClick(Sender: TObject); begin if Hook_Btn.Down then InitHook(HookCallback) else UninitHook; end; end. </code></pre>
[ { "answer_id": 308328, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 0, "selected": false, "text": "procedure THooktest_FO.UnInitClick(Sender: TObject);\nbegin\n UninitHook;\nend;\n\nprocedure THooktest_FO.InitClick(...
2008/11/18
[ "https://Stackoverflow.com/questions/299370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9784/" ]
299,382
<p>I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found <a href="https://stackoverflow.com/questions/236599/how-to-unit-test-if-my-object-is-really-serializablable">examples using C# 2.0</a>, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the NUnit framework for the unit tests.</p> <p>Thanks!</p>
[ { "answer_id": 299470, "author": "TheCodeJunkie", "author_id": 25319, "author_profile": "https://Stackoverflow.com/users/25319", "pm_score": 1, "selected": false, "text": "[Test]\npublic void ClassIsXmlSerializable()\n{\n bool exceptionWasThrown = false;\n\n try\n {\n // .. se...
2008/11/18
[ "https://Stackoverflow.com/questions/299382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19063/" ]
299,387
<p>I'm serializing class which contains DateTime property.</p> <pre><code>public DateTime? Delivered { get; set; } </code></pre> <p>After serializing Delivered node contains DateTime formatted like this:</p> <pre><code>2008-11-20T00:00:00 </code></pre> <p>How can I change this property to make it look like this:</p> <pre><code>2008-11-20 00:00:00 </code></pre> <p>Thanks in advance</p>
[ { "answer_id": 299508, "author": "Adam Tegen", "author_id": 4066, "author_profile": "https://Stackoverflow.com/users/4066", "pm_score": 5, "selected": true, "text": "//normal DateTime accessor\n[XmlIgnore]\npublic DateTime Delivered { get; set; }\n\n//special XmlSerialization accessor\n[...
2008/11/18
[ "https://Stackoverflow.com/questions/299387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23280/" ]
299,390
<p>Say I have the following Objective-C class:</p> <pre><code>@interface Foo { int someNumber; NSString *someString; } </code></pre> <p>and for reasons I won't get into here, I want to use KVC to update, in a generic fashion, the values for those variables:</p> <pre><code>[f setValue:object forKey:@"someNumber"]; or [f setValue:object forKey:@"someString"];` </code></pre> <p>If <code>object</code> is a string and I'm updating the <code>someNumber</code> variable, it seems that I need to know to use an NSNumberFormatter to get an NSNumber and then Cocoa automatically converts that to an int inside <code>setValue:forKey:</code>. </p> <p>Is there any way to avoid this custom code and have Cocoa infer the conversion to an int from a string, or do I need to catch this situation each time and handle it myself?</p>
[ { "answer_id": 299496, "author": "wisequark", "author_id": 33159, "author_profile": "https://Stackoverflow.com/users/33159", "pm_score": 2, "selected": true, "text": "id" }, { "answer_id": 299533, "author": "e.James", "author_id": 33686, "author_profile": "https://Sta...
2008/11/18
[ "https://Stackoverflow.com/questions/299390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1967/" ]
299,392
<p>How do I create a batch file timer to execute / call another batch through out the day Maybe on given times to run but not to run on weekends ? Must run on system times can also be .cmd to run on xp server 2003 </p>
[ { "answer_id": 493156, "author": "aphoria", "author_id": 2441, "author_profile": "https://Stackoverflow.com/users/2441", "pm_score": 2, "selected": false, "text": "@ECHO OFF\n\n:LOOP\nECHO Waiting for 1 minute...\n PING -n 60 127.0.0.1>nul\n IF %DATE:~0,3%==Mon CALL SomeOtherFile.cmd\n...
2008/11/18
[ "https://Stackoverflow.com/questions/299392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,405
<p>I'm just learning Perl.</p> <p>When is it advisable to use OO Perl instead of non-OO Perl?</p> <p>My tendency would be to always prefer OO unless the project is just a code snippet of &lt; 10 lines.</p> <p>TIA</p>
[ { "answer_id": 300117, "author": "Aristotle Pagaltzis", "author_id": 9410, "author_profile": "https://Stackoverflow.com/users/9410", "pm_score": 5, "selected": true, "text": "DB::check" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16609/" ]
299,412
<p>I love <a href="https://en.wikipedia.org/wiki/WinSCP" rel="noreferrer">WinSCP</a> for Windows. What is the best equivalent software for Linux?</p> <p>I tried to use sshfs to mount the remote file system on my local machine, but it is not as user friendly as simply launching a GUI, plus it seems to require root access on the client machine, which is not very convenient.</p> <p>Of course command-line tools such as scp are possible, but I am looking for a simple GUI.</p>
[ { "answer_id": 299516, "author": "William Brendel", "author_id": 2405, "author_profile": "https://Stackoverflow.com/users/2405", "pm_score": 6, "selected": false, "text": "sudo apt-get install filezilla\n" }, { "answer_id": 14485912, "author": "Alois Mahdal", "author_id":...
2008/11/18
[ "https://Stackoverflow.com/questions/299412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38626/" ]
299,414
<p>I have several aspx pages that can be opened either normally (full screen in browser), or called from another page as a popup (I am using Greybox, fwiw)</p> <p>If the page is opened as a popup in Greybox, I would like to NOT display the master page content (which displays common top and left menus, etc).</p> <p>As far as I know, there is no way of knowing server side if the page is a popup, this must be detected in client side javascript (in the case of Greybox, by checking window.parent.parent), and therefore the master page content must be hidden via javascript as well.</p> <p>Any ideas on how to approach this?</p>
[ { "answer_id": 299601, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 4, "selected": true, "text": "protected override void OnPreInit(EventArgs e)\n{\n base.OnPreInit(e);\n\n if(Request[\"PopUp\"] == \"Y\")\n ...
2008/11/18
[ "https://Stackoverflow.com/questions/299414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8678/" ]
299,416
<p>I'm working with a existing database and trying to write a sql query to get out all the account information including permission levels. This is for a security audit. We want to dump all of this information out in a readible fashion to make it easy to compare. My problem is that there is a bridge/link table for the permissions so there are multiple records per user. I want to get back results with all the permission for one user on one line. Here is an example:</p> <pre><code>Table_User: UserId UserName 1 John 2 Joe 3 James Table_UserPermissions: UserId PermissionId Rights 1 10 1 1 11 2 1 12 3 2 11 2 2 12 3 3 10 2 </code></pre> <p>PermissionID links to a table with the name of the Permission and what it does. Right is like 1 = view, 2 = modify, and etc.</p> <p>What I get back from a basic query for User 1 is:</p> <pre><code>UserId UserName PermissionId Rights 1 John 10 1 1 John 11 2 1 John 12 3 </code></pre> <p>What I would like something like this:</p> <pre><code>UserId UserName Permission1 Rights1 Permission2 Right2 Permission3 Right3 1 John 10 1 11 2 12 3 </code></pre> <p>Ideally I would like this for all users. The closest thing I've found is the Pivot function in SQL Server 2005. <a href="https://web.archive.org/web/20191230182030/http://geekswithblogs.net:80/lorint/archive/2006/08/04/87166.aspx" rel="nofollow noreferrer">Link</a> The problem with this from what I can tell is that I need to name each column for each user and I'm not sure how to get the rights level. With real data I have about 130 users and 40 different permissions.</p> <p>Is there another way with just sql that I can do this?</p>
[ { "answer_id": 299505, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 2, "selected": false, "text": "select userid, username\n, max(case when permissionid=10 then rights end) as permission10_rights\n, max(cas...
2008/11/18
[ "https://Stackoverflow.com/questions/299416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8664/" ]
299,433
<p>Is there a way to programatically access the DragHandleTemplate of a ReorderList (ASP.NET AJAX Control Toolkit) ... Specifically during ItemDataBound for the ReorderList, in order to change its appearance at the per item level?</p>
[ { "answer_id": 502744, "author": "Pavel Chuchuva", "author_id": 14131, "author_profile": "https://Stackoverflow.com/users/14131", "pm_score": 1, "selected": false, "text": "<DragHandleTemplate>\n <div class=\"dragHandle\">\n <asp:Label ID=\"lblDragHandle\" runat=\"server\" />\n </di...
2008/11/18
[ "https://Stackoverflow.com/questions/299433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36263/" ]
299,439
<p>I'm looking for a library or source code that provides guard methods such as checking for null arguments. Obviously this is rather simple to build, but I'm wondering if there are any out there for .NET already. A basic Google search didn't reveal much.</p>
[ { "answer_id": 1277101, "author": "Alexey Romanov", "author_id": 9204, "author_profile": "https://Stackoverflow.com/users/9204", "pm_score": 5, "selected": true, "text": "public ICollection GetData(Nullable<int> id, string xml, ICollection col)\n{\n // Check all preconditions:\n id...
2008/11/18
[ "https://Stackoverflow.com/questions/299439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2656/" ]
299,441
<p>I have a simple class in my WCF service that doesn't seem to be showing up properly for the client that accesses my WCF.</p> <p>My class has 4 public properties that are of type string.</p> <p>I marked the class with [DataContract()] and each member with [DataMember].</p> <p>Why is my constructor not visible? Is there a special [attribute] for constructors?</p>
[ { "answer_id": 299455, "author": "Brian Genisio", "author_id": 36687, "author_profile": "https://Stackoverflow.com/users/36687", "pm_score": 3, "selected": false, "text": "public partial class SomeDataItem\n{\n public SomeDataItem(int a, int b)\n {\n A = a;\n B = b;\n...
2008/11/18
[ "https://Stackoverflow.com/questions/299441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,446
<p>I have a function that resembles the one below. I'm not sure how to use the os module to get back to my original working directory at the conclusion of the jar's execution. </p> <pre><code>def run(): owd = os.getcwd() #first change dir to build_dir path os.chdir(testDir) #run jar from test directory os.system(cmd) #change dir back to original working directory (owd) </code></pre> <p>note: I think my code formatting is off - not sure why. My apologies in advance</p>
[ { "answer_id": 299462, "author": "grieve", "author_id": 34329, "author_profile": "https://Stackoverflow.com/users/34329", "pm_score": 6, "selected": true, "text": "os.chdir(owd)\n" }, { "answer_id": 300204, "author": "Alex Coventry", "author_id": 1941213, "author_prof...
2008/11/18
[ "https://Stackoverflow.com/questions/299446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37804/" ]
299,490
<p>I need to query Active Directory for a list of users whose password is about to expire. The obvious (and easy) way to do this is with:</p> <pre><code>dsquery user -stalepwd n </code></pre> <p>The problem is that I need to add additional filters to only look for users who are in certain security groups. This is hard to do with the "dsquery user" syntax that has the built-in -stalepwd option, so I've been using the "dsquery * -filter" option which allows you to use LDAP query syntax. Unfortunately, while its relatively easy to do apply the other filters with an LDAP query, I'm having trouble filtering users who have a password age greater than n.</p> <p>Does anyone know the syntax (or if it is even possible) to filter for old passwords using the "dsquery * -filter" method instead of the "dsquery user -stalepwd" method.</p>
[ { "answer_id": 300169, "author": "benPearce", "author_id": 4490, "author_profile": "https://Stackoverflow.com/users/4490", "pm_score": 2, "selected": false, "text": "&(objectCategory=user)(memberof=CN=User Group,OU=Test,DC=foo,dc=com)\n" }, { "answer_id": 300227, "author": "A...
2008/11/18
[ "https://Stackoverflow.com/questions/299490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,495
<p>I have a <a href="http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JPanel.html" rel="noreferrer">JPanel</a> to which I'd like to add JPEG and PNG images that I generate on the fly.</p> <p>All the examples I've seen so far in the <a href="http://java.sun.com/docs/books/tutorial/uiswing/" rel="noreferrer">Swing Tutorials</a>, specially in the <a href="http://java.sun.com/docs/books/tutorial/uiswing/examples/components/" rel="noreferrer">Swing examples</a> use <code>ImageIcon</code>s.</p> <p>I'm generating these images as byte arrays, and they are usually larger than the common icon they use in the examples, at 640x480.</p> <ol> <li>Is there any (performance or other) problem in using the ImageIcon class to display an image that size in a JPanel?</li> <li>What's the <em>usual</em> way of doing it?</li> <li>How to add an image to a JPanel without using the ImageIcon class?</li> </ol> <p><strong>Edit</strong>: A more careful examination of the tutorials and the API shows that you cannot add an ImageIcon directly to a JPanel. Instead, they achieve the same effect by setting the image as an icon of a JLabel. This just doesn't feel right...</p>
[ { "answer_id": 299545, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 3, "selected": false, "text": "protected void paintComponent(Graphics gc) {\n super.paintComponent(gc);\n\n Dimension ...
2008/11/18
[ "https://Stackoverflow.com/questions/299495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15649/" ]
299,497
<p>I've created a windows form control which works successfully hosted in Internet Explorer. I'd like to give it an event and be able to respond to the event through javascript. I found a link that talks about it <a href="http://msdn.microsoft.com/en-ca/magazine/cc301932.aspx" rel="nofollow noreferrer">here</a>. It shows me how to create the interfaces but I'm not sure how to fire the event from my control? </p> <p>Here's my code snippetS:</p> <pre><code>//Control Code: public class CardReader : Panel,ICardReaderEvents, ICardReaderProperties { public void Error() { } public void Success() { } } //Interface for events [Guid("DD0C202B-12B4-4457-9FC6-05F88A6E8BC5")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface ICardReaderEvents { [DispId(0x60020000)] void Error(); [DispId(0x60020001)] void Success(); } //Interface for public properties/methods public interface ICardReaderProperties { ... } //JavaScript to handle events &lt;SCRIPT FOR="CardReader1" EVENT="Error"&gt; window.status = "Error..."; &lt;/SCRIPT&gt; &lt;SCRIPT FOR="CardReader1" EVENT="Success"&gt; window.alert("Success"); window.status = ""; &lt;/SCRIPT&gt; </code></pre>
[ { "answer_id": 299551, "author": "Brian Genisio", "author_id": 36687, "author_profile": "https://Stackoverflow.com/users/36687", "pm_score": 1, "selected": false, "text": "public event Error;\npublic event Success;\n\nprotected void OnError()\n{\n if(Error != null)\n Error();\n...
2008/11/18
[ "https://Stackoverflow.com/questions/299497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
299,504
<p>I'm trying to use cygwin sqlplus to connect to a remote oracle installation located at myserver.mycompany.com port 1530. When I try</p> <pre><code>sqlplus username@myserver.mycompany.com:1530/orcl </code></pre> <p>I get the error:</p> <pre><code>ORA-12154: TNS:could not resolve the connect identifier specified </code></pre> <p>When I set <code>ORACLE_HOME</code> to /<code>cygdrive/c/oracle/product/10.2.0/client_1</code>, I get a different error:</p> <pre><code>Error 6 initializing SQL*Plus Message file sp1&lt;lang&gt;.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory </code></pre> <p>I can telnet to the server's port 1530, and the SQL Developer installed locally is also able to connect to the database. What am I doing wrong?</p>
[ { "answer_id": 299709, "author": "MCS", "author_id": 1094969, "author_profile": "https://Stackoverflow.com/users/1094969", "pm_score": 0, "selected": false, "text": "ORACLE_HOME" }, { "answer_id": 29122954, "author": "Sina", "author_id": 4685386, "author_profile": "ht...
2008/11/18
[ "https://Stackoverflow.com/questions/299504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
299,512
<p>What steps do I take? Any gotchas to be aware of or tips to enhance the IDE experience that are specific to SQL Server when using Emacs?</p>
[ { "answer_id": 299816, "author": "Ray", "author_id": 4872, "author_profile": "https://Stackoverflow.com/users/4872", "pm_score": 6, "selected": true, "text": "M-x sql-ms RET\nM-x sql-mode \n" }, { "answer_id": 6894794, "author": "fangzhzh", "author_id": 415673, "a...
2008/11/18
[ "https://Stackoverflow.com/questions/299512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
299,515
<p>In C# is there a technique using reflection to determine if a method has been added to a class as an extension method?</p> <p>Given an extension method such as the one shown below is it possible to determine that Reverse() has been added to the string class?</p> <pre><code>public static class StringExtensions { public static string Reverse(this string value) { char[] cArray = value.ToCharArray(); Array.Reverse(cArray); return new string(cArray); } } </code></pre> <p>We're looking for a mechanism to determine in unit testing that the extension method was appropriately added by the developer. One reason to attempt this is that it is possible that a similar method would be added to the actual class by the developer and, if it was, the compiler will pick that method up.</p>
[ { "answer_id": 299526, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "ExtensionAttribute" }, { "answer_id": 299598, "author": "James Curran", "author_id": 12725, "author_p...
2008/11/18
[ "https://Stackoverflow.com/questions/299515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27887/" ]
299,529
<p>I'm using Apache JMeter 2.3, which now supports "attempt HTTPS spoofing" under the Proxy Server element. </p> <p>I've tried this on several different servers, and have had no success. Has anyone been able to successfully record from an HTTPS source with this setting?</p> <p>Or barring successfully recording, can anyone share a work-around? When available, I simply have HTTPS turned off at the server level, but this is not always feasible. Thoughts?</p>
[ { "answer_id": 49614949, "author": "UBIK LOAD PACK", "author_id": 460802, "author_profile": "https://Stackoverflow.com/users/460802", "pm_score": 3, "selected": false, "text": "8888" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
299,536
<p>Is it possible to create an integer (or DataTime, etc) column in ListView? It is quite important, because I would like to properly sort the list according to this column.</p> <p>The only way to add subItems to a ListViewItem I found are:</p> <pre><code>listviewitem.SubItems.Add("1"); </code></pre> <p>I would like to avoid parsing these strings to get the int representation for every sort!</p>
[ { "answer_id": 299572, "author": "Mariusz", "author_id": 13541, "author_profile": "https://Stackoverflow.com/users/13541", "pm_score": 1, "selected": false, "text": ".Text" }, { "answer_id": 299968, "author": "Hans Passant", "author_id": 17034, "author_profile": "http...
2008/11/18
[ "https://Stackoverflow.com/questions/299536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5363/" ]
299,546
<p>I can query the AD and find all the IIS sites and their virtual directories, now I need to be able to update those home directories and save the changes.</p> <p>After I fetch the directory entry I can display the site path using <code>$site.Path</code>, however setting it doesn't seem to have any effect. It never changes the actual stored path. </p> <p>I have tried <code>$site.Path = &lt;new path&gt;</code> and <code>$site.Put( "Path", &lt;new path&gt; )</code> but neither have these seem to be affecting the stored path.</p> <pre><code> $site = $iis.psbase.children | where {$_.keyType -eq "iiswebserver"} | where {$_.psbase.properties.servercomment -eq $siteConfig.name }; $s = [ADSI]($site.psbase.path + "/ROOT"); $s.Path # $s.Path = $siteConfig.path # $s.Put("Path", $siteConfig.path ) $s.psbase.CommitChanges() </code></pre>
[ { "answer_id": 299561, "author": "vfilby", "author_id": 24279, "author_profile": "https://Stackoverflow.com/users/24279", "pm_score": 1, "selected": true, "text": " $s.psbase.properties.path[0] = $siteConfig.path\n $s.psbase.CommitChanges()\n" }, { "answer_id": 5463780, ...
2008/11/18
[ "https://Stackoverflow.com/questions/299546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24279/" ]
299,548
<p>In the helpfile entry for TDBComboBox, it says that the text of the selected option becomes the new value for the field. Is there any similar control that goes by ItemIndex instead of text? (To represent an enumerated type, for example.)</p>
[ { "answer_id": 300011, "author": "vrad", "author_id": 12891, "author_profile": "https://Stackoverflow.com/users/12891", "pm_score": 2, "selected": false, "text": "procedure TForm1.DBComboBox1DrawItem(Control: TWinControl; Index: Integer;\n Rect: TRect; State: TOwnerDrawState);\nbegin\n ...
2008/11/18
[ "https://Stackoverflow.com/questions/299548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32914/" ]
299,553
<p>I'm using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual call (which compared two strings of XML). Only one element of the XML is actually different in the new codebase, so my hope is that a comparison of all the other elements will give me the result I want. The comparison needs to be done programmatically, since it's part of a unit test.</p> <p>At first, I was considering using a couple instances of XmlDocument. But then I found this: <a href="http://drowningintechnicaldebt.com/blogs/scottroycraft/archive/2007/05/06/comparing-xml-files.aspx" rel="nofollow noreferrer">http://drowningintechnicaldebt.com/blogs/scottroycraft/archive/2007/05/06/comparing-xml-files.aspx</a></p> <p>It looks like it might work, but I was interested in Stack Overflow feedback in case there's a better way.</p> <p>I'd like to avoid adding another dependency for this if at all possible.</p> <h2>Similar questions</h2> <ul> <li><a href="https://stackoverflow.com/questions/3552648/is-there-an-xml-asserts-for-nunit">Is there an XML asserts for NUnit?</a></li> <li><a href="https://stackoverflow.com/questions/167946/how-would-you-compare-two-xml-documents">How would you compare two XML Documents?</a></li> </ul>
[ { "answer_id": 299607, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "xml" }, { "answer_id": 299725, "author": "jlew", "author_id": 7450, "author_profile": "https://Stackoverfl...
2008/11/18
[ "https://Stackoverflow.com/questions/299553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3475/" ]
299,554
<p>I am using a JSP bean and when I do an assignment to a new object, it gets over-written on a submit to the previous object.</p> <pre><code>&lt;jsp:useBean id="base" class="com.example.StandardBase" scope="session" /&gt; ... //base object id = 396 base = new Base() //base object id = 1000 </code></pre> <p>and on a resubmit of the page I get</p> <pre><code>&lt;jsp:useBean id="base" class="com.example.StandardBase" scope="session" /&gt; //base object id = 396 </code></pre> <p>Is there a way to tell JSP to do a new assignment?</p>
[ { "answer_id": 299573, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 3, "selected": true, "text": "base = new Base()" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17712/" ]
299,563
<p>I don't understand why one method would work and the other would throw a NoMethodError if they come from the same lib file.</p> <pre><code># app/views/bunnies/show.html.erb &lt;% if logged_in? %&gt; &lt;%= current_user.login %&gt; | &lt;%= link_to 'Logout', logout_path %&gt; | &lt;% if authorized? %&gt; &lt;%= link_to 'Edit Details', edit_bunny_path(@broker) %&gt; | &lt;% end %&gt; &lt;%= link_to 'Back', bunnies_path %&gt; &lt;% end %&gt; </code></pre> <p>... throws a NoMethodError for <code>authorized?</code>. If I comment that if block out, the page works fine (with <code>logged<code>_</code>in?</code>).</p> <pre><code># lib/authenticated_system.rb def logged_in? !!current_user end def authorized? current_user.login == "admin" end # app/controllers/application.rb class ApplicationController &lt; ActionController::Base include AuthenticatedSystem end </code></pre> <p>What gives?</p>
[ { "answer_id": 299764, "author": "neezer", "author_id": 32154, "author_profile": "https://Stackoverflow.com/users/32154", "pm_score": 1, "selected": true, "text": "helper_method :is_admin?\ndef is_admin?\n if logged_in? && current_user.login == \"admin\"\n true\n else\n false\n ...
2008/11/18
[ "https://Stackoverflow.com/questions/299563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32154/" ]
299,565
<p>I am compiling a legacy C code here and there is a lot of variables and struct members named "interface", but VC2008 express is complaining about these, do you know how to disable this?</p> <p>I already changed settings to compile the code only as a C code, but no effect on this.</p>
[ { "answer_id": 299593, "author": "wimh", "author_id": 33499, "author_profile": "https://Stackoverflow.com/users/33499", "pm_score": 3, "selected": true, "text": "#define interface QQInterface\n" }, { "answer_id": 5432241, "author": "Sebastian Brandt", "author_id": 676662,...
2008/11/18
[ "https://Stackoverflow.com/questions/299565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/440867/" ]
299,574
<p>If I have the following setting in my app.config file. It is a setting I need to make sure my WCF client can negotiate the default proxy server.</p> <pre><code>&lt;system.net&gt; &lt;defaultProxy enabled="true" useDefaultCredentials="true"&gt;&lt;/defaultProxy&gt; &lt;/system.net&gt; </code></pre> <p>Unfortunately, I can't add to the app.config file in my environment. How do I ensure these settings by setting them at runtime?</p>
[ { "answer_id": 299632, "author": "Zachary Yates", "author_id": 8360, "author_profile": "https://Stackoverflow.com/users/8360", "pm_score": 1, "selected": true, "text": "System.Net.WebProxy" }, { "answer_id": 310966, "author": "Mitch Baker", "author_id": 37896, "author...
2008/11/18
[ "https://Stackoverflow.com/questions/299574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36687/" ]
299,582
<p>I want to use JavaScript to control an embedded Windows Media Player, as well as access any properties that the player exposes. I've found a few hacky examples online, but nothing concrete. </p> <p>I really need access to play, pause, stop, seek, fullscreen, etc. I'd also like to have access to any events the player happens to broadcast. </p> <p>Help would be wonderful (I already have a Flash equiv, just so you know), thanks! </p>
[ { "answer_id": 728100, "author": "Mister Lucky", "author_id": 81589, "author_profile": "https://Stackoverflow.com/users/81589", "pm_score": 4, "selected": false, "text": "<html>\n<head>\n <title>so-wmp</title>\n <script>\n\n onload=function() {\n player = document.getElementByI...
2008/11/18
[ "https://Stackoverflow.com/questions/299582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4106/" ]
299,585
<p>The net is overflowing with explanations of the <a href="http://en.wikipedia.org/wiki/Diamond_problem" rel="nofollow noreferrer">"dreaded diamond problem"</a>. So is StackOverflow. I think I understand that bit, but I fail to translate that knowledge into comprehending something similar yet different.</p> <p>My question begins as a pure C++ question, but the answer might well branch over into MS-COM specifics. The general problem question goes:</p> <pre><code>class Base { /* pure virtual stuff */ }; class Der1 : Base /* Non-virtual! */ { /* pure virtual stuff */ }; class Der2 : Base /* Non-virtual! */ { /* pure virtual stuff */ }; class Join : virtual Der1, virtual Der2 { /* implementation stuff */ }; class Join2 : Join { /* more implementation stuff + overides */ }; </code></pre> <p>This is <em>not</em> the classic diamond solution. Exactly what does "virtual" do here?</p> <p>My real problem is trying to understand a <a href="http://www.codeproject.com/KB/COM/flashcontrol.aspx?fid=915540&amp;select=2784823&amp;tid=2774438" rel="nofollow noreferrer">discussion over at our friends' place at CodeProject.</a> It involves a custom class for creating a transparent container for the Flash player.</p> <p>I thought I would try this place for fun. It turns out that the following declaration crashes your app, with version 10 of the Flash player.</p> <pre><code>class FlashContainerWnd: virtual public IOleClientSite, virtual public IOleInPlaceSiteWindowless, virtual public IOleInPlaceFrame, virtual public IStorage </code></pre> <p>Debugging shows that when entering the function implementations (QueryInterface etc), from different callers, I get different "this"-pointer values for different calls. But <strong>removing "virtual" does the trick!</strong> No crashes, and same "this"-pointer.</p> <p>I would like to clearly understand exactly what is going on. Thanks a lot.</p> <p>Cheers Adam</p>
[ { "answer_id": 299961, "author": "deft_code", "author_id": 28817, "author_profile": "https://Stackoverflow.com/users/28817", "pm_score": 2, "selected": false, "text": "Der1" }, { "answer_id": 1254243, "author": "Kees-Jan", "author_id": 114197, "author_profile": "https...
2008/11/18
[ "https://Stackoverflow.com/questions/299585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38656/" ]
299,588
<p>I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python?</p> <p>I'd prefer something using the standard library, but I can install a third-party package if necessary.</p>
[ { "answer_id": 299611, "author": "altunyurt", "author_id": 37491, "author_profile": "https://Stackoverflow.com/users/37491", "pm_score": 3, "selected": false, "text": "...\nroot = etree.XML(_bytes(\"<b/>\")) \ndtd = etree.DTD(BytesIO(\"<!ELEMENT b EMPTY>\")) \nself.assert_(dtd.validate(r...
2008/11/18
[ "https://Stackoverflow.com/questions/299588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1694/" ]
299,597
<p>To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability).</p> <p>The coolest framework I used to work with is <a href="http://static.springframework.org/spring/docs/2.5.x/reference/jdbc.html" rel="noreferrer">Spring-Jdbc</a>. However, the policy of my company is to avoid external dependencies, especially spring, J2EE, etc. So we are thinking about writing own handy-made jdbc framework, with functionality similar Spring-jdbc: row mapping, error handling, supporting features of java5, but without transaction support.</p> <p>Does anyone have experience of writing such jdbc wrapper framework? If anyone has experience of using other jdbc wrapper frameworks, please share your experience.</p> <p>Thanks in advance.</p>
[ { "answer_id": 10635155, "author": "yegor256", "author_id": 187141, "author_profile": "https://Stackoverflow.com/users/187141", "pm_score": 1, "selected": false, "text": "JdbcSession" }, { "answer_id": 12846227, "author": "egaga", "author_id": 103014, "author_profile"...
2008/11/18
[ "https://Stackoverflow.com/questions/299597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15894/" ]
299,604
<p>My current project involves deploying an upgraded .exe file that runs as a Windows Service. In order to overwrite the existing .exe with the new version, I currently need to:</p> <ol> <li>Stop the service</li> <li>Uninstall the service</li> <li>Reboot the system (so Windows releases it's hold on the file)</li> <li>Deploy the new .exe</li> <li>Reinstall the service</li> <li>Start the upgraded service.</li> </ol> <p>I'd like to avoid the reboot, so that this can be a fully scripted/automated upgrade.</p> <p>Is there any way to avoid rebooting? Maybe a command-line tool that will force Windows to give up it's death grip on the old .exe?</p>
[ { "answer_id": 299614, "author": "Jonathan S.", "author_id": 2034, "author_profile": "https://Stackoverflow.com/users/2034", "pm_score": 4, "selected": false, "text": "net stop <service name>\nnet start <service name>\n" }, { "answer_id": 301930, "author": "StingyJack", "...
2008/11/18
[ "https://Stackoverflow.com/questions/299604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38657/" ]
299,606
<p>What is the most direct and/or efficient way to convert a <code>char[]</code> into a <code>CharSequence</code>? </p>
[ { "answer_id": 299609, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 3, "selected": false, "text": "String" }, { "answer_id": 299624, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile":...
2008/11/18
[ "https://Stackoverflow.com/questions/299606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
299,608
<p>In addition to informing the user, we want to collect information for our debugging purposes. Our system is a niche system for only about 1400 customers, and therefore we are not as well-financed as we would hope, so bugs are more common than we would like. We currently have a window that shows the first line of the error message in larger print with a yellow background to draw the user's eye, with the scary part in a textbox below it with a gray background. There is also a button that will put all of it in the copy buffer for sending to customer support. The message that we're trying to go to consists of the exception.Message, the last five parts of the stack trace, and the name of the method that caused the error (Reflection.MethodBase). We are planning to add the ability for the user to say what he was doing at the time, and maybe a radio button indicating how often this happens, and write it to a log file. What other other useful information should we include? </p> <p>We are also considering emailing it to customer support but not stressing if the email fails. There are other considerations with the email - customer support might drown in it, users might object because we'd be sending system info as well, etc.</p> <p>I found two similar questions on SO, but they aren't really focussed on what I'm interested in. <a href="https://stackoverflow.com/questions/117083/error-message-text-best-practices">Error Message Text - Best Practices</a> deals with how to make useful messages for the user, and <a href="https://stackoverflow.com/questions/116542/best-way-to-handle-error-messages">Best way to handle error messages</a> deals with where to keep error IDs vs error text. I'm more interested in debugging (because unfortunately our system DOES have lots of errors).</p>
[ { "answer_id": 299609, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 3, "selected": false, "text": "String" }, { "answer_id": 299624, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile":...
2008/11/18
[ "https://Stackoverflow.com/questions/299608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12897/" ]
299,610
<p>I want to send an array constructed in javascript with the selected values of a multiple select. Is there a way to send this array to a php script using ajax?</p>
[ { "answer_id": 299751, "author": "rmeador", "author_id": 10861, "author_profile": "https://Stackoverflow.com/users/10861", "pm_score": 2, "selected": false, "text": "http://blah.com/test.php?var[]=foo&var[]=bar&var[]=baz" }, { "answer_id": 424060, "author": "Community", "...
2008/11/18
[ "https://Stackoverflow.com/questions/299610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17600/" ]
299,619
<p>I'd like to write a plugin that does something with the currently edited file in Eclipse. But I'm not sure how to properly get the file's full path.</p> <p>This is what I do now:</p> <pre><code>IFile file = (IFile) window.getActivePage().getActiveEditor.getEditorInput(). getAdapter(IFile.class); </code></pre> <p>Now I have an IFile object, and I can retrieve it's path:</p> <pre><code>file.getFullPath().toOSString(); </code></pre> <p>However this still only gives me the path relative to the workspace. How can I get the absolute path from that?</p>
[ { "answer_id": 299633, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 6, "selected": true, "text": "IResource.getRawLocation()" }, { "answer_id": 302689, "author": "Community", "author_id": -1, "au...
2008/11/18
[ "https://Stackoverflow.com/questions/299619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
299,628
<p>When issuing an HTTP DELETE request, the request URI should completely identify the resource to delete. However, is it allowable to add extra meta-data as part of the entity body of the request?</p>
[ { "answer_id": 299696, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 11, "selected": true, "text": "Content-Length" }, { "answer_id": 18141127, "author": "Neil McGuigan", "author_id": 223478, "author_pr...
2008/11/18
[ "https://Stackoverflow.com/questions/299628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/598/" ]
299,659
<p>What's the difference between <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ref/WeakReference.html" rel="noreferrer"><code>java.lang.ref.WeakReference</code></a> and <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ref/SoftReference.html" rel="noreferrer"><code>java.lang.ref.SoftReference</code></a> ?</p>
[ { "answer_id": 299665, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 5, "selected": false, "text": "SoftReference" }, { "answer_id": 299702, "author": "Michael Myers", "author_id": 13531, "a...
2008/11/18
[ "https://Stackoverflow.com/questions/299659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24982/" ]
299,679
<p>In my web app, when a user logs in, I add his Id to a vector of valid Ids in the servlet, when he logs out, I remove his Id from the vector, so I can see how many current users are active, if a user forgets to log out, my servelt generated html has : </p> <pre><code>&lt;meta http-equiv="Refresh" content="30; url=My_Servlet?User_Action=logout&amp;User_Id=1111"&gt; </code></pre> <p>in the tag to automatically log him out.</p> <p>But I've noticed many users are there for ever, never logged out. I found out why, by closing their browsers, they never manually or automatically logged out, so their user Ids will never be removed from the valid user Ids vector.</p> <p>So, my question is : how do I detect users closing their browsers, so my servlet can remove their Ids from the vector ?</p> <hr> <p>I see some light at the end of the tunnel, but there is still a problem, my program has something like this : </p> <p>Active User List :</p> <pre><code>User_1 : Machine_1 [ IP_1 address ] User_2 : Machine_2 [ IP_2 address ] User_3 : Machine_3 [ IP_3 address ] ... </code></pre> <p>How do I know, from the session listener, which user's session has ended and therefore remove him from my list?</p> <p>I was hoping when the session ends, the HttpServlet's <code>destroy()</code> method would be called and I can remove the user Id in there, but it never gets called when user closes his browser, why? And is there any other method in the HttpServlet that gets called when a session closes?</p>
[ { "answer_id": 299697, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 2, "selected": false, "text": "onbeforeclose" }, { "answer_id": 299700, "author": "sblundy", "author_id": 4893, "a...
2008/11/18
[ "https://Stackoverflow.com/questions/299679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32834/" ]
299,695
<p>I'm trying to put in an exception in my web.config so that one page does not require authentication. However, it still redirects to the login page.</p> <p><strong>The question isn't how to setup the web.config</strong>. Why? Our system (for better or worse) has a bunch of instrumentation besides the web.config. We have global.asax and custom HttpHandlers. The code base isn't huge, but there's a lot of potential causes for the redirect.</p> <p>What I do want to know is <strong>how to best determine the cause of the redirect</strong>. Is there some way to find out what code triggered the redirect?</p>
[ { "answer_id": 299713, "author": "Gordon Bell", "author_id": 16473, "author_profile": "https://Stackoverflow.com/users/16473", "pm_score": 0, "selected": false, "text": "<system.web>\n...\n</system.web>\n\n<location path=\"NoAuthNeeded.aspx\">\n <system.web>\n <authorization>\n...
2008/11/18
[ "https://Stackoverflow.com/questions/299695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
299,703
<p>Once it is compiled, is there a difference between:</p> <pre><code>delegate { x = 0; } </code></pre> <p>and</p> <pre><code>() =&gt; { x = 0 } </code></pre> <p>?</p>
[ { "answer_id": 299712, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 8, "selected": true, "text": "Func" }, { "answer_id": 299752, "author": "Olmo", "author_id": 38670, "author_profile": "https://Stackoverf...
2008/11/18
[ "https://Stackoverflow.com/questions/299703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93/" ]
299,704
<p>I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?</p>
[ { "answer_id": 300173, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 5, "selected": false, "text": "doctest.testmod()" }, { "answer_id": 300361, "author": "Michael Kuhn", "author_id": 33996, "author_profile":...
2008/11/18
[ "https://Stackoverflow.com/questions/299704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37804/" ]
299,719
<p>In the Linux kernel, given the <code>task_struct</code>'s <code>mm</code> I can access the process's list of <code>vm_area_struct</code>s. Given these <code>vm_area_struct</code>s, how do I get the <code>struct page</code>s which actually correspond to this vma? </p> <p>I tried looking for functions in mm/memory.c and the like, but I was at a loss.</p> <p>Edit: the idea is to find which pages in the vma are currently in memory and which are not. But I <strong>don't</strong> want someone telling me how to do this bit, as that's a small part of a homework assignment that I need to figure out on my own. But I can't seem to figure out how to find the pages that correspond to this vma. If I can find the pages, I figure I can check to see if they have a valid pfn or not.</p>
[ { "answer_id": 299875, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 1, "selected": false, "text": "get_user_pages()" } ]
2008/11/18
[ "https://Stackoverflow.com/questions/299719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2132/" ]