instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I need to convert &rarr; (&amp;rarr) to a symbol I can type into a ANSI VBScript file. I am writing a script that translates a select set of htmlcodes to their actual double byte symbols using a regex. Many languages accomplish this using "\0x8594;"... what is the equivelent in VBScript?</p>
<p>Answer was ChrW(8594)</p>
<p>ChrW(&amp;H8594)</p>
16,343
<p>This is what reflector gives:</p> <pre><code>public int Int1 { get; set; } public string StringA { get; set; } // Fields [CompilerGenerated] private int &lt;Int1&gt;k__BackingField; [CompilerGenerated] private string &lt;StringA&gt;k__BackingField; </code></pre> <p>The problem is that C# specification doesn't exp...
<p>I don't think MS should specify a name - I think it's more reasonable to avoid binary serialization, which is always going to be somewhat brittle in my opinion. (Java serialization is similarly brittle.) If it relies on field names (and there may be a way of getting round that by attributing your properties - I'm no...
<p>I don't like the following about auto-properties:</p> <ol> <li><p>It is not possible to place break points on auto-properties.</p></li> <li><p>The fields in the class are obvious, you will have to examine the fields as well as the properties to know what are the fields in the class. Where if they are not used, the...
48,534
<p>I've just started learning linq and lambda expressions, and they seem to be a good fit for finding duplicates in a complex object collection, but I'm getting a little confused and hope someone can help put me back on the path to happy coding.</p> <p>My object is structured like list.list.uniqueCustomerIdentifier</p...
<ul> <li>Unpack the hierarchy</li> <li>Project each element to its uniqueID property</li> <li>Group these ID's up</li> <li>Filter the groups by groups that have more than 1 element</li> <li>Project each group to the group's key (back to uniqueID)</li> <li>Enumerate the query and store the result in a list.</li> </ul> ...
<p>If you want to flatten the two list hierarchies, use the <code>SelectMany</code> method to flatten an <code>IEnumerable&lt;IEnumerable&lt;T&gt;&gt;</code> into <code>IEnumerable&lt;T&gt;</code>.</p>
27,586
<p>Once it is compiled, is there a difference between:</p> <pre><code>delegate { x = 0; } </code></pre> <p>and</p> <pre><code>() =&gt; { x = 0 } </code></pre> <p>?</p>
<p>Short answer : no.</p> <p>Longer answer that may not be relevant: </p> <ul> <li>If you assign the lambda to a delegate type (such as <code>Func</code> or <code>Action</code>) you'll get an anonymous delegate.</li> <li>If you assign the lambda to an Expression type, you'll get an expression tree instead of a anony...
<p>There is a difference</p> <p>Example:</p> <pre><code>var mytask = Task.Factory.StartNew(() =&gt; { Thread.Sleep(5000); return 2712; }); mytask.ContinueWith(delegate { _backgroundTask.ContinueTask(() =&gt;lblPercent.Content = mytask.Result.ToString(CultureInfo.InvariantCulture)); }); </code></pre> <...
38,407
<p>I have a set of classes, each one is a different <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="noreferrer">strategy</a> to do the same work. </p> <pre><code>namespace BigCorp.SuperApp { public class BaseClass { } public class ClassA : BaseClass { } public class ClassB : BaseClass { } } </...
<p>Either use the assembly-qualified-name, or get hold of the Assembly and use <code>Assembly.GetType(name)</code>. In this case, since you want the types in the config file, assembly-qualified is a valid way to go - but since you know all your types are in the same assembly:</p> <pre><code>Assembly assembly = typeof(...
<pre><code>BaseClass c = Activator.CreateInstance(t) as BaseClass; // fails </code></pre> <p>Might also result from the fact, that CreateInstance does not return an instance of BaseClass, rather than an instance of BaseClass wrapped into an ObjectHandle.</p> <p>Cast into your BaseClass after you used the UnWrap metho...
37,882
<p>Related to my <a href="https://stackoverflow.com/questions/28975/anyone-using-couchdb">CouchDB</a> question.</p> <p>Can anyone explain MapReduce in terms a numbnuts could understand?</p>
<p>Going all the way down to the basics for Map and Reduce.</p> <hr> <p><strong>Map</strong> is a function which "transforms" items in some kind of list to another kind of item and put them back in the same kind of list.</p> <p>suppose I have a list of numbers: [1,2,3] and I want to double every number, in this case...
<p>I don't want to sound trite, but this helped me so much, and it's pretty simple:</p> <pre><code>cat input | map | reduce &gt; output </code></pre>
4,866
<p>From a programmer stuck in the web world...</p> <p>What are the most common desktop development "frameworks" currently being used for desktop application development?</p> <ol> <li><p>Is it realistic to write desktop software for both Windows and OS X?</p></li> <li><p>Is it realistic to use the same base code to wr...
<ol> <li><p>Yes. You could use Java, Python/ Ruby etc with a cross platform UI framework, AIR etc etc.</p></li> <li><p>Yes it is realistic. Build it on a client/server model and most of the code will fit either the desktop or web UI model.</p></li> </ol> <p>If you went down the .NET root, you could use Silverlight for...
<p>We've built many multi-tier, cross-platform apps using Java. On desktop Swing worked REALLY weel for us.</p>
32,530
<p>I'm working on a <code>PHP</code> application that links into the <code>Protx VSP Direct payment gateway</code>. To handle "3D Secure" requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been posted. I'm trying to use the <code>cURL</code> li...
<p>The 3D Secure API doesn't allow you to do the request in the background. You need to forward the user to the 3D secure site. Use javascript to automatically submit your form. Here's what our provider suggests:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Processing your request...&lt;/title...
<p>I think you are a bit confused as to what curl does. It does exactly what you explained, it acts sort of like a browser and makes the call to the site and returns the content of that post. I don't know of any way you can actually redirect the browser server side and represent a post. I would actually create a Jav...
13,046
<p>I am running </p> <ul> <li>OS X 10.5, </li> <li>Ruby 1.8.6, </li> <li>Rails 2.1, </li> <li>sqlite3-ruby 1.2.2 </li> </ul> <p>and I get the following error when trying to rake <code>db:migrate</code> on an app that works find connected to MySQL.</p> <blockquote> <p>rake aborted! no such file to load -- sqlite3...
<p>You have to store in UTC - if you don't, your historic reporting and behaviour during things like Daylight Savings goes... funny. GMT is a local time, subject to Daylight Savings relative to UTC (which is not).</p> <p>Presentation to users in different time-zones can be a real bastard if you're storing local time....
<p>I like storing in GMT and showing only relative ("about 10 seconds ago", "5 months ago"). Users don't need to see actual timestamps for most use cases.</p> <p>There are certainly exceptions, and an individual application might have many of them, so it can't be a 'one-true-way' answer. Things that need strong audi...
3,310
<p>I have a factory class that populates objects with data. I want to implementing saving from the object, but do not want to populate the object with db stuff - is it stupid to have my Factory that creates the class also save the data?</p> <p>ie: in my .Save() method on the object i would call Factory.Save(myObject)...
<p>The factory class is a creational pattern that helps with creating new objects. </p> <p>There are various patterns which deal with persisting objects, one of which is data mapper <a href="http://martinfowler.com/eaaCatalog/dataMapper.html" rel="nofollow noreferrer">http://martinfowler.com/eaaCatalog/dataMapper.html...
<p>No, it's not stupid at all, in fact, that's the way how everybody should do it. Business object shouldn't contain any persistence logic.</p> <p>Btw, if you're using C# 3.0, then you might not even bother with Factory class. Just create extension methods. That way you can still have your persistence code isolated fr...
23,026
<p>This is probably a simple question. Suppose I have a object called Users and it contains a lot of protected variables. </p> <p>Inside that Users class I have a method that creates a temporary Users object, does something with it, and if successful, transfers all the variables from the temp Users object into the on...
<p>A better approach is to implement the IClonable interface. But you'll find it doesn't save you a lot of work.</p>
<p>A better solution might be to move whatever this method is outside of your class, and then just assign the temp user object to your main user object reference like so:</p> <pre><code>_User = tmpUser; </code></pre> <p>sparing you the 75 lines of code. Whenever I have a class creating an instance of itself inside o...
37,510
<p>This is the error Dependency Walker gives me on an executable that I am building with VC++ 2005 Express Edition. When trying to run the .exe, I get:</p> <pre><code>This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. </code></pre...
<p>Open the properties sheet for your project, go to the Configuration Properties -> C/C++ -> Code Generation page, and change the Runtime Library selection to /MT or /MTd so that your project does not use the DLL runtime libraries.</p> <p>The C/C++ DLL runtimes used by VS2003 and up are not automatically distributed ...
<p>Run Event Viewer: it'll have more information.</p> <p>Probably you've attempted to run your program on a machine that doesn't have the VC redistributables installed, or you're attempting to run a debug build on a machine that doesn't have Visual Studio installed (the debug libraries aren't redistributable).</p>
31,681
<p>Is there a way to programmatically determine if a given file path and name is stored in ROM (i.e. came installed on the device) or RAM (i.e. created after a hard reset)?</p>
<p>Get the file attributes and check to see if <a href="http://msdn.microsoft.com/en-us/library/ms899899.aspx" rel="nofollow noreferrer">FILE_ATTRIBUTE_ROMMODULE</a> is set.</p>
<p>There is no 100% of telling if a file is in rom or not...</p> <p>For most files though you check the file attributes for either "FILE_ATTRIBUTE_INROM" or "FILE_ATTRIBUTE_ROMMODULE".</p> <p>"FILE_ATTRIBUTE_INROM" - normal data files. "FILE_ATTRIBUTE_ROMMODULE" - executable code files (dll, exe's, etc) (these files ...
16,397
<p>So I recently installed a genuine E3D V6 (direct) on my AM8 (Anet a8 with upgraded frame). I have already been able to fix most of the print quality problems. But the last one is a hard one for me. </p> <p>It prints super fine up until a certain height. Then the extruder starts slipping and starts making weird nois...
<p>I used a different heat break with a PFTE lining inside. After that it ran smoothly. </p> <p>Probably what was happening was that my filament was getting too hot and started to stick on the full metal heat break. </p>
<p>I have had some similar problems as you describe with my custom build CoreXY printer. I used an all-metal heat break for my 2.85 mm diameter filament. The heat break clogged up. I found that the inner diameter of the heatbreak, although specifically designed for 3 mm filament, narrowed down having a ledge inside. I ...
901
<p>This is how I wanted to do it which would work in PHP 5.3.0+</p> <pre><code>&lt;?php class MyClass { const CONSTANT = 'Const var'; } $classname = 'MyClass'; echo $classname::CONSTANT; // As of PHP 5.3.0 ?&gt; </code></pre> <p>But I'm restricted to using PHP 5.2.6. Can anyone th...
<p>You can accomplish this without using <a href="http://php.net/manual/en/function.eval.php" rel="nofollow noreferrer"><code>eval</code></a> in pre-5.3 code. Just use the <a href="http://php.net/manual/en/function.constant.php" rel="nofollow noreferrer"><code>constant</code></a> function:</p> <pre><code>&lt;?php cla...
<p>If you absolutly need to access a constant like that, you can do this:</p> <pre><code>&lt;?php class MyClass { const CONSTANT = 'Const var'; } $classname = 'MyClass'; echo eval( 'return '.$classname.'::CONSTANT;' ); ?&gt; </code></pre> <p>But, if i were you, I'd try not to use eval.</p>
2,735
<p>When I profile my application using SQL Server Profiler, I am seeing lots of <em>Audit Login</em> and <em>Audit Logout</em> messages for connections to the same database. I am wondering, does this indicate that something is wrong with my connection pooling? The reason I ask, is because I found this in the MSDN doc...
<p>Remember that connections are pooled per connectionstring. If you have many databases and connect using many connectionstrings, your app will create a new connection when none exist with the correct connectionstring. Then it will pool that connection and, if the pool is full, bump an existing connection. The default...
<p>Remember that connections are pooled per connectionstring. If you have many databases and connect using many connectionstrings, your app will create a new connection when none exist with the correct connectionstring. Then it will pool that connection and, if the pool is full, bump an existing connection. The default...
35,302
<p>Is there any software/methods to automatically splice objects into multiple pieces sort of like a jig saw puzzle so that I can combine them together and bypass the build plate size limit?</p> <p>As an example I have this 2D image that I want to print out but my printers size limit is roughly the size of the blue "s...
<p>From what I understand, you're trying to partition your object into smaller pieces with the hopes of putting them back together in a manner similar to a Jigsaw puzzle.</p> <p>There are two options that I know of to do this, which requires using OpenSCAD:</p> <ul> <li>The <a href="https://www.thingiverse.com/thing:...
<p>Sorry to put it that way, but does 3D printing the best "tool" for your case? </p> <p>it seems you want to generate a huge flat file when a CnC would be the best to generate a clean and solid part.</p> <p>Otherwise, as others suggets you are looking for a tooling tool.</p>
713
<p>I used to have a custom preferences class for my applications. For my next hobby project i wanted to switch to the Preferences API. But the put and get functions require a default value and i do not want to spread default values all over the source files. Even though my project is small i can not imagine changing de...
<p>You're mixing a few concepts here. The default given in the code should be specific to the local situation as a 'reasonable default'. If you want to have application-wide defaults, then you need a preference-provider that allows you to hook in both the default preferences and an overlaid user-preferences. Somethi...
<p>Would it be so hard to stick all your defaults in a single class so that they weren't littering your code?</p> <p>I've used <a href="http://commons.apache.org/configuration/" rel="nofollow noreferrer">commons configuration</a> in recent projects. I've looked into the Java Preferences API but I like the flexibility ...
27,041
<p>Is it possible in CSS using a property inside an @page to say that table headers (th) should be repeated on every page if the table spreads over multiple pages?</p>
<p>This is what the <a href="http://htmlhelp.com/reference/html40/tables/thead.html" rel="noreferrer">THEAD</a> element is for. Official docs <a href="http://www.w3.org/TR/html4/struct/tables.html#edef-THEAD" rel="noreferrer">here</a>.</p>
<p>Chrome and Opera browsers do not support <code>thead {display: table-header-group;}</code> but rest of others support properly..</p>
34,536
<p>I've been having a lot of problems trying to figure out how to use <code>scanf()</code>. It seems to work fine with integers, being fairly straight forward <code>scanf("%d", &amp;i)</code>.</p> <p>Where I am running into issues is using <code>scanf()</code> in loops trying to read input. For example:</p> <pre><c...
<p>When you enter "<code>c P101</code>" the program actually receives "<code>c P101\n</code>". Most of the conversion specifiers skip leading whitespace including newlines but <code>%c</code> does not. The first time around everything up til the "<code>\n</code>" is read, the second time around the "\n" is read into ...
<p>Perhaps using a while loop, not a do...while loop will help. This way the condition is tested before execution of the code. Try the following code snippet:</p> <pre><code> while(command != 'q') { //statements } </code></pre> <p>Also, if you know the string length ahead of time, 'for' loops can be m...
26,683
<p>For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome).</p> <p>This is the image tag</p> <pre><code>&lt;img src="images/dukkah.jpg" class="imgleft"/&gt; </code></pre> <p>Not only does it not display in the website, it wont display when...
<p>Imagemagick reports that this particular image is saved in CMYK colorspace instead of the more standard RGB. Try converting it, it should be more compatible with the webkit rendering engine.</p> <p>Imagemagick is available for download from <a href="http://www.imagemagick.org/script/index.php" rel="nofollow norefer...
<p>I tried the url you gave in FireFox 3 and IE 6, IE 6 won't show it either, firefox works. My guess is that there is something wrong with the jpg file.</p>
6,514
<p>There's a lot of great information on MSDN dealing with creating Visual Studio templates. I've been specifically working through a Multi-Project Solution (<a href="http://msdn.microsoft.com/en-us/library/ms185308(VS.80,printer).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms185308(VS.80,printer).as...
<p>I have been trying to do the same thing for a while now and have had no luck finding a native way to do it. The way I am doing it currently is having a custom project template that adds the items to the project and then through a VS Wizard associated with that template using convention to move the files to the solu...
<p>This hack might be 10 years late, but thought I'd add it anyway. Its less convoluted than creating a VS Wizard to drive the operation of adding solution level items.</p> <p>Basically I add a dummy project to the multi-project solution template, named "_SharedFiles".</p> <p>In the other projects that need links to ...
44,343
<p>I need a java api, that cannot use JMF, to play video interpreted by the SO codecs but i want to retrieve the each frames in java code. Somebody know some?</p>
<p>Have a look at <a href="http://fmj-sf.net/index.php" rel="nofollow noreferrer">FMJ</a>. It does <em>not</em> require the <a href="http://java.sun.com/javase/technologies/desktop/media/jmf/" rel="nofollow noreferrer">Java Media Framework</a> (JMF).</p> <p>They have an <a href="http://fmj-sf.net/ffmpeg-java/getting_...
<p>If you're OK with Java wrapper around FFMpeg, try <a href="https://github.com/zakgof/velvet-video" rel="nofollow noreferrer">velvet-video</a>. </p> <p>Code snippet to extract images from a video file:</p> <pre><code>IVelvetVideoLib lib = VelvetVideoLib().getInstance(); try (IDemuxer demuxer = lib.demuxer(new File(...
33,227
<p>We are looking at a standard way of configuring the various "endpoints" of our application. Our application is a distributed system with Windows Desktop applications, Windows Server "services" and databases. We currently configure each piece using XML files. This is getting a little out of hands as we work with larg...
<p>I've done a couple of things to give myself this functionality over the years. I build enterprise applicatons that may be distributed across many servers. I don't want to bury config settings in each services config file or each web server's web.config file. For application specific stuff I usually create an appl...
<p>Any VCS through a secure channel?</p> <p>For example, git through ssh (both available in cygwin).</p> <p>I think the first step is to have the secure channel (if you want the push ability, pulling might be different).</p> <p>As for managing the "versions" in different "branches", what's better than a version cont...
46,053
<p>I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so...</p> <p>The constructor for the Session handling class is</p> <pre><code>private function __construct() { if (!headers_sent()) ...
<p>Well, your session manager is basically broken by design. To be able to test something, it must be possible to isolate it from side effects. Unfortunately, PHP is designed in such a way, that it encourages liberal use of global state (<code>echo</code>, <code>header</code>, <code>exit</code>, <code>session_start</co...
<p>Can't you use output buffering before starting the test? If you buffer everything that is output, you shouldn't have problems setting any headers as no output would have yet been sent to client at that point.</p> <p>Even if OB is used somewhere inside your classes, it is stackable and OB shouldn't affect what's goi...
23,092
<p>the company I work for want to use a "hosted payment form" to charge our customers. A question came up on how we can populate the "payment form" automatically with information from one of our other system. We have no control over the hosed payment form, and we have to use IE. Is this possible at all? And if so, how ...
<p>Assuming that you are essentially embedding the contents of a remote form in a frame/iframe, the you should be able to use some javascript to set values for the fields - field.value = "xxxx".</p> <p>That solution of course depends on the form remaining the same - any changes to the remote form will require you to u...
<p>Unless your payment gateway allows you to pass through data in a set API (which lots do!), you'd need to take control (and responsibility) for your payment form.</p> <p>I say responsibility because you would have to prove to your merchant account provider that everything is secure. This will probably incur some sec...
15,347
<p>How can I figure out the state of the files in my client, I want to know if the file needs an updated, or patched, or modified etc. In CVS, I used to simply run "cvs -n -q update . > file". Later look for M,U,P,C attributes to get the current status of the file.</p> <p>In perforce, "p4 sync -n" doesn't give output ...
<p>To my knowledge, there isn't a command that will give you exactly what you want. In looking what the update command does, there is no single alternative in Perforce. I think that the closest that you will come will be to use the 'p4 fstat' command and parse the output from there to get the information that you nee...
<p>Not quite sure what you mean. If you are talking about seeing what files need "resolving" (in perforce language) then you can use:</p> <pre><code>p4 resolve -n </code></pre> <p>See the p4 command line manual website here: <a href="http://www.perforce.com/perforce/doc.current/manuals/cmdref/resolve.html#1040665" r...
10,822
<p>I'm trying to find the best design for the following scenario - an application to store results of dance competitions. </p> <p>An event contains multiple rounds, each round contains a number of performances (one per dance). Each performance is judged by many judges, who return a scoresheet.</p> <p>There are two ty...
<p>This requires a little domain knowledge that I don't have, but it seems to me that the ordered vs. non-ordered situation is a little bit irrelevant. If each couple has a score, the ordering in the final round can be deduced from each couple's score, right? That would mean that the final round's data structure woul...
<p>Without knowing in detail what is going on it's hard to give clear advice. However based on what I read it seems your parallel hierarchy may not be necessary. </p> <p>It's not clear that a final_performance is really different from a performance. I guess they are scored differently; that should be reflected in diff...
8,866
<p>I am binding a TreeView to an XMLDataSource, the databindings are being generated automatically and the XML looks like this:-</p> <pre><code>&lt;Passengers&gt; &lt;Passenger&gt; &lt;PassengerName&gt;Name1&lt;/PassengerName&gt; &lt;/Passenger&gt; &lt;Passenger&gt; &lt;PassengerName&gt;Name2&lt;/Passeng...
<p>Just a guess: the All vs Common tabs in intellisense?</p>
<p>It is the same as decorating your member with EditorBrowsableAttribute. I would guess values 0,1 and 2 corresponds to Always, Advanced and Never.</p>
35,596
<p>In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?</p>
<p>Gmail's SMTP-server requires a very specific configuration.</p> <p>From <a href="http://mail.google.com/support/bin/answer.py?answer=13287" rel="noreferrer">Gmail help</a>:</p> <pre><code>Outgoing Mail (SMTP) Server (requires TLS) - smtp.gmail.com - Use Authentication: Yes - Use STARTTLS: Yes (some clients call...
<p>You could use PEAR's mail function with Gmail's SMTP Server</p> <p>Note that when sending e-mail using Gmail's SMTP server, it will look like it came from your Gmail address, despite what you value is for $from.</p> <p>(following code taken from <a href="http://email.about.com/od/emailprogrammingtips/qt/et073006.h...
5,672
<p>I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET</p> <p>Thanks!</p> <p>edit: Additional constraint: I ca...
<p>This is how I get the text out, I believe you can set set the selection range to a page, then you could test that text, might be a little backwards from what you need but could be a place to start.</p> <pre><code>Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Applicat...
<p>How are you defining a page? </p> <p>If you only count section/hard page breaks it complex, but doable. If you want to count soft page breaks the task becomes very very difficult and somewhat meaningless. Consider that the determination of where soft-page breaks land is dynamically generated at run-time and is not ...
36,995
<p>There are about 200 projects in cvs and at least 100 projects in vss. Some are inactive code in maintenance mode. Some are legacy apps. Some are old apps no longer in use. About 10% are in active development. The plan is to move everything to perforce my end of year 2009.</p> <p>Has anyone done a large migration li...
<p>On the VSS side, there are conversion tools that are available to help with migration. They can mostly maintain version history (there are caveats that are explained in the readme and docs). I have migrated well over 50 VSS projcts into perforce using the VSS to perforce tool. Getting the data out of VSS can be ...
<p>Forgive my answering a question with a question, but doesn't <a href="http://www.perforce.com/" rel="nofollow noreferrer">Perforce</a> provide tools for this? Or, at the very least, documentation? I'd be beating up my Perforce salesperson...</p>
10,441
<p>How do I get the KeyDown event to work in a Delphi (2007) MDI Applications Parent window, even if a Child window has focus?</p> <p>I would like to implement a shortcut key (F1) that brings up a help screen in a MDI application, I have added the KeyDown procedure to the MDI Parent window and enabled KeyPreview in b...
<p>I had the exact same problem this week! I fixed it by creating an action in the ActionManager on the mainform. This action opens the help file and has the F1-key set as shortcut. It also works for all MDI child screens.</p>
<p>F1 help processing is built into Delphi, so all you have to do is handle the help messages properly. This may be as little as setting the helpfile property for the application. You can set particular pages using the form's help??? properties.</p> <p>Basically, just use the help system supplied and forget keydown. T...
27,816
<p>My team is working on a crappy old website and most of the pages are still ASP classic. However, we've recently migrated to forms authentication using ASP.NET and wildcard mapping. Everything works surprisingly well except for one thing: logged in users are timing out too quickly. After looking in the logs it app...
<p><strong>Create a perpetual session.</strong></p> <p>Essentially you end up emitting some JavaScript and an image tag in your master page or navigation users controls (whatever you're using for consistent navigation). This JavaScript on some interval changes the source of the image tag to an http handler endpoint (s...
<p>I am assuming that you have manually created the cookie, in which case your timeout value in code is probably overriding your timeout value in the configuration.</p> <p>First, if possible (which it probably isn't) don't create the cookie manually, it will save you from not only this headache but dozens of others.</...
8,211
<p>I start by creating a string variable with some <strong>non-ascii</strong> <em>utf-8</em> encoded data on it:</p> <pre><code>&gt;&gt;&gt; text = 'á' &gt;&gt;&gt; text '\xc3\xa1' &gt;&gt;&gt; text.decode('utf-8') u'\xe1' </code></pre> <p>Using <code>unicode()</code> on it raises errors...</p> <pre><code>&gt;&gt;&g...
<p>The behaviour does seem confusing, but intensional. I reproduce here the entirety of the unicode documentation from the <a href="http://docs.python.org/lib/built-in-funcs.html" rel="noreferrer">Python Built-In Functions documentation</a> (for version 2.5.2, as I write this):</p> <blockquote> <p><strong>unicode([o...
<p><code>unicode</code> does not guess the encoding of your text. If your object can print itself as <code>unicode</code>, define the <code>__unicode__()</code> method that returns a Unicode string.</p> <hr> <p>The secret is that <code>unicode(r)</code> is not actually calling <code>__str__()</code> itself. Instead, ...
13,223
<p>I've accidentally removed Win2K compatibility from an application by using <a href="http://msdn.microsoft.com/en-us/library/ms683215(VS.85).aspx" rel="nofollow noreferrer">GetProcessID</a>.</p> <p>I use it like this, to get the main HWND for the launched application.</p> <pre><code>ShellExecuteEx(&amp;info); // La...
<p>There is an 'sort-of-unsupported' function: ZwQueryInformationProcess(): see</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms687420.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms687420.aspx</a></p> <p>This will give you the process id (amongst other things), given the handle. This isn'...
<p>No, it's not ZwQueryInformationProcess() It's NtQIP and of course it works for all versions since NT 3.5 and you don't need to test OS at all</p>
34,238
<p>Our development and consulting teams (about 25 people) are looking for software to manage all of the passwords we have for our organization and for our clients. We looked at Keepass but it is not truly a database system nor does it have support for multiple concurrent updates. </p> <p>Needs:<br> -Uses database (v...
<p>If you don't mind a hosted solution, I find online password manager <a href="https://www.passpack.com/" rel="nofollow noreferrer">PassPack</a> very promising. The one thing missing are roles or accounts such that different projects would need to use distinct PassPack accounts. This would work very well where you set...
<p>Joel's entry on <a href="http://www.joelonsoftware.com/items/2008/09/11b.html" rel="nofollow noreferrer">Password management finally possible</a> may be a good place to start.</p> <p>Not sure it covers you on all bases though.</p>
24,605
<p>Currently, I am developing a product that does fairly intensive calculations using MS SQL Server 2005. At a high level, the architecture of my product is based on the concept of "runs" where each time I do some analytics it gets stored in a series of run tables (~100 tables per run).</p> <p>The problem I'm having ...
<p>In terms of performance, the big gain in using separate files/filegroups is that it lets you spread your data across multiple physical disks. This is beneficial because with several disks, multiple data requests can be handled simultaneously (parallel is generally faster than serial). All other things being equal, t...
<p>It could if you place them on separate drives - not logical but physical drives so IO is not slowing you down so much.</p>
13,385
<p>On my current project, we've been using Struts 1 for the last few years, and ... ahem ... Struts is showing its age. We're slowly migrating our front-end code to an Ajax client that consumes XML from the servers. I'm wondering if any of you have migrated a legacy Struts application to a different framework, and what...
<p>Sure. Moving from Struts to an AJAX framework is a very liberating experience. (Though we used JSON rather than XML. Much easier to parse.) However, you need to be aware that it's effectively a full rewrite of your application. </p> <p>Instead of the classic Database/JSP/Actions scheme for MVC, you'll find yourself...
<p>Check out the <a href="http://www.stripesframework.org" rel="nofollow noreferrer">Stripes Framework</a>. If you are familiar with struts then stripes will make sense to you, but it's so much better. They have a <a href="http://www.stripesframework.org/display/stripes/Stripes+vs.+Struts" rel="nofollow noreferrer">Str...
11,549
<p>What is the proper technique to have <strong>ThreadA</strong> signal <strong>ThreadB</strong> of some event, without having <strong>ThreadB</strong> sit blocked waiting for an event to happen?</p> <p>i have a background thread that will be filling a shared List&lt;T&gt;. i'm trying to find a way to asynchronously s...
<p>Here's a code sample for the System.ComponentModel.BackgroundWorker class.</p> <pre><code> private static BackgroundWorker worker = new BackgroundWorker(); static void Main(string[] args) { worker.DoWork += worker_DoWork; worker.RunWorkerCompleted += worker_RunWorkerCompleted; wor...
<p>If your "main" thread is the Windows message pump (GUI) thread, then you can poll using a Forms.Timer - tune the timer interval according to how quickly you need to have your GUI thread 'notice' the data from the worker thread. </p> <p>Remember to synchronize access to the shared <code>List&lt;&gt;</code> if you ar...
14,955
<p>What's the best way to implement the enum idiom in Ruby? I'm looking for something which I can use (almost) like the Java/C# enums.</p>
<p>Two ways. Symbols (<code>:foo</code> notation) or constants (<code>FOO</code> notation).</p> <p>Symbols are appropriate when you want to enhance readability without littering code with literal strings.</p> <pre><code>postal_code[:minnesota] = &quot;MN&quot; postal_code[:new_york] = &quot;NY&quot; </code></pre> <p>Co...
<p>Another approach is to use a Ruby class with a hash containing names and values as described in the following <a href="http://www.rubyfleebie.com/enumerations-and-ruby/" rel="nofollow noreferrer">RubyFleebie blog post</a>. This allows you to convert easily between values and constants (especially if you add a class ...
10,141
<p>I use cruisecontrol.rb for CI and FogBugz for bug tracking, but the more general the answers, the better.</p> <p>First is the technical problem: is there an API for FogBugz? Are there good tutorials, or better yet, pre-written code?</p> <p>Second is the procedural problem: what, exactly, should the CI put in the ...
<p>All the CI setups I've worked with send an email (to a list), but if you did want—especially if your team uses FogBugz much as a todo system—you could just open a case in FogBugz 6. <a href="http://www.fogcreek.com/FogBugz/docs/60/topics/advanced/API.html" rel="nofollow noreferrer">It has an API</a> that lets you op...
<p>CC comes with a utility that warns you when builds fail, it probably isn't worth logging the failing build in FogBugz - you don't need to track issues that are immediately resolved (as most broken builds will be)</p> <p>To go the other way round (FogBugz showing checkins that fixed the issue) you need a web based r...
3,418
<p>I am trying to animate a change in backgroundColor using jQuery on mouseover.</p> <p>I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div.</p> <pre><code>$(".user...
<p>The color plugin is only 4kb so much cheaper than the UI library. Of course you'll want to use a <a href="http://github.com/jquery/jquery-color" rel="noreferrer">decent version</a> of the plugin and not <a href="http://plugins.jquery.com/project/color" rel="noreferrer">some buggy old thing</a> which doesn't handle ...
<p>Try this one:</p> <pre><code>jQuery(".usercontent").hover(function() { jQuery(this).animate({backgroundColor:"pink"}, "slow"); },function(){ jQuery(this).animate({backgroundColor:"white"}, "slow"); }); </code></pre> <p>Revised way with effects:</p> <pre><code>jQuery(".usercontent").hover(function() { ...
23,127
<p>When I added service -> web service. The VS2008 added a App_WebReferences folder without a .asmx file. I see a .discomap file. </p> <p>When I use the cascading drop down ajax control, it is looking for .asmx in the service path. Am I doing it wrong? I remember the early edition of Visual Studio added a .asmx file w...
<p>If the dropdown needs to call the web service, just give it the URL of the web service (ex: <a href="http://localhost/mywebservice/service1.asmx" rel="nofollow noreferrer">http://localhost/mywebservice/service1.asmx</a>). I believe you'll also need to give it the name of the web method to call. </p> <p>You won't ne...
<p>You added a reference to an external service. You'll want to create a new web service by right clicking on your project, then Add New Item and selecting Web Service.</p>
31,664
<p>Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.</p>
<p>The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all windows on the terminal.</p>
<p>This is a Windows Forms application? I was able to make a very fat and thick scrollbar by adjusting the "Width" property of my scroll bar control. </p> <p><img src="https://i.stack.imgur.com/k6PAf.png" alt="Fat Scroll Bar"></p> <p>Is your scroll bar something you have programmatic access to (i.e. it is a control...
2,883
<p>I have a large project that I want to start using visual studio 2005 to edit. I want to tell it "Here are all the files I want you to track, now get on with it" and have them displayed as a directory tree, for example:</p> <pre><code>Folder 1 - File A - File B - File C Folder 2 - Folder 3 - File X - File ...
<p>click on the 'show all files' icon in the solution explorer, then select the folders you want to include, right click and select 'include in project'.</p>
<p>To clairfy this: To import a source tree with all subfolders, represented in the VS Explorer View like it is on the filesystem, you have to create a new Solution via the menu entry <code>Datei &gt;&gt; Neu &gt;&gt; Projekt aus vorhandenem Code</code> which is the last entry in the <code>New...</code> menu in VS2005 ...
23,681
<p>I need to build me a small support wall 250x80 cm mounted on two metal supports approximately 200 cm apart.</p> <p>I was looking into WPC (Wood Plastic Composite) boards and then it hit me that I may be able to make it functional AND pretty with my 3D printer (Prusa MK3S + MMU2).</p> <p>However, I have zero idea on ...
<p>You could print a decorative layer that attaches to the WPC board.</p> <p>It would be faster and cheaper, and there'd be no doubt about its strength.</p>
<p>Here are some general issues with load bearing 3d prints for this type of usage:</p> <ul> <li>If this is to be used outside, plastic has issues with both water and UV exposure making it brittle. PETG does better on both of these areas than either PLA or ABS.</li> <li>Plastic generally does better with compression t...
2,215
<p>I would like to make apps that can run in a flash enabled browser and decided flex would be best for me so I started to learn that. AFAIK flex has a GC but how that GC works compared to the ones in other languages I've seen may be a bit different. I have found <a href="http://blogs.adobe.com/aharui/2007/03/garbage_c...
<p>I work on a fairly large and complex Flex3 app, and we haven't had any terrible or uncontrollable memory leaks - even in IE.</p> <p>This post by Grant Skinner on garbage collection in AS3 was very helpful to me. It was posted in 2006, but it's still entirely relevant (as we're still using AS3). It's part of a thr...
<p>A couple resources you can have a look at are : <a href="http://bugs.adobe.com/flex/" rel="nofollow noreferrer">Flex Bug Tracking</a> which you could peruse for memory leak bugs that have been fixed/logged. Also in the Flex Builder IDE you can use the Profiler to monitor memory/CPU usage etc. I cant specifically ans...
37,469
<p>This may seem like a somewhat contrived example, but I'm left scratching my head.</p> <p>Ok, I have a console app that instantiates a WindowsForm and calls a method called DoSomeWork() on the form.</p> <pre><code>class Program { static void Main(string[] args) { Form1 form = new Form1(); ...
<p>You forgot to start a message loop, calling Application.Run() is required. Without a message loop, the BackgroundWorker events cannot work. To fix:</p> <pre><code>static void Main(string[] args) { Application.Run(new Form1()); } </code></pre> <p>Call DoSomeWork() in the form's constructor or it's Load event...
<p>Did you actually <code>throw NotImplementedException();</code> in the handler? or you're just mocking this up quick and forgot to remove it?</p> <p>My guess would be that it is related to different thread apartment models being utilized.</p> <p>From my experience if a single-thread-apartment <em>non-UI</em> thread...
28,705
<p>I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like <code>#ifdef IPHONE_SDK...</code>. </p> <p>Presumably Xcode defines something, but I can't see anything under project properties, and Google isn't much help.</p>
<p>It's in the SDK docs under "Compiling source code conditionally"</p> <p>The relevant definitions are TARGET_OS_IPHONE (and he deprecated TARGET_IPHONE_SIMULATOR), which are defined in /usr/include/TargetConditionals.h within the iOS framework. On earlier versions of the toolchain, you had to write:</p> <pre><code>...
<p>The answers to this question aren't quite correct. The question of the platform and hardware vs Simulator is orthogonal.</p> <p><strong>Do not use architecture as a shortcut for platform or simulator detection!</strong> This kind of sloppy thinking has caused many, many programmers a great deal of heartburn and hea...
17,697
<p>Hopefully this still falls within StackOverflow's umbrella!</p> <p>I'm looking to create a quick boot linux laptop for my wife. All it really needs is to be able to do is browse the internet (with flash and video etc.).</p> <p>Are there any distros that are made for this, or any guides out there that show good way...
<p>If you're using Ubuntu (or a variant, like xubuntu or kubuntu), there is a package called BootUp-Manager. There's an <a href="http://lifehacker.com/software/linux-tip/speed-up-ubuntu-boot-and-shutdown-process-267588.php" rel="nofollow noreferrer">article about it</a> over at Lifehacker. It lets you check and uncheck...
<p>There are LiveCD-versions of working linux-distros with browser and installed flash, java.</p> <p>Check out LiveCD</p> <p><a href="http://en.wikipedia.org/wiki/Live_CD" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Live_CD</a></p> <p>you will find links to different flavours with download.</p> <p>There ...
36,742
<p>I would class myself as a typical small developer/independant designer and I recently purchased some new hardware for the office and thought I better organise myself better than I have in the past.</p> <p>So I am wondering how you all organise all your files etc so that you can find them easily enough, and relate t...
<p>We use a StringTemplateLoader to load our tempates which we got from the db (as Dan Vinton suggested)</p> <p>Here is an example:</p> <pre><code>StringTemplateLoader stringLoader = new StringTemplateLoader(); String firstTemplate = "firstTemplate"; stringLoader.putTemplate(firstTemplate, freemarkerTemplate); // It'...
<p>Implement configuration.</p> <p>Example : </p> <pre><code>@Configuraton public class FreemarkerConfig { @Autowired TemplateRepository tempRepo; @Autowired TemplateUtils tempUtils; @Primary @Bean public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration() { // Create new configuration bean ...
46,597
<p>I know how to use the OleDbConnection class to open an excel file and select from it, but is there a simple method to read the data from an excel file that has been read into a Stream? And is there also a similar method for QuickBooks?</p>
<blockquote> <p>When the function terminates, the following steps happen:</p> <ul> <li><p>The function’s return value is copied into the placeholder that was put on the stack for this purpose.</p></li> <li><p>Everything after the stack frame pointer is popped off. This destroys all local variables ...
<p>The local variable is copied to the return value. Copy constructors are called for non-trivial classes.</p> <p>If you return a pointer or reference to a local variable you will have trouble---just as your intuition suggested.</p>
34,688
<p>I've got a web application that I'm trying to optimize. Some of the controls are hidden in dialog-style <code>DIVs</code>. So, I'd like to have them load in via AJAX only when the user wants to see them. This is fine for controls that are mostly literal-based (various menus and widgets), but when I have what I call...
<p>Check out the <a href="http://www.telerik.com/products/aspnet-ajax/controls/ajax/overview.aspx" rel="noreferrer">RadAjax</a> control from Telerik - it allows you to avoid using UpdatePanels, and limit the amount of info passed back and forth between server and client by declaring direct relationships between calling...
<p>Step one is to make your "dirty" pieces self contained user controls</p> <p>Step two is to embed those controls on your consuming page</p> <p>Step three is to wrap each user control tag in their own Asp:UpdatePanel</p> <p>Step four is to ensure your control gets the data it needs by having it read from properties...
2,437
<p>On researching another question I noted that the <code>stat</code> function in Perl can take a dirhandle as its argument (instead of a filehandle or filename).</p> <p>However I can't find any examples of correct use of this - there are none in the Perl manual.</p> <p>Can anyone show an example of how to use it?</p...
<p>You use it in the same way you do for a file or filehandle:</p> <pre><code>#!/usr/bin/perl use strict; my $dir = shift; opendir(DIR, $dir) or die "Failed to open $dir: $!\n"; my @stats = stat DIR; closedir(DIR); my $atime = scalar localtime $stats[8]; print "Last access time on $dir: $atime\n"; </code></pre> <p>...
<p>I use Perl 5.10.1 on windows (ActivePerl) and doing stat on a dirhandle doesn't work. But doing a stat on the path string of the directory works.</p> <h1>works</h1> <pre><code> my $mtime = (stat( $directory ))[ 9 ]; print "D $directory $mtime\n"; </code></pre> <h1>this doesn't ("The dirfd function is unimpleme...
42,622
<p>Been a while since I've dealt with ASP.NET and this is the first time I've had to deal with master pages. Been following tutorials everything is fine except a problem I'm having with the footer.</p> <p>The master page has divs for topContent, mainContent and footerContent. In mainContent I have a ContentPlaceHold...
<p>This doesn't sound like a master page issue, this sounds like an HTML/CSS layouting issue. What you haven't stated is whether your DIVs are absolutely positioned or whether they occur within page flow.</p> <p>Normally, assuming you're NOT positioning those DIVs absolutely, the header DIV will be statically sized, t...
<p>A clearing div between maincontent and footercontent will help, but other things to watch out for, especially in sucky browsers like IE6 that don't clear or float well, are height and overflow. You're probably not, but if you're hiding overflow and setting a height, that truncates any content that flows past the hei...
30,676
<p>What are the minimum OS requirements for each of the .Net frameworks? E.g. for which version is it impossible to run each OS on:</p> <ul> <li>Windows 95</li> <li>Windows 98</li> <li>Windows 98SE</li> <li>Windows ME</li> <li>Windows NT 3.x</li> <li>Windows NT 4</li> <li>Windows 2000</li> </ul> <p>I believe all .Ne...
<p>1.x and 2.0 work all the way back to Win98 but stop before Windows 8 (not verified).</p> <hr> <p>.NET Framework 2.0 Supported Operating Systems <a href="http://msdn.microsoft.com/en-us/library/ms229070(VS.80).aspx" rel="noreferrer">according to Microsoft</a>:</p> <ul> <li>Windows 98</li> <li>Windows ME</li> <li>W...
<p><strong>Update</strong>: Apparently I was wrong. As pointed by other people, MSDN states 2.0 and below work on Win 98 as well.</p> <p>All .Net versions work on XP SP2 and above, although some classes also offer support for Vista specific features and fail gracefully on XP. I think 1.0 used to work on Windows 2000, ...
24,238
<p>I am pretty much the only person making check ins to the svn repo but for some reason over the past week Tortoise is reported that my WCF Service Reference directory is 'obstructed' and I cant commit my changes. If I have no even made any changes to the contents of that directory, why does svn report obstructed and ...
<p>You've probably deleted/moved some files / directories directly from the file system, and not through SVN commands. This can sometimes lead to a directory becoming obstructed if it can not work out the differences against the repository. </p> <p>Try performing a clean-up first, and if that fails, revert that direct...
<p>As an addendum to the answer above, I think it's more convenient to rename your current broken directory, check out the latest copy in the right folder, and copy your changed files.</p>
43,593
<p>I had assumed that the canonical form for operator+, assuming the existence of an overloaded operator+= member function, was like this:</p> <pre><code>const T operator+(const T&amp; lhs, const T&amp; rhs) { return T(lhs) +=rhs; } </code></pre> <p>But it was pointed out to me that this would also work:</p> <pr...
<p>With the edited question, the first form would be preferred. The compiler will more likely optimize the return value (you could verify this by placing a breakpoint in the constructor for T). The first form also takes both parameters as const, which would be more desirable.</p> <p>Research on the topic of <strong>...
<p>Actually, the second is preferred. As stated in the c++ standard,</p> <blockquote> <p>3.7.2/2: Automatic storage duration</p> <p>If a named automatic object has initialization or a destructor with side effects, it shall not be destroyed before the end of its block, nor shall it be eliminated as an ...
14,441
<p>I'm trying to use SQL developer, but it won't connect using the proxy I specify in the preferences. I guess it's because of some kind of certificate error? Not sure. I'm getting the error:</p> <p>No HTTP response received.</p> <p>javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX ...
<p>This most likely means that the web server you are connecting to by SSL uses a certificate issued by an unknown authority. You want to add the certificate to your keystore (on the client).</p> <p>See this <a href="http://www.java-samples.com/showtutorial.php?tutorialid=210" rel="nofollow noreferrer">article</a> for...
<p>One of the first rules of debugging errors: Google the error message you're getting, in quotes, like this: "unable to find valid certification path to". When I did this, I found lots of useful information that is probably relevant to you.</p>
18,478
<p>I am trying to make a div, that when you click it turns into an input box, and focuses it. I am using prototype to achieve this. This works in both Chrome and Firefox, but not in IE. IE refuses to focus the newly added input field, even if I set a 1 second timeout.</p> <p>Basically the code works like this:</p> <p...
<p>My guess is that IE hasn't updated the DOM yet when you make the call to focus(). Sometimes browsers will wait until a script has finished executing before updating the DOM.</p> <p>I would try doing the update, then doing </p> <pre><code>setTimeout("setFocus", 0); function setFocus() { editElement.focus(); }...
<p>What version IE? What's your DocType set to? is it strict, standards or quirks mode? Any javascript errors appearing (check the status bar bottom left for a little yellow warning sign) ? Enable error announcing for all errors via Tools > Options > Advanced. </p> <p>Oisin</p>
12,757
<p>In my work experience, most fresh out of school programmers are set right to creating reports for 6-12 months or so. While I see the benefit of doing something non-crucial, it seems to really discourage them. </p> <p>So my question is, should organizations allow newbies to work with someone experienced right off th...
<p>Ah, there really is nothing like exploiting interns for remedial jobs...</p> <p>Seriously though, you get back what you put in. Forcing them to do a thoughtless, thankless job for a long period of time is a quick way to build up a useless team member.</p>
<p>It depends on the report, and it depends on the job. Many reports are anything but trivial, and excellent SQL skills are needed to create a performant and properly maintainable back-end. If your newbies are good with SQL, let them cut their teeth on the queries. It will be a good way for them to learn the schema ...
23,485
<p>I want to do something like this:</p> <pre> <code> create table app_users ( app_user_id smallint(6) not null auto_increment primary key, api_key char(36) not null default uuid() ); </code> </pre> <p>However this results in a error, is there a way to call a function for a default value in mysql?</p> <p...
<p>No, you can't.</p> <p>However, you could easily create a trigger to do this, such as:</p> <pre> CREATE TRIGGER before_insert_app_users BEFORE INSERT ON app_users FOR EACH ROW SET new.api_key = uuid(); </pre>
<p>I'm not sure if the above answers are for an older version, but I saw somewhere that you can do this using the unhex() function. I tried it and it works. (maria db version 10.2)</p> <p>You can do </p> <pre><code>.... column_name binary(16) not null default unhex(replace(uuid(),'-','')) </code></pre> <p>and it ...
33,966
<p>I've been trying to solve this for weeks...</p> <p>My Goal is to search my inbox for the following messages:</p> <pre><code>Hello Hi Hey </code></pre> <p>Im using three files to do this for me. The first, a .forward file in my $HOME</p> <pre><code>"|IFS=' '&amp;&amp;exec usr/bin/procmail||exit 75 #username" </co...
<p>Procmail processes mail as it comes in, not when it's just sitting there in your mailbox. If you want to process mail that's already in your mailbox, you've got to pass it through procmail again, either by "bouncing" it to yourself, or by piping it through procmail. In a command line email client like mutt, you'd ...
<p>I think your primary concern before any other debugging is to verify that procmail is being run on your incoming e-mail messages.</p> <p>My suggestion is to make your .procmailrc file look like this (with nothing else)</p> <pre><code>VERBOSE=on LOGFILE=/tmp/procmail.log :0 fhbw | sed "s/^Subject:/&amp; --procmail...
40,330
<p>How do I write unit tests in .NET? </p> <p>Specifically Visual Studio 2005?</p>
<p>You can either use one of the Team Suite products, or use a 3rd party tool like <a href="http://www.nunit.org/index.php" rel="nofollow noreferrer">NUnit</a>.</p>
<p>In my opinion, <a href="http://www.mbunit.com/" rel="nofollow noreferrer">MBUnit</a> is the way to go. It's vastly superior to NUnit (very similar, but with Row Tests and Transaction support) and other MS tools (Team Suite was not really successful, I would discourage its use).</p> <blockquote> <p>MbUnit provides...
18,022
<p>I expect the column to be a VARCHAR2, in my Oracle Database.</p> <p>US Zips are 9.</p> <p>Canadian is 7.</p> <p>I am thinking 32 characters would be reasonable upper limit</p> <p>What am I missing?</p> <p>[EDIT] TIL: 12 is a reasonable answer to the question Thanks to everyone who contributed.</p>
<p>Skimming through <a href="http://en.wikipedia.org/wiki/Postal_codes" rel="noreferrer">Wikipedia's Postal Codes page</a>, 32 characters should be more than enough. I would say even 16 characters is good.</p>
<p>If you want to integrate postal codes in database then geonames database is best to use. Even though it is tough to use and understand but it is the largest geographical database available freely to users like us.</p> <p>All the other such database are more or less likely have same data and structure. They just rem...
42,085
<p>I seem to remember being able to print out (or locate) the specific switches that each -O&lt;num> option turns on. Can you remind?</p> <p>Thanks!</p>
<p>The <a href="http://gcc.gnu.org/gcc-4.3/changes.html" rel="nofollow noreferrer">list of new features on gcc 4.3</a> shows a way to do it, via an extension to the <code>--help</code> command line option:</p> <pre><code>gcc -c -Q -O3 --help=optimizers &gt; /tmp/O3-opts gcc -c -Q -O2 --help=optimizers &gt; /tmp/O2-opt...
<p>On many machines, '<code>info gcc</code>' will produce a wealth of information. Using '<code>gcc -v --help</code>' produced a very long listing of options from sub-processes (actually, 1001 lines on stdout, and 14 on stderr) on my Mac (PPC G4 and MacOS X 10.4.11).</p>
31,868
<p>I have a whole bunch of files with filenames using our lovely Swedish letters <strong>å å</strong> and <strong>ö</strong>. For various reasons I now need to convert these to an [a-zA-Z] range. Just removing anything outside this range is fairly easy. The thing that's causing me trouble is that I'd like to replace <s...
<p>You can use this code (Python)</p> <h1>Rename international files</h1> <pre><code># -*- coding: cp1252 -*- import os, shutil base_dir = "g:\\awk\\" # Base Directory (includes subdirectories) char_table_1 = "áéíóúñ" char_table_2 = "aeioun" adirs = os.walk (base_dir) for adir in adirs: dir = adir[0] + "\\...
<p>I would write this in C++, C#, or Java -- environments where I know for certain that you can get the Unicode characters out of a path properly. It's always uncertain with command-line tools, especially out of Cygwin.</p> <p>Then the code is a simple find/replace or regex/replace. If you can name a language it wou...
8,105
<p>How do I install a specific package, like derbytools, with Maven without specifying it as a dependency of project?</p>
<p>Here is a sample using the <code>mvn install</code> goal. I used windows style env vars in place of parameters you will need to provide.</p> <pre><code>mvn install:install-file -DgroupId=%DERBYTOOLS_GROUP_ID% \ -DartifactId=%DERBYTOOLS_ARTIFACT_ID% \ -Dversion=%DERBYTOOLS_VERSION% \ -Dpackaging=jar \ ...
<p>For Maven to be able to use a jar, the jar needs to be declared as a dependency.</p> <p>If you have a jar that doesn't already exist on a Maven repository you can install it to your local repository using the install-plugin's <a href="http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html" rel=...
37,891
<p>I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time.</p>
<p>Management Studio supports an undocumented feature that <a href="https://stackoverflow.com/questions/84209/vertical-line-after-a-certain-amount-of-characters-in-visual-studio">Visual Studio has as well</a>. It adds vertical guide lines to the editor window at specific column locations.</p> <p>Create a .reg file usi...
<p>Perhaps <a href="http://www.red-gate.com/products/SQL_Refactor/index.htm" rel="nofollow noreferrer">SQL Refactor</a> by Red Gate. You can define the desired layout of the code, and then simply use command "Lay Out SQL".</p> <p>When you install SQL Refactor it adds extra menu item to the Management Studio main menu....
43,086
<p>I'd like to hear from people who are using distributed version control (aka distributed revision control, decentralized version control) and how they are finding it. What are you using, Mercurial, Darcs, Git, Bazaar? Are you still using it? If you've used client/server rcs in the past, are you finding it better, wor...
<p>I've been using Mercurial both at work and in my own personal projects, and I am really happy with it. The advantages I see are:</p> <ol> <li><strong>Local version control.</strong> Sometimes I'm working on something, and I want to keep a version history on it, but I'm not ready to push it to the central repositor...
<blockquote> <p>Using Subversion</p> </blockquote> <p>Subversion isn't distributed, so that makes me think I need a wikipedia link in case people aren't sure what I'm talking about :)</p>
4,647
<p>Is there a way to <strong>increase the font-size</strong> in the Firefox extension Firebug?</p>
<ol> <li>Right click on the bug icon in the status bar.</li> <li>Select "Open Firebug in New Window"</li> <li>Select "View" > "Text Size" > "Increase Text Size"</li> </ol> <p>The changes should stick if you revert back to opening Firebug in the same window.</p> <p><strong>Update</strong></p> <p>In new versions you c...
<p>Another way: You can edit the value for <code>extensions.firebug.textSize</code> in <code>about:config</code>. Setting the value to <code>0</code> resets the font size to the default.</p>
32,491
<p>Is there a simpler interface for end users to run "queries" on pre-existing SqlServer Analysis Service cubes? I'm looking for a way to deploy the cubes and allow the users to work with the data through a simpler interface than BIDS. Is this even possible?</p>
<p>I would recommend Excel too. It is an environment that your users are familiar with anyway, and they will be able to perform additional analysis (totals etc) without learning any new interfaces.</p> <p>However, I would advise against pivot tables as a method of getting the data into Excel. I once worked on a projec...
<p>Dundas has a set of tools that let you drag and drop dimensions/hierarchies/measures to create visualizations like charts and/or grids. The product name is Dundas Chart for ASP.NET Enterprise Edition, and it has a free demo.</p> <p>ProClarity also had a suite of tools. Not sure how you get those tools any longer, ...
7,244
<p>I'm building a class that automatically loads a DB record, looks at each DB column name, and fills the associated textbox/label/literal/etc, if it has the same name. I got this idea from Rails, in case that helps clarify what I'm trying to do.</p> <pre><code>public string presentData(Page thisForm) { // .. for eac...
<p>FindControl is not recursive, so it only finds top level controls, not controls that are nested within other controls. See <a href="https://blog.codinghorror.com/recursive-pagefindcontrol/" rel="nofollow noreferrer">this article</a> for an example of a recursive version of FindControl.</p>
<p>Have you thought about filling your controls client side? JQuery might be a good place to start. You'd generate the Javascript/JQuery to do the populating on the server, then JQuery takes care of searching for the controls. Very efficient.</p>
35,597
<p>I met an interesting issue about C#. I have code like below.</p> <pre><code>List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;(); int variable = 0; while (variable &lt; 5) { actions.Add(() =&gt; variable * 2); ++ variable; } foreach (var act in actions) { Console.WriteLine(act.Invok...
<p>Yes - take a copy of the variable inside the loop:</p> <pre><code>while (variable &lt; 5) { int copy = variable; actions.Add(() =&gt; copy * 2); ++ variable; } </code></pre> <p>You can think of it as if the C# compiler creates a "new" local variable every time it hits the variable declaration. In fact ...
<p>It is called the closure problem, simply use a copy variable, and it's done.</p> <pre><code>List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;(); int variable = 0; while (variable &lt; 5) { int i = variable; actions.Add(() =&gt; i * 2); ++ variable; } foreach (var act in actions) { ...
34,135
<p>I have a service that sometimes calls a batch file. The batch file takes 5-10 seconds to execute:</p> <pre><code>System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process proc.StartInfo.FileName = fileName; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.H...
<p>Here is what i use to execute batch files:</p> <pre><code>proc.StartInfo.FileName = target; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.UseShellExecute = false; proc.Start(); proc.WaitForExit ( (timeout &lt;= 0...
<p>Here is the solution. The solution is not clear because I have changed so many time the code and now it's working!</p> <p>I have tried to use a Account of User, and it's not what worked. Use LocalSystem. Here is the code that execute, mostly what Kevin gave me.</p> <pre><code> System.Diagnostics.Process...
47,124
<p>I want to get the headers only from a curl request</p> <p><code>curl -I www.google.com</code></p> <p>All grand. Now I want to do that but to pass in post data too:</p> <p><code>curl -I -d'test=test' www.google.com</code></p> <p>But all I get is:</p> <p><code>Warning: You can only select one HTTP request!</code>...
<p>The <code>-I</code> option tells curl to do a HEAD request while the <code>-d'test=test'</code> option tells curl to do a POST, so you're telling curl to do two different request types.</p> <pre><code>curl -s -d'test=test' -D- -o/dev/null www.google.com </code></pre> <p>or, on Windows:</p> <pre><code>curl -s -d'...
<p><code>-d</code> means you are sending form data, via the <code>POST</code> method. <code>-I</code> means you are just peeking at the metadata via <code>HEAD</code>.</p> <p>I'd suggest either</p> <ul> <li>Download to <code>/dev/null</code> and write the headers via the <code>-D headerfile</code> to the file <code>h...
36,501
<p>I'm implementing a secure WCF service. Authentication is done using username / password or Windows credentials. The service is hosted in a Windows Service process. Now, I'm trying to find out the best way to implement <em>authorization</em> for each service operation.</p> <p>For example, consider the following meth...
<p>For question 1, it's best to perform authorization first. That way, you don't leak validation error messages back to unauthorized users.</p> <p>BTW, instead of using a home-grown authentication method (which I assume is what your CheckAccessPermission is), you might be able to hook up to WCF's out-of-the-box suppo...
<p>For question 1, it's best to perform authorization first. That way, you don't leak validation error messages back to unauthorized users.</p> <p>BTW, instead of using a home-grown authentication method (which I assume is what your CheckAccessPermission is), you might be able to hook up to WCF's out-of-the-box suppo...
17,487
<p>What makes a language strongly typed? I'm looking for the most important aspects of a strongly typed language.</p> <p>Yesterday I asked if PowerShell was strongly typed, but no one could agree on the definition of "strongly-typed", so I'm looking to clarify the definition.</p> <p>Feel free to link to wikipedia or ...
<p>The term "strongly typed" has no agreed-upon definition.</p> <p>It makes a "great" argument in a flamewar, because whenever someone is proven wrong, they can just redefine it to mean whatever they want it to mean. Other than that, the term serves no real purpose.</p> <p>It is best to just not use the term, or, if ...
<p>Strongly typed means you declare your variables of a certain type, and your compiler will throw a hissy fit if you try to convert that variable to another type without casting it.</p> <p>Example (in java mind you):</p> <pre><code>int i = 4; char s = i; // Type mismatch: cannot convert from int to char </code></pre...
14,764
<p>I would like to save data in cookies (user name, email address, etc...) but I don't the user to easily read it or modify it. I need to be able able to read the data back. How can I do that with php 5.2+?</p> <p>It would be used for "welcome back bob" kind of feature. It is not a replacement for persistence or sessi...
<p>We use mcrypt in our projects to achieve encryption. Below is a code sample based on content found on the internet:</p> <pre><code>&lt;?php class MyProjCrypt { private $td; private $iv; private $ks; private $salt; private $encStr; private $decStr; /** * The constructor initializ...
<p>If you absolutely must do this then you can use the symmetric encryption functionality in <code>mcrypt</code>.</p> <p><a href="http://php.net/mcrypt" rel="nofollow noreferrer">http://php.net/mcrypt</a></p>
20,933
<p>We are about to develop a web app from scratch using ASP.Net, and would like it to be as platform-agnostic as possible. As far as I know, the only two options for this are IIS on windows, and Mono (via Apache) on Linux.</p> <p>The app will be follow the MVC architecture, so with all of this in mind, how difficult i...
<p>If you do .NET 1.1, there won't be any problems, but if you do .NET 2.0 keep in mind MONO doesn't support .NET 2.0 100%, so you'll have to read up on the gotchas.</p> <p>The mono project <a href="http://www.mono-project.com/ASP.NET" rel="nofollow noreferrer">talks about this on their site</a>. But in summary, they...
<p>If you are talking about ASP.NET MVC I am not sure that it is supported by MONO.</p> <p>I am a big fan of ASP.NET, as it is what I do for a living, but I personally do not find that MONO is really a production ready, viable solution.</p> <p>If you must be able to run under IIS or Apache you might consider differen...
48,197
<p>Modal dialogs are evil, but I keep reading "You should remove modal dialogs <i>when possible</i>"</p> <p>When isn't it possible to remove modal dialogs? I mean, what are some truly modal tasks that force us to use evil modal dialogs?</p> <p>The most common given example is the "Do you want to Save?" I think this...
<h3>Use Cases for Modal Dialogs</h3> <ul> <li>blocking the application flow until information required to continue is entered, as for example a password in a login process.</li> <li>collecting application configuration options in a centralized dialog. In such cases, typically the changes are applied upon closing the ...
<p>Imagine an application which needs to open a dialog for some actions. Now imagine that these would be non-modal dialogs: while one dialog is open, you could change the selection or even worse - invoke a different command which itself opens another dialog. Now imagine the these dialogs would be modal: then you would ...
47,175
<p>E.g.</p> <p>What's best out of these:</p> <pre><code>std::string f() {} </code></pre> <p>or </p> <pre><code>const std::string&amp; f() {} </code></pre>
<p>A function <strong>should never return</strong> a reference to a local object/variable since such objects go out of the scope and get destroyed when the function returns. </p> <p>Differently, the function can return a const or non const reference to an object whose scope is not limited by the function context. Typi...
<p>If you return a reference to a variable that is local to the function then you're going to end up with issues (depending on the compiler and its settings).</p> <p>If you return a reference to an instance that's still in scope when the function returns then it will be faster, as no copy of the string is being create...
34,763
<p>In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I wanted to see if t...
<p>You can use various ways to handle this situation, depending on your source control system. </p> <p>Private branches: Allow you to check in and work on code while you go, merging back and forth at appropriate times.</p> <p>Shelvesets/pacakaged changesets: Allow you to store changesets and send them around for revi...
<p>I would personally not approve of this because sometimes that's the best way to catch problem code with less experienced developers (by seeing it as they are working on it) and when you "check in early and often" you can rollback to earlier changes you made (as you were developing) if you decide that some changes yo...
6,639
<p>I have written a <a href="http://osirisdevelopment.com/BatteryBar" rel="nofollow noreferrer">toolbar</a> that runs on the taskbar. Unfortunately, after it is installed, the user has to enable it manually. Is there a way to tell explorer to open (or close) a given toolbar?</p> <p>I would like for the installer, NS...
<ul> <li><a href="http://www.codeproject.com/KB/atl/rbdeskband.aspx?display=PrintAll&amp;select=1659628#xx1659628xx" rel="noreferrer">This CodeProject comment does it by simulating key presses</a></li> <li>Vista+ has API to do this, with <a href="http://msdn.microsoft.com/en-us/library/bb774485(VS.85).aspx" rel="norefe...
<p>if you check well, google toolband exists while an exe is running behind (GoogleDesktop.exe) so if you insist on the way google or search bar are instantiated you should check again TrayBandSiteService and make a support exe...</p>
45,184
<p>I've seen some code where a <em>Class</em> is imported, instead of a namespace, making all the static members/methods of that class available. Is this a feature of VB? Or do other languages do this as well?</p> <p>TestClass.vb</p> <pre><code>public class TestClass public shared function Somefunc() as Boolean...
<p>One of the reasons this feature is in place is to emulate Visual Basic 6.0's GlobalMultiUse Option for Instancing. Visual Basic 6.0 doesn't have the ability to make modules public across a DLL boundary. Instead you set the instancing property to <code>GlobalMultiUse</code>. It is used mainly for utility classes like...
<p>wait, wait, wait.... </p> <p>I found just this morning that we could derived all the objects (class-s) inside any class that need their references using this method / function;</p> <pre><code>Protected Overrides Sub Finalize() MyBase.Finalize() End Sub </code></pre>
30,226
<p>How do I pick a random element from a set? I'm particularly interested in picking a random element from a HashSet or a LinkedHashSet, in Java. Solutions for other languages are also welcome. </p>
<pre><code>int size = myHashSet.size(); int item = new Random().nextInt(size); // In real life, the Random object should be rather more shared than this int i = 0; for(Object obj : myhashSet) { if (i == item) return obj; i++; } </code></pre>
<p>after reading this thread, the best i could write is:</p> <pre><code>static Random random = new Random(System.currentTimeMillis()); public static &lt;T&gt; T randomChoice(T[] choices) { int index = random.nextInt(choices.length); return choices[index]; } </code></pre>
15,165
<p>Talking from a 'best practice' point of view, what do you think is the best way to insert HTML using PHP. For the moment I use one of the following methods (mostly the latter), but I'm curious to know which you think is best.</p> <pre><code>&lt;?php if($a){ ?&gt; [SOME MARKUP] &lt;?php } else{ ?&gt; [SOME OTH...
<p>If you are going to do things that way, you want to separate your logic and design, true. </p> <p>But you don't need to use Smarty to do this. </p> <p>Priority is about mindset. I have seen people do shocking things in Smarty, and it eventually turns into people developing sites <strong>in</strong> Smarty, and the...
<p>Do NOT use smarty - PHP is a templating system in itself. Consider using this syntax:</p> <pre><code>&lt;?php if($a):?&gt; [SOME MARKUP] &lt;?php else: ?&gt; [SOME OTHER MARKUP] &lt;? endif; ?&gt; </code></pre>
32,669
<p><a href="http://blogs.msdn.com/larryosterman/archive/2004/09/10/228068.aspx" rel="nofollow noreferrer">This article</a> gives a good overview on why structured exception handling is bad. Is there a way to get the robustness of stopping your server from crashing, while getting past the problems mentioned in the arti...
<p>Break your program up into worker processes and a single server process. The server process will handle initial requests and then hand them off the the worker processes. If a worker process crashes, only the users on that worker are affected. Don't use SEH for general exception handling - as you have found out, it c...
<p>Fix the bugs in your program ? ;)</p> <p>Personally I'd keep the SEH handlers in, have them dump out a call stack of where the access violation or whatever happened and fix the problems. The 'sometimes the server hangs' problem is probably due to deadlocks caused by the thread that had the SEH exception keeping som...
19,872
<p>I am trying to run a query that will give time averages but when I do... some duplicate records are in the calculation. how can I remove duplicates?</p> <p>ex.</p> <p>Column 1 / 07-5794 / 07-5794 / 07-5766 / 07-8423 / 07-4259</p> <p>Column 2 / 00:59:59 / 00:48:22 / 00:42:48/ 00:51:47 ...
<p>To get the average of the minimum values for each incnum, you could write this SQL</p> <pre><code>select avg(min_time) as avg_time from (select incnum, min(col2) as min_time from inc group by incnum) </code></pre> <p>using the correct average function for your brand of SQL.</p> <p>If you're doing this in Acce...
<p>SELECT DISTINCT()</p> <p>or</p> <p>GROUP BY ()</p> <p>or</p> <p>SELECT UNIQUE()</p> <p>... but usually averages <em>have</em> duplicates included. Just tell me this isn't for financial software, I wont stand for <a href="http://scienceblogs.com/goodmath/2008/09/bad_probability_and_economic_d.php" rel="nofollow...
22,837
<p>We need is to push sports data to a number of different client types such as ajax/javascript, flash, .NET and Mac/iPhone. Data updates need to only be near-real time with delays of several seconds being acceptable. </p> <p>How to best accomplish this?</p>
<p>The best solution (if we're talking .NET) seem to be to use WCF and streaming http. The client makes the first http connection to the server at port 80, the connection is then kept open with a streaming response that never ends. (And if it does it reconnects).</p> <p>Here's a sample that demonstrates this: <a href=...
<p>I would go with XML. XML is widely supported on all platforms and has lots of libraries and tools available for it. And since it's text, there are no issues when you pass it between platforms.</p> <p>I know JSON is another alternative, but I'm not familiar enough with it to know whether or not to recommend it in ...
7,367
<p>Given a result set, how can I determin the actual names of the fields specified in the query (NOT their aliases).</p> <pre><code>$query = "SELECT first AS First_Name, last AS Last_Name FROM people"; $dbResult = mysql_query($query); $fieldCount = mysql_num_fields($dbResult); for ($i=0; $i&lt;$fieldCount; $i++) { ...
<p>If you are using MySQLi:</p> <p><a href="http://www.php.net/manual/en/mysqli-result.fetch-field.php" rel="noreferrer">http://www.php.net/manual/en/mysqli-result.fetch-field.php</a></p> <p>The field object has a "orgname" property.</p> <p>The "classic" MySQL equivalent function doesn't report back the original col...
<p>I'm not 100% sure about this, but I would say: there is no way.</p> <p>The MySQL gives you back the result set, nothing more. It does not return the select statement nor any details about it.</p> <p>So you cannot get the original field names because the server will provide you the information you asked: alias name...
32,987
<p>Are there any tools that auto-generate the hibernate POJOs by gathering information from the database?</p> <p>I made a perl script to do this after the schema got changed for the third or fourth time in a project i'm working with and just wondered if there is any established tool that will do this for me as my scri...
<p>See <a href="https://docs.jboss.org/tools/latest/en/hibernatetools/html/reverseengineering.html" rel="nofollow noreferrer">hibernate reverse engineering</a></p>
<p>See hibernate tools</p> <p><a href="http://www.hibernate.org/hib_docs/tools/reference/en/html_single/" rel="nofollow noreferrer">http://www.hibernate.org/hib_docs/tools/reference/en/html_single/</a></p> <p>Not sure about from the schema to Pojos but definitely from hbm.xml files to pojos.</p> <p>Maven plugins als...
39,795
<p>does anybody know how to refresh the Internet Explorer (like by pressingthe F5 key) but using some "backdoor" like PostMessage or SendMessage? The internet Explorer Window is not active so I can't use the keyboard.</p> <p>Thanks</p> <p>(Language doesnt matter)</p>
<p>If you can identify what is to be replaced through a regular expression, I recommend using the optional task <strong>replaceregexp</strong>. Here's the doc: <a href="http://ant.apache.org/manual/Tasks/replaceregexp.html" rel="nofollow noreferrer">http://ant.apache.org/manual/Tasks/replaceregexp.html</a> You can call...
<p>If it is an XML file, then you could also call an XSLT transform</p>
28,418
<p>I'm developing a todo list application. I'm looking for any way to alert the user when a task becomes due, even if the app is not running. Is there any way to set the program to run at a specified time w/out user interaction? Or a way to bring up an alert anyway?</p> <p><b>Edit:</b> How can I add an item to the ...
<p>No, not until the <a href="http://www.engadget.com/2008/06/09/iphone-push-notification-service-for-devs-announced/" rel="nofollow noreferrer">push notification service</a> gets released.</p>
<p>But even once push is released, that won't enable you to have the application independently alert the user. You would have to run a server that would push notifications to people once a task is approaching due, which means you would have to have everyone's task list synced to your server.</p>
45,560
<p>I want to know what a "<em>virtual base class</em>" is and what it means.</p> <p>Let me show an example:</p> <pre><code>class Foo { public: void DoSomething() { /* ... */ } }; class Bar : public virtual Foo { public: void DoSpecific() { /* ... */ } }; </code></pre>
<p>Virtual base classes, used in virtual inheritance, is a way of preventing multiple "instances" of a given class appearing in an inheritance hierarchy when using multiple inheritance.</p> <p>Consider the following scenario:</p> <pre><code>class A { public: void Foo() {} }; class B : public A {}; class C : public A ...
<p>Virtual classes are <strong>not</strong> the same as virtual inheritance. Virtual classes you cannot instantiate, virtual inheritance is something else entirely.</p> <p>Wikipedia describes it better than I can. <a href="http://en.wikipedia.org/wiki/Virtual_inheritance" rel="nofollow noreferrer">http://en.wikipedia....
4,169
<p>I'm trying to use CSS (<strong>under <code>@media print</code></strong>) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, so simply using a fixed-width font is not an option.</p>...
<p>The CSS font-size property accepts <a href="http://htmlhelp.com/reference/css/units.html#length" rel="nofollow noreferrer">length units</a> that include absolute measurements in inches or centimeters: </p> <blockquote> <p>Absolute length units are highly dependent on the output medium, and so are less useful t...
<p>I don't know of a way to do this in CSS. I think your best bet would be to use Javascript: </p> <ol> <li>Put the text in a div</li> <li>Get the dimensions of the div</li> <li>Make the text smaller if necessary</li> <li>Go back to step 2 until the text is small enough</li> </ol> <p>Here's some <a href="http://www.d...
19,198
<p>Is there any way to run ASDoc on your project via the Flex Builder UI? Or, is there a good (preferably free) plugin that will do so?</p> <p>If there is no UI for it, does someone have a link to a tutorial on how to set it up to be automatic when I build my project, maybe via Ant (which I've never used, but am more...
<p>Here are some links to ant tasks that run AsDoc for you:</p> <ul> <li><a href="http://www.ericfeminella.com/blog/2007/06/07/asdocanttask-project-for-eclipse/" rel="nofollow noreferrer">one from Eric Feminella</a></li> <li><a href="http://www.herrodius.com/blog/85" rel="nofollow noreferrer">one from Christophe Herre...
<p><a href="http://www.idefactory.com/" rel="nofollow noreferrer">This tool</a> says it does that in a single click on the features page, although it may be a bit more than you are looking for.</p>
26,030
<p>Can anyone point me out, how can I parse/evaluate HQL and get map where key is table alias and value - full qualified class name.</p> <p>E.g. for HQL</p> <blockquote> <p>SELECT a.id from Foo a INNER JOIN a.test b</p> </blockquote> <p>I wish to have pairs:</p> <p>a, package1.Foo</p> <p>b. package2.TestClassNam...
<p>Hardly a good way of doing it, but it seems you can get the AST through some internal interfaces and traverse this:</p> <pre><code>QueryTranslator[] translators = hqlPlan.getTranslators(); AST ast = (AST)((QueryTranslatorImpl)translators[0]).getSqlAST(); new NodeTraverser(new NodeTraverser.VisitationStrategy() ...
<p>I found right solution for my question. Your original post was almost correct except that part:</p> <pre><code>if(node.getType() == SqlTokenTypes.FROM_FRAGMENT || node.getType() == SqlTokenTypes.JOIN_FRAGMENT) { FromElement id = (FromElement)node; System.out.println(node+": "+id.getClassAlias()+" - "+id.getClassN...
41,968
<p>I have a FooController that responds to HTML and JS (AJAX) queries:</p> <pre><code># app/controllers/foo_controller.rb: class FooController &lt; ApplicationController layout 'foo' def bar respond_to do |format| format.html # foo/bar.html.erb format.js # foo/bar.js.erb end end end </code>...
<p>The most recent <a href="http://railscasts.com/episodes/136-jquery" rel="noreferrer">Railscast covers this topic (using jQuery)</a>.</p> <p>I'm not quite seeing where you might be going wrong, but here's a snippit from the Railscast that works just fine to render a partial:</p> <pre><code>// views/reviews/create.j...
<p>Try the following;</p> <pre><code>class FooController &lt; ApplicationController layout 'foo' def bar respond_to do |format| format.html format.js { render :layout =&gt; false } end end end </code></pre> <p>Hope that helps.</p> <p>J.K.</p>
38,521