instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>What is the meaning, and where is the Ruby documentation for the syntax of: </p> <pre><code>Array(phrases) </code></pre> <p>which I found browsing the Rails source here:</p> <pre><code># File actionpack/lib/action_view/helpers/text_helper.rb, line 109 ... 119: match = Array(phrases).map { |p| Regexp.esc...
<p>It's most likely the <code>Kernel#Array</code> method, see <a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005989" rel="noreferrer">here</a>. It's slightly different than <code>Array.new</code>; it's more of a cast into an array. (It tries <code>to_ary</code> and <code>to_a</code>.)</p>
<p>Array(x) appears to act exactly the same as x.to_a.</p> <p>@Brian is right - it's a method of Kernel. Pickaxe says:</p> <p><strong>Array( arg ) -> anArray</strong> </p> <p>Returns arg .to_a. </p> <pre><code>Array(1..5) » [1, 2, 3, 4, 5] </code></pre>
46,688
<p>I did not find the TryParse method for the Guid. I’m wondering how others handle converting a guid in string format into a guid type.</p> <pre><code>Guid Id; try { Id = new Guid(Request.QueryString["id"]); } catch { Id = Guid.Empty; } </code></pre>
<pre><code>new Guid(string) </code></pre> <p>You could also look at using a <code>TypeConverter</code>.</p>
<p>If all you want is some very basic error checking, you could just check the length of the string.</p> <pre><code> string guidStr = ""; if( guidStr.Length == Guid.Empty.ToString().Length ) Guid g = new Guid( guidStr ); </code></pre>
45,622
<p>Is there a basic php method that accepts a URL and retrieves the date last modified from the header? </p> <p>It would seem like something php can do, but I'm not sure which object to check.</p> <p>Thanks</p>
<p>Give this a go.. using <a href="http://www.php.net/curl" rel="nofollow noreferrer">cURL</a>.</p> <pre><code>$c = curl_init('http://...'); curl_setopt($c, CURLOPT_HEADER, 1); // Include the header curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // Return the result instead of printing it $result = curl_exec($c); if (cu...
<p>Thanks... I tried modifying your version a bit and this seems to work for me:</p> <pre><code>$c = curl_init('http://...'); curl_setopt($c, CURLOPT_HEADER, 1); // Include the header curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FILETIME, 1); curl_exec($c); $result = curl_getinfo($c);...
39,908
<p>I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are <a href="http://www.appscanadian.ca/archives/cs-101-introduction-to-computer-science/" rel="noreferrer">here</a> if you're interes...
<p>Here's how my school did it:</p> <pre><code>base: algebra trigonometry analytic geometry track 1 track 2 track 3 calc 1 linear algebra statistics calc 2 discrete math 1 calc 3 (multivariable) discre...
<p>Usually, an overview of each field is a good thing to have when looking at any topic, but it's rare to have a genuine dependence the way we'd think of it. Algebra is always needed. I can't think of a time I've needed any trigonometry. (except to expand it with new things from calculus) I'm even quite sure people wou...
4,192
<p>does anybody know any resources that I can refer to?</p>
<p>I believe you are referring to the <a href="http://docs.jquery.com/Effects/fadeOut#speedcallback" rel="nofollow noreferrer">JQuery FadeOut effect</a> (since <a href="http://ttp://blog.stackoverflow.com/2008/09/what-was-stack-overflow-built-with/" rel="nofollow noreferrer">Stackoverflow uses JQuery</a>)</p>
<p>You can easlily find this and lots of other effects in various javascript libraries. I personally like <a href="http://ui.jquery.com/repository/real-world/effects/" rel="nofollow noreferrer">JQuery</a></p>
38,771
<p>I want to be able to specify the file name stem for the log file in a Specman test. I need to hard-code the main *.elog filename so that I don't get variance between tests and confuse the post-processing scripts. Is there a constraint or command line I can pass into Specman?</p>
<p>You can control the *.elog filename with switch -log.</p>
<p>You can control the *.elog filename with switch -log.</p>
19,788
<p>Where can I find a list of all types of bsd style socket errors?</p>
<p>In the documentation? For instance, for connect(), see:</p> <pre><code>% man connect ... ECONNREFUSED No-one listening on the remote address. EISCONN The socket is already connected. ENETUNREACH Network is unreachable. </code></pre>
<p>Of you want to know all possible errno's or some comments on them you could take a look at the header files, on a Linux system there are located in </p> <ul> <li>/usr/include/asm-generic/errno-base.h</li> </ul> <pre> #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Op...
20,754
<p>This seems to be a common problem but I cannot find a solution.</p> <p>I type in my username and password which are in a login control I have created. I then press enter once I've typed in my password and the page just refreshes. It triggers the page load event but not the button on click event.</p> <p>If I press ...
<p>using your forms default button is correct, but you need to supply it the correct id as it will be rendered to HTML.</p> <p>so you do as Jon said above:</p> <pre><code>&lt;form runat="server" DefaultButton="SubmitButton"&gt; </code></pre> <p>But ensure you use the Button name that will be rendered. You can achiev...
<p>Pressing ENTER on a text input executes <strong>Form.onsubmit</strong>, not <strong>Button.onclick</strong>.</p> <p>I suppose this was inspired by the fact that you can have a form without an actual submit button (depending solely on the use of ENTER).</p>
19,528
<p>What is the best solution for converting WAV files to WMA (and vice versa) in C#? I have actually implemented this once already using the Windows Media Encoder SDK, but having to distribute Windows Media Encoder with my application is cumbersome to say the least. The Windows Media Format SDK has large sections of th...
<p>I haven't tried it personally (so not sure if it's the 'best' solution), but <a href="http://www.codeproject.com/KB/audio-video/WmaCompressor.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/audio-video/WmaCompressor.aspx</a> looks like it should meet your requirements...</p>
<p>You might look at <a href="http://www.mitov.com" rel="nofollow noreferrer">www.mitov.com</a>. There are some libraries there that may help. You'll need to buy a copy to ship in a commercial product, I believe, but I think it's a reasonable price.</p>
8,984
<p>Unit testing with C/C++: What do you teach people who either did not do unit testing before or come from Java/Junit?</p> <p>What is the single most important lesson / thing to remember/ practice from your point of view that saves a lot of time or stress (especially regarding C/C++)?</p>
<ol> <li>Unit tests have to run automatically on every checkin (or, unit tests that are written then forgotten are not unit tests).</li> <li>Before fixing a bug, write a unit test to expose it (it should fail). Then fix the bug and rejoice as the test turns green.</li> <li>It's OK to sacrifice a bit of "beauty" of a cl...
<p>Single most important lesson: A test is better than no test.</p>
27,303
<p>What is the fastest, easiest tool or method to convert text files between character sets?</p> <p>Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.</p> <p>Everything goes: one-liners in your favorite scripting language, command-line tools or other utilities for OS, web sites, etc.</p> <h2>Best...
<p><a href="http://linux.die.net/man/1/iconv" rel="noreferrer">Stand-alone utility</a> approach</p> <pre class="lang-none prettyprint-override"><code>iconv -f ISO-8859-1 -t UTF-8 in.txt &gt; out.txt </code></pre> <pre class="lang-none prettyprint-override"><code>-f ENCODING the encoding of the input -t ENCODING the e...
<p>As described on <a href="https://stackoverflow.com/questions/132318/how-do-i-correct-the-character-encoding-of-a-file">How do I correct the character encoding of a file?</a> <a href="http://www.synalysis.net" rel="nofollow noreferrer">Synalyze It!</a> lets you easily convert on OS X between all encodings supported b...
9,052
<p>I have been developing a compact framework app on an emulator, and some of the forms use DateTimePickers. These work fine in the emulator, but when running on the hardware they cause the form to close when a date is selected. No exception is thrown...the form just closes unexpectedly. Has anyone experienced this ...
<p>On both your device and the emulator, go to:</p> <p>Start | Settings [System] | Regional Settings [Date]</p> <p>and see if both have the same settings for Short date, Date Separator and Long date. This is just a guess, but it's one possible difference between the emulator and the device that is at least related t...
<p>On both your device and the emulator, go to:</p> <p>Start | Settings [System] | Regional Settings [Date]</p> <p>and see if both have the same settings for Short date, Date Separator and Long date. This is just a guess, but it's one possible difference between the emulator and the device that is at least related t...
43,537
<p>Is it possible to make a POST request from Ruby with open-uri?</p>
<p>Unfortunately <code>open-uri</code> only supports the <code>GET</code> verb.</p> <p>You can either drop down a level and use <code>net/http</code>, or use <code>rest-open-uri</code>, which was designed to support <code>POST</code> and other verbs. You can do <code>gem install rest-open-uri</code> to install it.</p>...
<p>As simple as it gets:</p> <pre><code>require 'open-uri' require 'net/http' response = Net::HTTP.post_form(URI.parse("https://httpbin.org/post"), { a: 1 }) puts response.code puts response.message puts response.body </code></pre> <p>I recommend using <code>response.methods - Object.methods</code> to see all the a...
30,033
<p>I have a really bent heatbed PCB, the middle is elevated about 3 mm with respect to all edges.</p> <p>I have found this thread <a href="http://midibox.org/forums/topic/17599-warped-pcbs/" rel="noreferrer">Warped PCBs</a>, where a heating method is applied by baking a PCB in the oven, as described here: <a href="htt...
<p>Baking PCB in an oven is not a good idea, I would say. I know PCBs are resistive to the heat (especially heatbeds) but, still, it sounds odd. But the real question is how baking would help. Let's leave it.</p> <p>If your heatbed is such bent you can do few things depending on your situation/environment.</p> <p>You...
<p>Easiest way would be to place a glass sheet on top of the bed and run a calibration... Although, that way you may lose a few millimeters of print height.</p>
255
<p>I am not concerned about other kinds of attacks. Just want to know whether HTML Encode can prevent all kinds of XSS attacks.</p> <p>Is there some way to do an XSS attack even if HTML Encode is used?</p>
<p>No.</p> <p>Putting aside the subject of allowing some tags (not really the point of the question), HtmlEncode simply does NOT cover all XSS attacks.</p> <p>For instance, consider server-generated client-side javascript - the server dynamically outputs htmlencoded values directly into the client-side javascript, ht...
<p>I don't believe so. Html Encode converts all functional characters (characters which could be interpreted by the browser as code) in to entity references which cannot be parsed by the browser and thus, cannot be executed.</p> <pre><code>&amp;lt;script/&amp;gt; </code></pre> <p>There is no way that the above can be...
7,727
<p>MS CRM Dynamics 4.0 incorporates the MS WF engine. The built in designer allows the creation of sequential workflows whos activities have native access to CRM entities.</p> <p>Is it possible to:</p> <ul> <li>Create a state machine workflow outside of CRM (i.e. in visual studio) and import it into CRM? </li> <li>H...
<ul> <li>It is NOT possible to create a state machine workflow for use in MSCRM.</li> <li>It is also not supported to create any workflow outside of MSCRM and import it.</li> <li>As a work around you could write either all the logic you need into a custom workflow activity and import that into MSCRM and have it called ...
<p>I don't know the answer to your specific question, but hopefully this information will point you in the right direction.</p> <p>The "native" format for WF workflows is ".xoml" files. These are basically identical to XAML files, and both are nothing more than generic persistence formats for a .NET object tree. If ...
5,427
<p>In a previous SO question, it was mentioned that USB devices can be mounted using the following approach in Windows:</p> <p>MOUNTVOL C:\USB: \\?\Volume{ebc79032-5270-11d8-a724-806d6172696f}\</p> <p>My question is what is that String starting with \\?\Volume called, and what is the best way to retrieve that. I woul...
<p>You can't bundle the Java "...runtime without physically installing it on the machine..." either.</p> <p>Enumerating the device after it is mounting should be straightforward. Actually mounting the device should NOT be straightforward since Java (and .NET) are both designed to abstract away the hardware.</p> <p>I...
<p>What kind of USB device are you looking for? The bit you quote is only applicable to USB disk drives, not USB devices in general.</p>
49,597
<p>How would you describe and promote WCF as a technology to a non-technical client/manager/CEO/etc?</p> <p>What are competing solutions or ideas that they might bring up(such as those they read about in their magazines touting new technology)?</p> <p>What is WCF <em>not</em> good for that you've seen people try to s...
<p>Comparing with .asmx: WCF is the next generation of Microsoft's Web service development platform, which addresses many of the issues with older versions, specifically:</p> <ul> <li>better interoperation, so you can interoperate with Web services that aren't from Microsoft or that are published on the Internet</li> ...
<p>In a single sentence, I'd say that WCF is "software that lets you set up and manage communication between systems a lot more efficiently than in the past".</p> <p>I can see them bringing up BizTalk as a competitor, but of course you could say that WCF works with it and is in fact used as base technology for it in t...
7,281
<p>Summary: </p> <blockquote> <p><strong>Can I program a "thick client" game in C without reinventing wheels</strong>, or should I just bite the bullet and use some library or SDK? I'm a moderate C programmer and am not afraid to work with pointers, data structures, memory locations, etc. if it will gi...
<p>I believe you are working under a fallacy. </p> <p>There are several frameworks out there specifically for game programming --- written by people with much experience with the complication of game design, almost certainly more tha you do.</p> <p>In other words, you have a "High risk of performance issues" if you ...
<p>I'm pretty sure most modern games are done in C++, not C. (Every gaming company I ever interviewed with asked C++ questions.)<br> Why not use C++ and existing libraries for physics + collisions, sound, graphics engine etc. You still write the game, but the mundane stuff is taken care of.</p>
29,104
<p>Starting from ASP.NET MVC Preview 3, HTML.Button ( and other related HTML controls) are no longer supported.</p> <p>The question is, what is the equivalent for them? I've an app that was built using Preview 2, now I have to make it compatible with the latest CTP releases.</p>
<p>I figured it out. It goes something like this:</p> <pre><code>&lt;form method="post" action="&lt;%= Html.AttributeEncode(Url.Action("CastUpVote")) %&gt;"&gt; &lt;input type="submit" value="&lt;%=ViewData.Model.UpVotes%&gt; up votes" /&gt; &lt;/form&gt; </code></pre>
<p><code>&lt;asp:Button&gt;</code> is the ASP.NET equivalent to the HTML.Button. It will by default generate an <code>&lt;input type="button"&gt;</code>. (This is the System.Web.UI.WebControls.Button class)</p>
8,380
<p>Let’s say I have this markup:</p> <pre><code>&lt;div id="content"&gt; &lt;div id="firstP"&gt;&lt;p&gt;First paragraph&lt;/p&gt;&lt;/div&gt; &lt;div id="secondP"&gt;&lt;p&gt;Second paragraph&lt;/p&gt;&lt;/div&gt; &lt;div id="thirdP"&gt;&lt;p&gt;Third paragraph&lt;/p&gt;&lt;/div&gt; &lt;div id="fourthP"&gt;&l...
<p>I think the main answer is incorrect. DIV and P tags can receive focus providing you specify a tabindex property for them. i.e. </p> <pre><code>&lt;div class="someclass" tabindex="100"&gt; </code></pre> <p>Once the tabindex is specified you can either tab to these elements or shift focus with <em>.focus()</em> .</...
<p>Only form elements and such can attain focus. If you want the browser to scroll down to that particular paragraph, there is no "default" way of doing so with jQuery, but there is a plugin for it at <a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" rel="nofollow noreferrer">jQuery.ScrollTo</a> and a b...
43,372
<p><a href="http://en.wikipedia.org/wiki/Tf-idf" rel="noreferrer">TF-IDF (term frequency - inverse document frequency)</a> is a staple of information retrieval. It's not a proper model though, and it seems to break down when new terms are introduced into the corpus. How do people handle it when queries or new documen...
<p>Er, nope, doesn't break down.</p> <p>Say I have two documents, A "weasel goat" and B "cheese gopher". If we actually represented these as vectors, they might look something like:</p> <p>A [1,1,0,0]<br/> B [0,0,1,1]</p> <p>and if we've allocated these vectors in an index file, yeah, we've got a problem when it com...
<p>When you talk about "break down" I think you mean that the new terms have no impact on the similarity measure, because they do not have any representation in the vector space defined by the original vocabulary.</p> <p>One approach to handle this smoothing problem would be to consider fixing the vocabulary to a smal...
27,527
<p>My model layers are printing much as I expect but the parts when removed from the plate are very soft and flexible and fail to harden any further in sunlight or UV lamplight. A tall or slender part will bend and distort under its own weight while printing. I am using LCD-T resin, I have increased time and reduced ...
<p>I could finally solve the issue. Calling <code>openscad</code> from command line with parameters does NOT work with the AppImage I used. It works fine with a "standard" installation, though.</p> <p>Thanks for your support.</p>
<p>You can specify variable values from command line using:</p> <pre> openscad ...\ ... \ [ -D var=val [..] ] \ ... \ ... \ filename </pre> <p>See the <a href="https://en.m.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_env...
1,228
<p>How many people actually write an SDD document before writing a single line of code?</p> <p>How do you handle large CSCI's? </p> <p>What standard do you use for SDD content?</p> <p>What tailoring have you done?</p>
<p>I certainly have. Historically and on recent projects.<br> Years ago I worked in organisations where templates were everything. Then I worked other places where the templates were looser or non-existent or didn't fit the projects I was working on.<br> Now the content of the software design is pretty much governed by...
<p>Most big software companies have their own practices. For example Motorola has detailed documentation for every aspect of software development process. There are standard templates for each type of documents. Having strict standards allows effectively maintain huge number of documents and integrate it with different...
11,733
<p>I know there has to be an obvious solution to this problem and I am missing it, so I would much appreciate someone enlightening me so I don't spin my wheels...</p> <p>I am writing an ASP.Net application that will interact with a service API (Evernote specifically). Evernote requires OAuth for security and before I...
<p>OAuth is quite tough to implement. It may not be the answer you're looking for, but this is how I managed to get the job done:</p> <ol> <li>Write some code on my local dev machine.</li> <li>Run a bat file (or alternatively hook a post-build event in VS) that executes a msbuild deploy script and deploys the applicat...
<p>According to this (<a href="https://stackoverflow.com/questions/670398/how-do-i-develop-against-oauth-locally">How do I develop against OAuth locally?</a>) the callback is issued by the browser, so it should be able to hit localhost.</p>
45,133
<p>What is the coolest <strong>somewhat practical</strong> metaprogramming hack you've done or seen done in the D programming language? Somewhat practical means excluding, for example, the compile-time raytracer.</p>
<p>In terms of the outright coolest, I'd have to say Kirk McDonald's <a href="http://pyd.dsource.org/" rel="noreferrer" title="PyD">PyD</a> (and other similar bindings) as these have do to a huge amount of work in detecting and handling lots of different types, as well as complex code generation.</p> <p>That said, PyD...
<p>I wrote a memoize() function whose header is this (the code is a bit long for pasting here):</p> <p>auto memoize(TFunc)(TFunc func);</p> <p>What it does is, you give it a function's address, and it returns a strongly-typed delegate (same signature and return type as the original function) that caches the return va...
30,464
<p>I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced with the same situation?</p> <blockquote> <p>Related Question:<br> <a href="https:/...
<ol> <li>Look at the execution plan in query analyzer</li> <li>See what step costs the most</li> <li>Optimize the step!</li> <li>Return to step 1 [thx to <strong>Vinko</strong>]</li> </ol>
<p>Look at the indexes on the tables that make the query. An indexes may be needed on particular fields that participate in the where clause. Also look at the fields used in the joins in the query (if joins exist). If indexes already exist, look at the type of index. </p> <p>Failing that (because there are negativ...
8,612
<p>I'm trying to write a print layout editor in VB6 or VB.Net, and am looking for some reference articles to help get me started. </p> <p>The idea is that the editor will be used to define print "areas" for invoice or statement layouts, by allowing the user to draw the box for customer address, invoice number, lines, ...
<p>First of all, you should have great knowledge of the language/APIs you're using, and in fact you <em>really</em> should specify if you're using Windows.Forms, WPF, GTK#, etc. Make sure you're <strong>very</strong> good on that.</p> <p>Then, you should think of a format for your form editor to store the forms. Usual...
<p>i remember developing exactly this kind of printout form editor in vb6, some 10 years ago iirc. not sure i can still find the sources sadly: indeed i found this question because i need to write another and was hoping to find some code to start from instead of doing it from scratch once again. anyway, the way i done...
41,543
<p>I need to display the log entries from a database. Of course the log data is huge, so I have to show the results on several pages, and that **without** getting **all** the log data at once, but as the user navigates through the pages.</p> <p>I know about <a href="http://displaytag.sourceforge.net/11/" rel="nofollow...
<p>About DisplayTag: it does support <a href="http://displaytag.sourceforge.net/11/tut_externalSortAndPage.html" rel="nofollow noreferrer">Value List</a> design pattern.</p>
<p>Inside your JSP is not really the good place to solve the whole problem. In a typical layered approach, you separate the presentation (JSP here) from the data access (where you do your query).</p> <p>Your displaytag/jsp tag should pass to the data access layer which page it wants (eg I need the next 30 and am on pa...
15,993
<p>From everything I've read, it seemed that adding paging to a ListView control should be dead simple, but it's not working for me. After adding the ListView and DataPager controls to the form and wiring them together, I'm getting very odd behavior. The DataPager correctly limits the ListView's page size, but clicking...
<p>We need to databind list view again in OnPreRender event. </p> <pre><code>protected override void OnPreRender(EventArgs e) { ListView1.DataBind(); base.OnPreRender(e); } </code></pre> <p>--Update</p> <p>After working on a few list views with asp.net ajax, I saw a solution t...
<pre><code>&lt;asp:ListView ID="ListView1" runat="server" DataSourceID="sdsImages"&gt; &lt;ItemTemplate&gt; &lt;div class="photo sample12"&gt; &lt;asp:Image ID="img_Galerie" runat="server" ImageUrl='&lt;%# "~/imageHandler.ashx?ID=" + Eval("ImageID") %&gt;' /&gt; &lt;/div&gt; &lt;...
29,003
<p>Is there any way to set an event handler without doing it manually in the classname.designer.cs file other than double clicking the UI element?</p>
<p>Click on the lightning bolt icon in the Properties window. Double-click the event you want to implement.</p>
<p>Sure. Use <code>myControl.Event += new EventHandler(SomeHandlerMethodInYourClass)</code> somewhere during initialization, e.g. in the form's constructor.</p>
39,915
<p>I just realized from an article in CACM that Doxygen works with Java (and several other languages) too. But Java has already the Javadoc tool. Can someone explain what are the pros and cons of either approach? Are they mutually exclusive? Is there a Maven plugin for Doxygen?</p>
<p>Doxygen has a number of features that JavaDoc does not offer, e.g. the class diagrams for the hierarchies and the cooperation context, more summary pages, optional source-code browsing (cross-linked with the documentation), additional tag support such as @todo on a separate page and it can generate output in TeX and...
<p>I like the fact that with Doxygen, you can get class diagrams displayed on the same page as the documentation. Also, I like the fact that it links you directly to the source code, if needed. I am not aware if javadoc has these features though.</p>
27,863
<p>It has to be simple, here's my CSS: </p> <pre><code>.progressImage { position:relative; top:50%; } .progressPanel { height:100%; width:100%; text-align:center; display:none; } &lt;asp:Panel ID="pnlProgress" runat="server" CssClass="progressPanel"&gt; &lt;asp:Image ID="Image1" runat="server" CssClass="progres...
<p>Set the position of <code>.progressPanel</code> to relative, and the position of <code>.progressImage</code> to absolute. The following works for me in FF, IE, Safari. Set the negative margins to half the width/height of your image for perfect centering. Note that some parent of the progressPanel (body in this ca...
<p>Position specification (relative or absolute) should be in both elements (parent and child) otherwise the positioning of child element doesn't necessarily work. You should always use relative positioning for an element unless you specify the exact position like left: 100px; top: 100px. Vertical-align refers to the e...
37,138
<p>I'm wondering if there's an integrated solution to have a database with versioned records supported by rails (ala version_fu ar_versioned) and a differ thanks!</p>
<p>Check out <a href="http://wiki.rubyonrails.org/rails/pages/ActsAsVersioned" rel="nofollow noreferrer">acts_as_versioned</a>.</p>
<p>As you noted, that functionality is supported in plugins, and won't be supported by Rails core.</p>
11,855
<p>Is there a way to modify/tell dired to copy files asynchronously? If you mark multiple files in dired and then use 'C' to copy them, emacs locks up until every file is copied. I instead want this copy to be started, and for me to continue editing as it goes on in the background. Is there a way to get this behavio...
<p>I think emacs is mostly limited to a single thread - so this may not be directly possible through standard dired commands such as 'C' copy. </p> <p>However, there is a dired command "<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Shell-Commands-in-Dired.html" rel="nofollow noreferrer">dired-do-sh...
<p>See also the Emacs function <code>dired-do-async-shell-command</code>.</p> <p>For an even more generic solution see <a href="https://github.com/jwiegley/emacs-async" rel="nofollow">https://github.com/jwiegley/emacs-async</a> with which you also can evaluate arbitrary Emacs Lisp code through call to a separate Emacs...
49,787
<p>I want to dive more into the unit testing concepts. An open source project which will illustrate the best practices in unit testing is required.</p>
<p>I work on <a href="http://cruisecontrol.sourceforge.net/" rel="nofollow noreferrer">CruiseControl</a> (original Java version) and I think it is worth considering as a source of study for a few reasons:</p> <ol> <li>Lots of unit tests. Certainly not the highest coverage but there are plenty to look at.</li> <li>Dive...
<p>The source code for <a href="http://www.nunit.org" rel="nofollow noreferrer">NUnit</a> (.NET unit testing software) would be worth a look.</p>
39,761
<p>I am going to be using C/C++, and would like to know the best way to talk to a MySQL server. Should I use the library that comes with the server installation? Are they any good libraries I should consider other than the official one?</p>
<p><a href="http://tangentsoft.net/mysql++/" rel="nofollow noreferrer">MySQL++</a></p>
<p>That depends a bit on what you want to do.</p> <p>First, check out libraries that provide connectivity to more than on DBMS platform. For example, Qt makes it very easy to connect to MySQL, MS SQL Server and a bunch of others, and change the database driver (connection type) at runtime - with just a few lines of co...
4,291
<p>I am Need of Formula to Accurately Calculate Bandwith for 1 Gig Nic Card. What i am doing is send Layer 2 Packets @ 1Gbps but my software is showing 6oo Mbps.</p> <p>The whole experiment is Back to Back. No switch No Router.</p> <p>Here is what i did.</p> <pre><code>// LinkSpeed = 1Gb UINT nBandwidth = LinkSpe...
<p>In ethernet, you also have to take into account the <a href="http://en.wikipedia.org/wiki/Interframe_gap" rel="nofollow noreferrer">interframe gap</a>, which is at minimum, 96 quantum time, that is, the quantum time being the time to send a bit, which is, 1ns in GigaEthernet (1 second / 1,000,000,000).</p> <p>Also,...
<p>First, you need a "long" at a minimum to store the no. of frames you received. </p> <p>To calculate the bandwidth being used,</p> <p>a = GetIntfCounters()</p> <p>Start a timer (timeout) in seconds</p> <p>b = GetIntfCounters()</p> <p>Pkts/sec = (b - a)/timeout</p> <p>Bits/sec = (Pkts/sec * pktsize)</p> <p>Byte...
44,599
<p>Microsoft's new F# programming language provides the powerful combination of functional programming (first-class lexical closures and tail calls) with an efficient concurrent garbage collector that makes it easy to leverage multicores.</p> <p>OCaml, Haskell, Erlang and all free Lisp and Scheme implementations that ...
<p>Erlang has a shared nothing model where <a href="http://prog21.dadgum.com/16.html" rel="noreferrer">each process has it's own garbage collector</a>. Whether you consider that to be no concurrency or not it's up to you. But it sure scales very well as the number of processes goes up.</p>
<p>Not really an answer to your question, but to my best knowledge, F# uses the standard .NET garbage collector, which is not concurrent; all threads are stopped during GC.</p> <p>Edit : my mistake, there is a concurrent GC in multiprocessor mode.</p>
35,060
<p>While debugging through a .NET 3.5 SP1 project which is contacting a local web service, I'm receiving the exception</p> <p>System.BadImageFormatException: "Bad Class Token"</p> <p>Of course there aren't much more details about what's causing the exception.</p> <p>I can tell that the method where this occurs, whic...
<p>Running peverify.exe on the assembly may yield useful diagnostics.</p> <p><a href="http://msdn.microsoft.com/en-us/library/62bwd2yd.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/62bwd2yd.aspx</a></p>
<p>Running peverify.exe on the assembly may yield useful diagnostics.</p> <p><a href="http://msdn.microsoft.com/en-us/library/62bwd2yd.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/62bwd2yd.aspx</a></p>
26,336
<p>I have a need to determine what security group(s) a user is a member of from within a SQL Server Reporting Services report. Access to the report will be driven by membership to one of two groups: 'report_name_summary' and 'report_name_detail'. Once the user is executing the report, we want to be able to use their me...
<p>You can add custom code to a report. <a href="http://msdn.microsoft.com/en-us/library/ms155798.aspx" rel="noreferrer">This link</a> has some examples.</p> <p>Theoretically, you should be able to write some code like this, and then use the return value to show/hide what you want. You may have permissions problems ...
<p>In Reporting Services just use :</p> <pre><code>Public Function IsMemberOfGroup() As Boolean If System.Threading.Thread.CurrentPrincipal.IsInRole("MyADGroup") Then Return True Else Return False End If End Function </code></pre> <p>as indicated in <a href="https://stackoverflow.com/questions/3095449/ssrs-...
33,740
<p>I'm looking to add a numeric up / down control to a .Net StatusStrip. Unfortunately, it isn't listed as an option in the UI designer. Is there a way to do this? </p>
<p>You can use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripcontrolhost.aspx" rel="nofollow noreferrer">ToolStripControlHost</a> class to host a custom ( NumericUpDown for now ) class. You can also derive from this class "NumericUpDownToolStripItem" which initialize the "Control" pro...
<p>You could try adding 3 ToolStripStatusLabels, set the Image of the first to an "Up Arrow" and the Image of the Third to "Down Arrow". Blank their Text properties.</p> <p>The Middle one can hold the Number, which you increase/decrease in the Click Events.</p> <p>Edit: Left/Right Arrows would probably look better. ...
14,165
<p>I recently build myself a semi beef up PC (Q9450, 8GB DDR2 1066, 1TB HDD, Dual 8600GT, Vista Ultimate and Dual 22' Monitors) and I'm evaluating whether i should develop on a VPC/VMWare session on top of Vista or not?</p> <p>One benefit I can see is that I can run the same VM on my Vista laptop so my development envi...
<p>For webdevelopment I like to have the serverpart separeted out into a VM. My current setup is a Macbook Pro with several Debian VM's inside. I like the isolation aspect of it. I can try new software on the servers and have the ability to revert them back if something is messed up.</p> <p>I do the programming via ne...
<p>It depends what you are developing and in what language.</p> <p>VM's tend to take a fairly hard hit on disk access, so compiling may slow down significantly, especially for large C/C++ projects. Not sure if this would be such an issue with .NET/Java.</p> <p>If you are doing anything that is graphics intensive (3D...
20,233
<p>If you are using Java or JavaScript, is there a good way to do something like a String subtraction so that given two strings:</p> <pre><code>org.company.project.component org.company.project.component.sub_component </code></pre> <p>you just get:</p> <pre><code>sub_component </code></pre> <p>I know that I could j...
<p>Depends on <em>precisely</em> what you want. If you're looking for a way to compare strings in the general case -- meaning finding common sub-strings between arbitrary inputs -- then you're looking at something closer to the Levenshtein distance and similar algorithms. However, if all you need is prefix/suffix com...
<p>This is a solution for the Javascript end of the question:</p> <pre><code>String.prototype.contracat = function(string){ var thing = this.valueOf(); for(var i=0; i&lt;string.length;i++){ thing=thing.replace(string.charAt(i),""); } return thing }; </code></pre>
15,741
<p>Writing some test scripts in IronPython, I want to verify whether a window is displayed or not. I have the pid of the main app's process, and want to get a list of window titles that are related to the pid. </p> <p>I was trying to avoid using win32api calls, such as FindWindowEx, since (to my knowledge) you canno...
<p>The article below shows how to access the win32api indirectly from IronPython. It uses CSharpCodeProvider CompileAssemblyFromSource method to compile an assembly in memory from the supplied C# source code string. IronPython can then import the assembly.</p> <p><a href="http://www.voidspace.org.uk/ironpython/dynam...
<p>It's like asking if you can swim without going in to the water. If you need information from windows, the only option is to use the win32api. There are lots of examples to find on how to do so.</p> <p>If you don't like this answer, just leave a comment in your question and I will remove this answer, so your questio...
15,569
<p>I get exception "There is no default persistence unit in this deployment." can I somehow mark unit as default?(I have only one persistence unit, so Id rather not call it by name)</p>
<p>My advice:</p> <p>Don't make a website from scratch. Use a content management system such as DotNetNuke or Drupal to do it. Find a provider that will host these platforms and learn it. Don't reinvent the wheel.</p>
<p>There's this recommendation that is valid for anyone learning anything new: keep it simple. In the case of web development, I would certainly vote against Silverlight, for a number of reasons. </p> <p>The first one you have already mentioned, it is very Google-unfriendly.</p> <p>The second one is that it is not an...
48,605
<p>How does Google Chrome command and control multiple cross platform processes and provide a shared window / rendering area?</p> <p>Any insights?</p>
<p>The source code is online <a href="https://chromium.googlesource.com/chromium/chromium/+/trunk/chrome/" rel="nofollow noreferrer">here</a> ...</p>
<p>The source code is online <a href="https://chromium.googlesource.com/chromium/chromium/+/trunk/chrome/" rel="nofollow noreferrer">here</a> ...</p>
6,353
<p>I am looking for a reporting service/tool for visual Studio. My only restraint is my web server is off limits to me as far as installing ANYTHING. So I need something I can just include in my project.</p> <p>My users need to be able to export a report to PDF and without being able to use Crystal I am pretty much ...
<p><a href="http://www.fyireporting.com/" rel="noreferrer">fyireporting</a> (released under Apache License) is worth a try. </p> <p>The fyiReporting RDL Project is a powerful report and charting system based on Report Definition Language (RDL). Tabular, free form, matrix, charts are fully supported. Report output ...
<p>If you're willing to have no report designer and open source is an absolute requirement, then take a look at <a href="http://itextsharp.com/" rel="nofollow">iTextSharp</a> - version 4.0 is totally open source (5.0 you have to pay for comercial use).</p> <p>There are some additional open source systems listed at <a ...
24,808
<p>I have a general exception handler, Application_error in my global.asax where I'm trying to isolate all the uncaught exceptions on all my many pages. I don't want to use Page_error to catch exception because it's inefficient to call that on so many pages. So where in the exception can I find what page actually cause...
<pre><code>HttpContext con = HttpContext.Current; con.Request.Url.ToString() </code></pre>
<p>Remember, the page is not (should not) always be the cause of the exception. It could just as easily be coming from another assembly - and if you don't have your logic in your codebehinds, it likely will be coming from another assembly. Don't get me wrong, it is great to know which page, from the aspect of saying ...
44,802
<p>I am preparing a lecture on files for the more junior students in programming class. One of the points I want to elaborate are good practices with files.</p> <p>What are the thing to keep in mind when using files in any programming language?</p>
<ul> <li><p>Files can be considered to contain a set of <em>records</em>, each either of a <em>fixed length</em> or ending with a <em>delimiter</em>.</p></li> <li><p>Files are generally optimized for <em>sequential access</em>, not <em>random-access</em>. It's hard to insert data into the middle of a file, and it's ty...
<p>Remember to close them when you're done with them.</p>
34,900
<p>I have some special cells in my Excel workbooks which are managed by my Excel Add-in. I want to prevent users from changing content of those cells, but I also want to know, what value users wanted to enter to those cells. On the SheetChange event I can check what users entered to my special cells, but how do I deter...
<p>How about something like this, which is in VBA, but should be fairly easy to translate to C#</p> <pre><code>Option Explicit ' We are monitoring cell B2... Private initialB2Value As Variant ' holds the value for reinstatement when the user changes it Private Sub Worksheet_Activate() ' record the value before the...
<p>I would keep a copy of the cells on a hidden sheet.</p> <p>Then when the user changes a cell, it's easy to find the matching cell on the hidden sheet.</p>
37,710
<p>What built-in PHP functions are useful for web scraping? What are some good resources (web or print) for getting up to speed on web scraping with PHP?</p>
<p>Scraping generally encompasses 3 steps: </p> <ul> <li>first you GET or POST your request to a specified URL </li> <li>next you receive the html that is returned as the response</li> <li>finally you parse out of that html the text you'd like to scrape.</li> </ul> <p>To accomplish steps 1 and 2, belo...
<p>The curl library allows you to download web pages. You should look into regular expressions for doing the scraping.</p>
4,660
<p>I have a specific changeset that I want to "rollback" my Development branch to, but I want to take all of the the changes after that specific changeset and put them in to a new branch. Is this possible in TFS? If so, how could I do such a thing?</p> <p>Thanks, Dave</p>
<p>Well.. The easiest way is to do exactly what you just said. </p> <p>Branch the existing code into a new spot. Then get the changeset you want, checkout the project, and check the changeset back in.</p>
<p>I ended up branching at the changeset I wanted, naming it Development-stable, then renamed Development to Development-experimental and then renamed Development-stable to Development.</p>
19,252
<p>Is it possible to get the expiry <code>DateTime</code> of an <code>HttpRuntime.Cache</code> object?</p> <p>If so, what would be the best approach?</p>
<p>I just went through the System.Web.Caching.Cache in reflector. It seems like everything that involves the expiry date is marked as internal. The only place i found public access to it, was through the Cache.Add and Cache.Insert methods.</p> <p>So it looks like you are out of luck, unless you want to go through refl...
<p>For my solution, I stored the expiry value in the the value of cached object and used the same value as expiry for the cache.</p> <pre><code>var expiry = DateTime.UtcNow.AddMinutes(10); HttpRuntime.Cache.Insert(&quot;key&quot;, new { Value = &quot;Value&quot;, Expiry = expiry }, null, expiry, Cache.NoSlidingExpirati...
44,810
<p>Given:</p> <pre><code>interface I { } class B: I { } class C: I { } class A { public void Method(B arg) { } public void Method(C arg) { } public void Method(I arg) { // THIS is the method I want to simplify. if (I is B) { this.Method(arg as B); ...
<p>I would put the method inside the interface and then let polymorphism decide which method to call</p> <pre><code>interface I { void Method(); } class B : I { public void Method() { /* previously A.Method(B) */} } class C : I { public void Method() { /* previously A.Method(C) */ } } class A { public v...
<p>It doesn't exist in a convenient form withing C# - <a href="https://stackoverflow.com/questions/156467/switch-pattern-matching-idea">see here</a> for an idea based on F#'s pattern matching, that does exactly what you want. You can do some things with reflection to select the overload at runtime, but that will be ver...
20,858
<p>I am trying to delete several rows from a MySQL 5.0.45 database:</p> <pre><code>delete from bundle_inclusions; </code></pre> <p>The client works for a while and then returns the error:</p> <pre><code>Lock wait timeout exceeded; try restarting transaction </code></pre> <p>It's possible there is some uncommitted t...
<p>I agree with Erik; TRUNCATE TABLE is the way to go. However, if you can't use that for some reason (for example, if you don't <em>really</em> want to delete every row in the table), you can try the following options:</p> <ul> <li>Delete the rows in smaller batches (e.g. DELETE FROM bundle_inclusions WHERE id BETWE...
<p>Guessing: truncate table bundle_inclusions</p>
9,026
<p>How can I verify a given xpath string is valid in C#/.NET?</p> <p>I'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against?</p>
<blockquote> <p>How can I verify a given XPath string is valid in C#/.NET?</p> </blockquote> <p>You try to build an <code>XPathExpression</code> from it and catch the exception.</p> <pre><code>try { XPathExpression.Compile(xPathString); } catch (XPathException ex) { MessageBox.Show("XPath syntax error: " +...
<p>Use a 'mild' regular expression to filter out complete garbage. If it passes the regex, just execute the query and catch exceptions, like mentioned above...</p>
39,803
<p>Microsoft like implementing their own versions of popular open-source frameworks and assemblies, for example:</p> <ul> <li>Microsoft's MVC Framework vs MonoRail</li> <li>Microsoft's Unity IoC container vs Castle Windsor / Spring.net / Ninject etc</li> <li>Microsoft's VS Unit Test framework vs nUnit (and various oth...
<p>Why not just take a stick to a hornet's nest?</p> <p>There's one thing definitely better about MS' versions of these great tools--its much easier to get your MS shop to use a product if it's an official MS product.</p> <p>If you're a shop that develops for Windows systems, you have to take extra steps when incorpo...
<p>Only kinda related, but I remember back when they first released windows xp I had a computer that would dual-boot between windows 98 and linux. It had an off-brand sound card where the linux driver was buggy; it would work for a while, and then start stuttering in a very distinct way. When I got xp for the machine...
25,258
<p>We are trying to bind a Linux machine (debian 4.0) to W2k3 AD. We have configured kerberos properly so that we can get TGTs. And users authenticate properly. However, PAM seems to be the sticky wicket. For example when we try to SSH to the linux machine as one of the AD users, the authentication succeeds (as per...
<p>If you're confident everything but PAM works correctly, I suggest passing the debug option to pam_krb5.so to see if that gives a clue to what's happening.</p> <p>I'd also suggest verifying that nss-ldap is set up correctly using </p> <pre><code>getent passwd avalidusername </code></pre>
<p>I have used Likewise to do something similar on our servers. Here is the process we use to configure it:</p> <p>Install Likewise:</p> <pre><code>$ sudo apt-get update $ sudo apt-get install likewise-open </code></pre> <p>Join the domain (Assuming the domain "domain.local")</p> <pre><code>$ sudo domainjoin-cli j...
21,525
<p>I have three closely related applications that are build from the same source code - let's say APP_A, APP_B, and APP_C. APP_C is a superset of APP_B which in turn is a superset of APP_A.</p> <p>So far I've been using a preprocessor define to specify the application being built, which has worked like this.</p> <pre...
<p>You don't always have to force inheritance relationships in applications that share a common code base. Really.</p> <p>There's an old UNIX trick where you tailor the behavior of you application based on argv[0], ie, the application name. If I recall correctly (and it's been 20 years since I looked at it), rsh and...
<p>You might want to have a look at tools that support the development of product lines and foster explicit variant management in a structured way.</p> <p>One of these tools is pure::variants from <a href="http://www.pure-systems.com/" rel="nofollow noreferrer">pure-systems</a> which is capable of variability manageme...
32,752
<p>I am fetching data in from an SQL table using a DataSet in VB.Net. When there is data in table, it displays the data properly in the grid, but when there is no data in the table, it only shows the UltraGrid's basic view.</p> <p>How can I display the column names of the table as headings of the UltraGrid even when ...
<p>After giving up on everything else, I deleted the local workspace and created a new one. Now everything works fine.</p>
<p>Have you checked to make sure that the Active Directory change has propagated to TFS? I've seen issues before where users information is changed and TFS doesn't pick up the change and gets confused about your user.</p> <p>Also take a look at the following blog post. It details how to sync up TFS with a user name ...
40,578
<p>I'm working with a WinForm app in C#, after I type something in a textbox I want to hit the Enter key but the textbox still has focus (flashing cursor is still in textbox), how can I achieve this?</p>
<p>The simple option is just to set the forms's AcceptButton to the button you want pressed (usually "OK" etc):</p> <pre><code> TextBox tb = new TextBox(); Button btn = new Button { Dock = DockStyle.Bottom }; btn.Click += delegate { Debug.WriteLine("Submit: " + tb.Text); }; Application.Run(new Form { Ac...
<pre><code>private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { button1_Click(textBox1.Focus(),e); } } </code></pre>
38,298
<p>I have a <code>byte[]</code> array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the <code>BinaryWriter</code> object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulat...
<p><strong>Edit:</strong> The assumption below is not correct, I had a chance to fire up my IDE later and tested with and without Write and both populated the MemoryStream correctly.</p> <p>I think you need to write to your MemeoryStream first.</p> <p>As if my memory (no pun intended) serves me correctly this:</p> <...
<p>All these were clues that helped me figure out my problem which was the same problem as the question asks. So i want to post my solution which i arrived at because of these helpful clues. Thanks for all the clues posted so far!</p> <p>As Time Saunders posted in his answer, that Write method to actually write the by...
5,276
<p>While accessing a webservice which is availbale at <a href="http://recpushdata.cyndigo.com/jobs.asmx" rel="nofollow noreferrer">http://recpushdata.cyndigo.com/jobs.asmx</a>, I am getting this Exception. "Remote name could not be resolved"</p> <p>Any Suggesytion..what to do..</p>
<p>The server error you got in the previous comment is good - it means your original problem, being unable to resolve the remote host, is solved. </p> <p>As to your HTTP 500 error, check the event log for that time on the remote host. If you don't have access to it, contact its administrator. </p>
<p>Try using the URL:</p> <p><a href="http://216.10.246.91/jobs.asmx" rel="nofollow noreferrer">http://216.10.246.91/jobs.asmx</a></p> <p>If this works, whereever you are calling the web service from has a problem with DNS. If that does not work report back.</p>
40,070
<p>Is there any BNF grammar for regular expression?</p>
<p>You can see one for <a href="http://www.cs.sfu.ca/~cameron/Teaching/384/99-3/regexp-plg.html" rel="noreferrer">Perl regexp</a> (displayed <a href="https://web.archive.org/web/20090129224504/http://faqts.com/knowledge_base/view.phtml/aid/25718/fid/200" rel="noreferrer">a little more in detail here</a>, as posted by <...
<p><a href="http://web.archive.org/web/20090129224504/http://faqts.com/knowledge_base/view.phtml/aid/25718/fid/200" rel="noreferrer">http://web.archive.org/web/20090129224504/http://faqts.com/knowledge_base/view.phtml/aid/25718/fid/200</a></p>
33,272
<p>I would like to use nail polish to paint and smooth a PLA model. Could nail polish damage a model made out of pure PLA?</p>
<p>NO if you want to smooth your print, gently heat the plastic and with a utensil smooth out the plastic. A hair dryer is a good way of doing this but be careful to only lightly melt the outside of the model.</p>
<p>Nail polish contains acetone. It melts PLA, so yes you <em>could</em> damage it. Google acetone vapor batch to read up on a safer way to do the job.</p>
699
<p>There is a way to keep the scroll on bottom for a multi line textbox?</p> <p>Something like in the vb6 </p> <pre><code>txtfoo.selstart=len(txtfoo.text) </code></pre> <p>I'm trying with txtfoo.selectionstart=txtfoo.text.length without success.</p> <p>Regards.</p>
<p>Ok, I found that the solution was to use </p> <pre><code>txtfoo.AppendText </code></pre> <p>instead of </p> <pre><code> txtfoo.text+="something" </code></pre>
<p>Interesting question. I'm guessing that you are trying to select the text via form load? I can't get it working on form load, but I can on form click. Wierd. :)</p> <pre><code>Public Class Form1 Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click ScrollTextbox(...
20,419
<p>Have a look at this very simple example WPF program:</p> <pre><code>&lt;Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"&gt; &lt;GroupBox&gt; ...
<p>It appears to be a subtle bug in the control template for the GroupBox. I found by editing the default template for the GroupBox and moving the Border named 'Header' to the last item in the control templates Grid element, the issue resolves itself. </p> <p>The reason is that the one of the other Border elements wit...
<p>If you change the GroupBox's BorderBrush, it works!</p> <pre><code>&lt;GroupBox BorderBrush="{x:Null}"&gt; </code></pre> <p>I know this defeats the objective but it does prove where the problem lies!</p>
18,324
<p>I want to create a very simple HTML/AJAX based GUI for a Python program. So the frontend is a HTML page which communicates with the program via AJAX. Can you give me a minimal implementation for the server-side using the python <code>SimpleHTTPServer.SimpleHTTPRequestHandler</code>?</p> <p>A simple example would be...
<p>O.K., I think I can now answer my own question. Here is an example implementation for calculating the square of a number on the server. Please let me know if there are any improvements or misconceptions.</p> <p>the python server file:</p> <pre><code>import threading import webbrowser import BaseHTTPServer import S...
<p>Thanks for a very intuitive example @nikow I was trying to follow your example, but did get an error:</p> <p>(process:10281): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed</p> <p>I modified your code to meet my needs.</p> <pre><code>webbrowser.open('file:///home/jon/workspace/webpage...
43,701
<p>How can you <a href="http://en.wikipedia.org/wiki/Diff" rel="noreferrer">diff</a> two pipelines without using temporary files in Bash? Say you have two command pipelines:</p> <pre><code>foo | bar baz | quux </code></pre> <p>And you want to find the <code>diff</code> in their outputs. One solution would obviously...
<p>A one-line with 2 tmp files (not what you want) would be:</p> <pre><code> foo | bar &gt; file1.txt &amp;&amp; baz | quux &gt; file2.txt &amp;&amp; diff file1.txt file2.txt </code></pre> <p>With <strong>bash</strong>, you might try though:</p> <pre><code> diff &lt;(foo | bar) &lt;(baz | quux) foo | bar | diff - ...
<p>Some people arriving at this page might be looking for a line-by-line diff, for which <code>comm</code> or <code>grep -f</code> should be used instead.</p> <p>One thing to point out is that, in all of the answer's examples, the diffs won't actually start until both streams have finished. Test this with e.g.: </p> ...
44,955
<p>There are many scenarios where it would be useful to call a Win32 function or some other DLL from a PowerShell script. to Given the following function signature:</p> <pre><code>bool MyFunction( char* buffer, int* bufferSize ) </code></pre> <p>I hear there is something that makes this easier in PowerShell CTP 2, bu...
<p>To call unmanaged code from Powershell, use the Invoke-Win32 function created by Lee Holmes. You can find the source <a href="http://www.leeholmes.com/blog/GetTheOwnerOfAProcessInPowerShellPInvokeAndRefOutParameters.aspx" rel="noreferrer">here</a>. There you can see an example of how to call a function that has poin...
<p>There isn't any mechanism in PowerShell 1.0 to directly call Win32 API's. You could of course write a C# or VB.NET helper class to do this for you and call that from PowerShell.</p> <p>Update: Take a look at -</p> <p><a href="http://blogs.msdn.com/powershell/archive/2006/04/25/583236.aspx" rel="nofollow noreferrer...
17,217
<p>Can I simulate in C#/C++ code <kbd>Control</kbd>+<kbd>Alt</kbd>+<kbd>Delete</kbd> sequence in Vista? When UAC enabled/disabled? How it is done in XP?</p> <p>Can you provide a code sample that works in Vista?</p>
<p>Existing code to simulate the Secure Attention Sequence (SAS), which most people refer to as control alt delete or ctrl-alt-del, no longer works in Windows Vista. It seems that Microsoft offers a library that exports a function called SimulateSAS(). It is not public and one is supposed to request it by sending a mai...
<p>PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));</p> <p>You get PostMessage from the user32 dll</p> <p>edit: <a href="http://www.codeproject.com/KB/system/alt_control_delete.aspx?fid=14112&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2634100&amp...
14,885
<p>I am using the mootools based Rokbox plugin, on one of my sites, and I can't figure out how to close it with javascript.</p> <p>I triggered the click event on the close button, but that did not work.</p> <p>I found the code in the rokbox source that is used to add the click listener</p> <pre><code>this.closeButto...
<p>The <code>this</code> likely refers to the rokbox instance; I don't think you need to worry about it, you're interested in the code that runs on the click event. The salient part looks to be the following:</p> <pre><code>self.swtch=false; self.close(e); </code></pre> <p><code>self</code> most likely refers to the ...
<p>For the current rokbox and mootools 1.12, the command is</p> <pre><code>window.parent.rokbox.close(null) </code></pre> <p>it took forever to come up with this. By the way, this is to close the rokbox from the page that's loaded in the rokbox, by clicking a regular button instead of the 'x' for instance. Also, to a...
11,936
<p>I have a string(char*), and i need to find its underlying datatype such as int, float, double, short, long, or just a character array containing alphabets with or with out digits(like varchar in SQL). For ex: </p> <pre><code> char* str1 = "12312" char* str2 = "231.342" char* str3 = "234234243234" cha...
<p>In C (not in C++), I would use a combination of strtod/strol and max values from &lt;limits.h&gt; and &lt;float.h&gt;:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;limits.h&gt; #include &lt;float.h&gt; /* Now, we know the following values: INT_MAX, INT_MIN, SHRT_MAX, SHRT...
<p>First of all, you should decide which representatins you want to recognize. For example, is 0xBAC0 an unsigned short expressed in hex? Same goes for 010 (in octal) and 1E-2 (for 0,01).</p> <p>Once you have decided on the represantation, you can use regular expressions to determine the general forms. For example:</p...
23,779
<p>I'm updating an old project &amp; my version of xdoclet complains about my Java 1.5 annontations (ArrayList data = ....) when parsing for Hibernate (hibernate3) tags.</p> <p>So my question is this...</p> <p>Is there a fix for Xdoclet 1.2.3, or should I look to move to Xdoclet2?</p> <p>I've already started moving ...
<p>I would definitively lose xdoclet in favor of JPA annotations. You can get about the same functionality from Hibernate using JPA annotations.</p>
<p>To answer the original question: I had a similar (the same?) problem, which was caused by the version of xjavadoc distributed with xdoclet 1.2.3.</p> <p>XJavadoc provided a snapshot release that fixes the compatibility. Replace the jar from the xdoclet-release with the one you can find as an attachment to <a href="...
27,240
<p>I'm trying to consume Sharepoint webservices with ruby. I've basically given up trying to authenticate with NTLM and temporarily changed the Sharepoint server to use basic authentication. I've been successful getting a WSDL using soap4r but still cannot authenticate when attempting to use an actual web service cal...
<p>I'm a total newb. But after a lot of time and with some help from more experience coders, I was able to get ruby working with Sharepoint 2010. The code below requires the 'ntlm/mechanize' gem.</p> <p>I've been able to download the sharepoint xml from lists specified (below) using the List GUID and the List View GUI...
<p>This may not help but micorosoft just release the toolkit for Sharepoint and WSRP, <a href="http://blogs.msdn.com/sharepoint/archive/2008/12/15/announcing-the-wsrp-toolkit-for-sharepoint.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sharepoint/archive/2008/12/15/announcing-the-wsrp-toolkit-for-sharepoint.asp...
48,671
<p>I am <a href="https://stackoverflow.com/questions/211260/perl-extract-text-then-save&lt;br">searching</a> for HF50(HF$HF) for example in "MyFile.txt" so that the extracted data must save to "save.txt". The data on "save.txt" now extracted again and fill the parameters and output on my table. But when I tried the cod...
<p>Are you running this as a CGI script? In that case, you probably don't have permission to open a file for writing. Did you check the error log to see if your message from <code>die</code> is in there?</p> <p>You might want to check out <a href="http://brian-d-foy.cvs.sourceforge.net/*checkout*/brian-d-foy/CGI_MetaF...
<p>First, Perl's output is by nature buffered. So, unless you use some explicit method, there's no guarantee that the physical file will have anything to read. As somebody mentioned, you'll have to flush the output somehow. My comments are below in the code. (You could also do this by closing the output file and openin...
26,762
<p>I have a list box control:</p> <pre> <code> &lt;asp:ListBox runat="server" id="lbox" autoPostBack="true" /> </code> </pre> <p>The code behind resembles:</p> <pre> <code> private void Page_Load(object sender, System.EventArgs e) { lbox.SelectedIndexChanged+=new EventHandler(lbox_SelectedIndexChanged); if(!...
<p>What's the output of the foo() function call?</p> <p>Populating manually the list box you can set indexes to whatever you want (all 0 for example) - so the same thing can happen setting a given dataSource under certain circumstances (one that specifies indexes I suppose). If all the item indexes are 0 the result is...
<p>I dont know if it makes a difference or not, but i generally attach my controls to events on the front page rather than in the codebehind. In your example i would have done:</p> <pre><code>&lt;asp:ListBox runat="server" id="lbox" autoPostBack="true" OnSelectedIndexChanged="lboxScorecard_SelectedIndexChanged" /&gt...
43,938
<p>I have an MPI program which compiles and runs, but I would like to step through it to make sure nothing bizarre is happening. Ideally, I would like a simple way to attach GDB to any particular process, but I'm not really sure whether that's possible or how to do it. An alternative would be having each process write ...
<p>As someone else said, <a href="https://www.roguewave.com/products-services/totalview" rel="noreferrer">TotalView</a> is the standard for this. But it will cost you an arm and a leg.</p> <p>The OpenMPI site has a great <a href="http://www.open-mpi.org/faq/?category=debugging" rel="noreferrer">FAQ on MPI debugging</...
<p>Another solution is to run your code within SMPI, the simulated MPI. That's an open source project in which I'm involved. Every MPI rank will be converted into threads of the same UNIX process. You can then easily use gdb to step the MPI ranks.</p> <p>SMPI proposes other advantages to the study of MPI applications:...
42,669
<p>Say you had to develop a web-based application that needs to be able to read the contents of a .NET DLL, and from that, populate the local database with a list of all the namespaces, classes, etc.</p> <p>It has to also do the same thing with Java JAR files.</p> <p>Are there limitations on what language I could use...
<p>I think that the "get this information from a DLL" and "get this information from a JAR file" activities would have nothing in common with each other, or with the web application to display the information. Surely there already exist tools to dump this information.</p> <p>You probably ought to write the Web part of...
<p>I would wonder if you would want that? I mean, firstly people write a lot of code that isn't really that good looking and second, some can run obfuscation on there code, what says that you could "get the content" and understand that then?</p> <p>But sure, there are tools out there that can read dll's and get the co...
34,063
<p>Here's the situation: I'm developing a simple application with the following structure:</p> <ul> <li>FormMain (startup point)</li> <li>FormNotification</li> <li>CompleFunctions</li> </ul> <p>Right?</p> <p>Well, in <strong>FormMain</strong> I have the following function:</p> <pre><code>private void DoItInNewThrea...
<p>Almost every GUI library is designed to only allow calls that change the GUI to be made in a single thread designated for that purpose (called the UI thread). If you are in another thread, you are required to arrange for the call to change the GUI to be made in the UI thread. In .NET, the way to do that is to call I...
<p>Use the <strong>SetWindowPos</strong> API call to ensure that your notify form is the topmost window. This post explains how:</p> <p><a href="http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html" rel="nofollow noreferrer">http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html</a></p>
19,411
<p>I've been exploring different strategies for running integration tests within some Nant build scripts. Typically a number of different scripts are chained in one monolithic build that has separate targets: staging (build a staging version, like build), build (just build the stuff), integration (build the stuff and r...
<p>Yes, you are on the right track. What you need to do now is to hook up your nant target to an automated process. I recommend using either Team City or Cruise Control for as your CI tool. Once you have your automated server setup you can run your build and unit tests on each check in (Continuous Integration). Yo...
<p>See this related thread <a href="https://stackoverflow.com/questions/102902/what-is-a-good-ci-build-process#103759">What is a good CI build process?</a></p> <p>You are on the right track. If you're using a decent CI tool, you should be able to set each setup up as a separate project that triggers the next step in t...
26,972
<p>I have a SQL Server 2005 database that I'm trying to access as a limited user account, using Windows authentication. I've got BUILTIN\Users added as a database user (before I did so, I couldn't even open the database). I'm working under the assumption that everybody is supposed to have permissions for the "public"...
<p>You only need to have SELECT rights. In raw SQL (see the "script" icon/button in your dialogue box), it's <code>GRANT SELECT ON dbo.tblFoo to public</code>. This is the only permission needed to view the data,</p> <p>In this case, the error message explicitly mentions "deny". "DENY" is a right in itself, so it ment...
<p>Assuming "UserTest" is a domain user account, connect as a member of the sysadmin role and run</p> <pre><code>EXEC MASTER.dbo.xp_logininfo 'Domain\UserTest', 'all' </code></pre> <p>(substituting your domain name for "Domain")</p> <p>this will display the Windows groups etc. that the account is inheriting security...
48,333
<p>Given:</p> <pre><code>FieldInfo field = &lt;some valid string field on type T&gt;; ParameterExpression targetExp = Expression.Parameter(typeof(T), "target"); ParameterExpression valueExp = Expression.Parameter(typeof(string), "value"); </code></pre> <p>How do I compile a lambda expression to set the field on the "...
<p><strong>.Net 4.0</strong> : now that there's <code>Expression.Assign</code>, this is easy to do:</p> <pre><code>FieldInfo field = typeof(T).GetField("fieldName"); ParameterExpression targetExp = Expression.Parameter(typeof(T), "target"); ParameterExpression valueExp = Expression.Parameter(typeof(string), "value"); ...
<p>I once made this class. Perhaps it helps:</p> <pre><code>public class GetterSetter&lt;EntityType,propType&gt; { private readonly Func&lt;EntityType, propType&gt; getter; private readonly Action&lt;EntityType, propType&gt; setter; private readonly string propertyName; private readonly Expression&lt;F...
41,637
<p>I have two models, Article and Post that both inherit from a base model called ContentBase.</p> <p>You can leave comments on both Articles and Posts, so I am using a Polymorphic Association between Comments and Article or Post.</p> <p>However, since both Article and Post inherit from ContentBase, the commentable_t...
<p>What's in the ContentBase class? Can you move that code into a module instead of using inheritance?</p> <pre><code>Module BaseContent def self.included(base) base.class_eval do validates_presence_of :somefield validates_length_of :someotherfield def my_method "h...
<p>I don't think you want to do that. For polymorphic associations, you want the XXX_type field to be the base model class, not the actual class. I'm not exactly sure of the reason, but I believe it has to do with determining the table name to select from to get the polymorphic data.</p> <p>I think you need to look ...
30,663
<p>I have an .Net Froms application that displays web pages through a WebBrowser control.</p> <p>Is there anyway that I can detect if the control shows a '<em>Page not found</em>' or '<em>Cannot display webpage</em>' error? There doesn't seem to be any error event handlers.</p>
<p>The WebBrowser windows forms control is wrapper around Internet Explorer and it doesn't expose all the functionality of the underlying ActiveX control and particularly the NavigateError event. Here's a workaround:</p> <p>First add reference to SHDocVw.dll to your project (COM tab of Add Reference window). Then you ...
<p>I found another way to solve this without setting a reference to the SHDocVw dll.</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.createsink(VS.80).aspx" rel="noreferrer">web browser CreateSink method</a> on MSDN.</p>
48,123
<p>How do I programmatically force the deletion of files that are locked by the operating system or any other program with C/C++? The functionality should be similar to the software "Unlocker" at <a href="http://ccollomb.free.fr/unlocker" rel="nofollow noreferrer">http://ccollomb.free.fr/unlocker</a>.</p>
<p>Look <a href="http://www.codeguru.com/cpp/w-p/files/fileio/article.php/c1287" rel="noreferrer">this</a> sample.</p>
<p>This really depends on the underlying filesystem. </p> <p>For example, on Linux, ext3 supports file attributes that are not part of the standard unix read/write/execute/user/group/world paradigm.</p> <p><a href="http://linux.about.com/od/commands/l/blcmdl1_chattr.htm" rel="nofollow noreferrer">There is a nice summ...
26,482
<p>This question is pretty much the same as <a href="https://stackoverflow.com/questions/91362/how-to-escape-brackets-in-a-format-string-in-net">this .Net question</a> exept for java.</p> <p>How do you escape the <code>%1$</code> characters in a java <code>String.format</code>?</p> <p>THe reason I need to do this is ...
<p>You can just double up the %</p>
<p>Either you can use the proposal of Draemon, either you can also have a look at <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html" rel="nofollow noreferrer">java.text.MessageFormat class</a> that has more powerfull formatting abilities than String.format()</p>
24,576
<p>I want to make a login system using ASP.NET (MVC).</p> <p>On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider.</p> <p>However, I want to roll my own. I don't want to use the built-in membership provider, as it only seem...
<p>I dont know about best practices but I can tell you what I do. Its not hitech security but it does the job.</p> <p>I use forms authentication. I receive the password secured with ssl via a textbox on the login page. I take that password and hash it. (Hashing is like one way encryption, you can get hash code that ca...
<p>I would avoid the whole issue and use openid. There is a library available that you can use directly. <a href="http://blog.wekeroad.com/blog/my-mvc-starter-template/" rel="nofollow noreferrer">Here is a link to a blog post about putting this in place</a></p>
18,399
<p>How can I improve the look and feel of my Linux desktop to suit my programming needs?</p> <p>I found Compiz and it makes switching between my workspaces (which is something I do all the time to make the most of my 13.3" screen laptop) easy and look great - so what else don't I know about that make my programming en...
<p>I found that the best programming experience comes from having quick access all your tools. This means getting comfortable with basic command line acrobatics and really learning keyboard shortcuts, flags, and little productivity apps.</p> <p>I find that most of my workflow comes down to just a few apps and command...
<p>If you have half decent 3D acceleration on board, CompizFusion adds attractive desktop effects like mapping your workspaces onto a cube using that to switch between them/move windows between them. Looks pretty and improves general usability - great!</p> <p><a href="http://en.wikipedia.org/wiki/Compiz" rel="nofollow...
5,730
<p>Let's compile a list of tips.</p> <p>(Understandably there will be some subjectivity involved, but some pointers would be useful to someone overwhelmed by tackling a large project within the Flash framework.)</p>
<p>These are just scattered thoughts on organization for projects being worked on mostly with the Flash IDE.</p> <p>First, I highly recommend using source control, like Subversion, CVS, or Git. </p> <p>Organization of filesystem folder structure is subjective, but I generally have a "src" folder for all my source FLA...
<p>A complex project will have many dependencies. In my Flash projects, I put all my libraries in a version controlled location as they are. Third party libraries are usually a mishmash of assets, code, demos and docs. </p> <p>I keep a small yaml file that keeps track of the location of each type of resource associate...
6,841
<p>We have an internal .NET case management application that automatically creates a new case from an email. I want to be able to identify other emails that are related to the original email so we can prevent duplicate cases from being created. </p> <p>I have observed that many, but not all, emails have a thread-index...
<p>As far as I know, there's not going to be a 100% foolproof solution, as not all email clients or gateways preserve or respect all headers.</p> <p>However, you'll get a pretty high hit rate with the following:</p> <ul> <li><p>Every email message should have a unique &quot;Message-ID&quot; field. Find this, and keep a...
<p>As far as I know, there's not going to be a 100% foolproof solution, as not all email clients or gateways preserve or respect all headers.</p> <p>However, you'll get a pretty high hit rate with the following:</p> <ul> <li><p>Every email message should have a unique &quot;Message-ID&quot; field. Find this, and keep a...
36,762
<p>I'm using an HTML sanitizing whitelist code found here:<br> <a href="http://refactormycode.com/codes/333-sanitize-html" rel="nofollow noreferrer">http://refactormycode.com/codes/333-sanitize-html</a></p> <p>I needed to add the "font" tag as an additional tag to match, so I tried adding this condition after the <cod...
<p>Your IsMatch Method is using the option <code>RegexOptions.IgnorePatternWhitespace</code>, that allows you to put comments inside the regular expressions, so you have to scape the # chatacter, otherwise it will be interpreted as a comment.</p> <pre><code>if (!IsMatch(tagname,@"&lt;font(\s*size=""\d{1}"")? (\s*c...
<p>It works fine for me... what version of the .NET framework are you using, and what is the <em>exact</em> exception?</p> <p>Also - what does you <code>IsMatch</code> method look like? is this just a pass-thru to <code>Regex.IsMatch</code>?</p> <p>[update] The problem is that the OP's example code didn't show they a...
29,718
<p>How can I generate UML diagrams (especially sequence diagrams) from existing Java code?</p>
<h1><a href="http://www.objectaid.com/home" rel="noreferrer">ObjectAid UML Explorer</a></h1> <p>Is what I used. It is easily <strong><a href="https://www.objectaid.com/install-objectaid" rel="noreferrer">installed</a></strong> from the repository:</p> <pre><code>Name: ObjectAid UML Explorer Location: http://www.o...
<p>I suggest PlantUML. this tools is very usefull and easy to use. PlantUML have a plugin for Netbeans that you can create UML diagram from your java code.</p> <p>you can install PlantUML plugin in the netbeans by this method:</p> <p>Netbeans Menu -> Tools -> Plugin</p> <p>Now select Available Plugins and then find ...
7,500
<p>I am trying to set the innerxml of a xmldoc but get the exception: Reference to undeclared entity</p> <pre><code>XmlDocument xmldoc = new XmlDocument(); string text = "Hello, I am text &amp;alpha; &amp;nbsp; &amp;ndash; &amp;mdash;" xmldoc.InnerXml = "&lt;p&gt;" + text + "&lt;/p&gt;"; </code></pre> <p>This throws ...
<p>XML, unlike HTML does not define entities (ie named references to UNICODE characters) so &amp;alpha; &amp;mdash; etc. are not translated to their corresponding character. You must use the numerical value instead. You can only use &amp;lt; and &amp;amp; in XML</p> <p>If you want to create HTML, use an HtmlDocument i...
<p>You could also set the InnerText to <code>"Hello, I am text α – —"</code>, making the XmlDocument escape them automatically. I think.</p>
35,649
<p>We are developing a WCF based system. In the process we are trying to lock some data from being modified by more than one users. So we decided to have a data structure that will contain the necessary information for the locking logic to execute (by for example storing the ID of the locked objects)</p> <p>The proble...
<p>Static members of the service implementing class are shared between sessions &amp; calls. </p>
<p>Perhaps a caching framework like <a href="http://blogs.msdn.com/velocity/" rel="nofollow noreferrer">velocity</a> help you out.</p>
34,780
<p>I'm just wondering what the optimal solution is here.</p> <p>Say I have a normalized database. The primary key of the whole system is a varchar. What I'm wondering is should I relate this varchar to an int for normalization or leave it? It's simpler to leave as a varchar, but it might be more optimal </p> <p>For i...
<p>Can you really use names as primary keys? Isn't there a high risk of several people with the same name?</p> <p>If you really are so lucky that your name attribute can be used as primary key, then - by all means - use that. Often, though, you will have to make something up, like a customer_id, etc.</p> <p>And final...
<p>If the "name" field really is appropriate as a primary key, then do it. The database will <em>not</em> get more normalized by creating a surrogate key in that case. You will get some duplicate strings for foreign keys, but that is not a normalization issue, since the FK constraint guarantrees integrity on strings ju...
17,379
<blockquote> <p>System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException:</p> </blockquote> <p>What does this exception mean? I get it at this line trying to add a panel to a panel at runtime...</p> <pre><code>splitReport.Panel1.Controls.Add(ChartPanel);...
<p>This exception means that the thread that owns the Panel (the Panel being added) has been initialized using the MTA threading model. The drag/drop system requires that the calling thread use the STA thread model (particularly it requires that COM be initialized via OleInitialize). Threading models are an unfortunate...
<p>I have encountered this situation recently,<code>[STAThreadAttribute]</code>is in my case,and i solved this problem by using <strong>Invoke</strong> method,it might be helpful for you guys,so I share with a little code snippet:</p> <pre><code>this.Invoke(new InvokeHandler(delegate() { //Your method here! })); </co...
16,445
<p>if you pay like 25% of the license cost as a annual maintenance fee for software, that usually gives you free upgrades (even major releases).</p> <p>this should mean that the software company has to release a major version right? otherwise why would you pay for the annual maintenance fee?</p>
<p>No, it doesn't mean that they should or will release a new major version unless that is in your contract. They might only release minor versions or patches.</p> <p>I do think that ethically they should release new major versions regularly, but I would look at their past release history.</p> <p>A Software Maint fee...
<p>Typically I would expect to get any major releases that happen, but I don't think you can expect anything.</p> <p>For a start what's a major release? If you were to <em>force</em> someone to release a major version then they might just change the numbers in the about box and hit compile on what they have. That doe...
37,137
<p>As you can see, even after the program should have died it speaks from the grave. Is there a way to "deregister" the exitfunction in case of exceptions?</p> <pre><code>import atexit def helloworld(): print("Hello World!") atexit.register(helloworld) raise Exception("Good bye cruel world!") </code></pre> <p>...
<p>I don't really know why you want to do that, but you can install an excepthook that will be called by Python whenever an uncatched exception is raised, and in it clear the array of registered function in the <code>atexit</code> module.</p> <p>Something like that :</p> <pre><code>import sys import atexit def clear...
<p>If you call</p> <pre><code>import os os._exit(0) </code></pre> <p>the exit handlers will not be called, yours or those registered by other modules in the application.</p>
10,656