qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
132,358
<p>In order to improve performance reading from a file, I'm trying to read the entire content of a big (several MB) file into memory and then use a istringstream to access the information.</p> <p>My question is, which is the best way to read this information and "import it" into the string stream? A problem with this approach (see bellow) is that when creating the string stream the buffers gets copied, and memory usage doubles.</p> <pre><code>#include &lt;fstream&gt; #include &lt;sstream&gt; using namespace std; int main() { ifstream is; is.open (sFilename.c_str(), ios::binary ); // get length of file: is.seekg (0, std::ios::end); long length = is.tellg(); is.seekg (0, std::ios::beg); // allocate memory: char *buffer = new char [length]; // read data as a block: is.read (buffer,length); // create string stream of memory contents // NOTE: this ends up copying the buffer!!! istringstream iss( string( buffer ) ); // delete temporary buffer delete [] buffer; // close filestream is.close(); /* ================================== * Use iss to access data */ } </code></pre>
[ { "answer_id": 132394, "author": "Luc Touraille", "author_id": 20984, "author_profile": "https://Stackoverflow.com/users/20984", "pm_score": 7, "selected": true, "text": "std::ifstream" }, { "answer_id": 138645, "author": "Martin York", "author_id": 14065, "author_pro...
2008/09/25
[ "https://Stackoverflow.com/questions/132358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20317/" ]
132,367
<p>How would I invert .NET regex matches? I want to extract only the matched text, e.g. I want to extract all IMG tags from an HTML file, but only the image tags.</p>
[ { "answer_id": 133480, "author": "ZeroBugBounce", "author_id": 11314, "author_profile": "https://Stackoverflow.com/users/11314", "pm_score": 1, "selected": false, "text": "static void Main(string[] args)\n{\n Regex re = new Regex(@\"\\sthe\\s\", RegexOptions.IgnoreCase);\n\n string...
2008/09/25
[ "https://Stackoverflow.com/questions/132367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
132,397
<p>When I do an "os.execute" in Lua, a console quickly pops up, executes the command, then closes down. But is there some way of getting back the console output only using the standard Lua libraries?</p>
[ { "answer_id": 132453, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 1, "selected": false, "text": "comd >comd.txt 2>&1\n" }, { "answer_id": 326715, "author": "Norman Ramsey", "author_id": 41661, "aut...
2008/09/25
[ "https://Stackoverflow.com/questions/132397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12291/" ]
132,409
<p>I have a web application that uses <a href="https://javaee.github.io/jaxb-v2/" rel="nofollow noreferrer">JAXB 2</a>. When deployed on an <a href="https://www.oracle.com/technetwork/middleware/ias/overview/index.html" rel="nofollow noreferrer">Oracle 10g Application Server</a>, I get errors as soon as I try to marshal an XML file. It turns out that Oracle includes <a href="https://github.com/javaee/jaxb-v1" rel="nofollow noreferrer">JAXB 1</a> in a jar sneakily renamed "xml.jar". </p> <p>How I can force my webapp to use the version of the jaxb jars that I deployed in <code>WEB-INF/lib</code> over that which Oracle has forced into the classpath, ideally through configuration rather than having to mess about with classloaders in my code?</p>
[ { "answer_id": 132434, "author": "NR.", "author_id": 11701, "author_profile": "https://Stackoverflow.com/users/11701", "pm_score": 2, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE weblogic-web-app PUBLIC \"-//BEA Systems, Inc.//DTD Web Application 8.1/...
2008/09/25
[ "https://Stackoverflow.com/questions/132409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/998/" ]
132,411
<p>I would like to translate some C code to Python code or bytecode. The C code in question is what i'd call purely algorithmic: platform independent, no I/O, just algorithms and in-memory data structures.</p> <p>An example would be a regular expression library. Translation tool would process library source code and produce a functionally equivalent Python module that can be run in a <strong>sandboxed</strong> environment.</p> <p>What specific approaches, tools and techniques can you recommend?</p> <hr> <p><em>Note: Python C extension or ctypes is <strong>not an option</strong> because the environment is sandboxed.</em></p> <p><em>Another note</em>: looks like there is a <a href="http://www.axiomsol.com/" rel="nofollow noreferrer">C-to-Java-bytecode compiler</a>, they even compiled libjpeg to Java. Is Java bytecode+VM too different from CPython bytecode+VM?</p>
[ { "answer_id": 6857972, "author": "John S", "author_id": 867314, "author_profile": "https://Stackoverflow.com/users/867314", "pm_score": 2, "selected": false, "text": "x * 1,000,000 = a\ny * 1,000,000 = b\na {function} b = result\nresult / 1,000,000 = z\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20310/" ]
132,437
<p>In an asp.net application, i would like to use a webservice to return the username associated with the session id passed as a parameter. We're currently using InProc session store.</p> <p>Is it possible to do this ?</p> <p>Edit: what i'm trying to do is get information about another session than the current one. I'm not trying to get the SessionID, i've already got it. I'm trying to get the user information <b>associated with</b> a given SessionID.</p> <p>Thanks,</p> <p>Mathieu G.</p>
[ { "answer_id": 6857972, "author": "John S", "author_id": 867314, "author_profile": "https://Stackoverflow.com/users/867314", "pm_score": 2, "selected": false, "text": "x * 1,000,000 = a\ny * 1,000,000 = b\na {function} b = result\nresult / 1,000,000 = z\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22078/" ]
132,444
<p>There is a UNIQUE database constraint on an index which doesn't allow more than one record having identical columns.</p> <p>There is a piece of code, managed by Hibernate (v2.1.8), doing two DAO <BR> <code>getHibernateTemplate().save( theObject )</code><BR> calls which results two records entered into the table mentioned above.</p> <p>If this code is executed without transactions, it results INSERT, UPDATE, then another INSERT and another UPDATE SQL statements and works fine. Apparently, the sequence is to insert the record containing DB NULL first, and then update it with the proper data.</p> <p>If this code is executed under Spring (v2.0.5) wrapped in a single Spring transaction, it results two INSERTS, followed by immediate exception due to UNIQUE constraint mentioned above.</p> <p>This problem only manifests itself on <a href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=299229" rel="nofollow noreferrer">MS SQL</a> due to its incompatibility with ANSI SQL. It works fine on MySQL and Oracle. Unfortunately, our solution is cross-platform and must support all databases.</p> <p>Having this stack of technologies, what would be your preferred workaround for given problem?</p>
[ { "answer_id": 138209, "author": "Giacomo Degli Esposti", "author_id": 20796, "author_profile": "https://Stackoverflow.com/users/20796", "pm_score": 0, "selected": false, "text": "alter table MyTable Add MyCalcField as \ncase when MyUniqueField is NULL \n then cast(Myprimarykey as M...
2008/09/25
[ "https://Stackoverflow.com/questions/132444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7345/" ]
132,445
<p>Consider the following code:</p> <pre><code>void Handler(object o, EventArgs e) { // I swear o is a string string s = (string)o; // 1 //-OR- string s = o as string; // 2 // -OR- string s = o.ToString(); // 3 } </code></pre> <p>What is the difference between the three types of casting (okay, the 3rd one is not a casting, but you get the intent). Which one should be preferred?</p>
[ { "answer_id": 132464, "author": "Sergio Acosta", "author_id": 2954, "author_profile": "https://Stackoverflow.com/users/2954", "pm_score": 3, "selected": false, "text": "string s = o as string;\n" }, { "answer_id": 132467, "author": "Sander", "author_id": 2928, "autho...
2008/09/25
[ "https://Stackoverflow.com/questions/132445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6621/" ]
132,449
<p>I'm running a strange problem sending emails. I'm getting this exception:</p> <pre><code>ArgumentError (wrong number of arguments (1 for 0)): /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:642:in `initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:642:in `new' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:642:in `create' /usr/lib/ruby/gems/1.8/gems/ar_mailer-1.3.1/lib/action_mailer/ar_mailer.rb:92:in `perform_delivery_activerecord' /usr/lib/ruby/gems/1.8/gems/ar_mailer-1.3.1/lib/action_mailer/ar_mailer.rb:91:in `each' /usr/lib/ruby/gems/1.8/gems/ar_mailer-1.3.1/lib/action_mailer/ar_mailer.rb:91:in `perform_delivery_activerecord' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `__send__' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `deliver!' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:383:in `method_missing' /app/controllers/web_reservations_controller.rb:29:in `test_email' </code></pre> <p>In my web_reservations_controller I have a simply method calling </p> <pre><code>TestMailer.deliver_send_email </code></pre> <p>And my TesMailer is something like:</p> <pre><code>class TestMailer &lt; ActionMailer::ARMailer def send_email @recipients = "xxx@example.com" @from = "xxx@example.com" @subject = "TEST MAIL SUBJECT" @body = "&lt;br&gt;TEST MAIL MESSAGE" @content_type = "text/html" end end </code></pre> <p>Do you have any idea?</p> <p>Thanks! Roberto</p>
[ { "answer_id": 133082, "author": "Dave Nolan", "author_id": 9474, "author_profile": "https://Stackoverflow.com/users/9474", "pm_score": 0, "selected": false, "text": "class TestMailer < ActionMailer::ARMailer\n def send_email\n recipients \"roberto.druetto@gmail.com\"\n from \"rob...
2008/09/25
[ "https://Stackoverflow.com/questions/132449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22083/" ]
132,465
<p>The file upload control in asp.net does not allow me to select a folder and enables me to select only the files. Is there any way in which I can select a folder (obviously without using the file upload control).</p> <p>Why I want to select the folder is basically to store its entire path in a database table. </p>
[ { "answer_id": 132500, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 2, "selected": false, "text": "<input type=file>" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4021/" ]
132,478
<p>I need to perform Diffs between Java strings. I would like to be able to rebuild a string using the original string and diff versions. Has anyone done this in Java? What library do you use?</p> <pre><code>String a1; // This can be a long text String a2; // ej. above text with spelling corrections String a3; // ej. above text with spelling corrections and an additional sentence Diff diff = new Diff(); String differences_a1_a2 = Diff.getDifferences(a,changed_a); String differences_a2_a3 = Diff.getDifferences(a,changed_a); String[] diffs = new String[]{a,differences_a1_a2,differences_a2_a3}; String new_a3 = Diff.build(diffs); a3.equals(new_a3); // this is true </code></pre>
[ { "answer_id": 132484, "author": "Paul Whelan", "author_id": 3050, "author_profile": "https://Stackoverflow.com/users/3050", "pm_score": 5, "selected": false, "text": "StringUtils.difference(\"foobar\", \"foo\");\n" }, { "answer_id": 132560, "author": "Paul Whelan", "auth...
2008/09/25
[ "https://Stackoverflow.com/questions/132478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
132,488
<p>I want a regex which can match conditional comments in a HTML source page so I can remove only those. I want to preserve the regular comments.</p> <p>I would also like to avoid using the .*? notation if possible. </p> <p>The text is </p> <pre><code>foo &lt;!--[if IE]&gt; &lt;style type="text/css"&gt; ul.menu ul li{ font-size: 10px; font-weight:normal; padding-top:0px; } &lt;/style&gt; &lt;![endif]--&gt; bar </code></pre> <p>and I want to remove everything in <code>&lt;!--[if IE]&gt;</code> and <code>&lt;![endif]--&gt;</code></p> <p><strong>EDIT:</strong> It is because of BeautifulSoup I want to remove these tags. BeautifulSoup fails to parse and gives an incomplete source</p> <p><strong>EDIT2:</strong> [if IE] isn't the only condition. There are lots more and I don't have any list of all possible combinations.</p> <p><strong>EDIT3:</strong> Vinko Vrsalovic's solution works, but the actual problem why beautifulsoup failed was because of a rogue comment within the conditional comment. Like</p> <pre><code>&lt;!--[if lt IE 7.]&gt; &lt;script defer type="text/javascript" src="pngfix_253168.js"&gt;&lt;/script&gt;&lt;!--png fix for IE--&gt; &lt;![endif]--&gt; </code></pre> <p>Notice the <code>&lt;!--png fix for IE--&gt;</code> comment?</p> <p>Though my problem was solve, I would love to get a regex solution for this.</p>
[ { "answer_id": 132519, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 1, "selected": false, "text": " \"<!--\\[if IE\\]>.*?<!\\[endif\\]-->\"\n" }, { "answer_id": 132521, "author": "Lev", "author_id": 7224, ...
2008/09/25
[ "https://Stackoverflow.com/questions/132488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448/" ]
132,501
<p>How to sort list of values using only one variable?</p> <p>EDIT: according to @Igor's comment, I retitled the question.</p>
[ { "answer_id": 132783, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 2, "selected": false, "text": "// define a compare and swap macro \n#define order(a,b) if ((a)<(b)) { temp=(a); (a) = (b); (b) = temp; }\n\nstat...
2008/09/25
[ "https://Stackoverflow.com/questions/132501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4235/" ]
132,507
<p>I'm creating a UI that allows the user the select a date range, and tick or un-tick the days of the week that apply within the date range.</p> <p>The date range controls are <code>DateTimePickers</code>, and the Days of the Week are <code>CheckBoxes</code></p> <p>Here's a mock-up of the UI:</p> <p><code>From Date: (dtpDateFrom)</code><br/> <code>To Date: (dtpDateTo)</code></p> <p><code>[y] Monday, [n] Tuesday, [y] Wednesday, (etc)</code></p> <p>What's the best way to show a total count the number of days, based not only on the date range, but the ticked (or selected) days of the week?</p> <p>Is looping through the date range my only option?</p>
[ { "answer_id": 132541, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 2, "selected": false, "text": "#weeks * skipped days in a week" }, { "answer_id": 132557, "author": "ravenspoint", "author_id": 16582,...
2008/09/25
[ "https://Stackoverflow.com/questions/132507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
132,544
<p>I have a .NET application which has different configuration files for Debug and Release builds. E.g. the debug app.config file points to a development <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" rel="noreferrer">SQL Server</a> which has debugging enabled and the release target points to the live SQL Server. There are also other settings, some of which are different in debug/release.</p> <p>I currently use two separate configuration files (debug.app.config and release.app.config). I have a build event on the project which says if this is a release build then copy release.app.config to app.config, else copy debug.app.config to app.config.</p> <p>The problem is that the application seems to get its settings from the settings.settings file, so I have to open settings.settings in Visual Studio which then prompts me that the settings have changed so I accept the changes, save settings.settings and have to rebuild to make it use the correct settings.</p> <p>Is there a better/recommended/preferred method for achieving a similar effect? Or equally, have I approached this completely wrong and is there a better approach?</p>
[ { "answer_id": 132600, "author": "Eric Z Beard", "author_id": 1219, "author_profile": "https://Stackoverflow.com/users/1219", "pm_score": 5, "selected": false, "text": "<appSettings file=\"Local.config\">\n" }, { "answer_id": 132655, "author": "Steven Williams", "author_i...
2008/09/25
[ "https://Stackoverflow.com/questions/132544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8354/" ]
132,564
<p>I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?</p>
[ { "answer_id": 132572, "author": "mmaibaum", "author_id": 12213, "author_profile": "https://Stackoverflow.com/users/12213", "pm_score": 5, "selected": false, "text": "<foo> This is Text </foo>" }, { "answer_id": 132635, "author": "fenomas", "author_id": 10651, "author...
2008/09/25
[ "https://Stackoverflow.com/questions/132564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
132,566
<p>Despite my most convincing cries to the contrary, I was recently forced to implement a horizontal drop-down navigation system, so I opted for the friendliest one I could find - <a href="http://www.htmldog.com/articles/suckerfish/dropdowns/" rel="nofollow noreferrer">Son of Suckerfish</a>.</p> <p>I tested in various browsers on my machine and all appeared to be fine. However, some (but not all!) IE7 users are experiencing an issue where sub menus do not close after they have been hovered over. The most annoying thing is that the affected users are using the exact version of IE7 that I am (7.0.5730.13), with the same privacy and security settings (I even had them send screenshots of the tabs in Internet Options) on the same OS (XP). I cannot verify if Vista is affected or not.</p> <p>Obviously trying to debug this issue is a nightmare since I cannot replicate it, so I am wondering if anyone here can and might know how to solve it. I have set up an example page here:</p> <blockquote> <p><a href="http://x01.co.uk/menu_test/" rel="nofollow noreferrer">http://x01.co.uk/menu_test/</a></p> </blockquote> <p>Additionally, there's an annoying flicker on rollover of the sub items which I have also tried to solve with no success, so any help with that would also be appreciated.</p>
[ { "answer_id": 133110, "author": "Bryan M.", "author_id": 4636, "author_profile": "https://Stackoverflow.com/users/4636", "pm_score": 3, "selected": true, "text": "#nav li:hover {\n position: static;\n}\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
132,590
<p>I've been writing a little application that will let people upload &amp; download files to me. I've added a web service to this applciation to provide the upload/download functionality that way but I'm not too sure on how well my implementation is going to cope with large files.</p> <p>At the moment the definitions of the upload &amp; download methods look like this (written using Apache CXF):</p> <pre><code>boolean uploadFile(@WebParam(name = "username") String username, @WebParam(name = "password") String password, @WebParam(name = "filename") String filename, @WebParam(name = "fileContents") byte[] fileContents) throws UploadException, LoginException; byte[] downloadFile(@WebParam(name = "username") String username, @WebParam(name = "password") String password, @WebParam(name = "filename") String filename) throws DownloadException, LoginException; </code></pre> <p>So the file gets uploaded and downloaded as a byte array. But if I have a file of some stupid size (e.g. 1GB) surely this will try and put all that information into memory and crash my service.</p> <p>So my question is - is it possible to return some kind of stream instead? I would imagine this isn't going to be terribly OS independent though. Although I know the theory behind web services, the practical side is something that I still need to pick up a bit of information on.</p> <p>Cheers for any input, Lee</p>
[ { "answer_id": 132603, "author": "Guvante", "author_id": 16800, "author_profile": "https://Stackoverflow.com/users/16800", "pm_score": 4, "selected": true, "text": "boolean uploadFile(String username, String password, String fileName, int currentChunk, int totalChunks, byte[] chunk);\n" ...
2008/09/25
[ "https://Stackoverflow.com/questions/132590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1900/" ]
132,592
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/114149/const-correctness-in-c-sharp">&ldquo;const correctness&rdquo; in C#</a> </p> </blockquote> <p>I have programmed C++ for many years but am fairly new to C#. While learning C# I found that the use of the <a href="http://en.csharp-online.net/const,_static_and_readonly" rel="nofollow noreferrer">const</a> keyword is much more limited than in C++. AFAIK, there is, <a href="http://andymcm.com/csharpfaq.htm#6.8" rel="nofollow noreferrer">for example</a>, no way to declare arguments to a function const. I feel uncomfortable with the idea that I may make inadvertent changes to my function arguments (which may be complex data structures) that I can only detect by testing. </p> <p>How do you deal with this situation?</p>
[ { "answer_id": 132603, "author": "Guvante", "author_id": 16800, "author_profile": "https://Stackoverflow.com/users/16800", "pm_score": 4, "selected": true, "text": "boolean uploadFile(String username, String password, String fileName, int currentChunk, int totalChunks, byte[] chunk);\n" ...
2008/09/25
[ "https://Stackoverflow.com/questions/132592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
132,607
<p>We're reviewing one of the company's system's exception handling and found a couple of interesting things.</p> <p>Most of the code blocks (if not all of them) are inside a try/catch block, and inside the catch block a new BaseApplicationException is being thrown - which seems to be coming from the Enterprise Libraries. I'm in a bit of a trouble here as I don't see the benefits off doing this. (throwing another exception anytime one occurs) One of the developers who's been using the system for a while said it's because that class's in charge of publishing the exception (sending emails and stuff like that) but he wasn't too sure about it. After spending some time going through the code I'm quite confident to say, that's all it does is collecting information about the environment and than publishing it.</p> <p>My question is: - Is it reasonable to wrap all the code inside try { } catch { } blocks and than throw a new exception? And if it is, why? What's the benefit?</p> <p>My personal opinion is that it would be much easier to use an HttpModule, sign up for the Error event of the Application event, and do what's necessary inside the module. If we'd go down this road, would we miss something? Any drawbacks?</p> <p>Your opinion's much appreciated.</p>
[ { "answer_id": 133044, "author": "Christoffer Lette", "author_id": 11808, "author_profile": "https://Stackoverflow.com/users/11808", "pm_score": 4, "selected": true, "text": "catch (Exception ex)" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1613872/" ]
132,612
<p>I have found that when I execute the show() method for a contextmenustrip (a right click menu), if the position is outside that of the form it belongs to, it shows up on the taskbar also.</p> <p>I am trying to create a right click menu for when clicking on the notifyicon, but as the menu hovers above the system tray and not inside the form (as the form can be minimised when right clicking) it shows up on the task bar for some odd reason</p> <p>Here is my code currently:</p> <pre><code>private: System::Void notifyIcon1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { if(e-&gt;Button == System::Windows::Forms::MouseButtons::Right) { this-&gt;sysTrayMenu-&gt;Show(Cursor-&gt;Position); } } </code></pre> <p>What other options do I need to set so it doesn't show up a blank process on the task bar.</p>
[ { "answer_id": 7433813, "author": "Dicu Alexandru", "author_id": 947202, "author_profile": "https://Stackoverflow.com/users/947202", "pm_score": 2, "selected": false, "text": "ContextMenuLeft" }, { "answer_id": 11242454, "author": "MaratSh", "author_id": 925008, "auth...
2008/09/25
[ "https://Stackoverflow.com/questions/132612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15087/" ]
132,620
<p>Here's the scenario:</p> <p>You have a Windows server that users remotely connect to via RDP. You want your program (which runs as a service) to know who is currently connected. This may or may not include an interactive console session.</p> <p>Please note that this is the <strong>not</strong> the same as just retrieving the current interactive user.</p> <p>I'm guessing that there is some sort of API access to Terminal Services to get this info?</p>
[ { "answer_id": 132711, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 1, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Runtime.InteropServices;\n\nnamespace Te...
2008/09/25
[ "https://Stackoverflow.com/questions/132620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7837/" ]
132,643
<p>I have a this aspx-code: (sample)</p> <pre><code>&lt;asp:DropDownList runat="server" ID="ddList1"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p>With this codebehind:</p> <pre><code>List&lt;System.Web.UI.WebControls.ListItem&gt; colors = new List&lt;System.Web.UI.WebControls.ListItem&gt;(); colors.Add(new ListItem("Select Value", "0")); colors.Add(new ListItem("Red", "1")); colors.Add(new ListItem("Green", "2")); colors.Add(new ListItem("Blue", "3")); ddList1.DataSource = colors; ddList1.DataBind(); </code></pre> <p>The output looks like this:</p> <pre><code>&lt;select name="ddList1" id="ddList1"&gt; &lt;option value="Select Value"&gt;Select Value&lt;/option&gt; &lt;option value="Red"&gt;Red&lt;/option&gt; &lt;option value="Green"&gt;Green&lt;/option&gt; &lt;option value="Blue"&gt;Blue&lt;/option&gt; &lt;/select&gt; </code></pre> <p>My question is: Why did my values (numbers) disappear and the text used as the value AND the text? I know that it works if I use the <code>ddList1.Items.Add(New ListItem("text", "value"))</code> method, but I need to use a generic list as the datasource for other reasons.</p>
[ { "answer_id": 132731, "author": "Serhat Ozgel", "author_id": 31505, "author_profile": "https://Stackoverflow.com/users/31505", "pm_score": 2, "selected": false, "text": "protected internal override void PerformDataBinding(IEnumerable dataSource)\n{\n base.PerformDataBinding(dataSourc...
2008/09/25
[ "https://Stackoverflow.com/questions/132643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2257/" ]
132,649
<p>What is the difference between overflow:hidden and display:none?</p>
[ { "answer_id": 132677, "author": "Vincent McNabb", "author_id": 16299, "author_profile": "https://Stackoverflow.com/users/16299", "pm_score": 1, "selected": false, "text": "div" }, { "answer_id": 132679, "author": "ConroyP", "author_id": 2287, "author_profile": "https...
2008/09/25
[ "https://Stackoverflow.com/questions/132649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21067/" ]
132,667
<p>While developing a C++ application, I had to use a third-party library which produced a huge amount of warnings related with a harmless #pragma directive being used.</p> <pre class="lang-none prettyprint-override"><code>../File.hpp:1: warning: ignoring #pragma ident In file included from ../File2.hpp:47, from ../File3.hpp:57, from File4.h:49, </code></pre> <p>Is it possible to disable this kind of warnings, when using the GNU C++ compiler?</p>
[ { "answer_id": 132730, "author": "Adam Wright", "author_id": 1200, "author_profile": "https://Stackoverflow.com/users/1200", "pm_score": 8, "selected": true, "text": "-Wno-unknown-pragmas\n" }, { "answer_id": 132732, "author": "Mike Dimmick", "author_id": 6970, "autho...
2008/09/25
[ "https://Stackoverflow.com/questions/132667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20317/" ]
132,685
<p>When setting the size of fonts in CSS, should I be using a percent value (<code>%</code>) or <code>em</code>? Can you explain the advantage?</p>
[ { "answer_id": 1723471, "author": "DA.", "author_id": 172279, "author_profile": "https://Stackoverflow.com/users/172279", "pm_score": 3, "selected": false, "text": "px" }, { "answer_id": 13840233, "author": "user743436", "author_id": 743436, "author_profile": "https:/...
2008/09/25
[ "https://Stackoverflow.com/questions/132685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16440/" ]
132,719
<p>I have a Visual Studio (2008) solution consisting of several projects, not all in the same namespace. When I build the solution, all the DLL files used by the top level project, <strong>TopProject</strong>, are copied into the <em>TopProject\bin\debug</em> folder. However, the corresponding .pdb files are only copied for some of the other projects. This is a pain, for example when using <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a>.</p> <p>How does Visual Studio decide which .pdb files to copy into higher level bin\debug folders? How can I get Visual Studio to copy the others too?</p> <hr> <p>References are as follows: all the DLL files are copied to a central location, without their PDB files. <strong>TopProject</strong> <em>only</em> has references to these copied DLL files; the DLL files themselves, however, evidently know where their PDB files are, and (most of them) get copied to the <code>debug</code> folder correctly.</p>
[ { "answer_id": 132899, "author": "Code Trawler", "author_id": 22073, "author_profile": "https://Stackoverflow.com/users/22073", "pm_score": 2, "selected": false, "text": "bin\\debug" }, { "answer_id": 132909, "author": "Dean Hill", "author_id": 3106, "author_profile":...
2008/09/25
[ "https://Stackoverflow.com/questions/132719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6091/" ]
132,720
<p>We have consumed a third party web service and are trying to invoke it from an ASP.NET web application. However when I instantiate the web service the following System.InvalidOperationException exception is thrown:</p> <blockquote> <p>Method 'ABC.XYZ' can not be reflected. System.InvalidOperationException: Method 'ABC.XYZ' can not be reflected. ---> System.InvalidOperationException: The XML element 'MyDoc' from namespace '<a href="http://mysoftware.com/ns" rel="noreferrer">http://mysoftware.com/ns</a>' references a method and a type. Change the method's message name using WebMethodAttribute or change the type's root element using the XmlRootAttribute.</p> </blockquote> <p>From what I can gather there appears to be some ambiguity between a method and a type in the web service. Can anyone clarify the probably cause of this exception and is there anything I can do to rectify this or should I just go to the web service owners to rectify?</p> <p>Edit: Visual Studio 2008 has created the proxy class. Unfortunately I can't provide a link to the wsdl as it is a web service for a locally installed thrid party app.</p>
[ { "answer_id": 17563323, "author": "Has AlTaiar", "author_id": 1570662, "author_profile": "https://Stackoverflow.com/users/1570662", "pm_score": 0, "selected": false, "text": "WebMethod" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/132720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1762/" ]
132,725
<p>I'm new to Delphi, and I've been running some tests to see what object variables and stack variables are initialized to by default:</p> <pre><code>TInstanceVariables = class fBoolean: boolean; // always starts off as false fInteger: integer; // always starts off as zero fObject: TObject; // always starts off as nil end; </code></pre> <p>This is the behaviour I'm used to from other languages, but I'm wondering if it's safe to rely on it in Delphi? For example, I'm wondering if it might depend on a compiler setting, or perhaps work differently on different machines. Is it normal to rely on default initialized values for objects, or do you explicitly set all instance variables in the constructor?</p> <p>As for stack (procedure-level) variables, my tests are showing that unitialized booleans are true, unitialized integers are 2129993264, and uninialized objects are just invalid pointers (i.e. not nil). I'm guessing the norm is to always set procedure-level variables before accessing them?</p>
[ { "answer_id": 132770, "author": "Giacomo Degli Esposti", "author_id": 20796, "author_profile": "https://Stackoverflow.com/users/20796", "pm_score": 8, "selected": true, "text": "string, variant, interface" }, { "answer_id": 495493, "author": "Heinrich Ulbricht", "author_...
2008/09/25
[ "https://Stackoverflow.com/questions/132725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11961/" ]
132,738
<p>I'm a C/C++ developer, and here are a couple of questions that always baffled me.</p> <ul> <li>Is there a big difference between "regular" code and inline code?</li> <li>Which is the main difference?</li> <li>Is inline code simply a "form" of macros?</li> <li>What kind of tradeoff must be done when choosing to inline your code?</li> </ul> <p>Thanks</p>
[ { "answer_id": 132759, "author": "Charles Duffy", "author_id": 14122, "author_profile": "https://Stackoverflow.com/users/14122", "pm_score": 1, "selected": false, "text": "inline" }, { "answer_id": 132776, "author": "QBziZ", "author_id": 11572, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/132738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20317/" ]
132,750
<p>I'm a jQuery novice, so the answer to this may be quite simple:</p> <p>I have an image, and I would like to do several things with it. When a user clicks on a 'Zoom' icon, I'm running the 'imagetool' plugin (<a href="http://code.google.com/p/jquery-imagetool/" rel="nofollow noreferrer">http://code.google.com/p/jquery-imagetool/</a>) to load a larger version of the image. The plugin creates a new div around the image and allows the user to pan around.</p> <p>When a user clicks on an alternative image, I'm removing the old one and loading in the new one.</p> <p>The problem comes when a user clicks an alternative image, and then clicks on the zoom button - the imagetool plugin creates the new div, but the image appears after it...</p> <p>The code is as follows:</p> <pre><code>// Product Zoom (jQuery) $(document).ready(function(){ $("#productZoom").click(function() { // Set new image src var imageSrc = $("#productZoom").attr("href"); $("#productImage").attr('src', imageSrc); // Run the imagetool plugin on the image $(function() { $("#productImage").imagetool({ viewportWidth: 300, viewportHeight: 300, topX: 150, topY: 150, bottomX: 450, bottomY: 450 }); }); return false; }); }); // Alternative product photos (jQuery) $(document).ready(function(){ $(".altPhoto").click(function() { $('#productImageDiv div.viewport').remove(); $('#productImage').remove(); // Set new image src var altImageSrc = $(this).attr("href"); $("#productZoom").attr('href', altImageSrc); var img = new Image(); $(img).load(function () { $(this).hide(); $('#productImageDiv').append(this); $(this).fadeIn(); }).error(function () { // notify the user that the image could not be loaded }).attr({ src: altImageSrc, id: "productImage" }); return false; }); }); </code></pre> <p>It seems to me, that the imagetool plugin can no longer see the #productImage image once it has been replaced with a new image... So I think this has something to do with binding? As in because the new image is added to the dom after the page has loaded, the iamgetool plugin can no longer use it correctly... is this right? If so, any ideas how to deal with it?</p>
[ { "answer_id": 132795, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 1, "selected": false, "text": "// Product Zoom (jQuery)\n$(document).ready(function(){\n$(\"#productZoom\").click(bindZoom);\n\n// Alternative prod...
2008/09/25
[ "https://Stackoverflow.com/questions/132750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22113/" ]
132,754
<p>I have a bunch of JSP files and backend in Tomcat. I have 3 different versions of JSP with same logic inside but with different layouts. So if I change some logic I have three JSP file to fix.</p> <p>What is the proper soution for such a scenario? I thought of some XML and XSLT stack: backend gives only data in XML and than for each layout I have XSLT that does some magic. </p> <p>Just imagine that you need to provide stackoverflow in various languages in JSP. Logic the same but layout different.</p> <p>Could you point me into some direction?</p>
[ { "answer_id": 132862, "author": "kosoant", "author_id": 15114, "author_profile": "https://Stackoverflow.com/users/15114", "pm_score": 1, "selected": false, "text": " <jsp-property-group>\n <url-pattern>/customers/*</url-pattern>\n <include-prelude>/shared/layout/_layout...
2008/09/25
[ "https://Stackoverflow.com/questions/132754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/501/" ]
132,764
<p>In our CMS, we have a place in which we enable users to play around with their site hierarchy - move pages around, add and remove pages, etc.</p> <p>We use drag &amp; drop to implement moving pages around. </p> <p>Each move has to saved in th DB, and exported to many HTML files. If we do that in every move, it will slow down the users. Therefore we thought that it's preferable to let the users play around as much as they want, saving each change to the DB, but only when they leave the page - to export their changes to the HTML files. </p> <p>We thought of making the user click a "publish" button when they're ready to commit their changes, but we're afraid users won't remember to do that, because from their stand point once they've moved a page to a new place - the action is done. Another problem with the button is that it's inconsistent with the behavior of the other parts of the site (for example, when a user moves a text inside a page, the changes are saved automatically, as there is only 1 HTML file to update)</p> <p>So how can we automatically save user changes on leaving the page?</p>
[ { "answer_id": 132775, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 3, "selected": true, "text": "<SCRIPT LANGUAGE=\"JavaScript1.2\" TYPE=\"text/javascript\">\n<!--\nfunction unloadMess(){\n mess = \"Wait! You haven't finis...
2008/09/25
[ "https://Stackoverflow.com/questions/132764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/278/" ]
132,799
<p>How can you you insert a newline from your batch file output?</p> <p>I want to do something like:</p> <pre class="lang-bat prettyprint-override"><code>echo hello\nworld </code></pre> <p>Which would output:</p> <pre class="lang-bat prettyprint-override"><code>hello world </code></pre>
[ { "answer_id": 132804, "author": "Matt Lacey", "author_id": 1755, "author_profile": "https://Stackoverflow.com/users/1755", "pm_score": 9, "selected": false, "text": "echo hello\necho:\necho world\n" }, { "answer_id": 132811, "author": "Grimtron", "author_id": 17378, ...
2008/09/25
[ "https://Stackoverflow.com/questions/132799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
132,812
<p>I created a report model using SSRS (2005) and published to the local server. But when I tried to run the report for the model I published using report builder I get the following error. </p> <blockquote> <p>Report execution error:The permissions granted to user are insufficient for performing this operation. (rsAccessDenied) </p> </blockquote>
[ { "answer_id": 1325291, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "rs.accessdenied" }, { "answer_id": 22348375, "author": "Ajay", "author_id": 3410149, "author_profile": "h...
2008/09/25
[ "https://Stackoverflow.com/questions/132812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14752/" ]
132,857
<p>I have the following layout for my test suite:</p> <p>TestSuite1.cmd:</p> <ol> <li>Run my program</li> <li>Check its return result</li> <li>If the return result is not 0, convert the error to textual output and abort the script. If it succeeds, write out success.</li> </ol> <p>In my single .cmd file, I call my program about 10 times with different input.</p> <p>The problem is that the program that I run 10 times takes several hours to run each time. </p> <p>Is there a way for me to parallelize all of these 10 runnings of my program while still somehow checking the return result and providing a proper output file and while still using a <strong>single</strong> .cmd file and to a single output file?</p>
[ { "answer_id": 132880, "author": "grapefrukt", "author_id": 914, "author_profile": "https://Stackoverflow.com/users/914", "pm_score": 0, "selected": false, "text": "testthingie.cmd >> output.txt\n" }, { "answer_id": 132892, "author": "paxdiablo", "author_id": 14860, "...
2008/09/25
[ "https://Stackoverflow.com/questions/132857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
132,867
<p>The question I'm really asking is why require does not take the name of the gem. Also, In the case that it doesn't, what's the easiest way to find the secret incantation to require the damn thing!?</p> <p>As an example if I have <code>memcache-client</code> installed then I have to require it using</p> <pre><code>require 'rubygems' require 'memcache' </code></pre>
[ { "answer_id": 132889, "author": "Kyle Burton", "author_id": 19784, "author_profile": "https://Stackoverflow.com/users/19784", "pm_score": 3, "selected": false, "text": "kburton@hypothesisf:~$ gem environment\nRubyGems Environment:\n - RUBYGEMS VERSION: 1.2.0\n - RUBY VERSION: 1.8.7 (2...
2008/09/25
[ "https://Stackoverflow.com/questions/132867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18751/" ]
132,885
<p>I need to switch among 3 different environments when developing my web app - Development, UAT, and Prod. I have different database connections in my configuration files for all 3. I have seen switching these settings done manually by changing all references and then rebuilding the solution, and also done with preprocessor directives. Is there an easy way to do this based on some variable so that the configuration doesn't have to be revised when deploying to a new environment every time?</p>
[ { "answer_id": 132934, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 2, "selected": false, "text": "<Target Name=\"Configs\">\n<Xslt RootTag=\"\" Inputs=\"web.config\" Output=\"Web.$(COMPUTERNAME).config\" Xsl=\"web.c...
2008/09/25
[ "https://Stackoverflow.com/questions/132885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
132,902
<p>I need to move entire tables from one MySQL database to another. I don't have full access to the second one, only phpMyAdmin access. I can only upload (compressed) sql files smaller than 2MB. But the compressed output from a mysqldump of the first database's tables is larger than 10MB.</p> <p>Is there a way to split the output from mysqldump into smaller files? I cannot use split(1) since I cannot cat(1) the files back on the remote server.</p> <p>Or is there another solution I have missed?</p> <p><strong>Edit</strong></p> <p>The --extended-insert=FALSE option to mysqldump suggested by the first poster yields a .sql file that can then be split into importable files, provided that split(1) is called with a suitable --lines option. By trial and error I found that bzip2 compresses the .sql files by a factor of 20, so I needed to figure out how many lines of sql code correspond roughly to 40MB.</p>
[ { "answer_id": 132939, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 6, "selected": true, "text": "mysqldump -d --all-databases \n" }, { "answer_id": 132957, "author": "skoob", "author_id": 20708, ...
2008/09/25
[ "https://Stackoverflow.com/questions/132902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1428/" ]
132,921
<p>I was wondering how i can force a user who has requested a page using Http to use the secure https version?</p> <p>I am using Websphere 6.1 as my application server and Rad 7 as my development environment</p> <p>Thanks Damien</p>
[ { "answer_id": 133116, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 3, "selected": true, "text": "ServletRequest.getScheme()" }, { "answer_id": 141407, "author": "fnCzar", "author_id": 15053, "author_prof...
2008/09/25
[ "https://Stackoverflow.com/questions/132921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11612/" ]
132,940
<p>Recently I noticed my application appears to be eating memory that never gets released. After profiling with CLRProfiler I've found that the Castle Windsor container I'm using is holding onto objects. These objects are declared with the lifestyle="transient" attribute in the config xml.</p> <p>I've found if I put an explicit call to <code>IWindsorContainer.Release(hangingObject)</code>, that it will drop its references.</p> <p>This is causing a problem though, I wasn't expecting that with a transient lifestyle object CastleWindsor would keep a reference and effectively create a leak. It's going to be a rather mundane and error prone task going around inserting explicit Release calls in all the appropriate places.</p> <p>Have you seen this problem, and do you have any suggestions for how to get around it?</p>
[ { "answer_id": 133058, "author": "Scott Langham", "author_id": 11898, "author_profile": "https://Stackoverflow.com/users/11898", "pm_score": 1, "selected": false, "text": "ILifestyleManager" }, { "answer_id": 166523, "author": "Bittercoder", "author_id": 4843, "author...
2008/09/25
[ "https://Stackoverflow.com/questions/132940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11898/" ]
132,955
<p>How do I have a script run every, say 30 minutes? I assume there are different ways for different OSs. I'm using OS X.</p>
[ { "answer_id": 133425, "author": "Mecki", "author_id": 15809, "author_profile": "https://Stackoverflow.com/users/15809", "pm_score": 8, "selected": true, "text": "launchd" }, { "answer_id": 58543077, "author": "webcpu", "author_id": 2442765, "author_profile": "https:/...
2008/09/25
[ "https://Stackoverflow.com/questions/132955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
132,971
<p>A <a href="http://www.google.com/search?ie=UTF-8&amp;oe=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=windows+cron" rel="noreferrer">Google search</a> turned up software that performs the same functions as cron, but nothing built into Windows.</p> <p>I'm running Windows XP Professional, but advice for any version of Windows would be potentially helpful to someone.</p> <p>Is there also a way to invoke this feature (which based on answers is called the Task Scheduler) programatically or via the command line?</p>
[ { "answer_id": 133053, "author": "enobrev", "author_id": 14651, "author_profile": "https://Stackoverflow.com/users/14651", "pm_score": 3, "selected": false, "text": "Supported systems\n\n* Windows 2000 (any version) works\n* Windows XP (SP 2) works\n* Windows Server 2003 ...
2008/09/25
[ "https://Stackoverflow.com/questions/132971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
132,976
<p>I have a MOJO I would like executed once, and once only after the test phase of the last project in the reactor to run.</p> <p>Using:</p> <pre><code>if (!getProject().isExecutionRoot()) { return ; } </code></pre> <p>at the start of the execute() method means my mojo gets executed once, however at the very beginning of the build - before all other child modules. </p>
[ { "answer_id": 137318, "author": "npellow", "author_id": 2767300, "author_profile": "https://Stackoverflow.com/users/2767300", "pm_score": 3, "selected": false, "text": "/**\n * The projects in the reactor.\n *\n * @parameter expression=\"${reactorProjects}\"\n * @readonly\n */\nprivate ...
2008/09/25
[ "https://Stackoverflow.com/questions/132976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2767300/" ]
132,988
<p>My <a href="https://english.stackexchange.com/questions/19967/what-does-google-fu-mean">Google-fu</a> has failed me.</p> <p>In Python, are the following two tests for equality equivalent?</p> <pre><code>n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' </code></pre> <p>Does this hold true for objects where you would be comparing instances (a <code>list</code> say)?</p> <p>Okay, so this kind of answers my question:</p> <pre><code>L = [] L.append(1) if L == [1]: print 'Yay!' # Holds true, but... if L is [1]: print 'Yay!' # Doesn't. </code></pre> <p>So <code>==</code> tests value where <code>is</code> tests to see if they are the same object?</p>
[ { "answer_id": 133017, "author": "stephenbayer", "author_id": 18893, "author_profile": "https://Stackoverflow.com/users/18893", "pm_score": 6, "selected": false, "text": "==" }, { "answer_id": 133022, "author": "mmaibaum", "author_id": 12213, "author_profile": "https:...
2008/09/25
[ "https://Stackoverflow.com/questions/132988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
133,002
<p>I am using Flex to connect to a Rest service. To access order #32, for instance, I can call the URL <a href="http://[service]/orders/32" rel="nofollow noreferrer">http://[service]/orders/32</a>. The URL <em>must</em> be configured as a destination - since the client will connect to different instances of the service. All of this is using the Blaze Proxy, since it involves GET, PUT, DELETE and POST calls. The problem is:- how do I append the "32" to the end of a destination when using HttpService? All I do is set the destination, and at some point this is converted into a URL. I have traced the code, but I don't know where this is done, so can't replace it.</p> <p>Options are: 1. Resolve the destination to a URL within the Flex client, and then set the URL (with the appended data) as the URL. 2. Write my own java Flex Adapter that overrides the standard Proxy, and map parameters to the url like the following: <a href="http://[service]/order/" rel="nofollow noreferrer">http://[service]/order/</a>{id}?id=32 to <a href="http://[service]/order/32" rel="nofollow noreferrer">http://[service]/order/32</a></p> <p>Has anyone come across this problem before, and are there any simple ways to resolve this?</p>
[ { "answer_id": 134260, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 0, "selected": false, "text": "<mx:HTTPService\n id=\"UCService\"\n result=\"UCServiceHandler(event)\" \n showBusyCursor=\"true\"\n resultFor...
2008/09/25
[ "https://Stackoverflow.com/questions/133002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/450527/" ]
133,008
<p>What is Big O notation? Do you use it?</p> <p>I missed this university class I guess :D</p> <p>Does anyone use it and give some real life examples of where they used it?</p> <hr /> <h3>See also:</h3> <p><a href="https://stackoverflow.com/questions/107165/big-o-for-eight-year-olds">Big-O for Eight Year Olds?</a><br /> <a href="https://stackoverflow.com/questions/3255/big-o-how-do-you-calculateapproximate-it">Big O, how do you calculate/approximate it?</a><br /> <a href="https://stackoverflow.com/questions/111426/did-you-apply-computational-complexity-theory-in-real-life">Did you apply computational complexity theory in real life?</a></p>
[ { "answer_id": 133128, "author": "Steve g", "author_id": 12092, "author_profile": "https://Stackoverflow.com/users/12092", "pm_score": 3, "selected": false, "text": "/** Takes an array of strings and concatenates them\n * This is a silly way of doing things but it gets the \n * point a...
2008/09/25
[ "https://Stackoverflow.com/questions/133008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
133,031
<p>I need to add a specific column if it does not exist. I have something like the following, but it always returns false:</p> <pre><code>IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'myTableName' AND COLUMN_NAME = 'myColumnName') </code></pre> <p>How can I check if a column exists in a table of the SQL Server database?</p>
[ { "answer_id": 133041, "author": "Leon Tayson", "author_id": 18413, "author_profile": "https://Stackoverflow.com/users/18413", "pm_score": 6, "selected": false, "text": "IF NOT EXISTS(\n SELECT TOP 1 1\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE \n [TABLE_NAME] = 'Employees'\n AND...
2008/09/25
[ "https://Stackoverflow.com/questions/133031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2631856/" ]
133,051
<p>The CSS rules <code>visibility:hidden</code> and <code>display:none</code> both result in the element not being visible. Are these synonyms?</p>
[ { "answer_id": 133059, "author": "mmaibaum", "author_id": 12213, "author_profile": "https://Stackoverflow.com/users/12213", "pm_score": 7, "selected": false, "text": "display:none" }, { "answer_id": 133064, "author": "kemiller2002", "author_id": 1942, "author_profile"...
2008/09/25
[ "https://Stackoverflow.com/questions/133051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14749/" ]
133,081
<p>In MS SQL 2000 and 2005, given a datetime such as '2008-09-25 12:34:56' what is the most efficient way to get a datetime containing only '2008-09-25'?</p> <p>Duplicated <a href="https://stackoverflow.com/questions/2775/whats-the-best-way-to-remove-the-time-portion-of-a-datetime-value-sql-server">here</a>.</p>
[ { "answer_id": 133101, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": 5, "selected": false, "text": "Select DateAdd(Day, DateDiff(Day, 0, GetDate()), 0)\n" }, { "answer_id": 133104, "author": "Matt Ho...
2008/09/25
[ "https://Stackoverflow.com/questions/133081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16881/" ]
133,087
<p>Note: not ASP.NET.</p> <p>I've read about various methods including using SOAPClient (is this part of the standard Windows 2003 install?), ServerXMLHTTP, and building up the XML from scratch and parsing the result manually.</p> <p>Has anyone ever done this? What did you use and would you recommend it?</p>
[ { "answer_id": 133366, "author": "pdavis", "author_id": 7819, "author_profile": "https://Stackoverflow.com/users/7819", "pm_score": 2, "selected": false, "text": "<% \n SoapUrl = \"http://www.yourdomain.com/yourwebservice.asmx\" \n set xmlhttp = CreateObject(\"MSXML2.ServerXMLHTTP\...
2008/09/25
[ "https://Stackoverflow.com/questions/133087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825/" ]
133,092
<p>I have an XPath expression which provides me a sequence of values like the one below:</p> <p><code>1 2 2 3 4 5 5 6 7</code></p> <p>This is easy to convert to a sequence of unique values <code>1 2 3 4 5 6 7</code> using <code>distinct-values()</code>. However, what I want to extract is the list of duplicate values = <code>2 5</code>. I can't think of an easy way to do this. Can anyone help?</p>
[ { "answer_id": 134986, "author": "JeniT", "author_id": 6739, "author_profile": "https://Stackoverflow.com/users/6739", "pm_score": 2, "selected": false, "text": "distinct-values(\n for $item in $seq\n return if (count($seq[. eq $item]) > 1)\n then $item\n else ())\n" ...
2008/09/25
[ "https://Stackoverflow.com/questions/133092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
133,111
<p>I need to increment a number in a source file from an Ant build script. I can use the <code><a href="http://ant.apache.org/manual/Tasks/replaceregexp.html" rel="nofollow noreferrer">ReplaceRegExp</a></code> task to find the number I want to increment, but how do I then increment that number within the <code>replace</code> attribute?</p> <p>Heres what I've got so far:</p> <pre><code>&lt;replaceregexp file="${basedir}/src/path/to/MyFile.java" match="MY_PROPERTY = ([0-9]{1,});" replace="MY_PROPERTY = \1;"/&gt; </code></pre> <p>In the replace attribute, how would I do </p> <pre><code>replace="MY_PROPERTY = (\1 + 1);" </code></pre> <p>I can't use the <code>buildnumber</code> task to store the value in a file since I'm already using that within the same build target. Is there another ant task that will allow me to increment a property?</p>
[ { "answer_id": 133159, "author": "Yuval F", "author_id": 1702, "author_profile": "https://Stackoverflow.com/users/1702", "pm_score": 3, "selected": true, "text": "<propertyfile file=\"${version-file}\">\n <entry key=\"revision\" type=\"string\" operation=\"=\" value=\"${revision}\" />\n ...
2008/09/25
[ "https://Stackoverflow.com/questions/133111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/270/" ]
133,122
<p>I want to make a .NET Form as a TopMost Form for another external App (not .NET related, pure Win32) so it stays above that Win32App, but not the rest of the apps running.</p> <p>I Have the handle of the Win32App (provided by the Win32App itself), and I've tried <a href="http://msdn.microsoft.com/en-us/library/ms633541(VS.85).aspx" rel="noreferrer">Win32 SetParent() function</a>, via <a href="http://www.pinvoke.net/default.aspx/user32/SetParent.html" rel="noreferrer">P/Invoke in C#</a>, but then my .NET Form gets confined into the Win32App and that's not what I want.</p>
[ { "answer_id": 133415, "author": "Joel Lucsy", "author_id": 645, "author_profile": "https://Stackoverflow.com/users/645", "pm_score": 5, "selected": true, "text": "SetWindowLongPtr(win32window, GWLP_HWNDPARENT, formhandle)" }, { "answer_id": 133496, "author": "Ricardo Amores"...
2008/09/25
[ "https://Stackoverflow.com/questions/133122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10136/" ]
133,129
<p>I use <em>Eclipse 3.3</em> in my daily work, and have also used <em>Eclipse 3.2</em> extensively as well. In both versions, sometimes the Search options (Java Search, File Search, etc) in the menu get disabled, seemingly at random times. However, with <kbd>Ctrl</kbd>+<kbd>H</kbd>, I am able to access the search functionality. Does anyone know why this happens? Has it been fixed in <em>Eclipse 3.4</em>?</p>
[ { "answer_id": 12950138, "author": "mehmet", "author_id": 1755622, "author_profile": "https://Stackoverflow.com/users/1755622", "pm_score": 3, "selected": false, "text": "org.eclipse.search" }, { "answer_id": 18730989, "author": "Eric L.", "author_id": 1007619, "autho...
2008/09/25
[ "https://Stackoverflow.com/questions/133129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8026/" ]
133,154
<p>While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.</p> <ol> <li>It can help you understand the problem better. Maybe you don't <em>have</em> to solve it the way you thought you did.</li> <li>It can help you understand the language better. Maybe it supports more features than you realized.</li> </ol> <p>And pushing this idea to it's illogical conclusion...how would you implement quicksort in a batch file? Is it even possible?</p>
[ { "answer_id": 133155, "author": "Cody Hatch", "author_id": 17086, "author_profile": "https://Stackoverflow.com/users/17086", "pm_score": 6, "selected": true, "text": "@echo off\nSETLOCAL ENABLEDELAYEDEXPANSION\n\ncall :qSort %*\nfor %%i in (%return%) do set results=!results! %%i\necho S...
2008/09/25
[ "https://Stackoverflow.com/questions/133154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17086/" ]
133,173
<p>In a previous job we had a classic ASP application that no one wanted to migrate to ASP.NET. The things that it did, it did very well. </p> <p>However there was some new functionality that needed to be added that just seemed best suited to ASP.NET. The decision was made to allow the system to become a weird hybrid of ASP and ASP.NET. </p> <p>Our biggest sticking point was session management and we hacked together a solution to pass session values through form variables. I've talked to others that handled this same problem through cookies.</p> <p>Both methods seem a horrible kluge (in addition to being terribly insecure). </p> <p>Is there a better or cleaner way or is this just such a bad idea to begin with that discussion on the topic is pointless?</p>
[ { "answer_id": 69920723, "author": "eliteproxy", "author_id": 2948862, "author_profile": "https://Stackoverflow.com/users/2948862", "pm_score": 1, "selected": false, "text": " <system.webServer>\n <modules>\n <remove name=\"FormsAuthenticationModule\" />\n <add name=\"Forms...
2008/09/25
[ "https://Stackoverflow.com/questions/133173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2173/" ]
133,194
<p>I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on Windows XP SP3 and Internet Explorer 7.</p> <p>My add-in is using custom Folder Home Page which displays my custom form, which wraps Outlook View Control.</p> <p>I get COM Exception with 'Exception from HRESULT: 0xXXXXXXXX' description every time when I try to set Folder property of the OVC. Error code is a random number, every time is different. It is not the first access to control's properties, before that, View and ViewXML properties are set already. Control is marked as Safe for Scripting.</p> <p>I am using value of the CurrentFolder.FolderPath property of the active explorer, which seems to be a right one:</p> <pre><code>Outlook.Explorer currentExplorer = app.ActiveExplorer(); if (currentExplorer != null) { ovcWrapper.Folder = currentExplorer.CurrentFolder.FolderPath; } </code></pre> <p>This is top of the stack trace:</p> <pre><code>System.Runtime.InteropServices.COMException (0xXXXXXXXX): Exception from HRESULT: 0xXXXXXXXX at Microsoft.Office.Interop.OutlookViewCtl.ViewCtlClass.set_Folder(String pVal) at AxMicrosoft.Office.Interop.OutlookViewCtl.AxViewCtl.set_Folder(String value).. </code></pre> <p>This is happening only if the folder is located in non-default PST file. Changing to folder inside default PST file will produce no exception.</p> <p>I must underline that everything worked just fine before I went to holiday :). It seems that Windows XP installed some updates which changed default security of Internet Explorer or Outlook 2003 while I was absent.</p> <p>On the other (virtual machine) with Office 2007 and Internet Explorer 6, without any updates, everything is working just fine.</p>
[ { "answer_id": 139934, "author": "BKimmel", "author_id": 13776, "author_profile": "https://Stackoverflow.com/users/13776", "pm_score": 1, "selected": false, "text": "app.Session.Logon() \n" }, { "answer_id": 158035, "author": "Nenad Dobrilovic", "author_id": 22062, "a...
2008/09/25
[ "https://Stackoverflow.com/questions/133194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22062/" ]
133,204
<p>How do I get a list of the files checked out by users (including the usernames) using P4V or P4? </p> <p>I want to provide a depot location and see a list of any files under that location (including sub folders) that are checked out.</p>
[ { "answer_id": 133222, "author": "Iain", "author_id": 20457, "author_profile": "https://Stackoverflow.com/users/20457", "pm_score": 5, "selected": false, "text": "p4 opened -a //depot/Your/Location/...\n" }, { "answer_id": 133249, "author": "Mark", "author_id": 4405, ...
2008/09/25
[ "https://Stackoverflow.com/questions/133204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20457/" ]
133,214
<p>We need to implement a simple state machine in <strong>C</strong>.<br> Is a standard switch statement the best way to go?<br> We have a current state (state) and a trigger for the transition.</p> <pre><code> switch(state) { case STATE_1: state = DoState1(transition); break; case STATE_2: state = DoState2(transition); break; } ... DoState2(int transition) { // Do State Work ... if(transition == FROM_STATE_2) { // New state when doing STATE 2 -> STATE 2 } if(transition == FROM_STATE_1) { // New State when moving STATE 1 -> STATE 2 } return new_state; } </code></pre> <p>Is there a better way <strong>for simple state machines</strong></p> <p>EDIT: For C++, I think the Boost <a href="http://www.boost.org/doc/libs/1_36_0/libs/statechart/doc/index.html" rel="noreferrer">Statechart</a> library might be the way to go. However, it does <strong>not</strong> help with C. Lets concentrate on the C use case.</p>
[ { "answer_id": 133301, "author": "Mark", "author_id": 4405, "author_profile": "https://Stackoverflow.com/users/4405", "pm_score": 2, "selected": false, "text": "static int current_state; // should always hold current state -- and probably be an enum or something\n\nvoid state_leave(in...
2008/09/25
[ "https://Stackoverflow.com/questions/133214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703/" ]
133,226
<p>how do i implement an eval script in a sever side control?</p> <p>eg. <code>&lt;a runat="server" href="?id=&lt;%= Eval("Id") %&gt;"&gt;hello world&lt;/a&gt;</code></p>
[ { "answer_id": 133252, "author": "Forgotten Semicolon", "author_id": 1960, "author_profile": "https://Stackoverflow.com/users/1960", "pm_score": 2, "selected": false, "text": "<%# Eval(\"Id\") %>" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11528/" ]
133,229
<p>I want to discover all xml files that my ClassLoader is aware of using a wildcard pattern. Is there any way to do this?</p>
[ { "answer_id": 133280, "author": "Steve B.", "author_id": 19479, "author_profile": "https://Stackoverflow.com/users/19479", "pm_score": -1, "selected": false, "text": "jar -tvf jarname | grep xml$" }, { "answer_id": 133450, "author": "corlettk", "author_id": 69224, "a...
2008/09/25
[ "https://Stackoverflow.com/questions/133229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
133,236
<p>I am wanting to store the "state" of some actions the user is performing in a series of different ASP.Net webforms. What are my choices for persisting state, and what are the pros/cons of each solution?</p> <p>I have been using Session objects, and using some helper methods to strongly type the objects:</p> <pre><code> public static Account GetCurrentAccount(HttpSessionState session) { return (Account)session[ACCOUNT]; } public static void SetCurrentAccount(Account obj, HttpSessionState session) { session[ACCOUNT] = obj; } </code></pre> <p>I have been told by numerous sources that "Session is evil", so that is really the root cause of this question. I want to know what you think "best practice", and why.</p>
[ { "answer_id": 133259, "author": "Kamiel Wanrooij", "author_id": 4174, "author_profile": "https://Stackoverflow.com/users/4174", "pm_score": 3, "selected": false, "text": "Session" }, { "answer_id": 133274, "author": "Kamiel Wanrooij", "author_id": 4174, "author_profi...
2008/09/25
[ "https://Stackoverflow.com/questions/133236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10589/" ]
133,243
<p>I want to have a <code>UIScrollView</code> with a set of subviews where each of these subviews has a <code>UITextView</code> with a different text. For this task, I have modified the <code>PageControl</code> example from the apple "iphone dev center" in order to add it a simple <code>UITextView</code> to the view which is used to generate the subviews of the scroll view. When I run the app (both on the simulator and the phone), NO Text is seen but if i activate the "user interaction" and click on it, the text magically appears (as well as the keyboard).</p> <p>Does anyone has a solution or made any progress with <code>UITextView</code> inside a <code>UIScrollView</code>? Thanks.</p>
[ { "answer_id": 156210, "author": "benzado", "author_id": 10947, "author_profile": "https://Stackoverflow.com/users/10947", "pm_score": 2, "selected": false, "text": "UITextView" }, { "answer_id": 750977, "author": "filmore", "author_id": 91015, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/133243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22154/" ]
133,270
<p>I would like to code a little program which visually illustrates the behavior of the <code>volatile</code> keyword. Ideally, it should be a program which performs concurrent access to a non volatile static field and which gets incorrect behavior because of that. </p> <p>Adding the volatile keyword in the same program should fix the problem.</p> <p>That something I didn't manage to achieve. Even trying several times, enabling optimization, etc., I always get a correct behavior without the 'volatile' keyword.</p> <p>Do you have any idea about this topic? Do you know how to simulate such a problem in a simple demo app? Does it depend on hardware?</p>
[ { "answer_id": 1284007, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 8, "selected": true, "text": "while (test.foo != 255)" }, { "answer_id": 13300755, "author": "corlettk", "author_id": 69224, "author_pro...
2008/09/25
[ "https://Stackoverflow.com/questions/133270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4687/" ]
133,277
<p>I am moving from classic ASP to ASP.NET and have encountered what many of you already know as "viewstate". I might be jumping the gun with my assumption, but it looks highly cumbersome. I have developed many ASP forms in the past and never had issues with keeping state. Is there another way OR am I going to have to learn this Viewstate thing in ASP.NET? I am using Visual Studio 2008, VB.NET as the code behind language and Framework v3.5 with SQL Server 2005.</p>
[ { "answer_id": 133342, "author": "CodeRedick", "author_id": 17145, "author_profile": "https://Stackoverflow.com/users/17145", "pm_score": 2, "selected": false, "text": "Viewstate[\"Key\"] = value;\n" }, { "answer_id": 20393875, "author": "Abdallah Daragmeh", "author_id": ...
2008/09/25
[ "https://Stackoverflow.com/questions/133277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14728/" ]
133,281
<p>Has anyone tried the ActiveRecord <a href="http://www.castleproject.org/activerecord/gettingstarted/index.html" rel="nofollow noreferrer">Intro Sample</a> with C# 3.5? I somehow have the feeling that the sample is completely wrong or just out of date. The XML configuration is just plain wrong:</p> <pre><code>&lt;add key="connection.connection_string" value="xxx" /&gt; </code></pre> <p>should be :</p> <pre><code>&lt;add key="hibernate.connection.connection_string" value="xxx" /&gt; </code></pre> <p>(if I understand the nhibernate config syntax right..)</p> <p>I am wondering what I'm doing wrong. I get a "Could not perform ExecuteQuery for User" Exception when calling Count() on the User Model. </p> <p>No idea what this can be. The tutorial source differs strongly from the source on the page (most notably in the XML configuration), and it's a VS2003 sample with different syntax on most things (no generics etc).</p> <p>Any suggestions? ActiveRecord looks awesome..</p>
[ { "answer_id": 133305, "author": "Gilligan", "author_id": 12356, "author_profile": "https://Stackoverflow.com/users/12356", "pm_score": 0, "selected": false, "text": "hibernate." }, { "answer_id": 133324, "author": "Paul Batum", "author_id": 48281, "author_profile": "...
2008/09/25
[ "https://Stackoverflow.com/questions/133281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21699/" ]
133,287
<p>I have a simple function that sends out emails, how would I go about using threads to speed email delivery?</p> <p>Sample code would be ideal.</p>
[ { "answer_id": 133321, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 1, "selected": false, "text": "using System;\nusing System.Threading;\n\nclass Test\n{\n static void Main() \n {\n Thread newThread = new ...
2008/09/25
[ "https://Stackoverflow.com/questions/133287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
133,308
<p>I'm new to CodeIgniter, and I need some help. I'd like to implement the following:</p> <ul> <li><p>View a user's profile via: http://localhost/profile/johndoe</p> </li> <li><p>Administrate a user's profile via: http://localhost/admin/profile/johndoe</p> </li> <li><p>Be able to accomplish even further processing via: http://localhost/admin/profile/create ...and... http://localhost/admin/profile/edit/johndoe</p> </li> </ul> <p>I've already created the admin object and secured it. Do I have to create a profile function under admin, and work with the URI to process accordingly? Is there a better way?</p>
[ { "answer_id": 133976, "author": "Christian Davén", "author_id": 12534, "author_profile": "https://Stackoverflow.com/users/12534", "pm_score": 4, "selected": true, "text": "index" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18334/" ]
133,310
<p>I have a JavaScript widget which provides standard extension points. One of them is the <code>beforecreate</code> function. It should return <code>false</code> to prevent an item from being created. </p> <p>I've added an Ajax call into this function using jQuery:</p> <pre><code>beforecreate: function (node, targetNode, type, to) { jQuery.get('http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value), function (result) { if (result.isOk == false) alert(result.message); }); } </code></pre> <p>But I want to prevent my widget from creating the item, so I should return <code>false</code> in the mother-function, not in the callback. Is there a way to perform a synchronous AJAX request using jQuery or any other in-browser API?</p>
[ { "answer_id": 133327, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 11, "selected": true, "text": "beforecreate: function (node, targetNode, type, to) {\n jQuery.ajax({\n url: 'http://example.com/catalog/c...
2008/09/25
[ "https://Stackoverflow.com/questions/133310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2313/" ]
133,313
<p>I'm trying to design some tables to store some data, which has to be converted to different languages later. Can anybody provide some "best practices" or guidelines for this?</p> <p>Thanks</p>
[ { "answer_id": 133351, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 5, "selected": true, "text": "Products\n----------\nid\nprice\n\nProducts_Translations\n----------------------\nproduct_id\nlocale\nname\ndescription...
2008/09/25
[ "https://Stackoverflow.com/questions/133313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22016/" ]
133,325
<p>Is there a way to Minimize an external application that I don't have control over from with-in my Delphi application?</p> <p>for example notepad.exe, except the application I want to minimize will only ever have one instance.</p>
[ { "answer_id": 133530, "author": "Germán Estévez -Neftalí-", "author_id": 17487, "author_profile": "https://Stackoverflow.com/users/17487", "pm_score": 4, "selected": true, "text": "var \n Indicador :Integer;\nbegin \n // Find the window by Classname\n Indicador := FindWindow(PChar('...
2008/09/25
[ "https://Stackoverflow.com/questions/133325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2098/" ]
133,328
<p>I have been asked to develop some usercontrols in ASP.NET that will at a later point be pulled into a SharePoint site as web parts. I am new to SharePoint and will not have access to a SharePoint server during the time I need to prototype these parts.</p> <p>Does anyone know of any reasons that this approach will not work? If this approach is not recommended, what would other options be? Any suggestions on a resource/tutorial on what to consider when developing an ASP.NET web part with SharePoint in mind?</p> <p>Thanks</p> <p><strong>Edit: 12/31/2008</strong> I finally marked an answer to this one. It took me a while to realize that going the SharePoint route right away, though painful at first, is the best way to go about it. The free VPC image makes getting set up to develop relatively painless. </p> <p>While you can, as I did, develop web parts in ASP.NET without SharePoint, when it comes to developing and deploying SharePoint applications you haven't learned a thing, only pushed the learning curve off into a time when you think you are done, (and have probably informed stakeholders to that effect). To delay the SharePoint learning curve doesn't do you or your project any favors, and your final product will better for the expertise you gain along the way.</p>
[ { "answer_id": 133438, "author": "Chris Cudmore", "author_id": 18907, "author_profile": "https://Stackoverflow.com/users/18907", "pm_score": 0, "selected": false, "text": "<SafeControl Assembly=\"MyControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=975cc42deafbee31\" Namespace=\"M...
2008/09/25
[ "https://Stackoverflow.com/questions/133328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10552/" ]
133,357
<p>How do I find the name of the namespace or module 'Foo' in the filter below?</p> <pre><code>class ApplicationController &lt; ActionController::Base def get_module_name @module_name = ??? end end class Foo::BarController &lt; ApplicationController before_filter :get_module_name end </code></pre>
[ { "answer_id": 133396, "author": "Daniel Lucraft", "author_id": 11951, "author_profile": "https://Stackoverflow.com/users/11951", "pm_score": 4, "selected": false, "text": " def get_module_name\n @module_name = self.class.to_s.split(\"::\").first\n end\n" }, { "answer_id": 1...
2008/09/25
[ "https://Stackoverflow.com/questions/133357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21872/" ]
133,364
<p>Which is your favorite way to go with strings in C++? A C-style array of <code>char</code>s? Or <code>wchar_t</code>? <code>CString</code>, <code>std::basic_string</code>, <code>std::string</code>, <code>BSTR</code> or <code>CComBSTR</code>?</p> <p>Certainly each of these has its own area of application, but anyway, which is your favorite and why?</p>
[ { "answer_id": 133422, "author": "xtofl", "author_id": 6610, "author_profile": "https://Stackoverflow.com/users/6610", "pm_score": 2, "selected": false, "text": "std::string" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19024/" ]
133,374
<p>When trying to call Close or Dispose on an SqlDataReader i get a timeout expired exception. If you have a DbConnection to SQL Server, you can reproduce it yourself with:</p> <pre><code>String CRLF = "\r\n"; String sql = "SELECT * " + CRLF + "FROM (" + CRLF + " SELECT (a.Number * 256) + b.Number AS Number" + CRLF + " FROM master..spt_values a," + CRLF + " master..spt_values b" + CRLF + " WHERE a.Type = 'p'" + CRLF + " AND b.Type = 'p') Numbers1" + CRLF + " FULL OUTER JOIN (" + CRLF + " SELECT (print("code sample");a.Number * 256) + b.Number AS Number" + CRLF + " FROM master..spt_values a," + CRLF + " master..spt_values b" + CRLF + " WHERE a.Type = 'p'" + CRLF + " AND b.Type = 'p') Numbers2" + CRLF + " ON 1=1"; DbCommand cmd = connection.CreateCommand(); cmd.CommandText = sql; DbDataReader rdr = cmd.ExecuteReader(); rdr.Close(); </code></pre> <p>If you call reader.Close() or reader.Dispose() it will throw a System.Data.SqlClient.SqlException:</p> <ul> <li>ErrorCode: -2146232060 (0x80131904)</li> <li>Message: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."</li> </ul>
[ { "answer_id": 133433, "author": "MADMap", "author_id": 17558, "author_profile": "https://Stackoverflow.com/users/17558", "pm_score": 0, "selected": false, "text": "DbDataReader rdr = cmd.ExecuteReader();\nwhile(rdr.Read())\n{\n int index = rdr.GetInt32(0);\n}\n" }, { "answer_...
2008/09/25
[ "https://Stackoverflow.com/questions/133374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
133,379
<p>I'm trying to install a service using InstallUtil.exe but invoked through <code>Process.Start</code>. Here's the code:</p> <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo (m_strInstallUtil, strExePath); System.Diagnostics.Process.Start (startInfo); </code></pre> <p>where <code>m_strInstallUtil</code> is the fully qualified path and exe to "InstallUtil.exe" and <code>strExePath</code> is the fully qualified path/name to my service.</p> <p>Running the command line syntax from an elevated command prompt works; running from my app (using the above code) does not. I assume I'm dealing with some process elevation issue, so how would I run my process in an elevated state? Do I need to look at <code>ShellExecute</code> for this?</p> <p>This is all on Windows Vista. I am running the process in the VS2008 debugger elevated to admin privilege.</p> <p>I also tried setting <code>startInfo.Verb = "runas";</code> but it didn't seem to solve the problem.</p>
[ { "answer_id": 133478, "author": "Vijesh VP", "author_id": 22016, "author_profile": "https://Stackoverflow.com/users/22016", "pm_score": 1, "selected": false, "text": "WindowsIdentity identity = new WindowsIdentity(accessToken);\nWindowsImpersonationContext context = identity.Impersonate...
2008/09/25
[ "https://Stackoverflow.com/questions/133379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683/" ]
133,390
<p>I want to use forms authentication in my asp.net mvc site.</p> <p>Can I use an already existing sql db (on a remote server) for it? How do I configure the site to use this db for authentication? Which tables do I need/are used for authentication?</p>
[ { "answer_id": 133432, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": 3, "selected": true, "text": "aspnet_regsql.exe" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9632/" ]
133,394
<p>I am developing a Joomla component and one of the views needs to render itself as PDF. In the view, I have tried setting the content-type with the following line, but when I see the response, it is text/html anyways.</p> <pre><code>header('Content-type: application/pdf'); </code></pre> <p>If I do this in a regular php page, everything works as expected. It seems that I need to tell Joomla to use application/pdf instead of text/html. How can I do it?</p> <p>Note: Setting other headers, such as <code>Content-Disposition</code>, works as expected.</p>
[ { "answer_id": 134827, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "$doc =& JFactory::getDocument();\n$doc->setMimeEncoding('application/pdf');\n" }, { "answer_id": 13920887, "aut...
2008/09/25
[ "https://Stackoverflow.com/questions/133394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2680/" ]
133,430
<p>I have created a web reference (Add Web Reference) from Visual Studio 2008 and strangely, I need to set the <em>propertyNameField</em>Specified to true for all the fields I want to submit. Failure to do that and values are not passed back to the WCF Service. </p> <p>I have read at several places that this was fixed in the RTM version of Visual Studio. Why does it still occurring?</p> <p>My data contracts are all valid with nothing else than properties and lists. Any ideas?</p>
[ { "answer_id": 133498, "author": "Sebastien Lachance", "author_id": 201997, "author_profile": "https://Stackoverflow.com/users/201997", "pm_score": 0, "selected": false, "text": "[DataContract]\npublic class BrowserBase : IBrowser\n{\n\n [DataMember]\n public BrowserType BrowserTyp...
2008/09/25
[ "https://Stackoverflow.com/questions/133430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/201997/" ]
133,436
<p>I'm using Java 6, Tomcat 6, and Metro. I use WebService and WebMethod annotations to expose my web service. I would like to obtain information about the request. I tried the following code, but wsCtxt is always null. What step must I take to <em>not</em> get null for the WebServiceContext.</p> <p>In other words: how can I execute the following line to get a non-null value for wsCtxt?</p> <p>MessageContext msgCtxt = wsCtxt.getMessageContext();</p> <pre><code>@WebService public class MyService{ @Resource WebServiceContext wsCtxt; @WebMethod public void myWebMethod(){ MessageContext msgCtxt = wsCtxt.getMessageContext(); HttpServletRequest req = (HttpServletRequest)msgCtxt.get(MessageContext.SERVLET_REQUEST); String clientIP = req.getRemoteAddr(); } </code></pre>
[ { "answer_id": 133565, "author": "James A Wilson", "author_id": 13892, "author_profile": "https://Stackoverflow.com/users/13892", "pm_score": 5, "selected": true, "text": "@Resource(name=\"wsContext\") WebServiceContext wsCtxt;" }, { "answer_id": 139169, "author": "Steve McLe...
2008/09/25
[ "https://Stackoverflow.com/questions/133436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2959/" ]
133,442
<p>Our server application is listening on a port, and after a period of time it no longer accepts incoming connections. (And while I'd love to solve this issue, it's not what I'm asking about here;)</p> <p>The strange this is that when our app stops accepting connections on port 44044, so does IIS (on port 8080). Killing our app fixes everything - IIS starts responding again.</p> <p>So the question is, can an application mess up the entire TCP/IP stack? Or perhaps, how can an application do that?</p> <p>Senseless detail: Our app is written in C#, under .Net 2.0, on XP/SP2.</p> <p>Clarification: IIS is not "refusing" the attempted connections. It is never seeing them. Clients are getting a "server did not respond in a timely manner" message (using the .Net TCP Client.)</p>
[ { "answer_id": 133466, "author": "RichS", "author_id": 6247, "author_profile": "https://Stackoverflow.com/users/6247", "pm_score": 2, "selected": false, "text": "netstat -a" }, { "answer_id": 134548, "author": "stephbu", "author_id": 12702, "author_profile": "https://...
2008/09/25
[ "https://Stackoverflow.com/questions/133442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16662/" ]
133,453
<p>Does IPsec in Windows XP Sp3 support AES-256 encryption?</p> <p><strong>Update:</strong></p> <ol> <li>Windows IPsec FAQ says that it's not supported in Windows XP, but maybe they changed it in Service Pack 3?<br> http://www.microsoft.com/technet/network/ipsec/ipsecfaq.mspx<br> Question: <em>Is Advanced Encryption Standard (AES) encryption supported?</em><br><br> </li> <li>origamigumby, please specify where, because I cannot find it.</li> </ol>
[ { "answer_id": 133466, "author": "RichS", "author_id": 6247, "author_profile": "https://Stackoverflow.com/users/6247", "pm_score": 2, "selected": false, "text": "netstat -a" }, { "answer_id": 134548, "author": "stephbu", "author_id": 12702, "author_profile": "https://...
2008/09/25
[ "https://Stackoverflow.com/questions/133453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22174/" ]
133,487
<p>I have a LinkedList, where Entry has a member called id. I want to remove the Entry from the list where id matches a search value. What's the best way to do this? I don't want to use Remove(), because Entry.Equals will compare other members, and I only want to match on id. I'm hoping to do something kind of like this:</p> <pre><code>entries.RemoveWhereTrue(e =&gt; e.id == searchId); </code></pre> <p>edit: Can someone re-open this question for me? It's NOT a duplicate - the question it's supposed to be a duplicate of is about the List class. List.RemoveAll won't work - that's part of the List class.</p>
[ { "answer_id": 133577, "author": "Matt Howells", "author_id": 16881, "author_profile": "https://Stackoverflow.com/users/16881", "pm_score": 3, "selected": true, "text": "list.Remove(list.First(e => e.id == searchId));\n" }, { "answer_id": 133946, "author": "munificent", "...
2008/09/25
[ "https://Stackoverflow.com/questions/133487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2348/" ]
133,493
<p>How can you check if a string is a valid GUID in vbscript? Has anyone written an IsGuid method?</p>
[ { "answer_id": 1042813, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "try\n{\n Guid g = new Guid(stringGuid);\n safeUseGuid(stringGuid); //this statement will execute only if guid is correct\n...
2008/09/25
[ "https://Stackoverflow.com/questions/133493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10023/" ]
133,515
<p>I am using <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" rel="noreferrer">SqlMetal</a> to general my DataContext.dbml class for my ASP.net application using LinqToSql. When I initially created the DataContext.dbml file, Visual Studio used this to create a related DataContext.designer.cs file. This designer file contains the DataContext class in C# that is used throughout the app (and is derived from the XML in the dbml file) and is essential to bridging the gap between the output of SqlMetal and using the DataContext with LinqToSql.</p> <p>However, when I make a change to the database and recreate the dbml file, the designer file never gets regenerated in my website. Instead, the old designer file is maintained (and therefore none of the changes to the DBML file are accessible through the LinqToSql DataContext class).</p> <p>The only process I have been able to use so far to regenerate the designer file is</p> <ol> <li>Go to Windows Explorer and delete both the dbml and designer.cs files</li> <li>Go to Visual Studio and hit Refresh in the Solution Explorer. The dbml and designer.cs files now disappear from the project.</li> <li>Regenerate the dbml file using SqlMetal</li> <li>Go to Visual Studio and hit Refresh in the Solution Explorer. Now the designer.cs file is recreated.</li> </ol> <p>It seems that Visual Studio will only generate the designer.cs file when a new dbml file is detected that does not yet have a designer.cs file. This process is pretty impractical, since it involves several manual steps and messes things up with source control.</p> <p>Does anyone know how I can get the designer.cs file automatically regenerated without having to follow the manual delete/refresh/regenerate/delete process outlined above?</p>
[ { "answer_id": 134670, "author": "DamienG", "author_id": 5720, "author_profile": "https://Stackoverflow.com/users/5720", "pm_score": 4, "selected": true, "text": "sqlmetal /code:DataContext.designer.cs /language:csharp DataContext.dbml\n" }, { "answer_id": 7165688, "author": ...
2008/09/25
[ "https://Stackoverflow.com/questions/133515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
133,558
<p>I want to log user's actions in my Ruby on Rails application.</p> <p>So far, I have a model observer that inserts logs to the database after updates and creates. In order to store which user performed the action that was logged, I require access to the session but that is problematic.</p> <p>Firstly, it breaks the MVC model. Secondly, techniques range from the hackish to the outlandish, perhaps maybe even tying the implementation to the Mongrel server.</p> <p>What is the right approach to take?</p>
[ { "answer_id": 136389, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 3, "selected": false, "text": "class MyObserverClass < ActiveRecord::Observer\n cattr_accessor :current_user # GLOBAL VARIABLE. RELIES ON RAILS BEING ...
2008/09/25
[ "https://Stackoverflow.com/questions/133558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6291/" ]
133,559
<p>I am writing a Windows service that pulls messages from an MSMQ and posts them to a legacy system (Baan). If the post fails or the machine goes down during the post, I don't want to loose the message. I am therefore using MSMQ transactions. I abort on failure, and I commit on success.</p> <p>When working against a local queue, this code works well. But in production I will want to separate the machine (or machines) running the service from the queue itself. When I test against a remote queue, an System.Messaging.MessageQueueException is thrown: "The transaction usage is invalid."</p> <p>I have verified that the queue in question is transactional.</p> <p>Here's the code that receives from the queue:</p> <pre><code>// Begin a transaction. _currentTransaction = new MessageQueueTransaction(); _currentTransaction.Begin(); Message message = queue.Receive(wait ? _queueTimeout : TimeSpan.Zero, _currentTransaction); _logger.Info("Received a message on queue {0}: {1}.", queue.Path, message.Label); WORK_ITEM item = (WORK_ITEM)message.Body; return item; </code></pre> <h2>Answer</h2> <p>I have since switched to <a href="http://www.developer.com/db/article.php/3640771" rel="noreferrer">SQL Service Broker</a>. It supports remote transactional receive, whereas MSMQ 3.0 does not. And, as an added bonus, it already uses the SQL Server instance that we cluster and back up.</p>
[ { "answer_id": 133654, "author": "Maurice", "author_id": 19676, "author_profile": "https://Stackoverflow.com/users/19676", "pm_score": 2, "selected": false, "text": "MessageQueue queue = new MessageQueue(\"myqueue\");\nusing (TransactionScope tx = new TransactionScope()) {\n Message m...
2008/09/25
[ "https://Stackoverflow.com/questions/133559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7668/" ]
133,569
<p>I usually use C++ stdlib map whenever I need to store some data associated with a specific type of value (a key value - e.g. a string or other object). The stdlib map implementation is based on trees which provides better performance (O(log n)) than the standard array or stdlib vector.</p> <p>My questions is, do you know of any C++ "standard" hashtable implementation that provides even better performance (O(1))? Something similar to what is available in the Hashtable class from the Java API.</p>
[ { "answer_id": 133591, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 7, "selected": true, "text": "<unordered_map>" }, { "answer_id": 133605, "author": "Adam Rosenfield", "author_id": 9530, "author_profil...
2008/09/25
[ "https://Stackoverflow.com/questions/133569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20317/" ]
133,571
<p>Wanted to convert</p> <pre><code>&lt;br/&gt; &lt;br/&gt; &lt;br/&gt; &lt;br/&gt; &lt;br/&gt; </code></pre> <p>into</p> <pre><code>&lt;br/&gt; </code></pre>
[ { "answer_id": 133593, "author": "mdec", "author_id": 15534, "author_profile": "https://Stackoverflow.com/users/15534", "pm_score": 2, "selected": false, "text": "<br/>" }, { "answer_id": 133600, "author": "levik", "author_id": 4465, "author_profile": "https://Stackov...
2008/09/25
[ "https://Stackoverflow.com/questions/133571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20907/" ]
133,596
<p>Is there a way to make a Radio Button enabled/disabled (not checked/unchecked) via CSS? </p> <p>I've need to toggle some radio buttons on the client so that the values can be read on the server, but setting the 'enabled' property to 'false' then changing this on the client via javascript seems to prevent me from posting back any changes to the radio button after it's been enabled.</p> <p>See: <a href="https://stackoverflow.com/questions/130165/aspnet-not-seeing-radio-button-value-change">ASP.NET not seeing Radio Button value change</a></p> <p>It was recommended that I use control.style.add("disabled", "true") instead, but this does not seem to disable the radio button for me.</p> <p>Thanks!</p>
[ { "answer_id": 133617, "author": "neuroguy123", "author_id": 12529, "author_profile": "https://Stackoverflow.com/users/12529", "pm_score": 3, "selected": false, "text": "$('#radiobuttonname').attr('disabled', 'true');\n" }, { "answer_id": 133636, "author": "JoshReedSchramm", ...
2008/09/25
[ "https://Stackoverflow.com/questions/133596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624/" ]
133,601
<p>Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces?</p> <p>For example:</p> <pre><code>public MyMethod() { if (test) { // More { } } // More { } } // End </code></pre> <p>Should match:</p> <pre><code>{ if (test) { // More { } } // More { } } </code></pre>
[ { "answer_id": 133771, "author": "Zsolt Botykai", "author_id": 11621, "author_profile": "https://Stackoverflow.com/users/11621", "pm_score": 5, "selected": false, "text": "my $NesteD ;\n$NesteD = qr/ \\{( [^{}] | (??{ $NesteD }) )* \\} /x ;\n\nif ( $Stringy =~ m/\\b( \\w+$NesteD )/x ) {\...
2008/09/25
[ "https://Stackoverflow.com/questions/133601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199234/" ]
133,610
<p>Ok, this is another one in the theory realm for the CS guys around.</p> <p>In the 90's I did fairly well in implementing BST's. The only thing I could never get my head around was the intricacy of the algorithm to balance a Binary Tree (AVL).</p> <p>Can you guys help me on this?</p>
[ { "answer_id": 267453, "author": "mscccc", "author_id": 2510, "author_profile": "https://Stackoverflow.com/users/2510", "pm_score": 2, "selected": false, "text": "IF tree is right heavy\n{\n IF tree's right subtree is left heavy\n {\n Perform Double Left rotation \n }\n ELSE\n {...
2008/09/25
[ "https://Stackoverflow.com/questions/133610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8167/" ]
133,626
<p>I am using Vim for windows installed in Unix mode. Thanks to this site I now use the <code>gf</code> command to go to a file under the cursor.</p> <p>I'm looking for a command to either:</p> <ol> <li>return to the previous file (similar to <kbd>Ctrl</kbd>+<kbd>T</kbd> for ctags), or </li> <li>remap <code>gf</code> to automatically launch the new file in a new window.</li> </ol>
[ { "answer_id": 133634, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 4, "selected": false, "text": ":e#↲" }, { "answer_id": 133661, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stack...
2008/09/25
[ "https://Stackoverflow.com/questions/133626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5823/" ]
133,648
<p>I want to insert say 50,000 records into sql server database 2000 at a time. How to accomplish this?</p>
[ { "answer_id": 133687, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 0, "selected": false, "text": "declare @index integer\nset @index = 0\nwhile @index < 50000\nbegin\n insert into table\n values (x,y,z)\n set @inde...
2008/09/25
[ "https://Stackoverflow.com/questions/133648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688440/" ]
133,660
<p>I need to create a directory on a mapped network drive. I am using a code:</p> <pre><code>DirectoryInfo targetDirectory = new DirectoryInfo(path); if (targetDirectory != null) { targetDirectory.Create(); } </code></pre> <p>If I specify the path like "\\\\ServerName\\Directory", it all goes OK. If I map the "\\ServerName\Directory" as, say drive Z:, and specify the path like "Z:\\", it fails.</p> <p>After the creating the targetDirectory object, VS shows (in the debug mode) that targetDirectory.Exists = false, and trying to do targetDirectory.Create() throws an exception:</p> <pre><code>System.IO.DirectoryNotFoundException: "Could not find a part of the path 'Z:\'." </code></pre> <p>However, the same code works well with local directories, e.g. C:.</p> <p>The application is a Windows service (WinXP Pro, SP2, .NET 2) running under the same account as the user that mapped the drive. Qwinsta replies that the user's session is the session 0, so it is the same session as the service's.</p>
[ { "answer_id": 23087325, "author": "IAmGroot", "author_id": 940834, "author_profile": "https://Stackoverflow.com/users/940834", "pm_score": 4, "selected": false, "text": "R:/" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
133,671
<p>In my ASP.net MVC app I have a view that looks like this:</p> <pre><code>... &lt;label&gt;Due Date&lt;/label&gt; &lt;%=Html.TextBox("due")%&gt; ... </code></pre> <p>I am using a <code>ModelBinder</code> to bind the post to my model (the due property is of <code>DateTime</code> type). The problem is when I put "01/01/2009" into the textbox, and the post does not validate (due to other data being input incorrectly). The binder repopulates it with the date <strong>and time</strong> "01/01/2009 <strong>00:00:00</strong>". </p> <p><strong>Is there any way to tell the binder to format the date correctly (i.e. <code>ToShortDateString()</code>)?</strong></p>
[ { "answer_id": 134097, "author": "Switters", "author_id": 1860358, "author_profile": "https://Stackoverflow.com/users/1860358", "pm_score": 1, "selected": false, "text": "public partial class SomethingView : ViewPage<T>\n{\n}\n" }, { "answer_id": 134613, "author": "Switters",...
2008/09/25
[ "https://Stackoverflow.com/questions/133671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736/" ]
133,675
<p>I need to implement red eye reduction for an application I am working on.</p> <p>Googling mostly provides links to commercial end-user products.</p> <p>Do you know a good red eye reduction algorithm, which could be used in a GPL application?</p>
[ { "answer_id": 718648, "author": "Benry", "author_id": 28408, "author_profile": "https://Stackoverflow.com/users/28408", "pm_score": 6, "selected": true, "text": "//Value of red divided by average of blue and green:\nPixel pixel = image.getPixel(x,y);\nfloat redIntensity = ((float)pixel....
2008/09/25
[ "https://Stackoverflow.com/questions/133675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20107/" ]
133,680
<p>When I am using Bitvise Tunnelier and I spawn a new xterm window connecting to our sun station everything works nicely. We have visual slick edit installed on the sun station and I have been instructed to open it using the command vs&amp;. When I do this I get the following:</p> <pre><code>fbm240-1:/home/users/ajahn 1 % vs&amp; [1] 4716 fbm240-1:/home/users/ajahn 2 % Visual SlickEdit: Can't open connection to X. DIS PLAY='&lt;Default Display&gt;' </code></pre> <p>I would rather not go jumping through hoops ftping my material back and forth to the server. Advice?</p>
[ { "answer_id": 133736, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 0, "selected": false, "text": "xhost +" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/133680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5831/" ]
133,686
<p>I'd like to find a way to determine how long each function in PHP, and each file in PHP is taking to run. I've got an old legacy PHP application that I'm trying to find the "rough spots" in and so I'd like to locate which routines and pages are taking a very long time to load, objectively. </p> <p>Are there any pre-made tools that allow for this, or am I stuck using microtime, and building my own profiling framework?</p>
[ { "answer_id": 3356079, "author": "petsagouris", "author_id": 140734, "author_profile": "https://Stackoverflow.com/users/140734", "pm_score": 3, "selected": false, "text": "javascript:if(document.URL.indexOf('XDEBUG_PROFILE')<1){var%20sep=document.URL.indexOf('?');sep%20=%20(sep<1)?'?':'...
2008/09/25
[ "https://Stackoverflow.com/questions/133686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21973/" ]