input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to simulate memory allocation errors <p>My C application uses 3rd libraries, which do their own memory management. In order to be robust, my application has code to deal with failures of library functions due to lack of free memory.</p> <p>I would like to test this code, and for this, I need to simulate failures d...
<p>You can use <code>ulimit</code> to limit the amount of resources a user can use, including memory. So you create a test user, limit their memory use to something just enough to launch your program, and watch it die :)</p> <p>Example:</p> <pre><code>ulimit -m 64 </code></pre> <p>Sets a memory limit of 64kb.</p>
Is there a .NET OS abstraction layer to make OS calls work cross-platform? <p>I really want to write .NET apps that run on any platform (PC, Linux and Mac). I am not really concerned about UI capabilities because these are mostly background services. I have heard of MONO and that it allows you to write .NET apps that...
<p>Yes, Mono has the windows service stuff ported to Linux, but you are going to have to think of a better way to store configuration settings than Registry... Using XML files for instance would be cross platform.</p> <p>You should also check out mono's wiki on how to develop portable applications <a href="http://www....
PHP GD, imagecreatefromstring( ); how to get the image dimensions? <p>Normally I use <code>imagecreatefromjpeg()</code> and then <code>getimagesize()</code>, but with Firefox 3 I need to go round this different. So now im using <code>imagecreatefromstring()</code>, but how do I retreive the image dimensions now?</p>
<p><code>imagesx()</code> and <code>imagesy()</code> functions seem to work with images made with <code>imagecreatefromstring()</code>, too.</p>
What is the best online book service for software development references? <p>I'm a member of ACM, and I have limited access to both Books 24x7 and Safari Books Online, however if I was interested in moving up to a full account for greater access to other books what online book service would you recommend?</p>
<p><a href="http://www.safaribooksonline.com/whysafari/try-safari.php" rel="nofollow">Safari Books Online</a> has a corporate subscription service which companies appreciate.</p>
In ASP.NET how you get the physcial file path when HttpContext.Current is NULL? <p>I'm working with DotNetNuke's scheduler to schedule tasks and I'm looking to get the physical file path of a email template that I created. The problem is that HttpContext is NULL because the scheduled task is on a different thread and t...
<p><a href="http://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.mappath.aspx">System.Web.Hosting.HostingEnvironment.MapPath</a> is what you're looking for. Whenever you're using the Server or HttpContext.Current objects, check first to see if <a href="http://msdn.microsoft.com/en-us/library/s...
Caching paginated results, purging on update - how to solve? <p>I've created a forum, and we're implementing an apc and memcache caching solution to save the database some work.</p> <p>I started implementing the cache layer with keys like "Categories::getAll", and if I had user-specific data, I'd append the keys with ...
<p>Just an update: I decided that Josh's point on data usage was a very good one. People are unlikely to keep viewing page 50 of a forum.</p> <p>Based on this model, I decided to cache the 90 latest threads in each forum. In the fetching function I check the limit and offset to see if the specified slice of threads is...
Rails and Gmail SMTP, how to use a custom from address <p>I've got my Rails (2.1) app setup to send email via Gmail, however whenever I send an email no matter what I set the from address to in my ActionMailer the emails always come as if sent from my Gmail email address. Is this a security restriction they've put in p...
<p>I believe it's just something Gmail does when mail is sent through its SMTP, as it was mentioned that they do this on a tutorial about using their SMTP to send mail.</p>
How do I access cookies within Flash? <p>I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible?</p> <p>Let's see I let a user set a variable foo and I store it using any web programming language. I can access it easily via that language, but I would like to access it via the Fl...
<p>If you just want to store and retrieve data, you probably want to use the SharedObject class. See <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html">Adobe's SharedObject reference</a> for more details of that.</p> <p>If you want to access the HTTP cookies, you'll need t...
What are the bigger hurdles to overcome migrating from Winforms to WPF? <p>I've been developing Winforms applications in C# for a few years now and have been interested in moving future development toward WPF, mainly because of the positive things I've been hearing about it. But, I'm wondering what sort of hurdles oth...
<p>I'm not sure I can give you just one hurdle, because it is a complete departure from WinForms. My suggestion is get Adam Nathan's WPF Unleashed, forget everything you know about building UI's with any previous technology (Winforms, MFC, Java) and begin again at square one. </p> <p>If you try and do it any other w...
likely()/unlikely() macros in the Linux kernel - how do they work? What's their benefit? <p>I've been digging through some parts of the Linux kernel, and found calls like this:</p> <pre><code>if (unlikely(fd &lt; 0)) { /* Do something */ } </code></pre> <p>or</p> <pre><code>if (likely(!err)) { /* Do somethin...
<p>They are an instruction to the compiler to emit instructions that will cause branch prediction to favour the "likely" side of a jump instruction. This can be a big win, if the prediction is correct it means that the jump instruction is basically free and will take zero cycles. On the other hand if the prediction is ...
Use of the Exception class in c# <p>Errors that occur deep down in a data access layer or even higher up, (say within ADO.net operations for example) rarely make much sense to an end user. Simply bubbling these errors up to a UI and displaying them will usually achieve nothing except frustration for an end user.</p> <...
<p>It is just slightly horrible.</p> <p>If you are showing an error to the end user, the user is supposed to be able to act about it. In "The list of customer names your requested could not be displayed." case, your user will just think "so what?" On all of these cases, just display a "something bad happened" message....
Database Choice for a C# 2008 front end <p>I was wondering what and why you would choose to be able to make a database that can support no more than 100 users with no more than 10 using it at once with a Visual Studio 2008 C# Windows Form front end to access it by. I have to access the database over a network connectio...
<p>If it is not for comercial purposes you can try SQL Server 2008 Express. It can integrate nicely with Visual Studio 2008 for development and has support for LINQ, Entity Data Model and ADO.NET Entity Framework to make it easy to create next generation data-enabled applications.</p> <p><a href="http://www.microsoft....
Not getting emails from ExceptionNotifier <p>I followed this <a href="http://svn.rubyonrails.org/rails/plugins/exception_notification/README" rel="nofollow">tutorial</a> on configuring the Rails plugin ExceptionNotifier.</p> <p>I know that I have ActionMailer configured correctly because I am getting mail from other f...
<p>You're using the SVN version of the plugin, which is probably unmaintained. <a href="http://github.com/rails/exception_notification/tree/master" rel="nofollow">Latest version can be found here</a>.</p> <p>Second thing which you can do is check the production log. Mailings get written to the log, so you'll see if Ra...
Is there a Perl solution for lazy lists this side of Perl 6? <p>Has anybody found a good solution for lazily-evaluated lists in Perl? I've tried a number of ways to turn something like </p> <pre><code>for my $item ( map { ... } @list ) { } </code></pre> <p>into a lazy evaluation--by tie-ing @list, for example. I'm ...
<p>As mentioned previously, for(each) is an eager loop, so it wants to evaluate the entire list before starting.</p> <p>For simplicity, I would recommend using an iterator object or closure rather than trying to have a lazily evaluated array. While you <em>can</em> use a tie to have a lazily evaluated infinite list, ...
Filtering duplicate newsgroup posts from Google <p>I have the constant need to Google error messages to try to find out what they mean and what solutions people might have. Usually those error messages were posted in some newsgroup. Unfortunately, Google's results (even when it says "similar results removed") usually c...
<p>Try using a google custom search like Dan Appleman's <a href="http://www.searchdotnet.com/" rel="nofollow">SearchDotNet</a> first. That will eliminate a lot of duplicates.</p>
How should I organize my ASP.Net themes and common CSS files <p>I am currently working on a project where a programmer who fancied themselves a graphic designer attempted their hand at ASP.Net themes. The CSS is pretty bad, but that is another question altogether.</p> <p>What I really need help with is the best way to...
<p>You should just include the standard/common css in the website and include it in the head of the masterpage instead of placing it in themes.</p>
VisualStudio using BootCamp/VMWare on OS X <p>Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and a 320GB hard drive. I plan on doing some .net development on it using a BootCamp/VMWare combo since VMWare grants access to the bootcamp partition.</p> <p>What is a recommended size for a BootCamp partition ...
<p>I use VMWare Fusion 2.0 on my MacBook Pro and I wouldn't have it any other way.</p> <p>I'd strongly recommend getting a min of 4gb RAM is you're going to run Windows + VS 2008 in virtualisation.</p> <p>I have a 2gb RAM for my VM and you do notice a bit of chugging, particularly when you are compiling a large solut...
How many unit tests should I write per function/method? <p>Do you write one test per function/method, with multiple checks in the test, or a test for each check?</p>
<p>One test per check and super descriptive names, per instance:</p> <pre><code>@Test public void userCannotVoteDownWhenScoreIsLessThanOneHundred() { ... } </code></pre> <p>Both only one assertion and using good names gives me a better report when a test fails. They scream to me: "You broke THAT rule!".</p>
USRP2: Number of A/D Converters <p>Why are there two A/D converters on the USRP2 board if you can only use one RX daughtercard?</p>
<p>Most of the daughterboards do quadrature downconversion and produce analog I &amp; Q. For those daughterboards we use 1 A/D for I and another one for Q.</p>
Report generation <p>I am writing a web app using TurboGears, and in that app the users must be able to generate different reports. The data the reports need is stored in a database (MySQL). The reports must be returned either as a easily printable html document, or a pdf file.</p> <p>I have previously used jasper and...
<p><a href="http://appyframework.org/pod.html" rel="nofollow">Pod</a> is my favorite solution to your problem.</p>
Changing Hostname / IP Address of Windows System Mounted as an Image <p>I'm looking for a way to change the hostname and IP address of a Windows XP system that is mounted via a loop-back image on a Linux system. So basically I have access to the Windows XP system on a file level, but I cannot execute any programs on it...
<p>You can use <a href="http://home.eunet.no/~pnordahl/ntpasswd/" rel="nofollow"><code>chntpw</code></a> tool to edit Windows registry offline. Here's an example of <a href="http://home.eunet.no/~pnordahl/ntpasswd/regedit.txt" rel="nofollow">how to use it</a>.</p> <p>The keys you're looking for are these:</p> <pre><c...
interval rails caching <p>I need to cache a single page. I've used ActionController's caches_page for this. But now, I'd like to expire AND regenerate it once in every 10 minutes. What are my options?</p> <p>later: I'd like to not use any external tools for this, like cron. The important point is <strong>interval-base...
<p>You can also use <a href="http://code.google.com/p/timedcachedfragment/" rel="nofollow">this</a> if you want to have fragments timeout.</p>
Developing MS Word add-in <p>Anyone knows of a good tool for developing add-ins for Word in .net? Hopefully something that supports both office 2003 and 2007.</p> <p>Thanks.</p>
<p>There are lots of options for development tools for Office. The most obvious one is of course Office itself. It has rich support for macros and VBA. You could also use SharePoint to extend document sharing and management functionality. But if your add-in is more complex than can be handled inside of Office, I sugg...
How does nunit work? <p>Can someone explain me how it works, starting from when you select to run a test</p>
<p>When you select to run a test, </p> <ul> <li>it will create an instance of the parent class of that test method. </li> <li>It then proceeds to run the method marked with TestFixtureSetup attribute if one exists (once for the the test class).</li> <li>Next is the method marked with the Setup attribute is called if o...
What are some ADFS alternatives for doing single sign on for an ASP.NET app with users in active directory? <p>Needs to be secure and able to handle thousands of users.</p>
<p>Check out ADAM and AzMan.</p> <p>ADAM is Active Directory Application Mode. There is a how-to guide at: <a href="http://msdn.microsoft.com/en-us/library/ms998331.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms998331.aspx</a></p> <p>AzMan is Authorization Manager. There is a how-to guide at: <a hr...
Should domain objects and simple JavaBeans be unit tested? <p>Should simple JavaBeans that have only simple getters and setters be unit tested?? </p> <p>What about Beans with some logic in getters and setters?</p>
<p>You should not write tests which:</p> <ul> <li>Test the language or the IDE (i.e. automatically generated getters and setters)</li> <li>Add no value to your test harness and kill your enthusiasm for Unit Testing</li> </ul> <p>The same applies for .NET objects which only have properties (sometimes called 'Info' obj...
How to configure asp.net process to run under a domain account? <p>I would like to configure asp.net process to run under an account with domain credentials. My requirement is to access some files on a network share.</p> <p>What are the steps for this? Is there any built-in account I can use?</p>
<p>Check this article from MSDN.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms998297.aspx">How To: Create a Service Account for an ASP.NET 2.0 Application</a></p> <p>*This How To shows you how to create and configure a custom least-privileged service account to run an ASP.NET Web application. By default,...
How can I detect, using php, if the machine has oracle (oci8 and/or pdo_oci) installed? <p>How can I detect, using php, if the machine has oracle <code>(oci8 and/or pdo_oci)</code> installed?</p> <p>I'm working on a <code>PHP</code> project where some developers, such as myself, have it installed, but there's little n...
<p>if the oci extension isn't installed, then you'll get a fatal error with farside.myopenid.com's answer, you can use function_exists('oci_connect') or extension_loaded('oci8') (or whatever the extension's actually called)</p>
.Net 8-bit Encoding <p>I'm working on serial port, transmitting and receiving data to some hardware at 8bit data. I would like to store it as string to facilitate comparison, and preset data are stored as string or hex format in xml file. I found out that only when using Encoding.Default which is ANSI encoding then the...
<p>Latin-1 aka ISO-8859-1 aka codepage 28591 is a useful codepage for this scenario, as it maps values in the range 128-255 unchanged. The following are interchangeable:</p> <pre><code>Encoding.GetEncoding(28591) Encoding.GetEncoding("Latin1") Encoding.GetEncoding("iso-8859-1") </code></pre> <p>The following code il...
Using the Window API, how do I ensure controls retain a native appearance? <p>Some of the controls I've created seem to default to the old Windows 95 theme, how do I prevent this? Here's an example of a button that does not retain the Operating System's native appearance (I'm using Vista as my development environment):...
<p>To add a manifest to the application you need create a MyApp.manifest file and add it to the application resource file:</p> <pre><code>//-- This define is normally part of the SDK but define it if this //-- is an older version of the SDK. #ifndef RT_MANIFEST #define RT_MANIFEST 24 #endif //-- Add the...
6502 CPU Emulation <p>It's the weekend, so I relax from spending all week programming by writing a hobby project.</p> <p>I wrote the framework of a MOS 6502 CPU emulator yesterday, the registers, stack, memory and all the opcodes are implemented. (Link to source below)</p> <p>I can manually run a series of operations...
<p>The opcode takes one byte, and the operands are in the following bytes. Check out the byte size column <a href="http://www.atariarchives.org/2bml/chapter_10.php">here</a>, for instance.</p>
source control with VB2005 Express <p>Can anyone suggest a good source control system that interfaces with VB2005 Express? As the Express editions of Visual Studio do not allow add-ins does this mean that I will not be able to integrate source control into the IDE? I'm used to the check-in/check-out process of SourceSa...
<p>TortoiseSVN is a good choice. Although it won't integrate into the IDE (because of the plug-in problem you mentioned), it's really solid in the Explorer right-button menu.</p> <p>Also consider <a href="http://www.sourcegear.com/vault/" rel="nofollow">Vault</a> from SourceGear. If you're used to SourceSafe, Vault ...
How to enable inno-db support on MySql 5 installed above MySql 4? <p>How to enable inno-db support on installed instance of MySql?</p> <p>I have installed mysql-5.0.67-win32. 'InnoDB' is 'DISABLED' when executing 'show engines'. According to documentation MySql is compiled with support of inno-db (From doc: A value of...
<p>Should be enabled by default. There are some situations where wrong permissions on the MySQL lib folder cause InnoDB to bark. Check your MySQL error log for permission errors.</p>
php.ini & SMTP= - how do you pass username & password <p><code>My ISP</code> account requires that I send a username &amp; password for outbound <code>SMTP</code> mail. </p> <p>How do I get <code>PHP</code> to use this when executing <code>php.mail()?</code> The <code>php.ini</code> file only contains entries for the ...
<p>PHP <code>mail()</code> command does not support authentication. Your options:</p> <ol> <li><a href="http://sourceforge.net/projects/phpmailer">PHPMailer</a>- <a href="http://phpmailer.codeworxtech.com/index.php?pg=tutorial#2">Tutorial</a></li> <li><a href="http://pear.php.net/package/Mail">PEAR</a> - <a href="http...
Is static metaprogramming possible in Java? <p>I am a fan of <a href="http://stackoverflow.com/questions/112277/best-intro-to-c-static-metaprogramming">static metaprogramming in C++</a>. I know Java now has generics. Does this mean that static metaprogramming (i.e., compile-time program execution) is possible in Java...
<p>No, this is not possible. Generics are not as powerful as templates. For instance, a template argument can be a user-defined type, a primitive type, or a value; but a generic template argument can only be <code>Object</code> or a subtype thereof.</p> <p>Edit: This is an old answer; since 2011 we have Java 7, which ...
Javascript error <p>I'm getting a JS error on displaying a page: Nothing concrete is specified but the line where it seems to be thrown. When looking into the source code of the page, I see the error is thrown inside the following script, but I can't understand why! It's only about loading images!</p> <pre><code> &...
<p>Have you tried loading your scripts into a JS debugger such as <a href="http://www.aptana.com/" rel="nofollow">Aptana</a> or Firefox plugin like <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow">Firebug</a>?</p>
Is it possible to have one appBase served by multiple context paths in Tomcat? <p>Is it possible to have one appBase served up by multiple context paths in Tomcat?</p> <p>I have an application base that recently replaced a second application base. My problem is a number of users still access the old context. I would...
<p>I'm not sure if the answer above will prevent your webapp from loading twice (as you'd have to deploy it to both new and old context paths), but I could be mistaken. Another option would be to have an extremely simple webapp left in the old context, that does nothing except have one custom servlet filter declared i...
How do I join two tables in a third n..n (hasAndBelongsToMany) relationship in CakePHP? <p>I have a <code>n...n</code> structure for two tables, <strong><code>makes</code></strong> and <strong><code>models</code></strong>. So far no problem.</p> <p>In a third table (<strong><code>products</code></strong>) like:</p> <...
<p>Here's my hint: Try getting your query written in regular SQL before trying to reconstruct using the Cake library. In essence you're doing a lot of extra work that the DB can do for you. Your approach (just for show - not good SQL):</p> <pre><code>SELECT * FROM makes, models, products WHERE make_id = 5 </code></p...
How do you re-attach a subversion local copy to a different remote? <p>Our subversion repository has been moved to a new host, and we have old applications that connect to that host. We CANNOT add an alias for the new server with the old name, how can we re-connect our checked out clients to the new repository?</p>
<p>Example:</p> <pre><code>svn switch --relocate \ http://svn.example.com/path/to/repository/path/within/repository \ http://svnnew.example.com/new/repository/path/within/repository </code></pre> <p>One thing which is to remember, lets assume you checked out the project "path/within/repository" then you have ...
Conflicting desires in Database Design, with fields of two similar functions <p>Okay, so I'm making a table right now for "Box Items".</p> <p>Now, a Box Item, depending on what it's being used for/the status of the item, may end up being related to a "Shipping" box or a "Returns" box.</p> <p>A Box Item may be defecti...
<p>I'm with Psychotic Venom and mattlant.</p> <p>Going the polymorphic route (having to figure out which table your foreign key points to based on the contents of another field) is going to be a pain. Coding the constraints for that maybe tough (I'm not sure most databases would support that natively, I think you'd ha...
Calling a ASP Page thru it Class <p>Like in Windows Forms:</p> <p>Dim myForm as New AForm(Constr-arg1, Constr-arg2)</p> <p>myForm.Show</p> <p>... is there a similar way to Load a Page in ASP.Net. I would like to overload the Page Constructor and instantiate the correct Page Contructor depending on the situation.</p>...
<p>Can you just link to the page passing parameters in the QueryString (after the ? in the URL) and then use them in the constructor (more likely PageLoad)</p>
What are the statistics of HTML vs. Text email usage <p>What the latest figures are on people viewing their emails in text only mode vs. HTML?</p> <p><a href="http://en.wikipedia.org/wiki/Html_email" rel="nofollow">Wikipedia</a> and it's <a href="http://www.emaillabs.com/tools/email-marketing-statistics.html" rel="nof...
<p>As with web browser usage statistics, it depends entirely on the audience.</p> <p>I have access to a bit of data on this subject and it seems that text-only email use is very low (for non-technical audiences, at least). &lt;0.1% up to ~6% depending on demographic.</p> <p>It's not <em>that</em> much effort to do bo...
Python - When to use file vs open <p>What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)</p>
<p>You should always use <code>open()</code>.</p> <p>As the <a href="http://docs.python.org/2/library/functions.html#file" rel="nofollow" title="BuiltinFuncs Doc">documentation</a> states:</p> <blockquote> <p>When opening a file, it's preferable to use open() instead of invoking this constructor directly. file ...
Dynamic IP-based blacklisting <p>Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determined dyna...
<p>Take a look at <a href="http://www.fail2ban.org/">fail2ban</a>. A python framework that allows you to raise IP tables blocks from tailing log files for patterns of errant behaviour.</p>
What is the cost of using a pointer to member function vs. a switch? <p>I have the following situation:</p> <pre><code> class A { public: A(int whichFoo); int foo1(); int foo2(); int foo3(); int callFoo(); // cals one of the foo's depending on the value of whichFoo }; </code></pre> <p>In my curren...
<p>How sure are you that calling a member function via a pointer is slower than just calling it directly? Can you measure the difference?</p> <p>In general, you should not rely on your intuition when making performance evaluations. Sit down with your compiler and a timing function, and actually <em>measure</em> the di...
What are the Python equivalents of the sighold and sigrelse functions found in C? <p>It appears the Python signal module doesn't have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of <em>any</em> sort?</p> <p>Many thanks!</p>
<p>There is no way to ``block'' signals temporarily from critical sections (since this is not supported by all Unix flavors).</p> <p><a href="https://docs.python.org/library/signal.html" rel="nofollow">https://docs.python.org/library/signal.html</a></p>
Displaying code in blog posts <p>What libraries and/or packages have you used to create blog posts with code blocks? Having a JavaScript library that would support line numbers and indentation is ideal.</p>
<p>The <a href="http://qbnz.com/highlighter/" rel="nofollow">GeSHi text highlighter</a> is pretty awesome. If you're using WordPress, <a href="http://wordpress.org/extend/plugins/wp-syntax/" rel="nofollow">there's a plugin</a> for you already</p>
Which CSS tag creates a box like this with title? <p>I want to create a box like this with title:</p> <p><img src="https://i.stack.imgur.com/2rip1.gif" alt="CSS box with title"></p> <p>Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?</p>
<p>I believe you are looking for the <code>fieldset</code> HTML tag, which you can then style with CSS. E.g.,</p> <pre><code>&lt;fieldset style="border: 1px black solid"&gt; &lt;legend style="border: 1px black solid; margin-left: 1em; padding: 0.2em 0.8em "&gt;title&lt;/legend&gt; Text within the box &lt;br /&gt; E...
How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine? <p>I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other things it needs to u...
<p>I would recommend to put the script into dhclient-exit-hooks.d. Because you should just change the DDNS entry, if the address change has been finished. However, I am not sure if dhclient-exit-hooks are called, if assigning an address fails. </p> <p>Edit: The man pages (man dhclient-script) says, that the exit-hooks...
How do I cancel a text selection after the initial mousedown event? <p>I'm trying to implement a pop-up menu based on a click-and-hold, positioned so that a (really) slow click will still trigger the default action, and with the delay set so that a text-selection gesture won't usually trigger the menu. </p> <p>What I...
<p>Try this:</p> <pre><code>var input = document.getElementById('myInputField'); if (input) { input.onmousedown = function(e) { if (!e) e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); } } </code></pre> <p>And if not, have a read of:</p> <p><a href="http:/...
Javascript curry - what are the practical applications? <p>I don't think I've grokked currying yet. I understand what it does, and how to do it. I just can't think of a situation I would use it.</p> <p>Where are you using currying in javascript (or where are the main libraries using it)? DOM manipulation or general ap...
<p>Here's an <a href="http://javascriptweblog.wordpress.com/2010/10/25/understanding-javascript-closures/" rel="nofollow"><strong>interesting AND practical use of currying in JavaScript that uses closures</strong></a>:</p> <blockquote> <pre><code>function converter(toUnit, factor, offset, input) { offset = offset ...
Performance penalty for working with interfaces in C++? <p>Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?</p>
<p>Short Answer: No.</p> <p>Long Answer: It is not the base class or the number of ancestors a class has in its hierarchy that affects it speed. The only thing is the cost of a method call.</p> <p>A non virtual method call has a cost (but can be inlined)<br> A virtual method call has a slightly higher cost as you nee...
How to check if an OLEDB driver is installed on the system? <p>How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendl...
<p>This is an old question but I had the same problem now and maybe this can help others.</p> <p>In Delphi 7 there is an procedure in ADODB that return a TStringList with the provider names.</p> <p>Usage example:</p> <pre><code>names := TStringList.Create; ADODB.GetProviderNames(names); if names.IndexOf('SQLNCLI10'...
Get Performance Counter Instance Name (w3wp#XX) from ASP.NET worker process ID <p>I would like to display some memory statistics (working set, GCs etc.) on a web page using the .NET/Process performance counters. Unfortunately, if there are multiple application pools on that server, they are differentiated using an inde...
<p>The first hit on Google:</p> <p><a href="http://openrent.blogspot.com/2008/01/multiple-clr-performance-counters.html">Multiple CLR performance counters appear that have names that resemble "W3wp#1"</a></p> <blockquote> <p>When multiple ASP.NET worker processes are running, Common Language Runtime (CLR) perfo...
Create anonymous object by Reflection in C# <p>Is there any way to create C# 3.0 anonymous object via Reflection at runtime in .NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically.</p> <p><em>edited later to clarify the use case</em></p> <p>An extra constr...
<p>Yes, there is. From memory:</p> <pre><code>public static T create&lt;T&gt;(T t) { return Activator.CreateInstance&lt;T&gt;(); } object anon = create(existingAnonymousType); </code></pre>
Pointer vs. Reference <p>What would be better practice when giving a function the original variable to work with:</p> <pre><code>unsigned long x = 4; void func1(unsigned long&amp; val) { val = 5; } func1(x); </code></pre> <p>or:</p> <pre><code>void func2(unsigned long* val) { *val = 5; } func2...
<p>My rule of thumb is:</p> <p>Use pointers if you want to do pointer arithmetic with them (e.g. incrementing the pointer address to step through an array) or if you ever have to pass a NULL-pointer.</p> <p>Use references otherwise.</p>
How can I share a variable value between classic asp, .NET and javascript? <p>I've created an <code>IHttpHandler</code> in .NET C# which returns pieces of html to a classic asp page.</p> <p>The classic asp page communicates with the <code>IHttpHandler</code> through basic http requests using <code>ServerXMLHTTP</code>...
<p>You could put your value in a cookie, then you could read with javascript and do anything with it, including sending it in a request to the .net app...</p>
Creating Custom GnuCash Reports with Scheme <p>Are there any resources which show how to create custom GnuCash reports? I don't know the intricacies of Scheme but I do know the basics of Lisp, based on tinkering with Emacs. Is there a site which lays out the API for GnuCash reports, ideally with a little explanation of...
<p>It appears that their wiki has some information <a href="http://wiki.gnucash.org/wiki/Custom_Reports">here</a>.</p>
Simple web "live chat" software (LAMP stack) that integrates with Jabber/Aim <p>I've looked for this a few times in the past, to no avail. I would like a simple <code>php/ajax</code> web chat interface, that, and this is the critical part, will interface with my <code>IM client (Pidgin)</code> ... via Jabber or Aim. <c...
<p>(Disclaimer: I work for <a href="http://www.jabber.com/" rel="nofollow">Jabber, Inc.</a>, the commercial company behind the product I'm about to pimp.)</p> <p><img src="http://www.jabber.com/images/GroupChatAJAXThumb.png" alt="JabberWerx AJAX" title="" /></p> <p>The <a href="http://www.jabber.com/CE/JabberWerxAJAX...
Is a Python dictionary an example of a hash table? <p>One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?</p>
<p>Yes, it is a hash mapping or hash table. You can read a description of python's dict implementation, as written by Tim Peters, <a href="http://mail.python.org/pipermail/python-list/2000-March/048085.html">here</a>.</p> <p>That's why you can't use something 'not hashable' as a dict key, like a list:</p> <pre><code>...
What is the best way to pack JavaScript code without getting perfomance flaws? <p>I am searching for a way to compress JavaScript code for the iPhone. Is there a way to avoid using a lot of CPU time on the small and rather slow device?</p>
<p>Use the <a href="http://www.julienlecomte.net/yuicompressor/" rel="nofollow">YUI Compressor</a></p>
How to pass an array parameter in TOAD <p>Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp?</p>
<p>In the Editor tab you can call it like this:</p> <pre><code>begin myproc (my_array_type(1,4,7,9)); end; </code></pre>
How do you verify the Work and Experience level of Consultants? <p>So, right now I am hunting for consultants for two technologies I have knowledge about but no experience in. I have put ads on Craigslist as these are two small tasks and most likely the larger firms wont want to be bothered and will charge an arm and a...
<p>Well, you get what you pay for, and using Craigslist for high-level technology hires might not be the best way to find the cream of the crop.</p> <p>The most telling tool that I have for weeding out the liars and posers is a good, grueling phone-screen. If you don't know anything about the technology, then you've ...
How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize? <p>I have some NSViews that I'm putting in one of two layouts depending on the size of my window.</p> <p>I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method.</p> <p>This wor...
<p>I don't think you can do this easily because CA's animations are run via a timer and the timer won't fire during the runloop modes that are active while the user is dragging.</p> <p>If you can control the runloop as the user is dragging, play around with the runloop modes. That'll make it work. I don't think you c...
MVC Preview 5 - Rendering A View To String For Testing <p>I was reading a post by Brad Wilson (<a href="http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html">http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html</a>) on the new ViewEngine changes to MVC Preview 5 and thought that it would be great ...
<p>It's tricky. What you have to do is set the Response.Filter property to a custom stream class that you implement. The MVC Contrib project actually has examples of doing this. I'd poke around in there.</p>
How to check whether a file is valid UTF-8? <p>I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do this.</p> <p>Th...
<p>You can use GNU iconv:</p> <pre><code>$ iconv -f UTF-8 your_file -o /dev/null </code></pre> <p>iconv will return 0 if the file could be converted successfully, and 1 if not. Additionally, it will print out the byte offset where the invalid byte sequence occurred.</p> <p><strong>Edit</strong>: The output encoding ...
Flex profiler gives "Socket timeout " error. Why for? <p>When trying to run the Flex Builder 3 profiler on any I don't get the profiler dialog window and then after a few seconds I get "Socket timeout" in the console window. Any ideas why it can't connect?</p> <p>I've got the latest debug version of Flash player and ...
<p>It looks like the browser (Firefox in my case) has to be shutdown before the profiler is started. Step 1. in the livedocs even says this -- wish I had read it earlier. :)</p> <p><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=profiler_3.html" rel="nofollow">http://livedocs.adobe.com/flex/3/html/h...
How do you specify a port range for Java sockets? <p>In Java you can give the number zero as a single parameter for the Socket or DatagramSocket constructor. Java binds that Socket to a free port then. Is it possible to limit the port lookup to a specific range?</p> <p>Thanks in advance,<br /> Roland</p>
<p>Hrm, after reading the docs, I don't think you can. You can either bind to any port, then rebind if it is not acceptable, or repeatedly bind to a port in your range until you succeed. The second method is going to be most "efficient".</p> <p>I am uneasy about this answer, because it is... inelegant, yet I really ca...
In P4V, how do I create a branch from a label? <p>My company just imported our CVS repository into Perforce. I'm new to P4V and I can't work out how to create a branch from an existing label. Can anyone tell me how to do this?</p>
<p>In my copy of P4V (Version 2013.3), I go to the <code>Actions</code> menu and choose <code>Branch Files...</code>, which brings up the <code>Branch Files</code> dialog:</p> <p><a href="http://i.stack.imgur.com/eAp34.png" rel="nofollow"><img src="http://i.stack.imgur.com/eAp34.png" alt="enter image description here"...
Is there a way to clear a user's brower of my page, or say not to use cache? <p>Is there a command in classic ASP I can use to tell the browser not to pull the page from it's cache, or, to not cache, or clear the cache of my page?</p>
<p>You can use HTML meta tags:</p> <pre><code>&lt;meta http-equiv="Pragma" content="no-cache" /&gt; &lt;meta http-equiv="Expires" content="Fri, 01 Jan 1999 1:00:00 GMT" /&gt; &lt;meta http-equiv="Last-Modified" content="0" /&gt; &lt;meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /&gt; </code></pre...
In Eclipse, why does "Build Automatically" get mysteriously disabled? <p>I'm running Eclipse Europa (3.3). I leave the "Build Automatically" setting, under the Project menu, on all the time. Once in awhile my code isn't compiling, and I puzzle over it and then pull down the Project menu ... lo and behold, it's not se...
<p>I don't have eclipse right here to test and make sure but here is an idea.</p> <p>Is any of the project or even workspace file in SVN ? if they are and they were uploaded with auto build disabled that might explain it</p> <p>You update and overwrite your settings. This doesn't become apparent until you restart ecl...
What pre-existing services exist for calculating distance between two addresses? <p>I'd like to implement a way to display a list of stored addresses sorted by proximity to a given address.</p> <p>Addresses in the list will be stored in a database table. Separate parts have separate fields (we have fields for postal ...
<p><a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding">Google</a> and <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html">Yahoo!</a> both provide geocoding services for free. You can calculate distance using the <a href="http://en.wikipedia.org/wiki/Haversine_formula">Haversine ...
Bad UI Design? Having two logos on the top left of the website? <p>Well i am currently working on a project doing some UI mockups when certain users wanted to have two logo on the top left ot the website. One is to indicate what is the website about then another is to indicate that this website is actually belong to th...
<p>It does sound rather confusing, though it may depend on the content of the logos as to whether they are difficult to figure out.</p> <p>I would recommend getting someone who hasn't used the site to see the mockup and see what they think about it (without guidance)... ie some usability testing.</p> <p>Check out <a ...
Location of My Pictures <p>How do I programatically (Using C#) find out what the path is of my My Pictures folder? </p> <p>Does this work on XP and Vista?</p>
<p>The following will return a full-path to the location of the users picture folder (Username\My Documents\My Pictures on XP, Username\Pictures on Vista)</p> <pre><code>Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); </code></pre>
How do I kill a process using Vb.NET or C#? <p>I have a scenario where I have to check whether user has already opened Microsoft Word. If he has, then I have to kill the winword.exe process and continue to execute my code. </p> <p>Does any one have any straight-forward code for killing a process using vb.net or c#?</...
<p>You'll want to use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx">System.Diagnostics.Process.Kill</a> method. You can obtain the process you want using <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.getprocessesbyname.aspx">System.Diagnostics....
Using AssemblyInfo to automatically update multiple AssemblyInfo.cs files <p>I've got several AssemblyInfo.cs files as part of many projects in a single solution that I'm building automatically as part of TeamCity.</p> <p>To make the msbuild script more maintainable I'd like to be able to use the AssemblyInfo communit...
<p>We use "linked" files in project. Solution Explorer -> Add Existin Item -> .. select_file .. -> arrow_on_left_of_add_button -> Add As Link</p> <p>Then the selected file ( AssemblyInfo.cs for now ) is not copied to the direcotry of project, bud is only linked from specified path.</p>
Open an Emacs buffer when a command tries to open an editor in shell-mode <p>I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable <code>VISUAL</code> set t...
<p>You can attach to an Emacs session through <code>emacsclient</code>. First, start the emacs server with </p> <pre><code>M-x server-start </code></pre> <p>or add <code>(server-start)</code> to your <code>.emacs</code>. Then,</p> <pre><code>export VISUAL=emacsclient </code></pre> <p>Edit away.</p> <p>Note:</p> <...
MySpace DOM? <p>I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks" include incom...
<p>You hit the nail on the head with your final question. The MySpace DOM is a disgusting set of nearly-infinitely nested tables. Normally, people edit the page by finding those sites that let you "cut and paste" and use their generated CSS since they've already done the hard work for isolating the proper elements.</p>...
Hiding Subreports in SQL Report (RDL) <p>I have a bunch a reports that are printed out and mailed to clients. At the top of the report is the return address, left aligned. I was asked to add an optional logo to the report. This logo should be left of the return address. (The logo and all other info is stored in the dat...
<p>You should be able to set an expression on the subreport's visibility so that it does not show if there isn't a logo.</p> <p>Here is the XML from an RDL I had handy:</p> <pre><code>&lt;Subreport Name="SubReport"&gt; &lt;ReportName&gt;SubReport&lt;/ReportName&gt; &lt;Visibility&gt; &lt;Hidden&gt;=Not Parame...
Low Java single process thread limit in Red Hat Linux <p>I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system is unwilling o...
<p>Have you looked at <a href="http://people.redhat.com/alikins/system_tuning.html#threads" rel="nofollow">this resource</a>? It states that you should be able run thread-limit to find the maximum number of threads and can tweak it by compiling glibc.</p>
cURL equivalent in JAVA <p>I am tasked with writing an authentication component for an open source <code>JAVA</code> app. We have an in-house authentication widget that uses <code>https</code>. I have some example <code>php</code> code that accesses the <code>widget</code> which uses <code>cURL</code> to handle the t...
<p>Exception handling omitted:</p> <pre><code>HttpURLConnection con = (HttpURLConnection) new URL("https://www.example.com").openConnection(); con.setRequestMethod("POST"); con.getOutputStream().write("LOGIN".getBytes("UTF-8")); con.getInputStream(); </code></pre>
Javascript to extract author/date from SVN keyword substitution <p>SVN keyword substition gives is not pretty. E.g.,</p> <blockquote> <p>Last updated: $Date$ by $Author$</p> </blockquote> <p>yields</p> <blockquote> <p>Last updated: $Date: 2008-09-22 14:38:43 -0400 (Mon, 22 Sep 2008) $ by $Author: cconway $"<...
<p>Errr.. This feels a bit like me doing your job for you :), but here goes:</p> <pre><code>function formatSvnString(string){ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] var re = /\$Date: (\d{4})-(\d\d)-(\d\d).*?\$Author: (\S+) \$/ return string.replac...
Oracle: Is there a simple way to say "if null keep the current value" in merge/update statements? <p>I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible.</p> <p>Say I have a table with the following schema:</p> <pre><code>MyTable Id INTEGER, Col1 V...
<p>Change the call or the update statement to use</p> <pre><code>nvl(newValue, oldValue) </code></pre> <p>for the new field value.</p>
Scrape multi-frame website <p>I'm auditing our existing web application, which makes heavy use of <a href="http://www.w3schools.com/HTML/html_frames.asp" rel="nofollow">HTML frames</a>. I would like to download all of the HTML in each frame, is there a method of doing this with <a href="http://www.gnu.org/software/wget...
<p>as an addition to Steve's answer:</p> <p>Span to any host—‘-H’</p> <p>The ‘-H’ option turns on host spanning, thus allowing Wget's recursive run to visit any host referenced by a link. Unless sufficient recursion-limiting criteria are applied depth, these foreign hosts will typically link to yet more hos...
Is there an "anonymous" generic tag in C#, like '?' in Java? <p>In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this:</p> <pre><code>Foo&lt;?&gt; x; </code></pre> <p>Is there an equivalent construct to this question-mark, in C#?</p>
<p>From <a href="http://www.25hoursaday.com/CsharpVsJava.html#generics">C# from a Java developer's perspective</a> by Dare Obasanjo:</p> <p>In certain cases, one may need create a method that can operate on data structures containing any type as opposed to those that contain a specific type (e.g. a method to print all...
When have we any practical use for hierarchical namespaces in c++? <p>I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception?</p>
<p>Hierarchical namespaces do have a use in that they allow progressively more refined definitions. Certainly a single provider may produce two classes with the same name. Often the first level is occupied by the company name, the second specifies the product, the third (and possibly more) my provide the domain.</p> <...
Can I (re-) map commands in vim? <p>I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing ":WQ" instead of ":wq" (on a German keyboard, you have to press shift to get the colon). Vim will then complain that 'W' is not an editor command.</p> <p>Is there some way to make...
<p>Try </p> <pre><code> :command WQ wq :command Wq wq :command W w :command Q q </code></pre> <p>This way you can define your own commands. See <code>:help command</code> for more information.</p>
Is it possible to delete subdomain cookies? <p>If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com.</p>
<p>Cookies are only readable by the domain that created them, so if the cookie was created at metric.foo.com, it will have to be deleted under the same domain as it was created. This includes sub-domains.</p> <p>If you are required to delete a cookie from metric.foo.com, but are currently running a page at www.foo.co...
How do I get a decimal value when using the division operator in Python? <p>For example, the standard division symbol '/' rounds to zero:</p> <pre><code>&gt;&gt;&gt; 4 / 100 0 </code></pre> <p>However, I want it to return 0.04. What do I use?</p>
<p>There are three options:</p> <pre><code>&gt;&gt;&gt; 4 / float(100) 0.04 &gt;&gt;&gt; 4 / 100.0 0.04 </code></pre> <p>which is the same behavior as the C, C++, Java etc, or </p> <pre><code>&gt;&gt;&gt; from __future__ import division &gt;&gt;&gt; 4 / 100 0.04 </code></pre> <p>You can also activate this behavior ...
Best approach for sortable table with a lot of data <p>On our web application, the search results are displayed in sortable tables. The user can click on any column and sort the result. The problem is some times, the user does a broad search and gets a lot of data returned. To make the sortable part work, you probab...
<p>You should be doing paging back on the database server. E.g. on SQL 2005 and SQL 2008 there are paging techniques. I'd suggest looking at paging options for whatever system you're looking at.</p>
What can Services do under Windows? <p>Does anyone have a good guide to capabilities of Windows Services under XP? In particular, I am trying to find out what happens when a program being run as a service tries to open windows, but hasn't been given permission to interact with the desktop.</p> <p>Basically, I have a p...
<p>Generally, services should be designed to not have any visible UI. The entire point of a service is to run in the background, without UI, unattended. (Think SQL Server, IIS, etc.)</p> <p>In most scenarios, a separate application controls the service's operation, should a GUI be needed. (Continuing the samples I jus...
Planning the flow of a program <p>I am already aware of UML but I want to look at all the options before I pick. Essentially I will need to have a way (preferably visual) to plan out the flow and actions of programs. They will all be web applications written in PHP or Python.</p> <p>What (preferably free) ways are the...
<p>Large white board, dry erase markers, time and collaborators always work in a pinch..and a digital camera is good to snapshot the progress(unless you have a really nice whiteboard that will save to a file).</p>
Wait until any of Future<T> is done <p>I have few asynchronous tasks running and I need to wait until at least one of them is finished (in the future probably I'll need to wait util M out of N tasks are finished). Currently they are presented as Future, so I need something like</p> <pre><code>/** * Blocks current thr...
<p>simple, check out <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorCompletionService.html">ExecutorCompletionService</a>.</p>
How to get Django AutoFields to start at a higher number <p>For our Django App, we'd like to get an <code>AutoField</code> to start at a number other than 1. There doesn't seem to be an obvious way to do this. Any ideas?</p>
<p>Like the others have said, this would be much easier to do on the database side than the Django side. </p> <p>For Postgres, it'd be <a href="http://www.postgresql.org/docs/9.1/static/sql-altersequence.html">like so</a>: <code>ALTER SEQUENCE sequence_name RESTART WITH 12345;</code> Look at your own DB engine's docs ...
Upload files directly to Amazon S3 from ASP.NET application <p>My ASP.NET MVC application will take a lot of bandwidth and storage space. How can I setup an ASP.NET upload page so the file the user uploaded will go straight to Amazon S3 without using my web server's storage and bandwidth?</p>
<p>Update Feb 2016:</p> <p>The AWS SDK can handle a lot more of this now. Check out <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTForms.html" rel="nofollow">how to build the form</a>, and <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-authentication-HTTPPOST.html" rel="nofollow">how t...
How do I unload a externally loaded SWF file from a SWFLoader component in Adobe Flex? <p>I have an application that loads external SWF files and plays them inside a Adobe Flex / Air application via the <a href="http://livedocs.adobe.com/flex/3/html/controls_15.html" rel="nofollow">SWFLoader Flex component</a>. I have ...
<blockquote> <p>... isn't that a problem with the Flex architecture?</p> </blockquote> <p>Yes it is, and it also affects Flash in general. Until you can take advantage of the <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html">Loader.unloadAndStop()</a> method in FP10 (AIR 1.5), you can...
How do I open Office 2007 files stored on a website? <p>I have a website where people can upload documents, and view them later at their convenience. I store the binary info along with the mime type in my db, and later just stream the binary content straight to the browser.</p> <p>This works for for every file type ex...
<p>Check out <a href="http://blogs.msdn.com/vsofficedeveloper/pages/Excel-2007-Extension-Warning.aspx" rel="nofollow">this explanation</a> on VS Office Developer.</p> <p>It gives a registry hack which your users could choose to apply to rid suppress this warning.</p>
How to version control the build tools and libraries? <p>What are the recommendations for including your compiler, libraries, and other tools in your source control system itself?</p> <p>In the past, I've run into issues where, although we had all the source code, building an old version of the product was an exercise...
<p>I think the VM is your best solution. We always used dedicated build machines to get consistency. In the old COM DLL Hell days, there were dependencies on (COMCAT.DLL, anyone) on non-development software installed (Office). Your first two options don't solve anything that has shared COM components. If you don't ...
Best practice for translating exceptions in C++/CLI wrapper class <p>I am writing a .NET wrapper class for an existing native class which throws exceptions. What are the best practices for translating between native C++ exceptions and Managed exceptions? Catch and re-throw on a one-to-one basis (e.g. std::invalid_argum...
<p>There is no standard mapping that I know of. What I've done in the past is translate the ones I know about, and a catch block for System.Runtime.InteropServices.SEHException. All non-translated exceptions will be turned into that exception. As long as you have a debug build of the code that is throwing the except...
How to refactor in a branch without losing my mind? <p>I refactor my and other people's code <strong>all the time</strong>. When I work in a branch and not in Trunk, this sometimes results in some extremely painful merges, especially if I don't merge back to Trunk regularly (the code at the branch slowly shifts away fr...
<p>Refactoring on a large scale needs to be done at the right time in the development timeline. If you do huge amounts of refactoring near release you'll end up hurting yourself because you'll introduce painful merges at a time when changes should be minimized. The more disruptive your refactoring will be the earlier i...