qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
64,748
<p>How can I poll disk activity in Applescript? Check to see if disk X is being read, written, or idle every N seconds and do something.</p>
[ { "answer_id": 65954, "author": "jackrabbit", "author_id": 3707, "author_profile": "https://Stackoverflow.com/users/3707", "pm_score": 2, "selected": false, "text": "call method" }, { "answer_id": 158032, "author": "Milhous", "author_id": 17712, "author_profile": "htt...
2008/09/15
[ "https://Stackoverflow.com/questions/64748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7216/" ]
64,749
<p>When I run a particular SQL script in Unix environments, I see a '^M' character at the end of each line of the SQL script as it is echoed to the command line.<br /> I don't know on which OS the SQL script was initially created.</p> <p>What is causing this and how do I fix it?</p>
[ { "answer_id": 64788, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 3, "selected": false, "text": "perl -pie 's/\\r//g' filename.txt\n" }, { "answer_id": 64792, "author": "dogbane", "author_id": 7412,...
2008/09/15
[ "https://Stackoverflow.com/questions/64749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7648/" ]
64,759
<p>I have a pdf file of a logo, about 1"x2" in dimension. Can anybody provide the code snippet to import that PDF logo into another PDF file using the <a href="http://framework.zend.com/manual/en/zend.pdf.html" rel="nofollow noreferrer">Zend_PDF</a> API's? </p> <p>Ideally, I'd like to be able to place it like the PNG, TIFF or JPG objects with the Zend_Pdf_Image object. </p> <p>In other words, I want to be able to place the little 1x2" pdf document on top of a 8.5x11" page, not use the original pdf as a background. </p> <p>Thanks!</p>
[ { "answer_id": 75021, "author": "user6824", "author_id": 6824, "author_profile": "https://Stackoverflow.com/users/6824", "pm_score": 2, "selected": false, "text": "$pdf = & new FPDI ('P', 'in', 'Letter' );\n$pagecount = $pdf->setSourceFile ( APP . 'logo.pdf' );\n$tplidx = $pdf->importPag...
2008/09/15
[ "https://Stackoverflow.com/questions/64759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6824/" ]
64,781
<p>I have a web application that receives messages through an HTTP interface, e.g.:</p> <pre><code>http://server/application?source=123&amp;destination=234&amp;text=hello </code></pre> <p>This request contains the ID of the sender, the ID of the recipient and the text of the message.</p> <p>This message should be processed like:</p> <ul> <li>finding the matching User object for both the source and the destination from the database</li> <li>creating a tree of objects: a Message that contains a field for the message text and two User objects for the source and the destination</li> <li>persisting this tree to a database.</li> </ul> <p>The tree will be loaded by other applications that I can't touch.</p> <p>I use Oracle as the backing database and JPA with Toplink for the database handling tasks. If possible, I'd stay with these.</p> <p>Without much optimization I can achieve ~30 requests/sec throughput in my environment. That's not much, I'd require ~300 requests/sec. So I measured where the performance bottleneck is and found that the calls to <code>em.persist()</code> takes most of the time. If I simply comment out that line, the throughput go well over 1000 requests/sec.</p> <p>I tried to write a small test application that used simple JDBC calls to persist 1 million messages to the same database. I used batching, meaning I did 100 inserts then a commit, and repeated until all the records was in the database. I measured ~500 requests/sec throughput in this scenario, that would meet my needs.</p> <p>It is clear that I need to optimize insert performance here. However as I mentioned earlier I would like to keep using JPA and Toplink for this, not pure JDBC.</p> <p>Do you know a way to create batch inserts with JPA and Toplink? Can you recommend any other technique for improving JPA persist performance?</p> <p><strong>ADDITIONAL INFO:</strong></p> <p>"requests/sec" means here: total number of requests / total time from beginning of test to last record written to database.</p> <p>I tried to make the calls to <code>em.persist()</code> asynchronous by creating an in-memory queue between the servlet stuff and the persister. It helped the performance greatly. However the queue did grow really fast and as the application will receive ~200 requests/second continuously, It is not an acceptable solution for me.</p> <p>In this decoupled approach I collected requests for 100 msec and called <code>em.persist()</code> on all collected items before commiting the transaction. The EntityManagerFactory is cached between each transaction.</p>
[ { "answer_id": 66373, "author": "Christian", "author_id": 9817, "author_profile": "https://Stackoverflow.com/users/9817", "pm_score": 3, "selected": true, "text": "uow=sess.acquireUnitOfWork();\nfor (job in batch) {\n thingyCl=uow.registerObject(new Thingy());\n user1Cl=uow.registerObjec...
2008/09/15
[ "https://Stackoverflow.com/questions/64781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/686/" ]
64,782
<pre><code>int i = 4; string text = "Player "; cout &lt;&lt; (text + i); </code></pre> <p>I'd like it to print <code>Player 4</code>.</p> <p>The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?</p>
[ { "answer_id": 64794, "author": "rupello", "author_id": 635, "author_profile": "https://Stackoverflow.com/users/635", "pm_score": 0, "selected": false, "text": "cout << \"Player\" << i ;\n" }, { "answer_id": 64795, "author": "Community", "author_id": -1, "author_profi...
2008/09/15
[ "https://Stackoverflow.com/questions/64782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,786
<p>What is your favorite method to handle errors in Bash? The best example of handling errors I have found on the web was written by William Shotts, Jr at <a href="http://www.linuxcommand.org" rel="noreferrer">http://www.linuxcommand.org</a>. </p> <p>He suggests using the following function for error handling in Bash:</p> <pre><code>#!/bin/bash # A slicker error handling routine # I put a variable in my scripts named PROGNAME which # holds the name of the program being run. You can get this # value from the first item on the command line ($0). # Reference: This was copied from &lt;http://www.linuxcommand.org/wss0150.php&gt; PROGNAME=$(basename $0) function error_exit { # ---------------------------------------------------------------- # Function for exit due to fatal program error # Accepts 1 argument: # string containing descriptive error message # ---------------------------------------------------------------- echo "${PROGNAME}: ${1:-"Unknown Error"}" 1&gt;&amp;2 exit 1 } # Example call of the error_exit function. Note the inclusion # of the LINENO environment variable. It contains the current # line number. echo "Example of error with line number and message" error_exit "$LINENO: An error has occurred." </code></pre> <p>Do you have a better error handling routine that you use in Bash scripts?</p>
[ { "answer_id": 64880, "author": "pjz", "author_id": 8002, "author_profile": "https://Stackoverflow.com/users/8002", "pm_score": 2, "selected": false, "text": "die() {\n echo $1\n kill $$\n}\n" }, { "answer_id": 69808, "author": "Bruno De Fraine", "author_id"...
2008/09/15
[ "https://Stackoverflow.com/questions/64786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,790
<p>I have breakpoints set but Xcode appears to ignore them.</p>
[ { "answer_id": 67957, "author": "pestophagous", "author_id": 10278, "author_profile": "https://Stackoverflow.com/users/10278", "pm_score": 8, "selected": true, "text": "Load Symbols Lazily" }, { "answer_id": 11310391, "author": "brian.clear", "author_id": 181947, "aut...
2008/09/15
[ "https://Stackoverflow.com/questions/64790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8761/" ]
64,808
<p>Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory.</p> <p>How do I do this in Emacs?</p>
[ { "answer_id": 64818, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 2, "selected": false, "text": "Buffers" }, { "answer_id": 64850, "author": "Robᵩ", "author_id": 8747, "author_profile": "https://Stacko...
2008/09/15
[ "https://Stackoverflow.com/questions/64808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8913/" ]
64,813
<p>These days, i came across a problem with Team System Unit Testing. I found that the automatically created accessor class ignores generic constraints - at least in the following case:</p> <p>Assume you have the following class:</p> <pre><code>namespace MyLibrary { public class MyClass { public Nullable&lt;T&gt; MyMethod&lt;T&gt;(string s) where T : struct { return (T)Enum.Parse(typeof(T), s, true); } } } </code></pre> <p>If you want to test MyMethod, you can create a test project with the following test method:</p> <pre><code>public enum TestEnum { Item1, Item2, Item3 } [TestMethod()] public void MyMethodTest() { MyClass c = new MyClass(); PrivateObject po = new PrivateObject(c); MyClass_Accessor target = new MyClass_Accessor(po); // The following line produces the following error: // Unit Test Adapter threw exception: GenericArguments[0], 'T', on // 'System.Nullable`1[T]' violates the constraint of type parameter 'T'.. TestEnum? e1 = target.MyMethod&lt;TestEnum&gt;("item2"); // The following line works great but does not work for testing private methods. TestEnum? e2 = c.MyMethod&lt;TestEnum&gt;("item2"); } </code></pre> <p>Running the test will fail with the error mentioned in the comment of the snippet above. The problem is the accessor class created by Visual Studio. If you go into it, you will come up to the following code:</p> <pre><code>namespace MyLibrary { [Shadowing("MyLibrary.MyClass")] public class MyClass_Accessor : BaseShadow { protected static PrivateType m_privateType; [Shadowing(".ctor@0")] public MyClass_Accessor(); public MyClass_Accessor(PrivateObject __p1); public static PrivateType ShadowedType { get; } public static MyClass_Accessor AttachShadow(object __p1); [Shadowing("MyMethod@1")] public T? MyMethod(string s); } } </code></pre> <p>As you can see, there is no constraint for the generic type parameter of the MyMethod method.</p> <p>Is that a bug? Is that by design? Who knows how to work around that problem?</p>
[ { "answer_id": 168453, "author": "Zachary Yates", "author_id": 8360, "author_profile": "https://Stackoverflow.com/users/8360", "pm_score": 1, "selected": false, "text": "TestEnum? e1 = target.MyMethod(\"item2\");\n" }, { "answer_id": 3570884, "author": "Igor Zevaka", "aut...
2008/09/15
[ "https://Stackoverflow.com/questions/64813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6777/" ]
64,820
<p>ASP.NET 2.0 web application, how to implement shortcut key combination of <kbd>CTRL + Letter</kbd>, preferably through JavaScript, to make web application ergonomically better? How to capture multiple-key keyboard events through JavaScript?</p>
[ { "answer_id": 65212, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 3, "selected": false, "text": "window.onkeyup = function(e) {\n if (e.altKey) alert(\"Alt pressed\");\n if (e.shiftKey) alert(\"Shift pressed\");\n}\n" } ...
2008/09/15
[ "https://Stackoverflow.com/questions/64820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8832/" ]
64,825
<p>Is there a way to substring in JSP files, using struts2 technologies? I mean, struts2 has its own taglib and also uses ognl. How can I get a substring from a stacked value or bean value?</p>
[ { "answer_id": 6848438, "author": "bakoyaro", "author_id": 455020, "author_profile": "https://Stackoverflow.com/users/455020", "pm_score": 1, "selected": false, "text": "fn:substring(YOUR_FIELD, START_INDEX, END_INDEX)\n" }, { "answer_id": 12646878, "author": "Aleksandr M", ...
2008/09/15
[ "https://Stackoverflow.com/questions/64825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,827
<p>I've created a learning application using <a href="http://jimneath.org/2008/09/09/bort-base-rails-application/" rel="noreferrer">Bort</a>, which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anything(<code>before_filter :login_required</code> in the controller). [edit: I should also mention that the user <code>has_many</code> of the new class and only the user should be able to see it.]</p> <p>I've created the new model/controller using Rspec's generators which have created a number of default tests. They all pass if there is no <code>before_filter</code> but several fail, as should be expected, once the <code>before_filter</code> is in place.</p> <p>How do I get the generated tests to run as if there is/is not a logged in user? Do I need a whole batch of matching not logged in - redirect tests? I assume it is some sort of mocking or fixture technique but I am new to RSpec and a bit adrift. Good RSpec tutorial links would also be appreciated.</p>
[ { "answer_id": 65748, "author": "TALlama", "author_id": 5657, "author_profile": "https://Stackoverflow.com/users/5657", "pm_score": 4, "selected": true, "text": "describe" }, { "answer_id": 71633, "author": "srboisvert", "author_id": 6805, "author_profile": "https://S...
2008/09/15
[ "https://Stackoverflow.com/questions/64827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6805/" ]
64,833
<p>I am writing a C# client that calls a web service written in Java (by another person). I have added a web reference to my client and I'm able to call methods in the web service ok.</p> <p>The service was changed to return an array of objects, and the client does not properly parse the returned SOAP message.</p> <pre><code>MyResponse[] MyFunc(string p) class MyResponse { long id; string reason; } </code></pre> <p>When my generated C# proxy calls the web service (using SoapHttpClientProtocol.Invoke), I am expecting a MyResponse[] array with length of 1, ie a single element. What I am getting after the Invoke call is an element with id=0 and reason=null, regardless of what the service actually returns. Using a packet sniffer, I can see that the service is returning what appears to be a legitimate soap message with id and reason set to non-null values.</p> <p>Is there some trick to getting a C# client to call a Java web service that returns someobject[] ? I will work on getting a sanitized demo if necessary.</p> <p><strong>Edit</strong>: This is a web reference via "Add Web Reference...". VS 2005, .NET 3.0.</p>
[ { "answer_id": 66834, "author": "David Chappelle", "author_id": 7475, "author_profile": "https://Stackoverflow.com/users/7475", "pm_score": 3, "selected": false, "text": "<import namespace=\"http://mynamespace.company.com\"/>\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/64833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7475/" ]
64,841
<p>I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look "pretty". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser.</p>
[ { "answer_id": 64942, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 2, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"info.xslt\"?>\n<info>\n <...
2008/09/15
[ "https://Stackoverflow.com/questions/64841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
64,843
<p>I am building a site that uses a simple AJAX Servlet to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site.</p> <p>I have Javascript that creates an XMLHttpRequest for data. The Servlet processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into my ActiveMQ Message Broker. It just sends back dummy data right now.</p> <p>I am thinking the Servelt should implement the messagelistener. Then onMessage send data to the JavaScript page. But I'm not sure how to do this.</p>
[ { "answer_id": 64883, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 0, "selected": false, "text": "Properties props = new Properties();\nprops.setProperty(Context.INITIAL_CONTEXT_FACTORY,\n \"org.apache.activemq.jndi.Ac...
2008/09/15
[ "https://Stackoverflow.com/questions/64843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1992/" ]
64,848
<p>Has anybody used C# to write a sample screen scraper for IBM as400?</p>
[ { "answer_id": 54542089, "author": "Ashetynw", "author_id": 9911023, "author_profile": "https://Stackoverflow.com/users/9911023", "pm_score": 1, "selected": false, "text": "using AutOIATypeLibrary;\nusing AutPSTypeLibrary;\n\nnamespace MyNamespace\n{\n public class Program \n {\n ...
2008/09/15
[ "https://Stackoverflow.com/questions/64848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,851
<p>How would you write (in C/C++) a macro which tests if an integer type (given as a parameter) is signed or unsigned?</p> <pre> #define is_this_type_signed (my_type) ... </pre>
[ { "answer_id": 64908, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 5, "selected": false, "text": "std::numeric_limits<type>::is_signed" }, { "answer_id": 64911, "author": "Fabio Ceconello", "author_id": 8999,...
2008/09/15
[ "https://Stackoverflow.com/questions/64851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4528/" ]
64,860
<p>What is the fastest, easiest tool or method to convert text files between character sets?</p> <p>Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.</p> <p>Everything goes: one-liners in your favorite scripting language, command-line tools or other utilities for OS, web sites, etc.</p> <h2>Best solutions so far:</h2> <p>On Linux/UNIX/OS X/cygwin:</p> <ul> <li><p>Gnu <a href="http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html" rel="noreferrer">iconv</a> suggested by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64889">Troels Arvin</a> is best used <strong>as a filter</strong>. It seems to be universally available. Example:</p> <pre><code> $ iconv -f UTF-8 -t ISO-8859-15 in.txt &gt; out.txt </code></pre> <p>As pointed out by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64991">Ben</a>, there is an <a href="http://www.iconv.com/iconv.htm" rel="noreferrer">online converter using iconv</a>.</p> </li> <li><p><a href="https://github.com/rrthomas/recode/" rel="noreferrer">recode</a> (<a href="http://www.informatik.uni-hamburg.de/RZ/software/gnu/utilities/recode_toc.html" rel="noreferrer">manual</a>) suggested by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64888">Cheekysoft</a> will convert <strong>one or several files in-place</strong>. Example:</p> <pre><code> $ recode UTF8..ISO-8859-15 in.txt </code></pre> <p>This one uses shorter aliases:</p> <pre><code> $ recode utf8..l9 in.txt </code></pre> <p>Recode also supports <em>surfaces</em> which can be used to convert between different line ending types and encodings:</p> <p>Convert newlines from LF (Unix) to CR-LF (DOS):</p> <pre><code> $ recode ../CR-LF in.txt </code></pre> <p>Base64 encode file:</p> <pre><code> $ recode ../Base64 in.txt </code></pre> <p>You can also combine them.</p> <p>Convert a Base64 encoded UTF8 file with Unix line endings to Base64 encoded Latin 1 file with Dos line endings:</p> <pre><code> $ recode utf8/Base64..l1/CR-LF/Base64 file.txt </code></pre> </li> </ul> <p>On Windows with <a href="https://learn.microsoft.com/en-us/powershell/" rel="noreferrer">Powershell</a> (<a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64937">Jay Bazuzi</a>):</p> <ul> <li><code>PS C:\&gt; gc -en utf8 in.txt | Out-File -en ascii out.txt</code></li> </ul> <p>(No ISO-8859-15 support though; it says that supported charsets are unicode, utf7, utf8, utf32, ascii, bigendianunicode, default, and oem.)</p> <h2>Edit</h2> <p>Do you mean iso-8859-1 support? Using &quot;String&quot; does this e.g. for vice versa</p> <pre><code>gc -en string in.txt | Out-File -en utf8 out.txt </code></pre> <p>Note: The possible enumeration values are &quot;Unknown, String, Unicode, Byte, BigEndianUnicode, UTF8, UTF7, Ascii&quot;.</p> <ul> <li>CsCvt - <a href="http://www.cscvt.de" rel="noreferrer">Kalytta's Character Set Converter</a> is another great command line based conversion tool for Windows.</li> </ul>
[ { "answer_id": 64878, "author": "Daniel Papasian", "author_id": 7548, "author_profile": "https://Stackoverflow.com/users/7548", "pm_score": 5, "selected": false, "text": "iconv -f FROM-ENCODING -t TO-ENCODING file.txt\n" }, { "answer_id": 64889, "author": "Troels Arvin", ...
2008/09/15
[ "https://Stackoverflow.com/questions/64860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2948/" ]
64,881
<p>During the load of my cocoa application, my program crashes with the messsage EXC_BAD_ACCESS. The stack trace is not helpful. Any clues to how I can find the problem?</p>
[ { "answer_id": 64938, "author": "AlanKley", "author_id": 8761, "author_profile": "https://Stackoverflow.com/users/8761", "pm_score": -1, "selected": false, "text": "#0 0x90a594c7 in objc_msgSend\n#1 0xbffff7b8 in ??\n#2 0x932899d8 in loadNib\n#3 0x932893d9 in +[NSBundle(NSNib...
2008/09/15
[ "https://Stackoverflow.com/questions/64881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8761/" ]
64,894
<p>Is it possible to select from <code>show tables</code> in MySQL?</p> <pre><code>SELECT * FROM (SHOW TABLES) AS `my_tables` </code></pre> <p>Something along these lines, though the above does not work (on 5.0.51a, at least).</p>
[ { "answer_id": 64918, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "SELECT ic.Table_Name,\n ic.Column_Name,\n ic.data_Type,\n IFNULL(Character_Maximum_Length,'') AS `Max`,\n ic.Numeri...
2008/09/15
[ "https://Stackoverflow.com/questions/64894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,904
<p>I need to support exact phrases (enclosed in quotes) in an otherwise space-separated list of terms. Thus splitting the respective string by the space-character is not sufficient anymore.</p> <p>Example:</p> <pre><code>input : 'foo bar "lorem ipsum" baz' output: ['foo', 'bar', 'lorem ipsum', 'baz'] </code></pre> <p>I wonder whether this could be achieved with a single RegEx, rather than performing complex parsing or split-and-rejoin operations.</p> <p>Any help would be greatly appreciated!</p>
[ { "answer_id": 65033, "author": "shyam", "author_id": 7616, "author_profile": "https://Stackoverflow.com/users/7616", "pm_score": 1, "selected": false, "text": "'foo bar \"lorem ipsum\" baz'.match(/\"[^\"]*\"|\\w+/g);\n" }, { "answer_id": 65085, "author": "A Nony Mouse", ...
2008/09/15
[ "https://Stackoverflow.com/questions/64904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
64,958
<p>Yacc does not permit objects to be passed around. Because the %union can only contain POD types, complex objects must be new'd and passed around by pointer. If a syntax error occurs, the yacc parser just stops running, and references to all of those created objects are lost.</p> <p>The only solution I've come up with is that all new'd object inherit a particular base class, be added to a container when allocated, and if there is an error everything in that container can be deleted.</p> <p>Does anyone know of any better yacc tricks to solve this problem?</p> <p>Please don't tell me to choose a different parser.</p>
[ { "answer_id": 65424, "author": "Michael L Perry", "author_id": 7668, "author_profile": "https://Stackoverflow.com/users/7668", "pm_score": 3, "selected": true, "text": "class IExpressionOwner\n{\npublic:\n virtual ExpressionAdd *newExpressionAdd() = 0;\n virtual ExpressionSubstrac...
2008/09/15
[ "https://Stackoverflow.com/questions/64958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8566/" ]
64,977
<p>How do you create SQL Server 2005 stored procedure templates in SQL Server 2005 Management Studio?</p>
[ { "answer_id": 64997, "author": "Chris Woodruff", "author_id": 7001, "author_profile": "https://Stackoverflow.com/users/7001", "pm_score": 5, "selected": true, "text": "-- ======================================================\n-- Create basic stored procedure template with TRY CATCH\n--...
2008/09/15
[ "https://Stackoverflow.com/questions/64977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7001/" ]
64,981
<p>How do I create a unique constraint on an existing table in SQL Server 2005?</p> <p>I am looking for both the TSQL and how to do it in the Database Diagram.</p>
[ { "answer_id": 65003, "author": "Ivan Bosnic", "author_id": 3221, "author_profile": "https://Stackoverflow.com/users/3221", "pm_score": 4, "selected": false, "text": "ALTER TABLE dbo.<tablename> ADD CONSTRAINT\n <namingconventionconstraint> UNIQUE NONCLUSTERED\n (\n ...
2008/09/15
[ "https://Stackoverflow.com/questions/64981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469/" ]
64,989
<p>What could be the cause of JVM thread dumps that show threads waiting to lock on a monitor, but the monitors do not have corresponding locking threads? </p> <p>Java 1.5_14 on Windows 2003</p>
[ { "answer_id": 79671, "author": "tgdavies", "author_id": 11002, "author_profile": "https://Stackoverflow.com/users/11002", "pm_score": 1, "selected": false, "text": "-verbose:gc with -XX:+PrintGCDetails" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/64989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8530/" ]
64,992
<p>I'm working with a support person who is supposed to be able to install SSL certs on a web server he maintains. He has local admin rights to the server via a domain security group. He also has permissions on our internal CA running Windows 2003 Server Certificate Authority: "Request cert" and "Issue and Manage certs".</p> <p>The server he's working with is running Windows 2000 SP4 / IIS 5. When he attempts to create an online server cert the IIS wizard ends with "Failed to install. Access is Denied.". The event viewer is not working properly, so I can't find any details there. I suspect the permission issue is locally and not with the CA.</p> <p>My account is a domain admin account and I know I am able to do this operation, however I need to make this work for others that are not domain admins.</p> <p>Any ideas why he can't perform this operation?</p>
[ { "answer_id": 65542, "author": "JWHEAT", "author_id": 7079, "author_profile": "https://Stackoverflow.com/users/7079", "pm_score": 3, "selected": false, "text": "\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\MachineKeys\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/64992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3347/" ]
65,001
<p>What sort of database schema would you use to store email messages, with as much header information as practical/possible, into a database?</p> <p>Assume that they have been fed into a script from the MTA and parsed into the relevant headers/body/attachments.</p> <p>Would you store the message body whole in the database table, or split any MIME-parts apart? What about attachments?</p>
[ { "answer_id": 4149301, "author": "Gareth Rees", "author_id": 68063, "author_profile": "https://Stackoverflow.com/users/68063", "pm_score": 2, "selected": false, "text": "In-Reply-To" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216/" ]
65,008
<p>I am experimenting with using the FaultException and FaultException&lt;T&gt; to determine the best usage pattern in our applications. We need to support WCF as well as non-WCF service consumers/clients, including SOAP 1.1 and SOAP 1.2 clients.</p> <p>FYI: using FaultExceptions with wsHttpBinding results in SOAP 1.2 semantics whereas using FaultExceptions with basicHttpBinding results in SOAP 1.1 semantics. </p> <p>I am using the following code to throw a FaultException&lt;FaultDetails&gt;:</p> <pre><code> throw new FaultException&lt;FaultDetails&gt;( new FaultDetails("Throwing FaultException&lt;FaultDetails&gt;."), new FaultReason("Testing fault exceptions."), FaultCode.CreateSenderFaultCode(new FaultCode("MySubFaultCode")) ); </code></pre> <p>The FaultDetails class is just a simple test class that contains a string "Message" property as you can see below.</p> <p>When using wsHttpBinding the response is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;Fault xmlns="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;Code&gt; &lt;Value&gt;Sender&lt;/Value&gt; &lt;Subcode&gt; &lt;Value&gt;MySubFaultCode&lt;/Value&gt; &lt;/Subcode&gt; &lt;/Code&gt; &lt;Reason&gt; &lt;Text xml:lang="en-US"&gt;Testing fault exceptions.&lt;/Text&gt; &lt;/Reason&gt; &lt;Detail&gt; &lt;FaultDetails xmlns="http://schemas.datacontract.org/2004/07/ClassLibrary" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;Message&gt;Throwing FaultException&amp;lt;FaultDetails&amp;gt;.&lt;/Message&gt; &lt;/FaultDetails&gt; &lt;/Detail&gt; </code></pre> <p></p> <p>This looks right according to the SOAP 1.2 specs. The main/root “Code” is “Sender”, which has a “Subcode” of “MySubFaultCode”. If the service consumer/client is using WCF the FaultException on the client side also mimics the same structure, with the faultException.Code.Name being “Sender” and faultException.Code.SubCode.Name being “MySubFaultCode”.</p> <p>When using basicHttpBinding the response is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;s:Fault xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;faultcode&gt;s:MySubFaultCode&lt;/faultcode&gt; &lt;faultstring xml:lang="en-US"&gt;Testing fault exceptions.&lt;/faultstring&gt; &lt;detail&gt; &lt;FaultDetails xmlns="http://schemas.datacontract.org/2004/07/ClassLibrary" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;Message&gt;Throwing FaultException&amp;lt;FaultDetails&amp;gt;.&lt;/Message&gt; &lt;/FaultDetails&gt; &lt;/detail&gt; &lt;/s:Fault&gt; </code></pre> <p>This does not look right. Looking at the SOAP 1.1 specs, I was expecting to see the “faultcode” to have a value of “s:Client.MySubFaultCode” when I use FaultCode.CreateSenderFaultCode(new FaultCode("MySubFaultCode")). Also a WCF client gets an incorrect structure. The faultException.Code.Name is “MySubFaultCode” instead of being “Sender”, and the faultException.Code.SubCode is null instead of faultException.Code.SubCode.Name being “MySubFaultCode”. Also, the faultException.Code.IsSenderFault is false.</p> <p>Similar problem when using FaultCode.CreateReceiverFaultCode(new FaultCode("MySubFaultCode")):</p> <ul> <li>works as expected for SOAP 1.2</li> <li>generates “s:MySubFaultCode” instead of “s:Server.MySubFaultCode” and the faultException.Code.IsReceiverFault is false for SOAP 1.1</li> </ul> <p>This item was also posted by someone else on <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=669420&amp;SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=669420&amp;SiteID=1</a> in 2006 and no one has answered it. I find it very hard to believe that no one has run into this, yet. </p> <p>Here is someone else having a similar problem: <a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3883110&amp;SiteID=1&amp;mode=1" rel="nofollow noreferrer">http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3883110&amp;SiteID=1&amp;mode=1</a></p> <p>Microsoft Connect bug: <a href="https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=367963" rel="nofollow noreferrer">https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=367963</a></p> <p>Description of how faults should work: <a href="http://blogs.msdn.com/drnick/archive/2006/12/19/creating-faults-part-3.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/drnick/archive/2006/12/19/creating-faults-part-3.aspx</a></p> <p>Am I doing something wrong or is this truly a bug in WCF?</p>
[ { "answer_id": 69390, "author": "wojo", "author_id": 9022, "author_profile": "https://Stackoverflow.com/users/9022", "pm_score": 4, "selected": true, "text": " /// <summary>\n /// Replacement for the static methods on FaultCode to generate Sender and Receiver fault codes due\n /...
2008/09/15
[ "https://Stackoverflow.com/questions/65008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9022/" ]
65,034
<p>How would I remove the border from an iframe embedded in my web app? An example of the iframe is:</p> <pre><code>&lt;iframe src="myURL" width="300" height="300"&gt;Browser not compatible.&lt;/iframe&gt; </code></pre> <p>I would like the transition from the content on my page to the contents of the iframe to be seamless, assuming the background colors are consistent. The target browser is IE6 only and unfortunately solutions for others will not help.</p>
[ { "answer_id": 65052, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 11, "selected": true, "text": "frameBorder" }, { "answer_id": 65126, "author": "xenox", "author_id": 8952, "author_profile": "http...
2008/09/15
[ "https://Stackoverflow.com/questions/65034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2650/" ]
65,035
<p>Considering this code, can I be <em>absolutely sure</em> that the <code>finally</code> block always executes, no matter what <code>something()</code> is?</p> <pre><code>try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println("I don't know if this will get printed out"); } </code></pre>
[ { "answer_id": 65049, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 13, "selected": true, "text": "finally" }, { "answer_id": 65185, "author": "Kevin", "author_id": 1058366, "author_profile": "https://S...
2008/09/15
[ "https://Stackoverflow.com/questions/65035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/885027/" ]
65,037
<p>As far as I know, in gcc you can write something like:</p> <pre><code>#define DBGPRINT(fmt...) printf(fmt); </code></pre> <p>Is there a way to do that in VC++?</p>
[ { "answer_id": 65067, "author": "kfh", "author_id": 6597, "author_profile": "https://Stackoverflow.com/users/6597", "pm_score": -1, "selected": false, "text": "#define DBGPRINT(DBGPRINT_ARGS) printf DBGPRINT_ARGS // note: do not use '(' & ')'\n" }, { "answer_id": 65077, "auth...
2008/09/15
[ "https://Stackoverflow.com/questions/65037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9102/" ]
65,039
<p>I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional HTML IDs in the code. </p> <p>There is heavy use of <code>CssClass='&amp;hellip;'</code>, or sometimes just <code>class='&amp;hellip;'</code>, but I can't seem to find a way to say id='&hellip;' and not have it swapped out by the server.</p> <p>Here is an example:</p> <pre><code>&lt;span id='position_title' runat='server'&gt;Manager&lt;/span&gt; </code></pre> <p>When the response comes back from the server, I get:</p> <pre><code>&lt;span id='$aspnet$crap$here$position_title'&gt;Manager&lt;/span&gt;</code></pre> <p>Any help here?</p>
[ { "answer_id": 65082, "author": "David Thibault", "author_id": 5903, "author_profile": "https://Stackoverflow.com/users/5903", "pm_score": 3, "selected": false, "text": "<script type=\"text/javascript\">\n var theSpan = document.getElementById('<%= position_title.ClientID %>');\n</scr...
2008/09/15
[ "https://Stackoverflow.com/questions/65039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,060
<p>If i have a simple named query defined, the preforms a count function, on one column:</p> <pre><code> &lt;query name="Activity.GetAllMiles"&gt; &lt;![CDATA[ select sum(Distance) from Activity ]]&gt; &lt;/query&gt; </code></pre> <p>How do I get the result of a sum or any query that dont return of one the mapped entities, with NHibernate using Either IQuery or ICriteria?</p> <p>Here is my attempt (im unable to test it right now), would this work?</p> <pre><code> public decimal Find(String namedQuery) { using (ISession session = NHibernateHelper.OpenSession()) { IQuery query = session.GetNamedQuery(namedQuery); return query.UniqueResult&lt;decimal&gt;(); } } </code></pre>
[ { "answer_id": 67675, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 2, "selected": false, "text": "var session = GetSession();\nvar criteria = session.CreateCriteria(typeof(Order))\n .Add(Restrictions.Eq(\"Prod...
2008/09/15
[ "https://Stackoverflow.com/questions/65060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
65,071
<p>Is there a performant equivalent to the isnull function for DB2?</p> <p>Imagine some of our products are internal, so they don't have names:</p> <pre><code>Select product.id, isnull(product.name, "Internal) From product </code></pre> <p>Might return:</p> <pre><code>1 Socks 2 Shoes 3 Internal 4 Pants </code></pre>
[ { "answer_id": 65111, "author": "Chris Shaffer", "author_id": 6744, "author_profile": "https://Stackoverflow.com/users/6744", "pm_score": 2, "selected": false, "text": "\nSELECT Product.ID, COALESCE(product.Name, \"Internal\") AS ProductName\nFROM Product\n" }, { "answer_id": 163...
2008/09/15
[ "https://Stackoverflow.com/questions/65071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9056/" ]
65,074
<p>I've just started writing unit tests for a legacy code module with large physical dependencies using the #include directive. I've been dealing with them a few ways that felt overly tedious (providing empty headers to break long #include dependency lists, and using #define to prevent classes from being compiled) and was looking for some better strategies for handling these problems.</p> <p>I've been frequently running into the problem of duplicating almost every header file with a blank version in order to separate the class I'm testing in it's entirety, and then writing substantial stub/mock/fake code for objects that will need to be replaced since they're now undefined.</p> <p>Anyone know some better practices?</p>
[ { "answer_id": 65923, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 4, "selected": true, "text": "#include \"TestHarness.h\"\n#include \"Scheduler.h\"\nTEST(create, Scheduler) // your fave C++ test framework macro\n{\n Sc...
2008/09/15
[ "https://Stackoverflow.com/questions/65074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8908/" ]
65,076
<p>I've trouble setting up Vim (7.1.xxx) for editing Python files (*.py). Indenting seems to be broken (optimal 4 spaces). I've followed some tutorials I found via Google. Still no effect :/ Please help.</p>
[ { "answer_id": 65122, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https://Stackoverflow.com/users/2260", "pm_score": 6, "selected": false, "text": "\" configure expanding of tabs for various file types\nau BufRead,BufNewFile *.py set expandtab\nau BufRead,BufNewFile *...
2008/09/15
[ "https://Stackoverflow.com/questions/65076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9099/" ]
65,091
<p>I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting &amp; setting.</p> <p>For example (where Foo is a PHP class of my making):</p> <pre><code>$foo = new Foo(); $foo['fooKey'] = 'foo value'; echo $foo['fooKey']; </code></pre> <p>I know that PHP has the _get and _set magic methods but those don't let you use array notation to access items. Python handles it by overloading __getitem__ and __setitem__.</p> <p>Is there a way to do this in PHP? If it makes a difference, I'm running PHP 5.2.</p>
[ { "answer_id": 65136, "author": "Mat Mannion", "author_id": 6282, "author_profile": "https://Stackoverflow.com/users/6282", "pm_score": 6, "selected": true, "text": "ArrayObject" }, { "answer_id": 5986293, "author": "Ron Cemer", "author_id": 751626, "author_profile": ...
2008/09/15
[ "https://Stackoverflow.com/questions/65091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
65,095
<p>What are the common algorithms being used to measure the processor frequency?</p>
[ { "answer_id": 65159, "author": "Todd Gamblin", "author_id": 9122, "author_profile": "https://Stackoverflow.com/users/9122", "pm_score": 0, "selected": false, "text": "> cat /proc/cpuinfo\n" }, { "answer_id": 65369, "author": "Nathan Fellman", "author_id": 1084, "auth...
2008/09/15
[ "https://Stackoverflow.com/questions/65095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,128
<p>I have a huge ear that uses log4j and there is a single config file that is used to set it up. In this config file there is no mention of certain log files but, additional files apart from those specified in the config file get generated in the logs folder. I've searched for other combinations of (logger|log4j|log).(properties|xml) and haven't found anything promising in all of the jar files included in the ear. How do I track down which is the offending thread/class that is creating these extra files?</p>
[ { "answer_id": 65957, "author": "James A. N. Stauffer", "author_id": 6770, "author_profile": "https://Stackoverflow.com/users/6770", "pm_score": 2, "selected": false, "text": "-Dlog4j.debug" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7616/" ]
65,129
<p>We are planning to use the jQuery library to augment our client side JavaScript needs. </p> <p>Are there any major issues in trying to use both ASP.Net AJAX and jQuery? Both libraries seem to use $ for special purposes. Are there any conflicts that we need to be aware of? </p> <p>We also use Telerik controls that use ASP.Net AJAX.</p> <p>TIA</p>
[ { "answer_id": 67754, "author": "Chris James", "author_id": 3193, "author_profile": "https://Stackoverflow.com/users/3193", "pm_score": 1, "selected": false, "text": "<input type=\"text\" id=\"whatever\" />\n" }, { "answer_id": 67907, "author": "gregmac", "author_id": 791...
2008/09/15
[ "https://Stackoverflow.com/questions/65129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3635/" ]
65,133
<p>I'm running into a perplexing problem with an ActiveX control I'm writing - sometimes, Internet Explorer appears to fail to properly unload the control on process shutdown. This results in the control instance's destructor not being called.</p> <p>The control is written in C++, uses ATL and it's compiled using Visual Studio 2005. The control instance's destructor is always called when the user browses away from the page the control is embedded in - the problem only occurs when the browser is closed. </p> <p>When I run IE under a debugger, I don't see anything unusual - the debugger doesn't catch any exceptions, access violations or assertion failures, but the problem is still there - I can set a breakpoint in the control's destructor and it's never hit when I close the broswer.</p> <p>In addition, when I load a simple HTML page that embeds multiple instances of the control I don't see the problem. The problem only appears to happen when the control is instantiated from our web application, which inserts tags dynamically into the web page - of course, not knowing what causes this problem, I don't know whether this bit of information is relevant or not, but it does seem to indicate that this might be an IE problem, since it's data dependent. </p> <p>When I run the simple test case under the debugger, I can set a breakpoint in the control's destructor and it's hit every time. I believe this rules out a problem with the control itself (say, an error that would prevent the destructor from ever being called, like an interface leak.)</p> <p>I do most of my testing with IE 6, but I've seen the problem occur on IE 7, as well. I haven't tested IE 8.</p> <p>My working hypothesis right now is that there's something in the dynamic HTML code that causes the browser to leak an interface on the ActiveX control. So far, I haven't been able to produce a good test case that reproduces this outside of the application, and the application is a bit too large to make a good test case.</p> <p>I was hoping that someone might be able to provide insight into possible IE bugs that are known to cause this kind of behavior. The answer provided below, by the way, is too general - I'm looking for a specific set of circumstances that is known to cause this. Surely someone out there has seen this before.</p>
[ { "answer_id": 165477, "author": "Bruce", "author_id": 6310, "author_profile": "https://Stackoverflow.com/users/6310", "pm_score": 0, "selected": false, "text": "BOOL WINAPI DllMain(HINSTANCE, DWORD dwReason, LPVOID) {\n if (dwReason == DLL_PROCESS_DETACH) {\n CleanUpAnyObjects...
2008/09/15
[ "https://Stackoverflow.com/questions/65133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9047/" ]
65,164
<p>Some 4 years back, I followed this <a href="http://msdn.microsoft.com/en-us/library/ms973825.aspx" rel="noreferrer">MSDN article</a> for DateTime usage best practices for building a .Net client on .Net 1.1 and ASMX web services (with SQL 2000 server as the backend). I still remember the serialization issues I had with DateTime and the testing effort it took for servers in different time zones.</p> <p>My questions is this: Is there a similar best practices document for some of the new technologies like WCF and SQL server 2008, especially with the addition of new datetime types for storing time zone aware info.</p> <p>This is the environment:</p> <ol> <li>SQL server 2008 on Pacific Time.</li> <li>Web Services layer on a different time zone.</li> <li>Clients could be using .Net 2.0 or .Net 3.5 on different time zones. If it makes it easy, we can force everyone to upgrade to .Net 3.5. :)</li> </ol> <p>Any good suggestions/best practices for the data types to be used in each layer?</p>
[ { "answer_id": 65474, "author": "Jesse C. Slicer", "author_id": 3312, "author_profile": "https://Stackoverflow.com/users/3312", "pm_score": 2, "selected": false, "text": "[Serializable]\npublic sealed class MyDateTime\n{\n public MyDateTime()\n {\n this.Now = DateTime.Now;\n...
2008/09/15
[ "https://Stackoverflow.com/questions/65164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4337/" ]
65,170
<p>What's the easiest way to get the filename associated with an open HANDLE in Win32?</p>
[ { "answer_id": 65254, "author": "Taylor Price", "author_id": 3805, "author_profile": "https://Stackoverflow.com/users/3805", "pm_score": 2, "selected": false, "text": "GetFileInformationByHandleEx( fileHandle, FILE_NAME_INFO, lpFileInformation, sizeof(FILE_NAME_INFO));\n" }, { "a...
2008/09/15
[ "https://Stackoverflow.com/questions/65170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4842/" ]
65,173
<p>I'm trying to run PHP from the command line under <a href="https://en.wikipedia.org/wiki/Windows_XP" rel="nofollow noreferrer">Windows XP</a>.</p> <p>That works, except for the fact that I am not able to provide parameters to my PHP script.</p> <p>My test case:</p> <pre><code>echo &quot;param = &quot; . $param . &quot;\n&quot;; var_dump($argv); </code></pre> <p>I want to call this as:</p> <pre><code>php.exe -f test.php -- param=test </code></pre> <p>But I never get the script to accept my parameter.</p> <p>The result I get from the above script:</p> <blockquote> <p>PHP Notice: Undefined variable: param in C:\test.php on line 2</p> </blockquote> <pre><code>param = '' array(2) { [0]=&gt; string(8) &quot;test.php&quot; [1]=&gt; string(10) &quot;param=test&quot; } </code></pre> <p>I am trying this using PHP 5.2.6. Is this a bug in PHP 5?</p> <p>The parameter passing is handled in the <a href="http://us3.php.net/features.commandline" rel="nofollow noreferrer">online help</a>:</p> <blockquote> <p>Note: If you need to pass arguments to your scripts you need to pass -- as the first argument when using the -f switch.</p> </blockquote> <p>This seemed to be working under PHP 4, but not under PHP 5.</p> <p>Under PHP 4 I could use the same script that could run on the server without alteration on the command line. This is handy for local debugging, for example, saving the output in a file, to be studied.</p>
[ { "answer_id": 65269, "author": "Ben", "author_id": 5005, "author_profile": "https://Stackoverflow.com/users/5005", "pm_score": 0, "selected": false, "text": "$tmp = $argv[1]; // $tmp=\"param=test\"\n$tmp = explode(\"=\", $tmp); // $tmp=Array( 0 => param, 1 => test)\n\n$par...
2008/09/15
[ "https://Stackoverflow.com/questions/65173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,200
<p>I was reading a book on programming skills wherein the author asks the interviewee, "How do you crash a JVM?" I thought that you could do so by writing an infinite for-loop that would eventually use up all the memory.</p> <p>Anybody has any idea?</p>
[ { "answer_id": 65290, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 0, "selected": false, "text": "public static void main(String[] args) {\n causeStackOverflow();\n}\n\npublic void causeStackOverflow() {\n causeStack...
2008/09/15
[ "https://Stackoverflow.com/questions/65200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9195/" ]
65,205
<p>What's the best way to store a linked list in a MySQL database so that inserts are simple (i.e. you don't have to re-index a bunch of stuff every time) and such that the list can easily be pulled out in order?</p>
[ { "answer_id": 65238, "author": "Adrian Dunston", "author_id": 8344, "author_profile": "https://Stackoverflow.com/users/8344", "pm_score": 5, "selected": true, "text": " alter table linked_list add column position integer not null default 0;\n alter table linked_list add index position_i...
2008/09/15
[ "https://Stackoverflow.com/questions/65205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,206
<p>Using <a href="http://en.wikipedia.org/wiki/JQuery" rel="noreferrer">jQuery</a>, how can I dynamically set the size attribute of a select box?</p> <p>I would like to include it in this code:</p> <pre><code>$("#mySelect").bind("click", function() { $("#myOtherSelect").children().remove(); var options = '' ; for (var i = 0; i &lt; myArray[this.value].length; i++) { options += '&lt;option value="' + myArray[this.value][i] + '"&gt;' + myArray[this.value][i] + '&lt;/option&gt;'; } $("#myOtherSelect").html(options).attr [... use myArray[this.value].length here ...]; }); }); </code></pre>
[ { "answer_id": 65239, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": 6, "selected": true, "text": "$('#mySelect').attr('size', value)\n" }, { "answer_id": 65261, "author": "Community", "author_id": -1, ...
2008/09/15
[ "https://Stackoverflow.com/questions/65206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
65,209
<p>I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers.</p> <p>I would love to stay with PHP for this, but I am open to Python or Perl as well.</p> <p>Any ideas would be greatly appreciated.</p>
[ { "answer_id": 65239, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": 6, "selected": true, "text": "$('#mySelect').attr('size', value)\n" }, { "answer_id": 65261, "author": "Community", "author_id": -1, ...
2008/09/15
[ "https://Stackoverflow.com/questions/65209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9176/" ]
65,250
<p>Convert a .doc or .pdf to an image and display a thumbnail in Ruby?<br> Does anyone know how to generate document thumbnails in Ruby (or C, python...)</p>
[ { "answer_id": 69015, "author": "Federico Builes", "author_id": 161, "author_profile": "https://Stackoverflow.com/users/161", "pm_score": 0, "selected": false, "text": "´convert -size 300x300 doc.pdf doc.png´\n" }, { "answer_id": 69804, "author": "tomafro", "author_id": 7...
2008/09/15
[ "https://Stackoverflow.com/questions/65250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,266
<p>Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory.</p> <pre><code>a = re.compile("a.*b") b = re.compile("c.*d") ... </code></pre> <p>Question: Is it possible to store these regular expressions in a cache on disk in a pre-compiled manner to avoid having to execute the regex compilations on each import?</p> <p>Pickling the object simply does the following, causing compilation to happen anyway:</p> <pre><code>&gt;&gt;&gt; import pickle &gt;&gt;&gt; import re &gt;&gt;&gt; x = re.compile(".*") &gt;&gt;&gt; pickle.dumps(x) "cre\n_compile\np0\n(S'.*'\np1\nI0\ntp2\nRp3\n." </code></pre> <p>And <code>re</code> objects are unmarshallable:</p> <pre><code>&gt;&gt;&gt; import marshal &gt;&gt;&gt; import re &gt;&gt;&gt; x = re.compile(".*") &gt;&gt;&gt; marshal.dumps(x) Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; ValueError: unmarshallable object </code></pre>
[ { "answer_id": 65440, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 5, "selected": true, "text": "sre" }, { "answer_id": 65844, "author": "Pat Notz", "author_id": 825, "author_profile": "https://Sta...
2008/09/15
[ "https://Stackoverflow.com/questions/65266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9241/" ]
65,268
<p>I have a sample held in a buffer from DirectX. It's a sample of a note played and captured from an instrument. How do I analyse the frequency of the sample (like a guitar tuner does)? I believe FFTs are involved, but I have no pointers to HOWTOs.</p>
[ { "answer_id": 77946, "author": "AShelly", "author_id": 10396, "author_profile": "https://Stackoverflow.com/users/10396", "pm_score": 2, "selected": false, "text": "FFT(N, input, output);\nmax = max_i = 0;\nfor(i=0;i<N;i++)\n if (output[i]>max) max_i = i;\nroot = S/2.0 * max_i/N ;\n" ...
2008/09/15
[ "https://Stackoverflow.com/questions/65268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,310
<p>I am using Apache Axis to connect my Java app to a web server. I used wsdl2java to create the stubs for me, but when I try to use the stubs, I get the following exception:</p> <blockquote> <p>org.apache.axis.ConfigurationException: No service named <code>&lt;web service name&gt;</code> is available</p> </blockquote> <p>any idea?</p>
[ { "answer_id": 65575, "author": "ScArcher2", "author_id": 1310, "author_profile": "https://Stackoverflow.com/users/1310", "pm_score": 0, "selected": false, "text": "SomeServiceLocator locator = new SomeServiceLocator();\nSomeService service = null;\ntry\n{\n service = locator.getSomeS...
2008/09/15
[ "https://Stackoverflow.com/questions/65310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2328/" ]
65,351
<p>I have a generic method defined like this:</p> <pre><code>public void MyMethod&lt;T&gt;(T myArgument) </code></pre> <p>The first thing I want to do is check if the value of myArgument is the default value for that type, something like this:</p> <pre><code>if (myArgument == default(T)) </code></pre> <p>But this doesn't compile because I haven't guaranteed that T will implement the == operator. So I switched the code to this:</p> <pre><code>if (myArgument.Equals(default(T))) </code></pre> <p>Now this compiles, but will fail if myArgument is null, which is part of what I'm testing for. I can add an explicit null check like this:</p> <pre><code>if (myArgument == null || myArgument.Equals(default(T))) </code></pre> <p>Now this feels redundant to me. ReSharper is even suggesting that I change the myArgument == null part into myArgument == default(T) which is where I started. Is there a better way to solve this problem?</p> <p>I need to support <b>both</b> references types and value types.</p>
[ { "answer_id": 65423, "author": "Eric Schoonover", "author_id": 3957, "author_profile": "https://Stackoverflow.com/users/3957", "pm_score": 5, "selected": false, "text": "public class Test<T> where T : Exception\n" }, { "answer_id": 65445, "author": "Kent Boogaart", "auth...
2008/09/15
[ "https://Stackoverflow.com/questions/65351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8739/" ]
65,364
<p>I've created a seperate assembly with a class that is intended to be published through wmi. Then I've created a windows forms app that references that assembly and attempts to publish the class. When I try to publish the class, I get an exception of type System.Management.Instrumentation.WmiProviderInstallationException. The message of the exception says "Exception of type 'System.Management.Instrumentation.WMIInfraException' was thrown.". I have no idea what this means. I've tried .Net2.0 and .Net3.5 (sp1 too) and get the same results.</p> <p>Below is my wmi class, followed by the code I used to publish it.</p> <pre><code>//Interface.cs in assembly WMI.Interface.dll using System; using System.Collections.Generic; using System.Text; [assembly: System.Management.Instrumentation.WmiConfiguration(@"root\Test", HostingModel = System.Management.Instrumentation.ManagementHostingModel.Decoupled)] namespace WMI { [System.ComponentModel.RunInstaller(true)] public class MyApplicationManagementInstaller : System.Management.Instrumentation.DefaultManagementInstaller { } [System.Management.Instrumentation.ManagementEntity(Singleton = true)] [System.Management.Instrumentation.ManagementQualifier("Description", Value = "Obtain processor information.")] public class Interface { [System.Management.Instrumentation.ManagementBind] public Interface() { } [System.Management.Instrumentation.ManagementProbe] [System.Management.Instrumentation.ManagementQualifier("Descriiption", Value="The number of processors.")] public int ProcessorCount { get { return Environment.ProcessorCount; } } } } </code></pre> <p><BR/></p> <pre><code>//Button click in windows forms application to publish class try { System.Management.Instrumentation.InstrumentationManager.Publish(new WMI.Interface()); } catch (System.Management.Instrumentation.InstrumentationException exInstrumentation) { MessageBox.Show(exInstrumentation.ToString()); } catch (System.Management.Instrumentation.WmiProviderInstallationException exProvider) { MessageBox.Show(exProvider.ToString()); } catch (Exception exPublish) { MessageBox.Show(exPublish.ToString()); } </code></pre>
[ { "answer_id": 97083, "author": "Jeremy", "author_id": 9266, "author_profile": "https://Stackoverflow.com/users/9266", "pm_score": 2, "selected": false, "text": "// the namespace used for publishing the WMI classes and object instances \n[assembly: Instrumented(\"root/mytest\")]\n\nusing...
2008/09/15
[ "https://Stackoverflow.com/questions/65364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
65,400
<p>How do I add an instance method to a class using a metaclass (yes I do need to use a metaclass)? The following kind of works, but the func_name will still be "foo":</p> <pre><code>def bar(self): print "bar" class MetaFoo(type): def __new__(cls, name, bases, dict): dict["foobar"] = bar return type(name, bases, dict) class Foo(object): __metaclass__ = MetaFoo &gt;&gt;&gt; f = Foo() &gt;&gt;&gt; f.foobar() bar &gt;&gt;&gt; f.foobar.func_name 'bar' </code></pre> <p>My problem is that some library code actually uses the func_name and later fails to find the 'bar' method of the Foo instance. I could do:</p> <pre><code>dict["foobar"] = types.FunctionType(bar.func_code, {}, "foobar") </code></pre> <p>There is also types.MethodType, but I need an instance that does'nt exist yet to use that. Am I missing someting here?</p>
[ { "answer_id": 65682, "author": "Nathan Shively-Sanders", "author_id": 7851, "author_profile": "https://Stackoverflow.com/users/7851", "pm_score": 2, "selected": false, "text": ">>> class Foo():\n... def __init__(self, x):\n... self.x = x\n... \n>>> def bar(self):\n... print 'bar...
2008/09/15
[ "https://Stackoverflow.com/questions/65400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5179/" ]
65,427
<p>As I understand it, anything created with an <strong>alloc</strong>, <strong>new</strong>, or <strong>copy</strong> needs to be manually released. For example:</p> <pre><code>int main(void) { NSString *string; string = [[NSString alloc] init]; /* use the string */ [string release]; } </code></pre> <p>My question, though, is wouldn't this be just as valid?:</p> <pre><code>int main(void) { NSAutoreleasePool *pool; pool = [[NSAutoreleasePool alloc] init]; NSString *string; string = [[[NSString alloc] init] autorelease]; /* use the string */ [pool drain]; } </code></pre>
[ { "answer_id": 65517, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": -1, "selected": false, "text": "-drain" }, { "answer_id": 181043, "author": "mmalc", "author_id": 23233, "author_profile": "https://...
2008/09/15
[ "https://Stackoverflow.com/questions/65427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7979/" ]
65,431
<p>Is there a reliable way to detect whether or not WinHelp is installed on Windows Vista or newer versions of Windows? If possible, I'd like a solution that's not specific to any particular version of Windows.</p> <p>I've posted this question to other message boards and got back answers regarding the size of Winhlp32.exe before and after installing WinHelp and Registry entries that Microsoft has documented, but none of them were correct.</p>
[ { "answer_id": 129698, "author": "TrevH", "author_id": 10124, "author_profile": "https://Stackoverflow.com/users/10124", "pm_score": 2, "selected": false, "text": "wmic qfe list full /format:htable >C:\\hotfixes.htm\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,434
<p>I know there are some ways to get notified when the page body has loaded (before all the images and 3rd party resources load which fires the <strong>window.onload</strong> event), but it's different for every browser.</p> <p>Is there a definitive way to do this on all the browsers?</p> <p>So far I know of:</p> <ul> <li><p><strong>DOMContentLoaded</strong> : On Mozilla, Opera 9 and newest WebKits. This involves adding a listener to the event:</p> <p>document.addEventListener( "DOMContentLoaded", [init function], false );</p></li> <li><p><strong>Deferred script</strong>: On IE, you can emit a SCRIPT tag with a @defer attribute, which will reliably only load after the closing of the BODY tag.</p></li> <li><p><strong>Polling</strong>: On other browsers, you can keep polling, but is there even a standard thing to poll for, or do you need to do different things on each browser?</p></li> </ul> <p>I'd like to be able to go without using document.write or external files.</p> <p>This can be done simply via jQuery:</p> <pre><code>$(document).ready(function() { ... }) </code></pre> <p>but, I'm writing a JS library and can't count on jQuery always being there.</p>
[ { "answer_id": 65476, "author": "Dave Ward", "author_id": 60, "author_profile": "https://Stackoverflow.com/users/60", "pm_score": -1, "selected": false, "text": "setTimeout(MyInitFunction, 0);\n" }, { "answer_id": 65527, "author": "John Millikin", "author_id": 3560, "...
2008/09/15
[ "https://Stackoverflow.com/questions/65434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
65,447
<p>A sample perl script that connects to an oracle database, does a simple SELECT query, and spits the results to stdout in CSV format would be great. Python or any other language available in a typical unix distribution would be fine too. </p> <p>Note that I'm starting from scratch with nothing but a username/password for a remote Oracle database. Is there more to this than just having the right oracle connection library?</p> <p>If there's a way to do this directly in mathematica, that would be ideal (presumably it should be possible with J/Link (mathematica's java integration thingy)).</p>
[ { "answer_id": 65568, "author": "Jumpy", "author_id": 9416, "author_profile": "https://Stackoverflow.com/users/9416", "pm_score": 3, "selected": true, "text": "use DBI; \nuse DBD::Oracle;\n\n$dbh = DBI->connect( \"dbi:Oracle:host=127.0.0.1;sid=XE\", \"username\", \"password\" );\n\n# som...
2008/09/15
[ "https://Stackoverflow.com/questions/65447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
65,456
<p>I'm specifically interested in tools that can be plugged into Vim to allow CScope-style source browsing (1-2 keystroke commands to locate function definitions, callers, global symbols and so on) for languages besides C/C++ such as Java and C# (since Vim and Cscope already integrate very well for browsing C/C++). I'm not interested in IDE-based tools since I know Microsoft and other vendors already address that space -- I prefer to use Vim for editing and browsing, but but don't know of tools for C# and/or Java that give me the same power as CScope.</p> <p>The original answer to this question included a pointer to the CSWrapper application which apparently fixes a bug that some users experience integrating Vim and CScope. However, my Vim/CScope installation works fine; I'm just trying to expand the functionality to allow using Vim to edit code in other languages.</p>
[ { "answer_id": 164864, "author": "alps123", "author_id": 22337, "author_profile": "https://Stackoverflow.com/users/22337", "pm_score": 3, "selected": true, "text": "find . -name '*.java' > cscope.files\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8998/" ]
65,458
<p>There are many SCM systems out there. Some open, some closed, some free, some quite expensive. Which one <em>(please choose only one)</em> would you use for a 3000+ developer organization with several sites (some behind a very slow link)? Explain why you chose the one you chose. (Give some reasons, not just "because".)</p>
[ { "answer_id": 66332, "author": "Lanny", "author_id": 9127, "author_profile": "https://Stackoverflow.com/users/9127", "pm_score": 3, "selected": false, "text": "git" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9362/" ]
65,475
<p>What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?</p>
[ { "answer_id": 65531, "author": "Ivan Bosnic", "author_id": 3221, "author_profile": "https://Stackoverflow.com/users/3221", "pm_score": 4, "selected": false, "text": "static final int NUM_GEARS = 6" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8720/" ]
65,491
<p>When working with large and/or many Javascript and CSS files, what's the best way to reduce the file sizes?</p>
[ { "answer_id": 65505, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 0, "selected": false, "text": "function compressCSS($css) {\n return\n preg_replace(\n array('@\\s\\s+@','@(\\w+:)\\s*([\\w\\s,#]+;?)@'),...
2008/09/15
[ "https://Stackoverflow.com/questions/65491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
65,512
<p>I've heard that <code>SELECT *</code> is generally bad practice to use when writing SQL commands because it is more efficient to <code>SELECT</code> columns you specifically need.</p> <p>If I need to <code>SELECT</code> every column in a table, should I use </p> <pre><code>SELECT * FROM TABLE </code></pre> <p>or </p> <pre><code>SELECT column1, colum2, column3, etc. FROM TABLE </code></pre> <p>Does the efficiency really matter in this case? I'd think <code>SELECT *</code> would be more optimal internally if you really need all of the data, but I'm saying this with no real understanding of database.</p> <p>I'm curious to know what the best practice is in this case.</p> <p><strong>UPDATE:</strong> I probably should specify that the only situation where I would really <em>want</em> to do a <code>SELECT *</code> is when I'm selecting data from one table where I know all columns will always need to be retrieved, even when new columns are added. </p> <p>Given the responses I've seen however, this still seems like a bad idea and <code>SELECT *</code> should never be used for a lot more technical reasons that I ever though about.</p>
[ { "answer_id": 67380, "author": "IDisposable", "author_id": 2076, "author_profile": "https://Stackoverflow.com/users/2076", "pm_score": 6, "selected": false, "text": "SELECT *" }, { "answer_id": 2972041, "author": "Matthew Abbott", "author_id": 357693, "author_profile...
2008/09/15
[ "https://Stackoverflow.com/questions/65512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
65,515
<p>What techniques or tools are recommended for finding broken links on a website?</p> <p>I have access to the logfiles, so could conceivably parse these looking for 404 errors, but would like something automated which will follow (or attempt to follow) all links on a site.</p>
[ { "answer_id": 65625, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 0, "selected": false, "text": "// Pseudo-code to recursively check for broken links\n// logging all errors centrally\nfunction check_links($page)\n{\n $h...
2008/09/15
[ "https://Stackoverflow.com/questions/65515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2084/" ]
65,524
<p>What is the best way to generate a Unique ID from two (or more) short ints in C++? I am trying to uniquely identify vertices in a graph. The vertices contain two to four short ints as data, and ideally the ID would be some kind of a hash of them. Prefer portability and uniqueness over speed or ease. </p> <p>There are a lot of great answers here, I will be trying them all tonight to see what fits my problem the best. A few more words on what I'm doing. </p> <p>The graph is a collection of samples from an audio file. I use the graph as a Markov Chain to generate a new audio file from the old file. Since each vertex stores a few samples and points to another sample, and the samples are all short ints, it seemed natural to generate an ID from the data. Combining them into a long long sounds good, but maybe something as simple as just a 0 1 2 3 <code>generateID</code> is all I need. not sure how much space is necessary to guarantee uniqueness, if each vertex stores 2 16 bit samples, there are 2^32 possible combinations correct? and so if each vertex stores 4 samples, there are 2^64 possible combinations? </p> <p>Library and platform specific solutions not really relevant to this question. I don't want anyone else who might compile my program to have to download additional libraries or change the code to suit their OS. </p>
[ { "answer_id": 65551, "author": "Fire Lancer", "author_id": 6266, "author_profile": "https://Stackoverflow.com/users/6266", "pm_score": 0, "selected": false, "text": "int ID = ((int)short1 << 16) | short2;\n" }, { "answer_id": 65589, "author": "Doug T.", "author_id": 8123...
2008/09/15
[ "https://Stackoverflow.com/questions/65524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
65,530
<p>In Tomcat 5.5 the server.xml can have many connectors, typically port only 8080, but for my application a user might configure their servlet.xml to also have other ports open (say 8081-8088). I would like for my servlet to figure out what socket connections ports will be vaild (During the Servlet.init() tomcat has not yet started the connectors.) </p> <p>I could find and parse the server.xml myself (grotty), I could look at the thread names (after tomcat starts up - but how would I know when a good time to do that is? ) But I would prefer a solution that can execute in my servlet.init() and determine what will be the valid port range. Any ideas? A solution can be tightly bound to Tomcat for my application that's ok.</p>
[ { "answer_id": 65656, "author": "jrudolph", "author_id": 7647, "author_profile": "https://Stackoverflow.com/users/7647", "pm_score": 3, "selected": true, "text": "org.apache.catalina.ServerFactory.getServer().getServices \n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6580/" ]
65,536
<p>How would I get the <code>here</code> and <code>and here</code> to be on the right, on the same lines as the lorem ipsums? See the following:</p> <pre class="lang-none prettyprint-override"><code>Lorem Ipsum etc........here blah....................... blah blah.................. blah....................... lorem ipsums.......and here </code></pre>
[ { "answer_id": 65572, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<div>" }, { "answer_id": 65591, "author": "AdamB", "author_id": 2176, "author_profile": "https://Stackoverf...
2008/09/15
[ "https://Stackoverflow.com/questions/65536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
65,566
<p>I have a control that, upon postback, saves form results back to the database. It populates the values to be saved by iterating through the querystring. So, for the following SQL statement (vastly simplified for the sake of discussion)...</p> <pre><code>UPDATE MyTable SET MyVal1 = @val1, MyVal2 = @val2 WHERE @id = @id </code></pre> <p>...it would cycle through the querystring keys thusly:</p> <pre><code>For Each Key As String In Request.QueryString.Keys Command.Parameters.AddWithValue("@" &amp; Key, Request.QueryString(Key)) Next </code></pre> <p>HOWEVER, I'm now running into a situation where, under certain circumstances, some of these variables may not be present in the querystring. If I don't pass along val2 in the querystring, I get an error: <code>System.Data.SqlClient.SqlException: Must declare the scalar value "@val2"</code>.</p> <p>Attempts to detect the missing value in the SQL statement...</p> <pre><code>IF @val2 IS NOT NULL UPDATE MyTable SET MyVal1 = @val1, MyVal2 = @val2 WHERE @id = @id </code></pre> <p>... have failed.</p> <p>What's the best way to attack this? Must I parse the SQL block with RegEx, scanning for variable names not present in the querystring? Or, is there a more elegant way to approach?</p> <p>UPDATE: Detecting null values in the VB codebehind defeats the purpose of decoupling the code from its context. I'd rather not litter my function with conditions for every conceivable variable that might be passed, or not passed.</p>
[ { "answer_id": 65629, "author": "Sander Rijken", "author_id": 5555, "author_profile": "https://Stackoverflow.com/users/5555", "pm_score": 3, "selected": false, "text": "Command.Parameters.AddWithValue(\"@val2\", null)\n" }, { "answer_id": 65676, "author": "user7658", "aut...
2008/09/15
[ "https://Stackoverflow.com/questions/65566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1923/" ]
65,585
<p>I want to delete foo() if foo() isn't called from anywhere.</p>
[ { "answer_id": 65740, "author": "Helen Toomik", "author_id": 9449, "author_profile": "https://Stackoverflow.com/users/9449", "pm_score": 3, "selected": false, "text": "public" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
65,607
<p>I've been attempting to write a Lisp macro that would perfom the equivalent of ++ in other programming languages for semantic reasons. I've attempted to do this in several different ways, but none of them seem to work, and all are accepted by the interpreter, so I don't know if I have the correct syntax or not. My idea of how this would be defined would be</p> <pre><code>(defmacro ++ (variable) (incf variable)) </code></pre> <p>but this gives me a SIMPLE-TYPE-ERROR when trying to use it. What would make it work?</p>
[ { "answer_id": 65641, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 5, "selected": true, "text": "(defmacro ++ (variable)\n `(incf ,variable))\n" }, { "answer_id": 65657, "author": "Drew Olson", "author_i...
2008/09/15
[ "https://Stackoverflow.com/questions/65607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1256/" ]
65,627
<p>In a Flex <code>AdvancedDatGrid</code>, we're doing a lot of grouping. Most of the columns are the same for the parents and for the children, so I'd like to show the first value of the group as the summary rather than the MAX, MIN or AVG</p> <p>This code works on numerical but not textual values (without the commented line you get NaN's):</p> <pre><code>private function firstValue(itr:IViewCursor,field:String, str:String=null):Object { //if(isNaN(itr.current[field])) return 0 //Theory: Only works on Numeric Values? return itr.current[field] } </code></pre> <p>The XML:</p> <pre><code>(mx:GroupingField name="Offer") (mx:summaries) (mx:SummaryRow summaryPlacement="group") (mx:fields) (mx:SummaryField dataField="OfferDescription" label="OfferDescription" summaryFunction="firstValue"/) (mx:SummaryField dataField="OfferID" label="OfferID" summaryFunction="firstValue"/) (/mx:fields) (/mx:SummaryRow) (/mx:summaries) (/mx:GroupingField) </code></pre> <p><code>OfferID</code>'s work Correctly, <code>OfferDescription</code>s don't.</p>
[ { "answer_id": 1406545, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": " private function getNestedItem(item:Object):Object {\n\n try {\n if (item.undef...
2008/09/15
[ "https://Stackoverflow.com/questions/65627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9056/" ]
65,651
<p>I'm a longtime Java programmer working on a PHP project, and I'm trying to get PHPUnit up and working. When unit testing in Java, it's common to put test case classes and regular classes into separate directories, like this -</p> <pre><code>/src MyClass.java /test MyClassTest.java </code></pre> <p>and so on.</p> <p>When unit testing with PHPUnit, is it common to follow the same directory structure, or is there a better way to lay out test classes? So far, the only way I can get the "include("MyClass.php")" statement to work correctly is to include the test class in the same directory, but I don't want to include the test classes when I push to production.</p>
[ { "answer_id": 65754, "author": "Brian Phillips", "author_id": 7230, "author_profile": "https://Stackoverflow.com/users/7230", "pm_score": 2, "selected": false, "text": "include()" }, { "answer_id": 65814, "author": "Mattias", "author_id": 261, "author_profile": "http...
2008/09/15
[ "https://Stackoverflow.com/questions/65651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8770/" ]
65,668
<p>Someone told me it's more efficient to use <code>StringBuffer</code> to concatenate strings in Java than to use the <code>+</code> operator for <code>String</code>s. What happens under the hood when you do that? What does <code>StringBuffer</code> do differently?</p>
[ { "answer_id": 65677, "author": "André Chalella", "author_id": 4850, "author_profile": "https://Stackoverflow.com/users/4850", "pm_score": 4, "selected": false, "text": "String" }, { "answer_id": 65678, "author": "jodonnell", "author_id": 4223, "author_profile": "http...
2008/09/15
[ "https://Stackoverflow.com/questions/65668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,683
<p>I would like to know how to write PHPUnit tests with Zend_Test and in general with PHP.</p>
[ { "answer_id": 70082, "author": "Stefan Gehrig", "author_id": 11354, "author_profile": "https://Stackoverflow.com/users/11354", "pm_score": 4, "selected": false, "text": "abstract class Controller_TestCase extends Zend_Test_PHPUnit_ControllerTestCase\n{\n protected function setUp()\n ...
2008/09/15
[ "https://Stackoverflow.com/questions/65683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,687
<p>Can someone tell me how to get path geometry from a WPF FlowDocument object? Please note that I do <strong>not</strong> want to use <code>FormattedText</code>. Thanks.</p>
[ { "answer_id": 87716, "author": "Tim Erickson", "author_id": 8787, "author_profile": "https://Stackoverflow.com/users/8787", "pm_score": 1, "selected": false, "text": "FlowDocument myFlowDocument = new FlowDocument(); //get your FlowDocument\n\n//put in some (or it already has) text\nst...
2008/09/15
[ "https://Stackoverflow.com/questions/65687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9476/" ]
65,718
<p>Maybe this is a silly question, but I've always assumed each number delineated by a period represented a single component of the software. If that's true, do they ever represent something different? I'd like to start assigning versions to the different builds of my software, but I'm not really sure how it should be structured. My software has five distinct components.</p>
[ { "answer_id": 65807, "author": "Thomas Jespersen", "author_id": 8547, "author_profile": "https://Stackoverflow.com/users/8547", "pm_score": 1, "selected": false, "text": "// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Mi...
2008/09/15
[ "https://Stackoverflow.com/questions/65718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
65,724
<p>As everyone knows, the <a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B" rel="nofollow noreferrer">Visual C++</a> runtime marks uninitialized or just freed memory blocks with special non-zero markers. Is there any way to disable this behavior entirely without manually setting all uninitialized memory to zeros? It's causing havoc with my valid not null checks, since <code>0xFEEEFEEE != 0</code>.</p> <p>Hrm, perhaps I should explain a bit better. I create and initialize a variable (via new), and that all goes just fine. When I free it (via delete), it sets the pointer to <code>0xFEEEFEEE</code> instead of <code>NULL</code>. When I insert a proper check for <code>NULL</code>, as all good programs that manage their own memory should, I come up with problems as <code>0xFEEEFEEE</code> passes a <code>NULL</code> check without problems. Is there any good way, other than manually setting all pointers to <code>NULL</code> when deleting them, to detect when memory has already been freed? I would prefer to not use <a href="http://en.wikipedia.org/wiki/Boost_C%2B%2B_Libraries" rel="nofollow noreferrer">Boost</a> simply because I don't want the overhead, small though it may be, since that's the only thing I'd be using Boost for.</p>
[ { "answer_id": 65760, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 4, "selected": false, "text": "NULL" }, { "answer_id": 65777, "author": "Fire Lancer", "author_id": 6266, "author_profile": "https://Sta...
2008/09/15
[ "https://Stackoverflow.com/questions/65724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8844/" ]
65,734
<p>This link describes an exploit into my app using fckEditor: <a href="http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html" rel="nofollow noreferrer">http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html</a></p> <p>How do I make my app secure while still using fckEditor? Is it an fckEditor configuration? Is it some processing I'm supposed to do server-side after I grab the text from fckEditor?</p> <p>It's a puzzle because fckEditor <em>USES</em> html tags for its formatting, so I can't just HTML encode when I display back the text.</p>
[ { "answer_id": 65851, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 2, "selected": false, "text": "<b><script>evil here</script></b>" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
65,820
<p>I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java using JUnit but was at a loss as to the best way to write unit tests for existing code (which needed refactoring) as well as new code added to the system.</p> <p>Are there any projects out there that make unit testing plain C code as easy as unit testing Java code with JUnit? Any insight that would apply specifically to embedded development (cross-compiling to arm-linux platform) would be greatly appreciated.</p>
[ { "answer_id": 69820, "author": "Ovid", "author_id": 8003, "author_profile": "https://Stackoverflow.com/users/8003", "pm_score": 5, "selected": false, "text": "#include <tap.h>\n\nint main () {\n plan(5);\n\n ok(3 == 3);\n is(\"fnord\", \"eek\", \"two different strings not that ...
2008/09/15
[ "https://Stackoverflow.com/questions/65820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7049/" ]
65,849
<p>I'm writing a web service, and I want to return the data as XHTML. Because it's data, not markup, I want to keep it very clean - no extra <code>&lt;div&gt;</code>s or <code>&lt;span&gt;</code>s. However, as a convenience to developers, I'd also like to make the returned data reasonably readable in a browser. To do so, I'm thinking a good way to go about it would be to use CSS. </p> <p>The thing I specifically want to do is to insert linebreaks at certain places. I'm aware of <code>display: block</code>, but it doesn't really work in the situation I'm trying to handle now - a <code>form</code> with <code>&lt;input&gt;</code> fields. Something like this: </p> <pre><code>&lt;form&gt; Thingy 1: &lt;input class="a" type="text" name="one" /&gt; Thingy 2: &lt;input class="a" type="text" name="two" /&gt; Thingy 3: &lt;input class="b" type="checkbox" name="three" /&gt; Thingy 4: &lt;input class="b" type="checkbox" name="four" /&gt; &lt;/form&gt; </code></pre> <p>I'd like it to render so that each label displays on the same line as the corresponding input field. I've tried this: </p> <pre class="lang-css prettyprint-override"><code>input.a:after { content: "\a" } </code></pre> <p>But that didn't seem to do anything. </p>
[ { "answer_id": 65929, "author": "Dergachev", "author_id": 9621, "author_profile": "https://Stackoverflow.com/users/9621", "pm_score": -1, "selected": false, "text": "$(\"input.a\").after(\"<br/>\")\n" }, { "answer_id": 65941, "author": "Thunder3", "author_id": 2832, "...
2008/09/15
[ "https://Stackoverflow.com/questions/65849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,856
<p>VMware ESX, ESXi, and VirtualCenter are supposed to be able to support HTTP PUT uploads since version 3.5. I know how to do downloads, that's easy. I've never done PUT before.</p> <p>Background information on the topic is here: <a href="http://communities.vmware.com/thread/117504" rel="nofollow noreferrer">http://communities.vmware.com/thread/117504</a></p>
[ { "answer_id": 67048, "author": "Jaykul", "author_id": 8718, "author_profile": "https://Stackoverflow.com/users/8718", "pm_score": 2, "selected": false, "text": "Send-PoshCode" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6637/" ]
65,865
<p>I get this error:</p> <p><code>Can't locate Foo.pm in @INC</code></p> <p>Is there an easier way to install it than downloading, untarring, making, etc?</p>
[ { "answer_id": 65876, "author": "dreeves", "author_id": 4234, "author_profile": "https://Stackoverflow.com/users/4234", "pm_score": 4, "selected": false, "text": "sudo perl -MCPAN -e 'install Foo'" }, { "answer_id": 65883, "author": "Benedikt Waldvogel", "author_id": 4308...
2008/09/15
[ "https://Stackoverflow.com/questions/65865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
65,925
<p>From time to time am I working in a completely disconnected environment with a Macbook Pro. For testing purposes I need to run a local DNS server in a VMWare session. I've configured the lookup system to use the DNS server (/etc/resolve.conf and through the network configuration panel, which is using configd underneath), and commands like "dig" and "nslookup" work. For example, my DNS server is configured to resolve www.example.com to 127.0.0.1, this is the output of "dig www.example.com":</p> <pre><code>; &lt;&lt;&gt;&gt; DiG 9.3.5-P1 &lt;&lt;&gt;&gt; www.example.com ;; global options: printcmd ;; Got answer: ;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 64859 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.example.com. IN A ;; ANSWER SECTION: www.example.com. 86400 IN A 127.0.0.1 ;; Query time: 2 msec ;; SERVER: 172.16.35.131#53(172.16.35.131) ;; WHEN: Mon Sep 15 21:13:15 2008 ;; MSG SIZE rcvd: 49 </code></pre> <p>Unfortunately, if I try to ping or setup a connection in a browser, the DNS name is not resolved. This is the output of "ping www.example.com":</p> <pre><code>ping: cannot resolve www.example.com: Unknown host </code></pre> <p>It seems that those tools, that are more integrated within Mac OS X 10.4 (and up), are not using the "/etc/resolv.conf" system anymore. Configuring them through scutil is no help, because it seems that if the wireless or the buildin ethernet interface is <strong>inactive</strong>, basic network functions don't seem to work.</p> <p>In Linux (for example Ubuntu), it is possible to turn off the wireless adapter, without turning of the network capabilities. So in Linux it seems that I can work completely disconnected.</p> <p>A solution could be using an ethernet loopback connector, but I would rather like a software solution, as both Windows and Linux don't have this problem.</p>
[ { "answer_id": 66756, "author": "Nicholas Riley", "author_id": 6372, "author_profile": "https://Stackoverflow.com/users/6372", "pm_score": 1, "selected": false, "text": "/etc/resolv.conf" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9504/" ]
65,926
<p>When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL?</p> <p>example:</p> <p><strong>data.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?xml-stylesheet type="text/xsl" href="sample.xsl"?&gt; &lt;root&gt; &lt;document type="resume"&gt; &lt;author&gt;John Doe&lt;/author&gt; &lt;/document&gt; &lt;document type="novella"&gt; &lt;author&gt;Jane Doe&lt;/author&gt; &lt;/document&gt; &lt;/root&gt; </code></pre> <p><strong>sample.xsl</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt; &lt;xsl:output method="html" /&gt; &lt;xsl:template match="/"&gt; &lt;xsl:param name="doctype" /&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;List of &lt;xsl:value-of select="$doctype" /&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;xsl:for-each select="//document[@type = $doctype]"&gt; &lt;p&gt;&lt;xsl:value-of select="author" /&gt;&lt;/p&gt; &lt;/xsl:for-each&gt; &lt;/body&gt; &lt;/html&gt; &lt;/&lt;xsl:stylesheet&gt; </code></pre>
[ { "answer_id": 66017, "author": "Peter Boughton", "author_id": 9360, "author_profile": "https://Stackoverflow.com/users/9360", "pm_score": 3, "selected": true, "text": "<?xml-stylesheet type=\"text/xsl\"href=\"/myscript.cfm/sample.xsl?paramter=something\" ?>\n" }, { "answer_id": ...
2008/09/15
[ "https://Stackoverflow.com/questions/65926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9547/" ]
65,940
<p>This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing programs that require remote access to the database.</p> <p>I wrote a query on the Access database and I'm trying to loop through and insert each record into the corresponding SQL Server table. But it keeps erroring out. I'm fairly certain it's because of the HTML and God knows what other weird characters are in one of the Access text fields. I tried using CFQUERYPARAM but that doesn't seem to help either.</p> <p>Any ideas would be helpful. Thanks.</p>
[ { "answer_id": 66324, "author": "David-W-Fenton", "author_id": 9787, "author_profile": "https://Stackoverflow.com/users/9787", "pm_score": -1, "selected": false, "text": "INSERT INTO tblSQLServer (ID, OtherField ) \nSELECT ID, OtherField\nFROM [c:\\MyDBs\\Access.mdb].tblSQLServer \n" }...
2008/09/15
[ "https://Stackoverflow.com/questions/65940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
65,969
<p>In C# documentation tags allow you to produce output similar to MSDN. What are a list of allowable tags for use inside the /// (triple slash) comment area above classes, methods, and properties?</p>
[ { "answer_id": 66022, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": false, "text": "/// <\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/65969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9587/" ]
65,970
<p>I was asked this question in a job interview. The interviewer and I disagreed on what the correct answer was. I'm wondering if anyone has any data on this.</p> <p>Update: I should have mentioned that the use of shuffle() was strictly forbidden... sorry.</p>
[ { "answer_id": 65978, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": 2, "selected": false, "text": "shuffle($arr);\n" }, { "answer_id": 66688, "author": "Scott Swezey", "author_id": 9439, "author_profi...
2008/09/15
[ "https://Stackoverflow.com/questions/65970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9557/" ]
65,994
<p>I want to use a file to store the current version number for a piece of customer software which can be used by a start-up script to run the binary in the correct directory.</p> <p>For Example, if the run directory looks like this:</p> <pre><code>. .. 1.2.1 1.2.2 1.3.0 run.sh current_version </code></pre> <p>And current_version contains:</p> <pre><code>1.2.2 </code></pre> <p>I want <code>run.sh</code> to descend into 1.2.2 and run the program <code>foo</code>.</p> <p>The current solution is this:</p> <pre><code>#!/bin/sh version = `cat current_version` cd $version ./foo </code></pre> <p>It works but is not very robust. It does not check for file existence, cannot cope with multiple lines, leading spaces, commented lines, blank files, etc.</p> <p>What is the most survivable way to do this with either a shell or perl script?</p>
[ { "answer_id": 66087, "author": "slipset", "author_id": 9422, "author_profile": "https://Stackoverflow.com/users/9422", "pm_score": -1, "selected": false, "text": "!#/bin/sh\n\nif [ -e 'current_version' ]; then\n version=`cat current_version`;\n version=`echo $version | tr -ds [[:b...
2008/09/15
[ "https://Stackoverflow.com/questions/65994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7476/" ]
66,006
<p>Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL transformations? How is it done and how official is it?</p> <p>Microsoft's XML DOM objects allow this on the server-side (i.e. in ASP/ASP.NET).</p> <p><strong>Clarification:</strong> I do not mean HTML DOM scripting performed <em>after</em> the document is transformed, nor do I mean XSL transformations <em>initiated</em> by JavaScript in the browser (e.g. what the W3Schools page shows). I am referring to actual script blocks located within the XSL during the transformation.</p>
[ { "answer_id": 74836, "author": "Neil C. Obremski", "author_id": 9642, "author_profile": "https://Stackoverflow.com/users/9642", "pm_score": 3, "selected": true, "text": "<?xml version=\"1.0\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"scripted.xsl\"?>\n<data a=\"v\">\n ding dong\n<...
2008/09/15
[ "https://Stackoverflow.com/questions/66006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9642/" ]
66,009
<p>I know you could make a helper pretty easily given the data. So, if possible, please only submit answers that also include getting the data.</p>
[ { "answer_id": 67644, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 5, "selected": true, "text": " public override void OnActionExecuting(ActionExecutingContext filterContext)\n {\n var controller = (Controll...
2008/09/15
[ "https://Stackoverflow.com/questions/66009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
66,016
<p>Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ?</p>
[ { "answer_id": 66145, "author": "squadette", "author_id": 7754, "author_profile": "https://Stackoverflow.com/users/7754", "pm_score": 0, "selected": false, "text": "Control.Exception" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/66016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9613/" ]
66,032
<p>The DOM method <code>getChildNodes()</code> returns a <code>NodeList</code> of the children of the current <code>Node</code>. Whilst a <code>NodeList</code> is ordered, is the list guaranteed to be in document order?</p> <p>For example, given <code>&lt;a&gt;&lt;b/&gt;&lt;c/&gt;&lt;d/&gt;&lt;/a&gt;</code> is <code>a.getChildNodes()</code> guaranteed to return a <code>NodeList</code> with <code>b</code>, <code>c</code> and <code>d</code> <em>in that order</em>?</p> <p>The <a href="http://java.sun.com/javase/6/docs/api/org/w3c/dom/Node.html#getChildNodes()" rel="noreferrer">javadoc</a> isn't clear on this.</p>
[ { "answer_id": 66116, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 4, "selected": true, "text": "current = node.firstChild;\nwhile(null != current) {\n ...\n current = current.nextSibling;\n}\n" }, { "answer_i...
2008/09/15
[ "https://Stackoverflow.com/questions/66032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4332/" ]
66,066
<p>I've seen examples like this: </p> <pre><code>public class MaxSeconds { public static final int MAX_SECONDS = 25; } </code></pre> <p>and supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the best way to create constants. </p>
[ { "answer_id": 66076, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 10, "selected": true, "text": "(public/private) static final TYPE NAME = VALUE;\n" }, { "answer_id": 66142, "author": "Community", "author_id...
2008/09/15
[ "https://Stackoverflow.com/questions/66066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1797/" ]
66,094
<p>Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do this using the LINQ Datasource object?</p>
[ { "answer_id": 84141, "author": "naspinski", "author_id": 14777, "author_profile": "https://Stackoverflow.com/users/14777", "pm_score": 3, "selected": true, "text": "<%# Bind(\"unit1.unit_name\") %>\n" } ]
2008/09/15
[ "https://Stackoverflow.com/questions/66094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9626/" ]
66,107
<p>I need to get the number of digits containing the number 1. I know in java I can take the input as a <code>String</code> and use <code>charAt</code>, but I understand there is no implicit String function in C. How can I accomplish this?</p>
[ { "answer_id": 66122, "author": "Aaron Maenpaa", "author_id": 2603, "author_profile": "https://Stackoverflow.com/users/2603", "pm_score": 3, "selected": false, "text": "#include \"stdio.h\"\n\nint main(){\n int digits[] = {0,0,0,0,0,0,0,0,0,0};\n int i = 11031;\n\n while(i > 0){...
2008/09/15
[ "https://Stackoverflow.com/questions/66107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9628/" ]
66,117
<p>When I am working with ASP.NET, I find that there are always unexpected things I run into that take forever to debug. I figure that having a consolidated list of these would be great for those "weird error" circumstances, plus to expand our knowledge of oddness in the platform.</p> <p>So: answer with one of your "Gotcha"s!</p> <p>I'll start: Under ASP.NET (VB), performing a Response.Redirect inside a try/catch block does not stop execution of the current Response, which can lead to two concurrent Responses executing against the same Session.</p>
[ { "answer_id": 66401, "author": "Thunder3", "author_id": 2832, "author_profile": "https://Stackoverflow.com/users/2832", "pm_score": -1, "selected": false, "text": "UpdateName(ByRef aName as String)" }, { "answer_id": 179298, "author": "Adam Lassek", "author_id": 1249, ...
2008/09/15
[ "https://Stackoverflow.com/questions/66117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2832/" ]
66,164
<p>I'm responsible for some test database servers. Historically, too many other poeple have access to them. They run on <code>SQL Server 2005</code>. </p> <p>I've been writing queries and wrapping them in scripts so I can run a regular audit of rights. Finding out which users had Administrator rights on the server itself was fine, as was finding out who had the <code>sysadmin</code> role on their login - it was a single line query for the latter.</p> <p>But how to find out which logins have a User Mapping to a particular (or any) database? </p> <p>I can find the <code>sys.database_principals</code> and <code>sys.server_principals</code> tables. I have located the <code>sys.databases table</code>. I haven't worked out how to find out which users have rights on a database, and if so, what. </p> <p>Every Google search brings up people manually using the User Mapping pane of the Login dialog, rather than using a query to do so. Any ideas?</p>
[ { "answer_id": 66349, "author": "Jason Punyon", "author_id": 6212, "author_profile": "https://Stackoverflow.com/users/6212", "pm_score": 1, "selected": false, "text": "\nselect * from Master.dbo.syslogins l inner join sys.sysusers u on l.sid = u.sid\n" }, { "answer_id": 66511, ...
2008/09/15
[ "https://Stackoverflow.com/questions/66164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9727/" ]
66,293
<p>I have a Visual Studio application with a splash screen image cut into "slices". The positions are specified in the Form Designer so they line up properly on the screen. However, the images are out of place when the application is run on the Chinese version of Windows XP. It looks as if the image slices were "exploded" apart.</p> <p>What's going on here? Do international versions of Windows have a different meaning of the "top left" coordinate of the picture? How can I force the images to be precisely displayed where I want them?</p>
[ { "answer_id": 67007, "author": "Benjamin Autin", "author_id": 1440933, "author_profile": "https://Stackoverflow.com/users/1440933", "pm_score": 0, "selected": false, "text": "images[0].Location = new Point(0,0);\nfor (int i = 1; i < images.Length; i++)\n{\n images[i].Location = new Poi...
2008/09/15
[ "https://Stackoverflow.com/questions/66293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5626/" ]
66,330
<p>Is there a Perl module that allows me to view diffs between actual and reference output of programs (or functions)? The test fails if there are differences.</p> <p>Also, in case there are differences but the output is OK (because the functionality has changed) I want to be able to commit the actual output as future reference output.</p>
[ { "answer_id": 68725, "author": "Yanick", "author_id": 10356, "author_profile": "https://Stackoverflow.com/users/10356", "pm_score": 2, "selected": false, "text": "use Test::Command tests => 3;\n\nmy $echo_test = Test::Command->new( cmd => 'echo out' );\n\n$echo_test->exit_is_num(0, 'exi...
2008/09/15
[ "https://Stackoverflow.com/questions/66330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9792/" ]