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 best way to design an interface so that very long drop down values that get trucated due to size limits do not create a very bad user experience. My question is for web applications.</p> <p>Could you please send your suggestions.</p> <p>Thanks.</p>
<p>One option is to use 'type-ahead' with postback (AJAX) to reduce the size of the list.</p>
<p>have a tooltip for each item in the dropdown list so when a user hovers his mouse pointer to an item, he'll still be able to see the full description of the item.</p> <p>or have your dropdown width auto-resize to the longest description in the list.</p>
16,021
<pre><code>string [] files = new string[2]; files[0] = "ThinkFarAhead.Example.Settings.Configuration_Local.xml"; files[1] = "ThinkFarAhead.Example.Settings.Configuration_Global.xml"; //Resharper complains this is an "access to modified closure" for (int i = 0; i &lt; files.Length; i++ ) { // Resharper disable Acce...
<p>In this case, it's okay, since you are actually executing the delegate <em>within</em> the loop.</p> <p>If you were saving the delegate and using it later, however, you'd find that all of the delegates would throw exceptions when trying to access files[i] - they're capturing the <em>variable</em> <code>i</code> rat...
<p>"files" is a <strong>captured outer variable</strong> because it has been captured by the anonymous delegate function. Its lifetime is extended by the anonymous delegate function.</p> <blockquote> <p>Captured outer variables When an outer variable is referenced by an anonymous function, the outer variable is sa...
29,151
<p>I've created a MATLAB class, something like:</p> <pre><code>classdef myclass properties x_array = []; end methods function increment(obj,value) obj.x_array = [obj.x_array ; value); end end end </code></pre> <p>The problem is, the property <code>x_array</code> is never modified when I...
<p>This is similar to <a href="https://stackoverflow.com/questions/209005/object-oriented-matlab-properties">this question</a>. In short all you should have to do is inherit from handle class.</p> <p>Quick example </p> <p>Contents of file myclass.m</p> <pre><code>classdef myclass&lt;handle properties x_a...
<p>There is an easier way. You only need to overwrite your initial instance <code>s</code> as follows:</p> <pre><code>s = increment(s,5); </code></pre> <p>More information <a href="https://www.mathworks.com/help/matlab/matlab_oop/matlab-vs-other-oo-languages.html" rel="nofollow noreferrer">in the documentation</a>.</...
34,318
<p>When I try to execute the following code in IE:</p> <pre><code> &lt;script type="text/javascript"&gt; google.load("jquery", 1); google.load("jqueryui", "1.5.3"); $(document).ready(function() { $("#main-dialog").draggable(); }); &lt;/script&gt; &lt;d...
<p>Essentially, yes, you need to at least be able to read and understand CAML. However you can probably get out of writing it. I've used these tools:</p> <p>U2U CAML Query Builder by U2U - <a href="http://www.u2u.be/res/Tools/CamlQueryBuilder.aspx" rel="nofollow noreferrer">download</a> and <a href="http://www.u2u.be/...
<p>I depends on what you want to do.<br> You can also use the MOSS search engine to search for documents.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms544561.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms544561.aspx</a></p>
44,717
<p><a href="https://stackoverflow.com/questions/2262/aspnet-url-rewriting">So this post</a> talked about how to actually implement url rewriting in an ASP.NET application to get "friendly urls". That works perfect and it is great for sending a user to a specific page, but does anyone know of a good solution for creati...
<p>See <a href="http://www.codethinked.com/post/2008/08/20/Exploring-SystemWebRouting.aspx" rel="nofollow noreferrer">System.Web.Routing</a></p> <p>Routing is a different from rewriting. Implementing this technique does require minor changes to your pages (namely, any code accessing querystring parameters will need to...
<p>Create a UrlBuilder class with methods for each page like so:</p> <pre><code>public class UrlBuilder { public static string BuildProductUrl(int id) { if (true) // replace with logic to determine if URL rewriting is enabled { return string.Format("~/Product/{0}", id); } ...
11,273
<p>OK,</p> <p>Here is my problem, I have a master page with a HEAD section that contains my JS includes. I have one JS include </p> <pre><code>&lt;script src="Includes/js/browser.js" language="javascript" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>In my page i consume it like this:</p> <pre><code>&...
<p>If you can use Firefox, I would highly recommend installing and enabling the Firebug addon.</p> <p>Otherwise, see some of the following for tools that might help:</p> <ul> <li><a href="https://stackoverflow.com/questions/3404/javascript-troubleshooting-tools-in-ie">Javascript troubleshooting tools in IE</a></li> <...
<p>check if youre using a keyword as an identifier in yoru code</p> <hr> <p><a href="http://mattsnider.com/languages/javascript/reserved-words-in-javascript/" rel="nofollow noreferrer">http://mattsnider.com/languages/javascript/reserved-words-in-javascript/</a></p> <p><a href="http://bytes.com/groups/javascript/4246...
42,334
<p>cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;</p> <p>in this method</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; </code></pre> <p>but I can only see it when I select that cell otherwise it's not visible.and it work perfe...
<p>It would appear that the disclosure indicator is a gray, high-alpha image, so overlaying that over a black background makes it invisible. If you want to do this, you'll need to add your own UIImageView to the cell's contentView.</p>
<p>I made a solution where I added an ImageView with addSubView in the normal fashion, with an image that was not black (in my case, a grey filled circle) at the position where the accessory appears. </p> <p>That allows the arrow to be seen and still have a dark/black table cell background color.</p> <p>Maybe not the...
30,951
<p>We have a SharePoint site on it's own domain and are debating using Forms Authentication or Active Directory. Really we would like the power of kerberos with the flexibility and transparancy of a forms authentication (like storing the users in sqlserver using sqlmembershipprovider in asp.net). Is there any way to ...
<p>Maybe ADAM might be helpful for your scenario: <a href="http://www.microsoft.com/windowsserver2003/adam/default.mspx" rel="nofollow noreferrer">http://www.microsoft.com/windowsserver2003/adam/default.mspx</a></p> <p>The problem with Forms authentication is that it misses some end user GUI controls like: change pass...
<p>You might also consider using Forefront User Access Gateway (UAG). I have implemented multiple times and it works much better than ISA and in fact, bits are installed along with SharePoint for the User Profile Service - <a href="http://www.microsoft.com/en-us/server-cloud/forefront/unified-access-gateway.aspx" rel="...
14,220
<p>Can I use three-phase stepper motors with pololu style stepper drivers? If not, what kind of drivers support three-phase motors?</p>
<p>Three phase stepper motors are superior in several ways: <a href="http://www.fullingmotorusa.com/the-new-range-of-3-phase-stepper-motors/" rel="nofollow noreferrer">see this advertising literature.</a> Unfortunately for using this with simple stepper drivers, they have an extra coil of wire that simple drivers have...
<p>3D printers typically use bipolar two-phase stepper motors, and it is possible that Pololu-style carriers for stepper-motor drivers only support such motors.</p> <p>Certainly, drivers for three-phase stepper motors exist, for example, the Trinamic TMC5062, but I cannot find any Pololu-style carriers for this chip. ...
1,324
<p>Here's some background on what I'm trying to do:</p> <ol> <li>Open a serial port from a mobile device to a Bluetooth printer.</li> <li>Send an EPL/2 form to the Bluetooth printer, so that it understands how to treat the data it is about to receive.</li> <li>Once the form has been received, send some data to the pri...
<p>Flow control is the correct answer here, and it may not be present/implemented/applicable to your bluetooth connection.</p> <p>Check out the Zebra specification and see if they implement, or if you can turn on, software flow control (xon, xoff) which will allow you to see when the various buffers are getting full.<...
<p>The issue is likely not with the serial port code, but with the underlying bluetooth stack. The port you're using is purely virtual, and it's unlikely that any of the handshaking is even implemented (as it would be largely meaningless). CTS/RTS DTR/DSR are simply non-applicable for what you're working on.</p> <p>...
27,444
<p>How do I implement this equality comparison is a sane java way? </p> <pre><code>boolean x = (a == b) || (a.equals(b)) </code></pre> <p>I want to make sure the content of both objects is equal but null is also ok, i.e. both can be null and are thus equal.</p> <p>Update: just to be clear, I have to implement thi...
<p>What happens if a is null but b is not? I think you really want:</p> <pre><code>boolean x = (a == null &amp;&amp; b == null) || (a != null &amp;&amp; a.equals(b)) </code></pre> <p><strong>EDIT:</strong> You could implement a static NullEquals method for the class that takes two objects of that class and does the ...
<p>Can not add comment, Treat this as comment to <a href="https://stackoverflow.com/users/22656/jon-skeet">Jon Skeet</a>'s answer.</p> <p>Does Null = Null true or false in Java. </p> <p>More specifically what should be Null = Null should be treated and How and why the different language treat this case ?</p>
43,727
<p>I want to simulate a 'Web 2.0' Lightbox style UI technique in a <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window. </p> <p>The obvious solution is to...
<p>Can you do this in .NET/C#? </p> <p>Yes you certainly can but it takes a little bit of effort. I would recommend the following approach. Create a top level Form that has no border or titlebar area and then give make sure it draws no client area background by setting the TransparencyKey and BackColor to the same val...
<p>Every form has "Opacity" property. Set it to 50% (or 0.5 from code) so will be half transparent. Remove borders and show it maximized before the form you want to have focus. You can change BackColor of the form or even set background image for different effects.</p>
9,860
<p>Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't get much response so I thought I'd rephrase. Does anyone have any experience building Adobe Flex applications with a .NET back-end? If so, what architecture did you use and what third-party tools if any did you employ. I've read a litt...
<p>I've mainly used plain ASP.NET pages that return XML for situations that are mainly one-way (data from ASP.NET --> Flex/Flash) communication. The Flex side just uses a URLLoader to hit the ASP.NET page and loads the result as XML.</p> <p>If the communication needs to be a little more two-sided (sending more than a ...
<p>I've mainly used plain ASP.NET pages that return XML for situations that are mainly one-way (data from ASP.NET --> Flex/Flash) communication. The Flex side just uses a URLLoader to hit the ASP.NET page and loads the result as XML.</p> <p>If the communication needs to be a little more two-sided (sending more than a ...
6,688
<p>How to customize the color of the symbol inserted in the "glasses mode" in Emacs? I have not found the option for this. Can anyone suggest anything?</p>
<p>There's no option to set the face for the inserted separator (and from a brief study of the docs for emacs overlays, I don't think it's simple to add).</p> <p>You can customize the face used for the capital letters that glasses-mode splits on; it's called <code>glasses-face</code>.</p>
<p>The easiest way to see the customisations available for <code>glasses-mode</code> is to enter:</p> <pre><code>M-x customize-group </code></pre> <p>and then enter <code>glasses</code> at the <code>Customize group (default emacs):</code> prompt.</p> <p>However, you will need to set up a <a href="http://www.gnu.org/...
14,082
<p>I know that this should be easy but how do I export/save a DataGridView to excel?</p>
<p>You can use this library for more detailed formatting<br> <a href="http://www.carlosag.net/Tools/ExcelXmlWriter/" rel="nofollow noreferrer">http://www.carlosag.net/Tools/ExcelXmlWriter/</a></p> <p>There are samples in the page.</p>
<p>Here some code we use to do it across lots of our apps. We have a special method to clean up "not exportable" column. Additionally, we don't export cols without headers but you can adjust that logic to your needs.</p> <p>Edit: The code formatter doesn't love vb.net - you can copy/paste into visual studio and it ...
4,694
<p>I was reading <a href="https://stackoverflow.com/questions/144735/best-way-to-get-started-with-programming-other-things-than-your-computer#144843">this</a> answer previously and it got me interested in purchasing a Nintendo DS Lite for learning to program embedded devices. Before I go out and splurge on a DS I had ...
<ol> <li><p>No, there really isn't much of a limitation beyond that of the hardware, and even that can be overcome with enough effort. Quake has been ported to DS, for example, and particle games that utilize both processors have been made. There has also been discussion on how to make higher quality ...
<p>Honestly, I found the Nintendo DS and the homebrew community while I was attending an Embedded Systems course in college, and I realized the similarities between the ATmega32-based kit I was programming for the class and the hardware-level development of the Nintendo DS via libnds, and I was hooked.</p> <p>Personal...
17,482
<p>I've been banging my head against for wall for a while with this one.</p> <p>I want to SSH into a set of machines and check whether they are available (accepting connections and not being used). I have created a small script, tssh, which does just that:</p> <pre><code>#!/bin/bash host=$1 timeout=${2:-1} ssh -qo ...
<p>Chris is correct. The source of the loop breaking was SSH using stdin, however guns is correct in is usage of a looping methodology.</p> <p>If you are looping through input (a file with a list of hostnames for example), and calling SSH, you need to pass the -n parameter, otherwise your loop based on input will fai...
<p>I'm also unsure about why it fails, but i like <code>xargs</code> and <code>seq</code>:</p> <pre><code>seq 0 20 | xargs -n1 tssh MYBOXES </code></pre>
45,078
<p>Given an integer typedef:</p> <pre><code>typedef unsigned int TYPE; </code></pre> <p>or</p> <pre><code>typedef unsigned long TYPE; </code></pre> <p>I have the following code to reverse the bits of an integer:</p> <pre><code>TYPE max_bit= (TYPE)-1; void reverse_int_setup() { TYPE bits= (TYPE)max_bit; w...
<pre><code>#include&lt;stdio.h&gt; #include&lt;limits.h&gt; #define TYPE_BITS sizeof(TYPE)*CHAR_BIT typedef unsigned long TYPE; TYPE reverser(TYPE n) { TYPE nrev = 0, i, bit1, bit2; int count; for(i = 0; i &lt; TYPE_BITS; i += 2) { /*In each iteration, we swap one bit on the 'right half' ...
<p>How about:</p> <pre><code>long temp = 0; int counter = 0; int number_of_bits = sizeof(value) * 8; // get the number of bits that represent value (assuming that it is aligned to a byte boundary) while(value &gt; 0) // loop until value is empty { temp &lt;&lt;= 1; // shift whatever was in ...
8,922
<p>in XSLT processing, is there a performance difference between apply-template and call-template? In my stylesheets there are many instances where I can use either, which is the best choice?</p>
<p>As with all performance questions, the answer will depend on your particular configuration (in particular the XSLT processor you're using) and the kind of processing that you're doing.</p> <p><code>&lt;xsl:apply-templates&gt;</code> takes a sequence of nodes and goes through them one by one. For each, it locates th...
<p>It may depend on the xml parser you are using. I can't speak for anything but .NET 2003 parser where I did some informal performance tests on <a href="http://www.dpawson.co.uk/xsl/sect2/pushpull.html" rel="nofollow noreferrer">push vs pull</a> XSLT code. This is similar to what you are asking: apply-template = push ...
11,001
<p>In java, when using SimpleDateFormat with the pattern:</p> <pre><code>yyyy-MM-dd'T'HH:mm:ss.SSSZ </code></pre> <p>the date is outputted as:</p> <pre><code>"2002-02-01T18:18:42.703-0700" </code></pre> <p>In xquery, when using the xs:dateTime function, it gives the error:</p> <pre><code>"Invalid lexical value [er...
<p>OK, the linked to forum post DID help, thank you. I did however find a simpler solution, which I include below:</p> <p>1) Use Apache commons.lang java library<br> 2) Use the following java code: </p> <pre class="lang-java prettyprint-override"><code>//NOTE: ZZ on end is not compatible with jdk, but allows for f...
<p>Try this:</p> <pre><code>static public String formatISO8601(Calendar cal) { MessageFormat format = new MessageFormat("{0,time}{1,number,+00;-00}:{2,number,00}"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); df.setTimeZone(cal.getTimeZone()); format.setFormat(0, df); long zoneOff = cal.get(Calend...
20,122
<p>By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location.</p> <p>You can add "/Y" to say "Yes to all" replacements.</p> <p>But how can you say "No to all" ?</p> <p>In other words, I want to copy everything from one directory that does <strong>not</st...
<p>Unless there's a scenario where you'd <em>not</em> want to copy existing files in the source that have changed since the last copy, why not use XCOPY with /D without specifying a date?</p>
<p>We used "robocopy" through "invoke-command" to copy a huge amount of VMs in our environment. We've discovered that "robocopy" unexpectedly exits sometimes and the whole proccess goes to down. So we've decided to use "xcopy". Now we're checking it's work and to "create" "Not for all" option we use that function (powe...
23,217
<p>C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance:</p> <pre><code>List&lt;int&gt; myInts = new List&lt;int&gt; {0,1,1, 2,3,5,8,13,21,34,55,89,144,233,377, 610,987,1597,2584,4181,6765}; //this statement is clunky List&lt;string&gt; myStrings = myInts. ...
<p>Actually, your question isn't bad. I've been toying with a generic programming language for last few years and although I've never come around to actually develop it (and probably never will), I've thought a lot about generic type inference and one of my top priorities has always been to allow the construction of cl...
<p>Thanks Konrad, that's a good response (+1), but just to expand on it.</p> <p>Let's pretend that C# has an explicit constructor function:</p> <pre><code>//your example var x = new Foo( 1 ); //becomes var x = Foo.ctor( 1 ); //your problem is valid because this would be var x = Foo&lt;T&gt;.ctor&lt;int&gt;( 1 ); //...
6,753
<p>I am debugging with breakpoints and I realize the assert call? I thought it was only for unit tests. What does it do more than breakpoint? Since I can breakpoint, why should I use Assert?</p>
<p>In a debug compilation, <a href="https://msdn.microsoft.com/en-us/library/kssw4w7z.aspx" rel="noreferrer" title="MSDN Debug.Assert"><code>Assert</code></a> takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the conditio...
<p>The way I think of it is Debug.Assert is a way to establish a contract about how a method is supposed to be called, focusing on specifics about the values of a paramter (instead of just the type). For example, if you are not supposed to send a null in the second parameter you add the Assert around that parameter to...
19,770
<p>What options / methods / software are available to convert a JAR file to a managed .NET assembly?<br> Please provide all commercial and non-commercial methods in the answer.<br> These don't include solutions which require Java to be installed on the host machine.</p>
<p>I could be wrong, but I'm pretty sure that's impossible. The java byte code is different to the code produced to run on the CLR.</p> <p><strong>Snarky answer</strong>: Get the source code, and port it.</p> <p>EDIT: A little poking comes up with <a href="http://sourceforge.net/projects/ikvm/" rel="noreferrer">http:...
<p>Confronted with this situation last year, I wrote a small wrapper (in java) that read the inputs from a temp file, invoked the jar and placed the output in anther temp file. The .NET project would create the input file, call the JVM and start the wrapper, wait for it to finish and read the output file. Quick and Dir...
9,457
<p>Short of rolling your own. There has to be something out there. FlexLM/FlexNet is overpriced, and does not work for a company like ours. The same goes for RLM. There was one product I had hope in called LUM, but IBM no longer licenses the API. So what else is available? Or do you have any known way to get LUM?...
<p>There's also <a href="http://www.reprisesoftware.com/" rel="nofollow noreferrer">Reprise</a>, coded by the people who originally wrote FlexLM. It's touted as cheaper and better than the original.</p> <p>I haven't tried it yet, since I'm doing the same search as the OP.</p>
<p>Here's one product -- SoftwarePassport: <a href="http://www.siliconrealms.com/" rel="nofollow noreferrer">http://www.siliconrealms.com/</a> They purchased Armadillo, which used to be an inexpensive software protection and licensing scheme. The price is higher than it was back then but I'll bet it's still less than ...
37,976
<p>When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.e...
<p>Download <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">Sysinternal's Process Explorer</a>. It's a task manager much more powerfull than Windows's own manager. </p> <p>One of it's features is that you can see all the resources that each process is using (like registry keys,...
<p>I'd suggest downloading Process Explorer from Sysinternals and looking at the different java.exe processes more closesly, that way you can get a better idea of which one to kill.</p> <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-...
8,782
<p>How do you create a simple, custom rule using the jQuery Validate plugin (using <a href="http://jqueryvalidation.org/jQuery.validator.addMethod" rel="noreferrer"><code>addMethod</code></a>) that doesn't use a regex?</p> <p>For example, what function would create a rule that validates only if at least one of a group...
<p>You can create a simple rule by doing something like this:</p> <pre><code>jQuery.validator.addMethod("greaterThanZero", function(value, element) { return this.optional(element) || (parseFloat(value) &gt; 0); }, "* Amount must be greater than zero"); </code></pre> <p>And then applying this like so:</p> <pre><c...
<p><strong>Step 1</strong> Included the cdn like</p> <pre><code> &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;script src=&quot;http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js&quot;&gt;&lt;/script&gt; </code></pr...
29,845
<p>I have a Java application that launches another java application. The launcher has a watchdog timer and receives periodic notifications from the second VM. However, if no notifications are received then the second virtual machine should be killed and the launcher will perform some additional clean-up activities.</...
<p>I may be missing something but can't you call the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#destroy()" rel="noreferrer"><code>destroy()</code></a> method on the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html" rel="noreferrer"><code>Process</code></a> object retu...
<p>You should be able to do that <code>java.lang.Runtime.exec</code> and shell commands.</p>
8,919
<p>The problem is very simple. An object needs to notify some events that might be of interest to observers.</p> <p>When I sat to validate a design that I cooked up now in Ruby just to validate it.. I find myself stumped as to how to implement the object events. In .Net this would be a one-liner.. .Net also does handl...
<p>Firstly, in Ruby there are no method signatures. The closest would be checking the function's arity. Duck typing requires thinking differently (slightly).</p> <p>The Observable module is a start, but if you have a requirement to have multiple events from a single class it might not be enough.</p> <p>This is a qu...
<p>I wrote a gem just for this because I had exactly the same issue. Try this:</p> <pre><code>gem install ruby_events </code></pre> <p>Follow the instructions as on <a href="http://github.com/nathankleyn/ruby_events" rel="nofollow noreferrer">http://github.com/nathankleyn/ruby_events</a>, but in a nutshell:</p> <pre...
30,535
<p>This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc.</p> <p>I come from an object-oriented background, so I'm trying to put everything we do into reusable classes. I've had...
<p>The most practical approach seems to be to ignore most of OpenGL functionality that is not directly applicable (or is slow, or not hardware accelerated, or is a no longer a good match for the hardware).</p> <p>OOP or not, to render some scene those are various types and entities that you usually have:</p> <p><stro...
<p>I usually have a drawOpenGl() function, per class that can be rendered, that contains it's opengl calls. That function gets called from the renderloop. The class holds all info needed for its opengl function calls, eg. about position and orientation so it can do its own transformation. </p> <p>When objects are depe...
20,093
<p>I have a table with a structure like the following:</p> <hr /> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>LocationID</th> <th>AccountNumber</th> </tr> </thead> <tbody> <tr> <td>long-guid-here</td> <td>12345</td> </tr> <tr> <td>long-guid-here</td> <td>54321</td> </tr> </tbody> </table> <...
<p>try</p> <pre><code>SELECT 1 AS Tag, 0 AS Parent, AccountNumber AS [Root!1!AccountNumber!element] FROM Location.LocationMDAccount WHERE LocationID = 'long-guid-here' FOR XML EXPLICIT </code></pre>
<p>Try this, Chris:</p> <pre><code>SELECT AccountNumber as [clientId] FROM Location.Location root WHERE LocationId = 'long-guid-here' FOR XML AUTO, ELEMENTS </code></pre> <p>TERRIBLY SORRY! I mixed up what you were asking for. I prefer the XML AUTO just for ease of maintainance, but I believe either o...
2,496
<p>Is there such a thing as too many stored procedures?</p> <p>I know there is not a limit to the number you can have but is this any performance or architectural reason not to create hundreds, thousands??</p>
<p>To me the biggest limitation to that hundreds or thousands store procedure is maintainability. Even though that is not a direct performance hit, it should be a consideration. That is an architectural stand point, you have to plan not just for the initial development of the application, but future changes and maint...
<p>You have to put all that code somewhere.<br> If you are going to have stored procedures at all (I personally do favour them, but many do not), then you might as well use them as much as you need to. At least all the database logic is in one place. The downside is that there isn't typically much structure to a buck...
16,431
<p>How do I maintain the scroll position of the parent page when I open new window using window.open()? The parent page returns to the top of the page.</p> <p>Here is my current code:</p> <pre><code>&lt;a href="#" onclick="javascript: window.open('myPage.aspx');"&gt; Open New Window &lt;/a&gt; </code></pre>
<pre><code>&lt;a href="#" onclick="window.open('myPage.aspx');return false;"&gt;Open New Window&lt;/a&gt; </code></pre> <ul> <li><code>javascript:</code> is not required in event attributes.</li> <li>You were not returning false from the event handler, so the link was being following, it was equivilent to <code>&lt;a ...
<p>I think the problem is that your link is pointing to an empty # (<code>href="#"</code>), which the browser will interpret to mean "the top of the page".</p> <p>Try removing the href attribute from your anchor tag. The onclick attribute should be enough for what you need.</p>
48,753
<p>I need a programmatic way of creating a SQL Server ODBC Data Source. I can do this by directly accessing the Registry. It would be better if this could be done via an available (SQL Server/Windows) API to protect against changes in the registry keys or values with updated SQL Server drivers.</p> <p><strong>Accepted...
<p>SQLConfigDataSource() does the job.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ck4z6wwt.aspx?ppud=4" rel="noreferrer">MSDN article</a></p> <p>Just in case here is a VB6 example:</p> <pre><code>Const ODBC_ADD_DSN = 1 'user data source Const ODBC_ADD_SYS_DSN = 4 'system data source Private Declare Fun...
<p>I'd use odbcad32.exe which is located in your system32 folder.</p> <p>This will add your odbc data sources to the correcct location, which won't be effected by any patches.</p>
20,568
<p>I have a function which parses one string into two strings. In C# I would declare it like this:</p> <pre><code>void ParseQuery(string toParse, out string search, out string sort) { ... } </code></pre> <p>and I'd call it like this:</p> <pre><code>string searchOutput, sortOutput; ParseQuery(userInput, out sear...
<p>C++/CLI itself doesn't support a real 'out' argument, but you can mark a reference as an out argument to make other languages see it as a real out argument.</p> <p>You can do this for reference types as:</p> <pre><code>void ReturnString([Out] String^% value) { value = "Returned via out parameter"; } // Called ...
<p>It's not supported. The closest you can get is ref</p> <p>Granted you can fake it, but you lose a compile time check.</p>
22,562
<p>I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table:</p> <pre><code>ID COMPANY_ID EMPLOYEE 1 1 Anna 2 1 Bill 3 2 Carol 4 2 Dave </code></pre> <p>and I wanted to group by company_id to get so...
<h3>PostgreSQL 9.0 or later:</h3> <p>Modern Postgres (since 2010) has the <a href="http://www.postgresql.org/docs/current/static/functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE" rel="noreferrer"><code>string_agg(expression, delimiter)</code></a> function which will do exactly what the asker was looking for:</p> <pre...
<p>According to version PostgreSQL 9.0 and above you can use the aggregate function called string_agg. Your new SQL should look something like this:</p> <pre><code>SELECT company_id, string_agg(employee, ', ') FROM mytable GROUP BY company_id; </code></pre>
6,550
<p>Is this possible via CSS? </p> <p>I'm trying </p> <pre class="lang-css prettyprint-override"><code>tr.classname { border-spacing: 5em; } </code></pre> <p>to no avail. Maybe I'm doing something wrong?</p>
<p>In the parent table, try setting</p> <pre class="lang-css prettyprint-override"><code>border-collapse: separate; border-spacing: 5em; </code></pre> <p>Plus a border declaration, and see if this achieves your desired effect. Beware, though, that IE doesn't support the &quot;separated borders&quot; model.</p>
<p>Have you tried:</p> <pre><code>tr.classname { margin-bottom:5em; } </code></pre> <p>Alternatively, each td can be adjusted as well:</p> <pre><code>td.classname { margin-bottom:5em; } </code></pre> <p>or</p> <pre><code> td.classname { padding-bottom:5em; } </code></pre>
45,701
<p>Is there a way to query against exchange 2007 to distinguish who is either an active sync or blackberry user using powershell exchange addin? </p>
<p>BBES typically uses a service account that has access to ALL mailboxes in order to do it's thing. you will want to look at the BBES server itself to find out which users are active, not AD or Exchange. Because BBES is backed by a database, just dig into the dbo.UserStats table to see what's there.</p>
<p>You could query to see which mailboxes have the necessary permission enabled - just as you could see which mailboxes are OWA-enabled. That won't actually tell you who is USING the capability, merely who COULD.</p>
43,927
<p>I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for.</p> <p>An example...</p> <pre><code>public class Person { string firstName; string lastName; public string FirstName { g...
<p>What you see here is some syntatic sugar provided by the compiler. Under the hood what it really does is something like:</p> <p><strong>Person p = new Person( FirstName = "Joe", LastName = "Smith" );</strong></p> <pre><code>Person _p$1 = new Person(); _p$1.FirstName = "Joe"; _p$1.LastName = "Smith"; Person p = _p$...
<p>It's also quite necessary for projected classes returned from a language integrated query (linq) </p> <pre><code>var qry = from something in listofsomething select new { Firstname = something.FirstName, Lastname = something.Surname } </...
11,445
<p>By graphing I mean bar charts, pie charts, line graphs, that sort of thing. I've used a couple over the years, but what is your favourite and why?</p> <p>One tool per answer please (to make the voting easier :o)</p>
<p>I like <a href="http://zedgraph.org/wiki/index.php?title=Main_Page" rel="noreferrer">ZedGraph</a> it is a free library and produces quality output. You can tweak the anti-aliasing to work the way it looks best to you and it supports a variety of charts and graphs.</p>
<p><a href="http://www.steema.com/products/teechart/whatsnew.html" rel="nofollow noreferrer">TeeChart</a>. I've been using this tool for a few years now, although it is not free (~500€) it is packed with features.<br></p> <p>What I prefer:</p> <ul> <li>axes scale automatically</li> <li>automatic colours for different...
9,529
<p>I am using the following method to browse for a file:</p> <pre><code> OpenFileDialog.ShowDialog() PictureNameTextEdit.Text = OpenFileDialog.FileName </code></pre> <p>Is there a way get ONLY the file name?</p> <p>The <strong>FileName</strong> method returns the entire path and file name.</p> <p>i.e. I want...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx" rel="noreferrer"><code>Path.GetFileName(fullPath)</code></a> to get just the filename part, like this:</p> <pre><code>OpenFileDialog.ShowDialog() PictureNameTextEdit.Text = System.IO.Path.GetFileName(OpenFileDialog.FileName) </cod...
<pre><code>//Following code return file name only string[] FileFullPath; string FileName; objOpenFileDialog.Title = "Select Center Logo"; objOpenFileDialog.ShowDialog(); FileFullPath = objOpenFileDialog.FileNames[0].ToString().Split('\\'); FileName = FileFullPath[FileFullPath.Length - 1]; //return only File Name //...
44,493
<p>I have an application that is built against OpenSceneGraph (2.6.1) and therefore indirectly OpenGL. The application initializes and begins to run, but then I get the following exception "attempt was made to execute an invalid lock sequence" in OpenGL32.dll. When I re-run it, I sometimes get this exception, and somet...
<p>Can you reproduce it with one of the standard examples?<br> Can you create a minimal app that causes this?<br> Do you have a machine with a different brand video card you can test it on (eg Nvidia vs. ATI) there are some issues with openscenegraph and bad OpenGL drivers.</p> <p>Have you tried posting to osg-users@l...
<p>The problem turned out to be our app was picking up an incorrect version of the OpenGL DLL , instead of the one installed in System32.</p>
35,291
<p>Is there a pattern using Linq to dynamically create a filter?</p> <p>I have the need to create custom filtering on a list, in the past I would just dynamically create the SQL...it doesn't seem like this is possible with Linq.</p>
<p>Check out the <a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" rel="noreferrer">Dynamic Linq Library</a> from ScottGu's blog:</p> <p>For example, below is a standard type-safe LINQ to SQL VB query that retrieves data from a Northwind database ...
<p>something like this?</p> <pre><code>var myList = new List&lt;string&gt; { "a","b","c" }; var items = from item in db.Items where myList.Contains(item.Name) select item; </code></pre> <p>that would create a sql statement like</p> <pre><code>SELECT * FROM Items [t0] where Name IN ('a','b','c...
5,074
<p>Does anybody know of a good media framework for Flex?<br/> I'd like to be able to create apps that can play not only those formats that the Flex framework provides support for, but other formats as well (like wav, wma, ogg and other...).</p> <p><strong>EDIT 13.10.2008.:</strong> It was recently pointed out to me in...
<p>is there a reason you're trying to put a <code>&lt;p&gt;</code> within <code>&lt;textarea&gt;</code>? as you found out it's not valid. if it's for display purposes (ie, showing code) it should be translated:</p> <pre><code>&lt;textarea&gt;&amp;lt;p&amp;gt;text&amp;lt;/p&amp;gt;&lt;/textarea&gt; </code></pre> <p>be...
<p>You can leave out the tags in the text area, and when you need new lines use \n Otherwise use <code>&amp;lt;p&amp;gt;</code> and <code>&amp;lt;/p&amp;gt;</code> in the place of your tags.</p>
23,831
<p>We are running MOSS 2007 with profiles coming from our active directory. One feature we use is "Audiences" which get compiled based on specific AD groups. We have problems with very few of the accounts where they do not get included in the audience. We have for example AD group of "Procurement" where 15 out of 16 us...
<p>I didn't find a good solution, but I did find this very good posting on issues around this stuff:</p> <p><a href="http://www.moss2007.be/blogs/vandest/archive/2008/12/11/add-a-new-security-group-to-an-audience.aspx" rel="nofollow noreferrer">http://www.moss2007.be/blogs/vandest/archive/2008/12/11/add-a-new-security...
<p>I would check the log files (in the \12 hive) to see is there is more information related to the compilation of audiences. </p> <p>If necessary you can log more for this component by configuring the logging in the Central Administration site.</p>
21,444
<p>Using the ClearCase find command, how do I find all files in a directory that do not have the name pom.xml? </p> <p>I'd like to pass other selection options to the ClearCase find command so I'd prefer not to execute another command.</p> <p>I am using a RedHat linux version of ClearCase. I have tried "cleartool f...
<p>You seem to forget the <strong><em>-exec</em></strong> option of the cleartool find command. </p> <p>It actually does allow you to execute other commands than cleartool ones, including system ones (like a sh or DOS script). </p> <p>I know you would "prefer not to execute another command", but if that other system ...
<p>ClearCase wildcards doesn't have inversion (AFAIR) but you can use grep for this - </p> <pre><code>cleartool ls -short -nxname | grep -v pom.xml </code></pre>
26,901
<p>I understand that heater blocks act as kind of “low-pass-filter” on the temperature change of the hotend, but why do we need that?</p> <p>Wouldn’t it be better to have as little metal as possible in order to be able to control temperature changes quickly and precisely (using PID, PWM plus maybe some predictions base...
<p>Let's look at the elements and what they do:</p> <p>The <em>Heater Cartridge</em> (blue) is the device that converts electric to thermal energy to melt the plastic. 30 and 40 W are common.</p> <p>The <em>Thermosensor</em> (red) is there to give feedback to the mainboard.</p> <p>The <em>Filament Path</em> (gold) in t...
<p>I think the idea is to <em>not</em> change the temperature fast. You want it to maintain a certain temperature so you have consistent flow. The extra mass at the hot end provides the mass which is needed to maintain the heat. If you don't maintain the heat while you print, you'll have inconsistent filament flow, whi...
1,335
<p>I am writing a script at the moment that will grab certain information from HTML using dom4j.</p> <p>Since Python/Jython does not have a native <strong>switch</strong> statement I decided to use a whole bunch of <strong>if</strong> statements that call the appropriate method, like below:</p> <pre><code>if type == ...
<p>To avoid specifying the tag and handler in the dict, you could just use a handler class with methods named to match the type. Eg</p> <pre><code>class MyHandler(object): def handle_extractTitle(self, dom): # do something def handle_extractMetaTags(self, dom): # do something def handle...
<p>It depends on how many if statements we're talking about; if it's a very small number, then it will be more efficient than using a dictionary.</p> <p>However, as always, I strongly advice you to do whatever makes your code look cleaner until experience and profiling tell you that a specific block of code needs to b...
35,090
<p>Suppose I have a SELECT statement that returns some set of results. Is there some way I can number my results in the following way:</p> <blockquote> <p>SELECT TOP 3 Name FROM PuppyNames ORDER BY NumberOfVotes</p> </blockquote> <p>would give me...</p> <blockquote> <p>Fido</p> <p>Rover</p> <p>Freddy Krueger</p> </blo...
<p>In Microsoft SQL Server 2005, you have the <code>ROW_NUMBER()</code> function which does exactly what you want. </p> <p>If you are stuck with SQL Server 2000, the typical technique was to create a new temporary table to contain the result of your query, plus add an <code>IDENTITY</code> column and generate increme...
<p>SQL 2005, 2008:</p> <p>SELECT TOP 3 ROW_NUMBER() OVER(ORDER BY NumberOfVotes DESC) AS VoteRank, Name FROM PuppyNames </p> <p>EDIT: Sorry - just saw you specified 2000.</p>
35,751
<p>Every time I create a new excel sheet, I have to go in and change it's cell reference mode to the familiar A1, B1, etc. I can't seem to find a way to permanently set it to A1 style.</p> <p>Is there a macro I can write or a way to use templates or something, so that I don't have to keep changing the R1C1 setting?</p...
<p>In Office 2007, Click the Office button and click Excel Options which you will find at the end near Exit Excel.</p> <p>Go to Formulas tab and under Working with formulas, Check or uncheck R1C1 reference style to use it or to change it to A1 reference style.</p> <p><a href="https://i.stack.imgur.com/hfZTf.jpg" rel=...
<p>I suppose the template has been saved with the R1C1 option. Maybe you can open it, change the option and overwrite the original template?</p>
48,588
<p>Is there any way, in any language, to hook my program when a user renames a file?</p> <p>For example: A user renames a file and presses enter (or clicks away) to confirm the rename action. BEFORE the file is actually renamed, my program "listens" to this event and pops up a message saying "Are you sure you want to ...
<p>You can probably solve this by using the <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="noreferrer">FileSystemWatcher class</a> in .NET framework.</p> <p>From the class remarks:</p> <blockquote> <p>You can watch for renaming, deletion, or creation of files or directorie...
<p>My guess is that this is <em>not</em> possible, I did find <a href="http://msdn.microsoft.com/en-us/library/bb776794(VS.85).aspx" rel="nofollow noreferrer">this</a> which is for monitoring operations (including rename) on a folder, but there does not appear to be a similar method for files.</p> <p>@Richard, FileSys...
4,430
<p>I'm using SqlServer for the first time, and in every single one of our create procedure scripts there is a block of code like below to remove the procedure if it already exists:</p> <pre><code>IF EXISTS (SELECT * FROM information_schema.routines WHERE routine_name = 'SomeProcedureName' ...
<p>The full answer is: <PRE> DECLARE @SQL VARCHAR(8000) SELECT @SQL = 'USE ' + DB_NAME() + CHAR(10) SET @SQL = @SQL + 'DROP PROCEDURE ' + @procName --PRINT @SQL EXEC(@SQL) </PRE></p> <p>The one given by Andrew will only work if the default database for your login is set to the database you want. When using dynamic sq...
<p>its missing quotes, try adding them in with an exec statement.</p> <pre><code>EXEC( 'DROP PROCEDURE ''' + @procName + '''') ( all single quotes) </code></pre>
23,286
<p>I need to store log files and configuration files for my application. Where is the best place to store them?</p> <p>Right now, I'm just using the current directory, which ends up putting them in the Program Files directory where my program lives.</p> <p>The log files will probably be accessed by the user somewhat ...
<p>If you're not using <code>ConfigurationManager</code> to manage your application and user settings, you should be. The configuration toolkit in the .NET Framework is remarkably well thought out, and the Visual Studio tools that interoperate with it are too. </p> <p>The default behavior of <code>ConfigurationManage...
<p>I use the <strong>Isolation Storage</strong> for configuration. You can also use the <strong>Temp</strong> folder to store temporary information like log.</p>
33,915
<p>Why would a stored procedure that returns a table with 9 columns, 89 rows using this code take 60 seconds to execute (.NET 1.1) when it takes &lt; 1 second to run in SQL Server Management Studio? It's being run on the local machine so little/no network latency, fast dev machine</p> <pre><code>Dim command As SqlCom...
<p>First, make sure you are profiling the performance properly. For example, run the query twice from ADO.NET and see if the second time is much faster than the first time. This removes the overhead of waiting for the app to compile and the debugging infrastructure to ramp up.</p> <p>Next, check the default settings in...
<p>I don't know "Why" it's so slow per se - but as Marcus is pointing out - comparing Mgmt Studio to filling a dataset is apples to oranges. Datasets contain a LOT of overhead. I hate them and NEVER use them if I can help it.</p> <p>You may be having issues with mismatches of old versions of the SQL stack or some su...
31,202
<p>I myself am convinced that in a project I'm working on signed integers are the best choice in the majority of cases, even though the value contained within can never be negative. (Simpler reverse for loops, less chance for bugs, etc., in particular for integers which can only hold values between 0 and, say, 20, anyw...
<h2>I made this community wiki... Please edit it. I don't agree with the advice against "int" anymore. I now see it as not bad.</h2> <p>Yes, i agree with Richard. You should never use <code>'int'</code> as the counting variable in a loop like those. The following is how you might want to do various loops using indices...
<p><code>vector.size()</code> returns a <code>size_t</code> var, so just change <code>int</code> to <code>size_t</code> and it should be fine.</p> <p>Richard's answer is more correct, except that it's a lot of work for a simple loop.</p>
34,770
<p>How do I initialize an automatic download of a file in Internet Explorer?</p> <p>For example, in the download page, I want the download link to appear and a message: "If you download doesn't start automatically .... etc". The download should begin shortly after the page loads.</p> <p>In Firefox this is easy, you j...
<p><a href="http://en.wikipedia.org/wiki/SourceForge" rel="noreferrer">SourceForge</a> uses an <code>&lt;iframe&gt;</code> element with the <code>src=""</code> attribute pointing to the file to download.</p> <pre><code>&lt;iframe width="1" height="1" frameborder="0" src="[File location]"&gt;&lt;/iframe&gt; </code></pr...
<p>Nice jquery solution:</p> <pre><code>jQuery('a.auto-start').get(0).click(); </code></pre> <p>You can even set different file name for download inside <code>&lt;a&gt;</code> tag:</p> <pre><code>Your download should start shortly. If not - you can use &lt;a href="/attachments-31-3d4c8970.zip" download="attachments-...
18,954
<p>This is an adapted version of a question from someone in my office. She's trying to determine how to tell what ports MSDE is running on for an application we have in the field.</p> <p>Answers to that narrower question would be greatly appreciated. I'm also interested in a broader answer that could be applied to a...
<pre><code>netstat -b </code></pre> <p>from the command line will display the application name, process owner, address, and port number used for all running applications.</p>
<p>Download currports from <a href="http://www.nirsoft.net/utils/cports.html" rel="nofollow noreferrer">here</a>.</p> <p>It will show you which ports are open and which processes are associated with each port.</p> <p>Scroll down to: Download CurrPorts</p>
6,354
<p>In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine:</p> <pre><code>module T { type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); // A : A; // } where A in As &amp;&amp; identity Id...
<p>I think what you want is:</p> <pre><code>type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); A : A; } where identity Id; Bs : (B where value.A in As)*; type C { Id : Integer32 = AutoNumber(); B : B; } where identity Id &amp;&amp; B in...
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/05103bf8-4e0f-4976-bcdd-2c724cb08738/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/05103bf8-4e0f-4976-bcdd-2c724cb08738/</a></p>
31,633
<p>I am trying to have an element fade in, then in 5000 ms fade back out again. I know I can do something like:</p> <pre><code>setTimeout(function () { $(".notice").fadeOut(); }, 5000); </code></pre> <p>But that will only control the fade out, would I add the above on the callback?</p>
<p><strong>Update:</strong> As of jQuery 1.4 you can use the <code>.delay( n )</code> method. <a href="http://api.jquery.com/delay/" rel="noreferrer">http://api.jquery.com/delay/</a></p> <pre><code>$('.notice').fadeIn().delay(2000).fadeOut('slow'); </code></pre> <p><strong>Note</strong>: <code>$.show()</code> and <c...
<p>This can be done with only a few lines of jQuery:</p> <pre><code>$(function(){ // make sure img is hidden - fade in $('img').hide().fadeIn(2000); // after 5 second timeout - fade out setTimeout(function(){$('img').fadeOut(2000);}, 5000); });​ </code></pre> <hr> <p>see the fiddle below for a worki...
40,836
<p>I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command.</p> <p>I want to do this so that I can have a system where I can add users to without having to create a s...
<p>When you write a Conch server, you can control what happens when the client makes a shell request by implementing <a href="http://twistedmatrix.com/trac/browser/trunk/twisted/conch/interfaces.py?rev=24441#L62" rel="noreferrer"><code>ISession.openShell</code></a>. The Conch server will request <a href="http://twiste...
<p>While Python really is my favorite language, I think you need not create you own server for this. When you look at the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&amp;sektion=8" rel="nofollow noreferrer">OpenSSH Manualpage for sshd</a> you'll find the "command" options for the authorized keys file tha...
22,542
<p>I am working on a web page that is using jQuery. I have an Ajax call that gets data from the server and updates a div. Inside that data there is a jQuery function, but the function is not being called after the data is loaded into the page. I have the proper js files included in the page already.</p> <p>This is wha...
<p>If you want JavaScript tag evaluation, with html content, you should set the dataType option of the ajax call to "html":</p> <pre><code>$.ajax({ type: "GET", url: "yourPage.htm", dataType: "html" }); </code></pre> <p>Or dataType "script", if you want to load and execute a .js file:</p> <pre><code>$.ajax({ ...
<p>have you tried Sys.WebForms.PageRequestManager.add_endRequest method?</p> <pre><code> $(document).ready(function() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); } ); function endRequestHandler(sender, args) { // whatever } </...
29,201
<p>I'm looking for a Web UI toolkit for a Rails-based application. I have an experience with YUI but not in a Rails context. I have many questions I wish you could help me to answer.</p> <ol> <li>Do you use a web UI toolkit like <code>YUI</code>, <code>ExtJS</code> or <code>JxLib</code> within your Rails application ?...
<p>If you're okay with Leopard-only, The new NSCollectionView supports horizontal display. Just set the collection view's number of rows to 1 in Interface Builder; it'll even handle the horizontal scroll bar for you. The <a href="http://developer.apple.com/samplecode/IconCollection/index.html" rel="noreferrer">IconCo...
<p>With a table view? No. If I'm understanding correctly what you want, in the past I've created my own NSView subclass for this type of control. Define a data source protocol similar to NSTableView, and in your NSView drawRect method, draw the elements in order one by one from left to right. You can either keep track ...
48,933
<p>Suppose I have a set of commits in a repository folder...</p> <pre><code>123 (250 new files, 137 changed files, 14 deleted files) 122 (150 changed files) 121 (renamed folder) 120 (90 changed files) 119 (115 changed files, 14 deleted files, 12 added files) 118 (113 changed files) 117 (10 changed files) </code></pre>...
<p>To undo revisions 118 and 120:</p> <pre><code>svn up -r HEAD # get latest revision svn merge -c -120 . # undo revision 120 svn merge -c -118 . # undo revision 118 svn commit # after solving problems (if any) </code></pre> <p>Also see the description in <a href="http://svnbook.red-bean.com/en/1.5/...
<p>I suppose you could create a branch from revision 117, then merge everything except 118 and 120.</p> <pre><code>svn copy -r 117 source destination </code></pre> <p>Then checkout this branch and from there do <code>svnmerge.py merge -r119,120-123</code></p> <p><strong>EDIT:</strong> This doesn't undo the revisions...
15,363
<p>When creating a UserControl in WPF, I find it convenient to give it some arbitrary Height and Width values so that I can view my changes in the Visual Studio designer. When I run the control, however, I want the Height and Width to be undefined, so that the control will expand to fill whatever container I place it i...
<p>For Blend, a little known trick is to add these attributes to your usercontrol or window:</p> <pre><code> xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="600" </cod...
<p>I do it similar, but my solution assures that if you add your control to an container in design mode, it will appear reasonably.</p> <pre><code>protected override void OnVisualParentChanged(DependencyObject oldParent) { if (this.Parent != null) { this.Width = double.NaN; this.Height = double.N...
10,113
<p>In subclipse, the Team > Update menu option performs an "svn update -r HEAD".</p> <p>I want to run "svn update -r [revision number]" but can't find a menu option which will let me update to anything besides the HEAD revision.</p>
<p>It is the "Replace With" menu option. It is not under "Team", but on the same level.</p>
<p>It is the "Replace With" menu option. It is not under "Team", but on the same level.</p>
10,910
<p>I have a form with a default OK button, and a Cancel button. I have a treeview with nodes that can be edited, i.e. you can double-click them or press F2 to open another form.</p> <p>Now, I've never liked that F2 shortcut, and now that I'm enabling treeview label edition, it's even worse. My first reaction when test...
<p>Definitely not... Confuses our users no end that enter doesn't select what they have highlighted.</p>
<p>Definitely not... Confuses our users no end that enter doesn't select what they have highlighted.</p>
16,206
<p>In Delphi 2007, in a mouse move event, I try to change the mouse cursor with:</p> <pre><code>procedure TFr_Board_Display.PaintBox_Proxy_BoardMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if left_mouse_button_down then begin if some_condition then begin Cursor := crDrag; e...
<p>If you set the mouse cursor in the OnMouseDown and reset it in the OnMouseUp, anything works fine:</p> <pre><code>procedure TForm4.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin Cursor := crCross; end; procedure TForm4.FormMouseUp(Sender: TObject; Button: TMouseB...
<p>Slightly off-topic, but perhaps useful to you.</p> <p>I created a global stack to allow nested cursor changes. It lets any piece of code set the mouse cursor to what they want without worrying about what their caller or callee's set it to.</p> <p>For example:</p> <pre><code>procedure AskUserWhatToDo; begin Push...
49,374
<p>Lots of frameworks let me expose an ejb as a webservice. </p> <p>But then 2 months after publishing the initial service I need to change the ejb or any part of its interface. I still have clients that need to access the old interface, so I obviously need to have 2 webservices with different signatures.</p> <p>Anyo...
<p>I don't think, you need any additional frameworks to do this. Java EE lets you directly expose the EJB as a web service (since <a href="http://www.jcp.org/en/jsr/detail?id=153" rel="nofollow noreferrer">EJB 2.1</a>; see <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Session3.html#wp79822" rel="nofollow nore...
<p>I'm not an EBJ guy, but I can tell you how this is generally handled in the web service world. If you have a non-breaking change to the contract (for instance, adding a property that is optional), then you can simply update the contract and consumers should be fine.</p> <p>If you have a breaking change to a contrac...
27,382
<p>How can I find out the decorated name that will be asigned to each method name ? I'm trying to find out what the decorated name is , so that I may export it , in a DLL .</p>
<p>This question is pretty similar: <a href="https://stackoverflow.com/questions/186232/exporting-dll-c-class-question-about-def-file">Exporting DLL C++ Class , question about .def file</a>. The quick summary is that you probably want to use <code>__declspec(dllexport)</code> to let the compiler do the work of exportin...
<p>I think you should take the advice of the previous 2 respondants <a href="https://stackoverflow.com/users/893/greg-hewgill">Greg Hewgill</a> and <a href="https://stackoverflow.com/users/12711/mike-b">Mike B</a>, but if you are using the Microsoft tool chain and you really want to know the decorated name(s)... <p></p...
23,095
<p>Cura has a layer view feature that lets you watch a simulation of the extruder head as it lays down material at each layer. Is it possible to get Cura to show a time stamp as it does this? That would let me set reminders to check a print just at certain critical times.</p>
<p>These estimates tend to be very approximate, even if Cura has the accurate acceleration values for your firmware. An error of 100% is not unusual.</p> <p>What you probably want is an alarm at a specific layer (a few before the critical ones). You might be able to add this to Octoprint fairly easily - it does suppor...
<p>If I may interpret your question a bit, and add alternatives to Sean H's suggestions. I agree that any attempt to estimate elapsed time per layer is doomed. </p> <p>Perhaps you should just look at the LayerView to determine the critical layers of interest. Then edit the gcode file in a text editor. Locate the st...
1,001
<p>While LOC (# lines of code) is a problematic measurement of a code's complexity, it is the most popular one, and when used very carefully, can provide a rough estimate of at least relative complexities of code bases (i.e. if one program is 10KLOC and another is 100KLOC, written in the same language, by teams of roug...
<p>A wise man once told me 'you get what you measure' when it comes to managing programmers.</p> <p>If you rate them in their LOC output amazingly you tend to get a lot of lines of code.</p> <p>If you rate them on the number of bugs they close out, amazingly you get a lot of bugs fixed.</p> <p>If you rate them on fe...
<p>Depends on what you are using the LOC for.</p> <p>As a complexity measure - not so much. Maybe the 100KLOC are mostly code generated from a simple table, and the 10KLOC kas 5KLOC regexps.</p> <p>However, I see every line of code associated with a running cost. You pay for every line as long as the program lives: i...
34,591
<p>What happens if I use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181%28v=vs.85%29.aspx" rel="nofollow noreferrer">SHGetFolderPath</a> api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id instead of the CSIDL_PROGRAM_FILES id?</p> <p>Theoretically CSIDL_PROGRAM_FILESx86 should...
<p>The different scenarios are described in <a href="http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx" rel="nofollow noreferrer">this article on MSDN</a>.</p> <p>Scroll down to remarks, &quot;FOLDERID_ProgramFiles&quot;</p> <pre><code>The interpretation of certain KNOWNFOLDERID values depends on whether the...
<p>Try this:</p> <pre><code>GetEnvironmentVariable("ProgramW6432", szBuffer, nBufferSize); </code></pre> <p>YMMV</p>
16,753
<p>In actionscript 3 is it possible to allow a user to upload an image into a flash movie at runtime without POSTing to a PHP script? I dont want to export the image or save it anywhere I just want to be able to display the image in the flash movie</p> <p><em>fingers crossed</em></p>
<p>Yes, you can if you are targeting Flash Player 10. Use the FileReference.load() method. Once the file is loaded, you can access to the raw data as a ByteArray, using the data property. In flex you can pass that to an Image component. In plain Actionscript, you can use the Loader.loadBytes() method to the display the...
<p>The flash developer at work, seems to believe that it is not possible. That said you don't have to use PHP, you could use any server side technology that allows uploading (ASP.NET, Python, etc) </p>
39,681
<p>I'm working in two different Oracle schemas on two different instances of Oracle. I've defined several types and type collections to transfer data between these schemas. The problem I'm running into is that even though the type have exactly the same definitions (same scripts used to create both sets in the schemas...
<p>I have read the Oracle Documentation and it is not very difficult. </p> <p>You need to add an OID to your type definitions in both databases. </p> <p>You can use a GUID as OID.</p> <pre><code>SELECT SYS_OP_GUID() FROM DUAL; SYS_OP_GUID() -------------------------------- AE34B912631948F0B274D778A29F6C8C </code><...
<p>I think the underlying issue is that Oracle doesn't know how to automatically serialize/deserialize your custom type over the wire, so to speak.</p> <p>Your best bet is probably to pass an XML (or other) representation over the link.</p>
49,546
<p>How can I find out the folder where the windows service .exe file is installed dynamically?</p> <pre><code>Path.GetFullPath(relativePath); </code></pre> <p>returns a path based on <code>C:\WINDOWS\system32</code> directory.</p> <p>However, the <code>XmlDocument.Load(string filename)</code> method appears to be wo...
<p>Try</p> <pre><code>System.Reflection.Assembly.GetEntryAssembly().Location </code></pre>
<p>This should give you the path that the executable resides in:</p> <pre><code>Environment.CurrentDirectory; </code></pre> <p>If not, you could try:</p> <pre><code>Directory.GetParent(Assembly.GetEntryAssembly().Location).FullName </code></pre> <p>A more hacky, but functional way:</p> <pre><code>Path.GetFullPath(...
24,384
<p>Is there a function like <code>document.getElementById("FirstDiv").clear()</code>?</p>
<p>To answer the original question - there are various ways to do this, but the following would be the simplest.</p> <p>If you already have a handle to the child node that you want to remove, i.e. you have a JavaScript variable that holds a reference to it:</p> <pre><code>myChildNode.parentNode.removeChild(myChildNod...
<p>You should be able to use the .RemoveNode method of the node or the .RemoveChild method of the parent node.</p>
3,470
<p>I have one std::list&lt;> container and these threads:</p> <ul> <li><p>One writer thread which adds elements indefinitely.</p></li> <li><p>One reader/writer thread which reads and removes elements while available.</p></li> <li><p>Several reader threads which access the SIZE of the container (by using the size() met...
<p>Yes, the read threads will need some sort of mutex control, otherwise the write will change things from under it.</p> <p>A reader/writer mutex should be enough. But strictly speaking this is an implmentation-specific issue. It's possible that an implementation may have mutable members even in const objects that a...
<p>Yes. I would suggest wrapping your STL library with a class that enforces serial access. Or find a similar class that's already been debugged.</p>
22,724
<p>Does anyone of you know, if and if so, how can I check, with my application code, if a server has ssl enabled or not?</p>
<p><a href="http://mail.python.org/pipermail/python-list/2003-May/203039.html" rel="nofollow noreferrer">"It's easier to ask forgiveness than permission"</a></p> <p>For example, to read <code>stackoverflow.com</code> via SSL, don't ask whether <code>stackoverflow.com</code> supports it, just do it. In Python:</p> <pr...
<p>You need to specify what protocol you're working with -- there are SSL versions of HTTP, IMAP, POP, etc.</p> <p>Assuming it's HTTPS you're interested in, you could check to see if something is listening on port 443 on the server and go from there... </p>
42,182
<p>I'm playing with <a href="http://www.dncompute.com/blog/2007/03/19/seed-based-pseudorandom-number-generator-in-actionscript.html" rel="nofollow noreferrer">this ActionScript</a> which generates a random 'squiggle'.</p> <p>Each time a 'squiggle' is placed, it appears within a sprite with a white background.</p> <p>...
<p>In RandomSquiggle.as change line 76 from</p> <pre><code>bitmapData = new BitmapData(width,height,false,0xfafafa); </code></pre> <p>to</p> <pre><code>bitmapData = new BitmapData(width,height,true,0x000000); </code></pre> <p>the third param is for transparency</p>
<p>That is not an actual Sprite (Sprite is an AS3 datatype) it's just a MovieClip that's called 'sprite'. I see that in the code the squiggles are actually being drawn to a MovieClip called 'paintSurface', then when it's done a Bitmap of 'paintSurface' is captured via this line:</p> <pre><code>bitmapData.draw(paintSur...
38,311
<p>I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.</p>
<p>A Python file is called a "module" and it's one way to organize your software so that it makes "sense". Another is a directory, called a "package".</p> <p>A module is a distinct thing that may have one or two dozen closely-related classes. The trick is that a module is something you'll import, and you need that i...
<p>I would say to put as many classes as can be logically grouped in that file without making it too big and complex.</p>
13,247
<p>I'm thinking floats. For the record I'm also using NHibernate.</p>
<p><code>decimal</code></p> <p>You won't lose precision due to rounding.</p>
<p>It depends on what you are using them for.</p> <p>if it's for display, an int would do just fine, and be faster than a float. If it's for infrequent mathematics, an int would still do fine (or even a short, in either case).</p> <p>If you're doing a lot of math, then a float would probably be best, performance-wis...
19,231
<p>I have an XML feed (which I don't control) and I am trying to figure out how to detect the volume of certain attribute values within the document.</p> <p>I am also parsing the XML and separating attributes into Arrays (for other functionality) </p> <p>Here is a sample of my XML</p> <pre><code>&lt;items&gt; &lt;it...
<p>If you have the values, you should be able to use LINQ's GroupBy...</p> <pre><code> XDocument doc = XDocument.Parse(xml); var query = from item in doc.Descendants("item") select new { att1 = (string)item.Attribute("att1"), ...
<p>You can use LINQ/XLINQ to accomplish this. Below is a sample console application I just wrote, so the code might not be optimized but it works.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Text; namespace FrequencyThingy { class Program ...
49,194
<p>Comparing LinkedLists and Arrays while also comparing their differences with sorted and unsorted data</p> <ul> <li>Adding </li> <li>Removing</li> <li>Retrieving </li> <li>Sorting</li> <li>Overall speed</li> <li>Overall memory usage</li> </ul> <p>Actual questions</p> <blockquote> <p>Discuss the feasibility of im...
<p>On unsorted vs. sorted. I'll do one, then you really do need to do your homework</p> <p>Stackoverflow markup really needs tables to do this one. You want to say how "expensive" the operation is for the unsorted/array, sorted/array, unsorted/linked-list, sorted/linked-list</p> <p>One final point: "speed of the appl...
<p>@Paul: Thanks</p> <blockquote> <ul> <li>Removing</li> </ul> </blockquote> <p>Unsorted &amp; sorted: Array removing is O(n) - have to move all element over to fill 'hole'</p> <p>Unsorted &amp; sorted: Linked list is O(1) - Change pointers as needed</p>
34,836
<p>On <strong>Linux/NPTL</strong>, threads are created as some kind of process.</p> <p>I can see some of my process have a weird cmdline:</p> <pre><code>cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) </code></pre> <p>Do you have an idea how I could do that for each thread of my process? Tha...
<p>If you want to do this in a portable way, something that will work across multiple Unix variations, there are very few options available.</p> <p>What you have to do is that your caller process must call exec with the <code>argv [0]</code> argument pointing to the name that you would like to see in the process outpu...
<p>Bah.. the code is not that nice, the trick is to reuse the environ (here argv_buffer) pointer:</p> <pre><code>memset (argv_buffer[0] + len, 0, argv_size - len); argv_buffer[1] = NULL; </code></pre> <p>Any better idea?</p> <p>Is that working for different threads?</p>
16,919
<p>From basic things likes page views per second to more advanced stuff like cpu or memory usage. Any ideas?</p>
<p>I think someone has asked the same type of question before <a href="https://stackoverflow.com/questions/18080/best-traffic-performance-usage-monitoring-module#19502">here</a>? Though I'm not too sure how helpful it is.</p> <p>For CPU usage, etc, I would try <a href="http://oss.oetiker.ch/rrdtool/" rel="nofollow no...
<p>I've been using monit (<a href="http://www.tildeslash.com/monit/" rel="nofollow noreferrer">http://www.tildeslash.com/monit/</a>) for years. It monitors CPU and memory usage as well as downtime for apache/mysql/etc... you can also configure it to notify you of outages and automatically restart services in real time....
13,183
<p>I want to use <a href="http://jmockit.dev.java.net" rel="nofollow noreferrer">JMockit</a>'s incremental test runner instead of the standard JUnit test runners from within Eclipse. Is there a way to do this?</p> <p><strong>Edit</strong> Received the following answer to my email to the JMockit dev:</p> <blockquote> ...
<p>Reporting Services does not have an event based model that would allow you to hook in custom code in order to dynamically create report objects. Using expressions to hide and show objects is the correct way of achieving this sort of functionality. </p>
<p>I don't think the default report viewer control that comes with SSRS supports this. You may have to build your own report viewer interface that calls the reporting services manually.</p>
26,016
<p>I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?</p> <p>Reason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234.</p> <p>Has this been addressed in version 3.5? (I remember reading yo...
<p>The easiest way I've found is just to match on the end of the mangled ID for most controls. The exceptions that Know of are radiobutton lists and checkbox lists - you have to be a little trickier with them.</p> <p>But if you have this in your .aspx page:</p> <pre><code>&lt;asp:TextBox ID="txtExample" runat="server...
<p>You can attach a unique attribute to your controls (I'm not sure if you can do this without extending the base web controls; a quick search <a href="http://www.codeproject.com/KB/webforms/customhtmlattributes.aspx" rel="nofollow noreferrer">revealed only this</a>) and then use the "element[attribute:value]" selector...
32,753
<p>The original bed surface of my Ender 3 has become brittle and finally cracked, requiring replacement. I'm trying to figure out what the cause might have been to avoid it happening again. It seems to have started after using "flex PLA", which involves both high temperatures (225&nbsp;&deg;C) and plasticizers mixed in...
<p>The build surface on the Ender3 is a BuildTak clone. The picture is a bit unclear, but given my experience with BuildTak (clones) this certainly damage because of heat. You can, as suggested before, replace the bed surface, but I do not think it is necessary at this stage. </p> <p>Normally these surfaces do not get...
<p>The material used for the Build surface is not PEI but a BuildTak Clone that offers adhesion through a rough surface texture. I do not know what exactly is in the composition of the polymer, but I can say that my bed surface needed replacement about 9 months after purchase after I vigorously removed a piece I printe...
1,295
<p>When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?</p>
<p>If you're not a developer (or you want to shortcut the development process), another possible solution is to utilize the auto_nodetitle module. Auto nodetitle will let you create rules for generating the title of the node. These can be programmatic rules, tokens that are replaced, or simply static text. Worth a lo...
<p>The initial answers are all good. Just as another idea for the title part... how about creating a custom template file for the cck node type. You would copy node.tpl.php to node-TYPE.tpl.php, and then edit the new file and remove where the title is rendered. (Dont forget to clear your cache).</p> <p>Doing it this w...
11,516
<p>What's the difference between <code>TRUNCATE</code> and <code>DELETE</code> in SQL?</p> <p>If your answer is platform specific, please indicate that.</p>
<p>Here's a list of differences. I've highlighted Oracle-specific features, and hopefully the community can add in other vendors' specific difference also. Differences that are common to most vendors can go directly below the headings, with differences highlighted below.</p> <p><hr></p> <h1>General Overview</h1> <p>...
<p>TRUNCATE is fast, DELETE is slow.</p> <p>Although, TRUNCATE has no accountability.</p>
16,889
<p>Using the Windows API, how can I get a list of domains on my network?</p>
<p>Answered my own question:</p> <p>Use the <a href="http://msdn.microsoft.com/en-us/library/aa370623(VS.85).aspx" rel="nofollow noreferrer">NetServerEnum</a> function, passing in the <code>SV_TYPE_DOMAIN_ENUM</code> constant for the "servertype" argument.</p> <p>In Delphi, the code looks like this:</p> <pre><code>&...
<p>Answered my own question:</p> <p>Use the <a href="http://msdn.microsoft.com/en-us/library/aa370623(VS.85).aspx" rel="nofollow noreferrer">NetServerEnum</a> function, passing in the <code>SV_TYPE_DOMAIN_ENUM</code> constant for the "servertype" argument.</p> <p>In Delphi, the code looks like this:</p> <pre><code>&...
3,036
<p>I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. </p> <p>What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like Stru...
<p>"Best" will always be subjective.</p> <p>That said, I favor Castle Windsor because its XML is simpler. I've only tried Windsor and Spring.NET, by the way, so I couldn't say much about the others.</p>
<p>I like StructureMap. The latest version allows you to declare inline too without having to resort to XML configuration files.</p>
16,646
<p>I want to do this, but haven't figured it quite out yet...</p> <pre><code> $(document).ready(function() { $("a.whateverclass").click(function() { $("div.whateverclass").show(); return false; }); </code></pre> <p>Basically when a link with a certain class is clicked all di...
<p>I like @Eran's answer, but in event that you have some links that don't fit this pattern, you may want to make sure that you only apply this to links that do.</p> <pre><code>$('a[class]').click(function() { $('div.' + $(this).attr('class')).show(); return false; }); </code></pre> <p>And in the case where l...
<pre><code>$("a").click(function() { $("div." + $(this).attr('class')).show(); }); </code></pre>
41,781
<p>After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading code very annoying.</p> <p>What are the benefits? Why do coders...
<p>A <a href="https://stackoverflow.com/questions/5916/how-do-you-feel-about-code-folding">similar question</a> has already been asked.</p> <p>but...</p> <p>I would say <strong>not anymore</strong>. It was originally intended to hide <em>generated code</em> from WinForms in early versions of .NET. With partial classe...
<p>My working day starts with opening files in editor and clicking on "Expand All" to hide all regions. After that I can begin to work.</p>
20,433
<p>I’m selecting data on an old database which has an abused status column. The status column has multiple pieces of information in it. Values are like ‘New Contact YYYY’, ‘Online YYYY’, ‘Updated YYYY’, ‘Withdrawn YYYY’, etc…. As you may have guessed, YYYY represents the year … which I need.</p> <p>In the past I’ve ...
<p>If you simply want to extract a four digit year from the string, you could use PATINDEX</p> <pre><code>SELECT SUBSTRING(FieldName, PATINDEX('%[0-9][0-9][0-9][0-9]%', FieldName), 4) FROM TableName </code></pre>
<p>If the year allways are the last 4:</p> <pre><code>SELECT right(FieldName,4) from table </code></pre>
44,032
<p>As most of you probably noticed, when uninstalling an MSI package Windows will ask for the original <code>.msi</code> file. Why is that?</p> <p>I can only see disadvantages to that:</p> <ul> <li>not resilient to network changes.</li> <li>not resilient to local disk changes.</li> <li>unexpected by users.</li> <li>t...
<blockquote> <p><strong><em>Fix Broken Uninstall</em></strong>: You can try the newest <a href="https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed" rel="nofollow noreferrer">FixIt Uninstall tool from Microsoft</a> if you have problems uninstalling an MSI. A...
<p>There are a few reasons for keeping the original msi:</p> <ul> <li>The uninstaller uses it to know what files and registry keys were installed and make sure they are all cleaned up.</li> <li>The msi may contain special uninstall actions that need to be performed.</li> <li>It allows you do to a 'repair' operation fr...
25,585
<p>I have a templated class defined (in part) as</p> <pre><code>template &lt;class T&gt; MyClass { public: void DoSomething(){} }; </code></pre> <p>If I want to call DoSomething from another class, but be able to do this for multiple 'T' types in the same place, I am stuck for an idea as method functions pointers ...
<p>Ok, so the functor solution doesn't work as you need. Perhaps you should have your template class inherit from a common base "Interface" class. And then you use a vector of those.</p> <p>Something like this:</p> <pre><code>class Base { public: virtual ~Base(){} virtual void DoSomething() = 0; } template &lt;...
<p>You know, that is just what I needed to do. Bizzarly I had discounted it as a solution valid for my usecase early on, for reasons that now escape me. I think I was blinded by some metaprogramming stuff I'm doing in the same place for compile-time dispatch (i.e. confusing compile time and runtime in my addled brain)....
17,616
<p>Quite a few comments to answers in a different post, <em><a href="https://stackoverflow.com/questions/191609/where-are-the-best-locations-to-write-an-error-log-in-windows">Where are the best locations to write an error log in Windows?</a></em>, gave me the impression that a lot of things regarding standard folders (...
<p>Make them Vista-ready, if only for the fact that Windows 7 will have the same changes. Better to future-proof now when you have the chance, than later when time is critical.</p>
<p>Is your company going to upgrade to Windows&nbsp;Vista at all? A lot of companies are ignoring Windows&nbsp;Vista and are planning to upgrade to the next Windows version when it comes out in the hopes that it will suck less than Windows&nbsp;Vista. If this is the case, it would be a complete waste of time. Who know...
23,295
<p>Where can I find a good sample of Asynchronous IO on files with thread hooping?</p> <p>Thanks</p>
<p>In this video cast <a href="http://channel9.msdn.com/pdc2008/TL11/" rel="nofollow noreferrer">http://channel9.msdn.com/pdc2008/TL11/</a> Luca Bolognese explain F#, including async file reading and parallel map reduce. </p> <p>I hope it helps. </p>
<p>Here is an example: <a href="http://through-the-interface.typepad.com/through_the_interface/2008/01/harnessing-f-as.html" rel="nofollow noreferrer">Using F# Asynchronous Workflows to simplify concurrent programming in AutoCAD</a>.</p>
44,707
<p>Is there any way in Python to determine what exceptions a (built-in) function might raise? For example, the documentation (<a href="http://docs.python.org/lib/built-in-funcs.html" rel="nofollow noreferrer">http://docs.python.org/lib/built-in-funcs.html</a>) for the built-in int(s) says nothing about the fact that it...
<p>The only way to tell what exceptions something can raise is by looking at the documentation. The fact that the int() documentation doesn't say it may raise ValueError is a bug in the documentation, but easily explained by ValueError being exactly for that purpose, and that being something "everybody knows".</p> <p>...
<p>I don't know of any definitive source, apart from the source.</p>
18,175