instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm using a Flash TextField control to display some HTML content inside a Flash presentation to be shown on a large touch-screen kiosk. Unfortunately, if any image tag in the displayed HTML content points to a non-existent image, a dialogue is shown with the error message </p>
<pre><code>Error #2044: Unhandled IOEr... | <p>You can add ID's to images </p>
<pre><code>html.htmlText = "Bogus image: <img src=\"foo.jpg\" id="image" />";
</code></pre>
<p>And then setup IOErrorEvent handler to each image in HTML</p>
<pre><code>var loader:Loader = html.getImageReference("image") as Loader;
if(loader){
loader.contentLoaderInfo.add... | <p>This is a problem I'm also dealing with: it's a real annoyance. I'd really like to be able to catch all the errors. I assumed you could say...</p>
<pre><code>stage.addEventListener(IOError.IO_ERROR, myErrorHandler);
</code></pre>
<p>...but that doesn't seem to work, as you've pointed out.</p>
<p>Perhaps you can c... | 39,902 |
<p>How do I make <a href="http://logging.apache.org/log4net/index.html" rel="noreferrer">Log4net</a> only log Info level logs? Is that even possible? Can you only set a threshold? </p>
<p>This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?</p>
<pre c... | <p>Within the definition of the appender, I believe you can do something like this:</p>
<pre class="lang-xml prettyprint-override"><code><appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO"... | <p>you can use log4net.Filter.LevelMatchFilter.
other options can be found at
<a href="http://www.beefycode.com/post/log4net-tutorial-pt-7-filters.aspx" rel="nofollow noreferrer">log4net tutorial - filters</a></p>
<p>in ur appender section add</p>
<pre class="lang-xml prettyprint-override"><code><filter type="log4... | 2,786 |
<p>Here's one that has me perplexed. I'm trying to implement a basic Hibernate DAO structure, but am having a problem.</p>
<p>Here's the essential code:</p>
<pre><code>int startingCount = sfdao.count();
sfdao.create( sf );
SecurityFiling sf2 = sfdao.read( sf.getId() );
sfdao.delete( sf );
int endingCount = sfdao.coun... | <p>The problem is that you are trying to access a collection in an object that is <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html" rel="noreferrer">detached</a>. You need to re-attach the object before accessing the collection to the current session. You can do that through</p>
<pr... | <p>If you are managing the Hibernate session manually, you may want to look into sessionFactory.getCurrentSession() and associated docs here:</p>
<p><a href="http://www.hibernate.org/hib_docs/v3/reference/en/html/architecture-current-session.html" rel="nofollow noreferrer">http://www.hibernate.org/hib_docs/v3/referenc... | 44,980 |
<p>My applications installer offers the user the ability to run the application as a service through use of the <code>srvany.exe</code> application. To remove the application on uninstall, I've been using the application <code>instsrv.exe</code> with the following command:</p>
<blockquote>
<p>instsrv "myservice" RE... | <p>I tried the same with Rk-Tools 2003 and 2000 and I get the same error both times.
But after removing the registry-parameters manually after the next reboot the services (I tried out several constellations) were gone.
Please think about stopping the service before(!) you're gonna delete the registry-entries, because... | <p>First of all - references to instsrv.c is just an error message (it tells you where the error has actually happened in the source code). I think (but I am not sure) that this 1783 error occurs when it tries to enumerate services but hits an overflow error (too many services installed?)</p>
<p>A better approach woul... | 27,103 |
<p>I'd like to use Doxygen to document legacy code that's a mix of C and x86 assembly language. The assembly language is not inline, but in separate assembly-only files. How can I document the assembly language portion?</p>
| <p>See question 12 of the <a href="http://www.doxygen.nl/manual/faq.html" rel="nofollow noreferrer">Doxygen FAQ</a>. Are you dealing with pure assembly files, or inline assembly inside C sources? Assuming the former, you'll have to either write an input filter to transform the assembly code into something C-like (eas... | <p>See question 12 of the <a href="http://www.doxygen.nl/manual/faq.html" rel="nofollow noreferrer">Doxygen FAQ</a>. Are you dealing with pure assembly files, or inline assembly inside C sources? Assuming the former, you'll have to either write an input filter to transform the assembly code into something C-like (eas... | 33,501 |
<p>I would like to create a page where all images which reside on my website are listed with title and alternative representation.</p>
<p>I already wrote me a little program to find and load all HTML files, but now I am stuck at how to extract <code>src</code>, <code>title</code> and <code>alt</code> from this HTML:</... | <h2>EDIT : now that I know better</h2>
<p>Using regexp to solve this kind of problem is <a href="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454">a bad idea</a> and will likely lead in unmaintainable and unreliable code. Better use an <a href="http://s... | <p>Here is THE solution, in PHP:</p>
<p>Just download QueryPath, and then do as follows:</p>
<pre><code>$doc= qp($myHtmlDoc);
foreach($doc->xpath('//img') as $img) {
$src= $img->attr('src');
$title= $img->attr('title');
$alt= $img->attr('alt');
}
</code></pre>
<p>That's it, you're done !</p>
| 16,742 |
<p>I have a table, call it TBL. It has two columns,call them A and B. Now in the query I require one column as A and other column should be a comma seprated list of all B's which are against A in TBL.
e.g. TBL is like this</p>
<p>1 Alpha</p>
<p>2 Beta</p>
<p>1 Gamma</p>
<p>1 Delta</p>
<p>Result of query s... | <p>You can concatenate the records with a User Defined Function (UDF).</p>
<p>The code below can be pasted 'as is' into a standard module. The SQL for you example would be:</p>
<pre><code>SELECT tbl.A, Concatenate("SELECT B FROM tbl
WHERE A = " & [A]) AS ConcA
FROM tbl
GROUP BY tbl.A
</code></pre>
<p>Th... | <p>Well, you can use a Recordset object to loop through your query in VBA, concatenating field values based on whatever criteria you need.</p>
<p>If you want to return the results as strings, you'll be fine. If you want to return them as a query, that will be more complicated. You might have to create a temporary tabl... | 28,499 |
<p>Are there any known methods of finding peers without using a dedicated central server?</p>
<p>ie: If I have peers which are disconnecting and reconnecting to the internet but getting a new IP address each time, and I want to connect to them without setting up a dedicated server to register with.</p>
<p>I was think... | <p>There's no way around having to know at least one initial peer to discover more.
Fully P2P protocols, such as Gnutella or Gnutella2, or the simpler Overnet (made famous by Storm Worm), are based on each client having a start-up list of a few peers. These can come off a web-based automated tracker for example. The cl... | <p>This is a typical use of a distributed hash table algorithm. I'd suggest looking at something like pastry. It uses a overlay network (Application layer network) on top of other layers. </p>
<p>Each node has a GUID which is used to route requests across the peer network. </p>
| 40,023 |
<p>I develop and maintain small intranet web apps(JSP and Resin).</p>
<p>Some users takes so much time to complete the forms that,
when they submit, they lose all their input data because of session timeout.</p>
<p>Currently I prolonged session timeout to 30 minutes and
display count-down clock till session timeout ... | <p>This may or may not be the case with your framework, but I think that if your page just uses AJAX to call the server every five minutes (or whatever), then that will keep your user's session alive. You don't even have to do a partial save of your form this way.</p>
| <p>You could store the data in a cookie every once in a while, use Gears as a temporary storage (if the data is complex or requires more than 4K storage) or send the temporary data to the server every n second using AJAX. </p>
| 31,435 |
<p>My question is related to the command pattern, where we have the following abstraction (C# code) :</p>
<pre><code>public interface ICommand
{
void Execute();
}
</code></pre>
<p>Let's take a simple concrete command, which aims to delete an entity from our application. A <code>Person</code> instance, for example... | <p>You'll need to associate the parameters with the command object, either by constructor or setter injection (or equivalent). Perhaps something like this:</p>
<pre><code>public class DeletePersonCommand: ICommand
{
private Person personToDelete;
public DeletePersonCommand(Person personToDelete)
{
... | <p>Have "Person" implement some sort of IDeletable interface, then make the command take whatever base class or interface your entities use. That way, you can make a DeleteCommand, which tries to cast the entity to an IDeletable, and if that works, call .Delete</p>
<pre><code>public class DeleteCommand : ICommand
{
... | 13,051 |
<p>I am looking to protect the code of my Firefox extension because it has server calls in it that no would be a security risk if someone could make them outside of the extension. Any suggestions on how to encrypt it?</p>
| <p>This is basically impossible. You want to give executable code to an untrusted client that has "secret" calls in it, yet not let the client know the secrets? How, then, is it going to execute the code?</p>
<p>At some point, it must be decrypted. Which means the client has everything it needs to perform the decrypti... | <p>You could use xauth, which is a variant of OAuth designed to solve this type of problem. Twitter uses xauth: <a href="http://dev.twitter.com/pages/xauth" rel="nofollow">http://dev.twitter.com/pages/xauth</a></p>
<p>Additionally, you could obfuscate your Javascript code, or even write it in C (as a NPAPI plugin).</p... | 35,545 |
<p>I am a developer for a .net application that uses ClickOnce for deployment. I have deployed it over 60 times and computers have not had any issues downloading the latest release. However, when I deployed this morning, the following error occurs when computers with Office 2007 installed tries to start the application... | <p>As far as I know this version of stdole is removed when Office2k7 is installed. You could install it individually via gacutil on all target machines <em>or</em> somehow include it via the ClickOnce package bootstrapper. On a mac right now so I can't test. </p>
| <p>I am not sure about your particular problem, but the Office 12 version of the stdole library is different (and -in my experience- not always backwards compatible) than then one you have when you use Office 2003. </p>
<p>We use a wrapper around the Office DLLs to use the Mailmerge features Office has to offer and, b... | 14,947 |
<p>I want to draw spinner controls, such as those found on a NumericUpDown, on a custom component. If I want to draw a drop-down button, I can use ComboBoxRenderer. Is there an equivalent of ComboBoxRenderer for NumericUpDown?</p>
| <p>Turns out there is. See the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.visualstyles.visualstyleelement.spin.aspx" rel="nofollow noreferrer">VisualStyleElement.Spin class</a>.</p>
| <p>I do not think a ComboBoxRenderer exists in the Windows Forms namespace. You need to directly draw the UpDown control arrows (spin buttons) using interop and the Theme API. I don't have a complete sample for you, but you'll need</p>
<pre><code>[DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicod... | 30,586 |
<p>Up until now I have been using std::string in my C++ applications for embedded system (routers, switches, telco gear, etc.).</p>
<p>For the next project, I am considering to switch from std::string to std::wstring for Unicode support. This would, for example, allow end-users to use Chinese characters in the command... | <p>Not to my knowledge.</p>
<p>To get around this, I manage my stored procedures in a Visual Studio database project. Every stored procedure is in its own file and has a drop command at the top of the file. When I update the stored through Visual Studio, the database's created date is updated in the database because... | <p>From all the research I've done on this in the past, I unfortunately have to say no. SQL Server 2000 simply does not store this information, and I've never seen any solution for retrieving it.</p>
<p>There are a few alternative methods, but they all involve user intervention. Besides keeping stored procedure script... | 19,819 |
<p>I recently started facelets development, and a couple of days ago made my first useful custom tag. Now I would like to have auto-completion support in eclipse, like I have for standard taglibs like h, c and ui.</p>
<p>Is there any easy way (less than 30 min work) to enable tool support for custom tags?</p>
<p>I'm ... | <p>You can use Jboss Tools 3.0M3 or newer.
About it support of custom facelets you can find information here <a href="http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154315" rel="nofollow noreferrer">Jboss Tools Forum</a></p>
| <p>What version of Eclipse are you using?</p>
<p>My current version (Version: 3.4.0, Build id: I20080617-2000, with WTP)has autocompletion for any taglib added as a directive on my JSP page (even if the current JSP file does a <code><%@ include file="..." %></code> to the actual file with the taglib declarations... | 38,415 |
<p>I want to automate a Windows 2000+ server reboot process using Task Scheduler or similar tool to remotely reboot a server and wait for it to come back up. I can issue <code>shutdown</code> or <code>psshutdown</code> to remotely reboot, but I want something better than <code>sleep</code> to wait for it to come back.... | <p>Your remote restart script could start the server, wait n minutes, then query your RFC service. You could also have a local script on the server do the same thing.</p>
| <p>You can poll some core service to see if it has started:</p>
<pre><code>sc "\\server_name" query EventSystem
</code></pre>
| 8,062 |
<p>Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode the string back to the original string?</p>
<p>I know I'm making a very silly mistake somewhere in this code. Here's what I've been ... | <p>Your code was fine except for the Base 64 encoding bit (which you mentioned was a test), the reason the output may not have made sense is that you were displaying a raw byte array (doing toString() on a byte array returns its internal Java reference, not the String representation of the <strong>contents</strong>). H... | <pre><code>import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.util.Base64;
import java.util.Base64.Encoder;
/*... | 4,057 |
<p>We have a couple of developers asking for <code>allow_url_fopen</code> to be enabled on our server. What's the norm these days and if <code>libcurl</code> is enabled is there really any good reason to allow?</p>
<p>Environment is: Windows 2003, PHP 5.2.6, FastCGI</p>
| <p>You definitely want <code>allow_url_include</code> set to Off, which mitigates many of the risks of <code>allow_url_fopen</code> as well.</p>
<p>But because not all versions of PHP have <code>allow_url_include</code>, best practice for many is to turn off fopen. Like with all features, the reality is that if you d... | <p>The big problem is that <strong>allow_url_fopen is not more secured</strong>, so if you want to save file from a url using curl, you must pass from fopen/file_get to save the file. </p>
<blockquote>
<ul>
<li>CURL is only good to retrieve remote content from URL.
<strong>(allow_url_fopen not necessary)</strong... | 15,519 |
<p>Exactly what the title says. Note, this is not about "<a href="https://stackoverflow.com/questions/216972/in-python-what-does-it-mean-if-an-object-is-scriptable-or-not">subscriptable</a>" objects.</p>
| <p>A scriptable object is an object that records the operations done to it and it can store them as a "script" which can be replayed.</p>
<p>For example, see: <a href="https://svn.enthought.com/enthought/browser/AppTools/trunk/docs/source/appscripting/Introduction.rst" rel="nofollow noreferrer">Application Scripting F... | <p>A scriptable object is an object that records the operations done to it and it can store them as a "script" which can be replayed.</p>
<p>For example, see: <a href="https://svn.enthought.com/enthought/browser/AppTools/trunk/docs/source/appscripting/Introduction.rst" rel="nofollow noreferrer">Application Scripting F... | 26,688 |
<p>I have noticed in phpMyAdmin you can click 'optimise' on tables, and it runs:</p>
<pre><code>OPTIMIZE TABLE table_name
</code></pre>
<p>What does this actually do?</p>
<p>Should I have some cron job running daily that runs OPTIMIZE TABLE on my tables?</p>
<p>Thank you</p>
| <p>From <a href="http://www.informit.com/articles/article.aspx?p=29406&seqNum=3" rel="noreferrer">InformIT</a></p>
<blockquote>
<p>An optimized table structure is
different than a well-designed table.
Table structure optimization has to do
with reclaiming unused space after
deletions and basically cleani... | <p>I'd start with the <a href="http://dev.mysql.com/doc/refman/5.0/en/optimize-table.html" rel="nofollow noreferrer">MySQL documentation about that command</a>. After reading that, do you still have questions?</p>
| 46,280 |
<p>When using host headers to host multiple websites on the same IP address in IIS, is there any way of accessing that website from a browser running on the local machine?</p>
<p>This is normally required when a given web component only allows configuration from the local machine. It's also useful when things like ASP... | <p>Just an idea: Mapping the hostname to 127.0.0.1 in the hosts ($WINDOWS$\system32\drivers\etc) file may help. This way you should be able to pull up the local IIS site by typing the hostname as if it's a remote server</p>
| <p>Maybe I am not understanding the question, but what's wrong with just typing in the URL for the website? If it's the matter of domain name resolution, you can point to the right DNS or put it in <a href="http://en.wikipedia.org/wiki/Hosts_file" rel="nofollow noreferrer">hosts</a> file.</p>
| 5,733 |
<p>Is there any meaningful distinction between:</p>
<pre><code>class A(object):
foo = 5 # some default value
</code></pre>
<p>vs.</p>
<pre><code>class B(object):
def __init__(self, foo=5):
self.foo = foo
</code></pre>
<p>If you're creating a lot of instances, is there any difference in performance... | <p>There is a significant <em>semantic</em> difference (beyond performance considerations):</p>
<ul>
<li><strong>when the attribute is defined on the instance</strong> (which is what we usually do), there can be multiple objects referred to. <strong>Each gets a totally separate version of that attribute</strong>.</li>
... | <p>There is one more situation. </p>
<p>Class and instance attributes is <strong>Descriptor</strong>.</p>
<pre><code># -*- encoding: utf-8 -*-
class RevealAccess(object):
def __init__(self, initval=None, name='var'):
self.val = initval
self.name = name
def __get__(self, obj, objtype):
... | 25,368 |
<p>I need to be able to launch a process and read the output into a variable. Then based on the return of the command I can choose to show the full output or just a selected subset.</p>
<p>So to be clear, I want to launch a text based process (psexec actually) and read the output from that command (stdout, stderr, et... | <p>You left off some details regarding what kind of process, but I think <a href="http://blogs.msdn.com/powershell/archive/2007/01/16/managing-processes-in-powershell.aspx" rel="nofollow noreferrer">this article</a> from the Powershell Team Blog has whatever you'd like to do, either from piping the executable's output ... | <p>As far as reading stuff into variables is concerned, you should just be able to do something like</p>
<pre><code>$output = ps
</code></pre>
<p>This will only capture stdout, though, not the verbose, warning or error streams. You can get the exit code of the previous command by testing the special variable <code>$... | 28,187 |
<p>Within the last year I have become addicted to subversion. I am an only developer and I also work on a few of my own projects. With SVN its really easy to manage everything - and because it is hosted on an online server though HTTPS I can access my code from anywhere. It is also great for deploying code to our produ... | <p>Git, Mercurial and Bazaar are distributed control systems that operate of the idea that you aren't always connected to the Net, and that there need not be one central version of the repository.</p>
<p>If you're doing a lot of detached work, sometimes called "airplane mode", as in you're on an airplane and can't co... | <p>If SVN addresses all of your needs then I don't see the reason for change.
If curiosity is the driver of your quest for a different source control then I would recommend reading about git or other distributed scm solution and try to figure out if it's worth the investment in order to switch (which i doubt it is in y... | 27,719 |
<p>If I have something like a UILabel linked to a xib file, do I need to release it on dealloc of my view? The reason I ask is because I don't alloc it, which makes me think I don't need to release it either?
eg (in the header):</p>
<pre><code>IBOutlet UILabel *lblExample;
</code></pre>
<p>in the implementation:</p>
... | <p>If you follow what is now considered to be best practice, you <em>should</em> release outlet properties, because you should have retained them in the set accessor:</p>
<pre><code>@interface MyController : MySuperclass {
Control *uiElement;
}
@property (nonatomic, retain) IBOutlet Control *uiElement;
@end
@imp... | <p>Related: <a href="https://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-objective-c">Understanding reference counting with Cocoa / Objective C</a></p>
| 8,714 |
<p>I'm using SQL Server 2005.</p>
<p>I have a field that must either contain a unique value or a NULL value. I think I should be enforcing this with either a <code>CHECK CONSTRAINT</code> or a <code>TRIGGER for INSERT, UPDATE</code>.</p>
<p>Is there an advantage to using a constraint here over a trigger (or vice-vers... | <p>Here is an alternative way to do it with a constraint. In order to enforce this constraint you'll need a function that counts the number of occurrences of the field value. In your constraint, simply make sure this maximum is 1.</p>
<p>Constraint:</p>
<pre><code> field is null or dbo.fn_count_maximum_of_field(f... | <p>Usually a trigger will allow you to provide a more verbose and explanatory message than a check constraint, so I have used those to avoid the "which column was bad" game in debugging. </p>
| 49,479 |
<p>I am pondering about buying a Creality Ender-3, and I am honestly confused about some reviews. Some claim it is running 24 V, one did claim it was 12 V, most don't mention it. Since I know about some issues with the clamps, if I get myself an Ender-3, I want to replace the hotend with a proper one from day one. So k... | <p>Bearing in mind that the specifications on Amazon's page are sometimes not 100% (even though they are <em>in this case</em>), it is always best to check on the manufacturer's website.</p>
<p>From Creality3D's own website, <a href="https://www.creality3dofficial.com/" rel="nofollow noreferrer">Creality3D.shop</a>, on... | <p>After checking the amazon listings of the ender-3, they contain more information than the gearbest listing: indeed it is a <strong>24V</strong> machine.</p>
<blockquote>
<p>Product description</p>
<p>[...]</p>
<p><strong>Output: DC 24 V 15 A 360 W</strong></p>
<p>[...]</p>
</blockquote>
| 956 |
<p>I have a star schema type data base, with fact tables that have many foreign keys to dimension tables. The number of records in each dimension table is small - often less than 256 bytes, but always less than 64k. The fact tables typically have hundreds of thousands of records, so I want maximize join speed.</p>
<p... | <p>Yr co-worker is wrong. If you use four byte integers for the foreign Keys, then the primary keys in the fact table have to be 4-byte integers as well. And then you are making your fact table wider than it needs to be, reducing the number of records that can fit on a single index page. To the degree that this cha... | <p>As always with performance questions, it depends. If your fact rows are tiny, say 20 bytes each, then a saving of two bytes per row will save 400 bytes, and allow you to fit an extra 20 rows on each page. If your fact rows are larger, say 500 bytes, then you'll only be able to save 32 bytes, which won't matter at ... | 45,759 |
<p>I'm trying to extract the attributes of a anchor tag (<code><a></code>). So far I have this expression:</p>
<pre><code>(?<name>\b\w+\b)\s*=\s*("(?<value>[^"]*)"|'(?<value>[^']*)'|(?<value>[^"'<> \s]+)\s*)+
</code></pre>
<p>which works for strings like</p>
<pre><code><a href=... | <p>Update 2021: <a href="https://stackoverflow.com/users/2377961/radon8472">Radon8472</a> proposes in <a href="https://stackoverflow.com/questions/317053/regular-expression-for-extracting-tag-attributes/317081?noredirect=1#comment121192951_317081">the comments</a> the regex <a href="https://regex101.com/r/tOF6eA/1" rel... | <p>Extract the element:</p>
<pre><code>var buttonMatcherRegExp=/<a[\s\S]*?>[\s\S]*?<\/a>/;
htmlStr=string.match( buttonMatcherRegExp )[0]
</code></pre>
<p>Then use jQuery to parse and extract the bit you want:</p>
<pre><code>$(htmlStr).attr('style')
</code></pre>
| 40,948 |
<p>I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.</p>
<p>Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatic... | <p>Facebook does it, when you write on people's walls, but only resizes vertically.</p>
<p>Horizontal resize strikes me as being a mess, due to word-wrap, long lines, and so on, but vertical resize seems to be pretty safe and nice.</p>
<p>None of the Facebook-using-newbies I know have ever mentioned anything about it... | <p>Here is an extension to the Prototype widget that Jeremy posted on June 4th:</p>
<p>It stops the user from entering more characters if you're using limits in textareas. It checks if there are characters left. If the user copies text into the textarea, the text is cut off at the max. length:</p>
<pre><code>/**
* P... | 2,901 |
<p>What is the best way to send e-mail using outlook express from the command line? It has to be an automated operation with no user interaction. There will be some .jpg files in attachment.
Thanks.</p>
| <p>Perhaps <a href="https://stackoverflow.com/questions/248569/starting-outlook-and-having-an-email-pre-populated-from-command-line">this post</a> is helpful. It speaks pre-populating a new e-mail message and including a file.</p>
| <p>This thread: <a href="https://stackoverflow.com/questions/152323/send-mail-from-a-windows-script#152411" title="Send mail from a Windows script">Send mail from a Windows script</a> might help you, I think.</p>
| 31,560 |
<p>I was previously taught today how to set parameters in a SQL query in .NET in this answer (<a href="https://stackoverflow.com/questions/169359/improving-code-readability-for-sql-commands#169369">click</a>).</p>
<p>Using parameters with values are fine, but when I try to set a field in the database to null I'm unsuc... | <p>you want <a href="http://msdn.microsoft.com/en-us/library/system.dbnull.aspx" rel="noreferrer">DBNull</a>.Value.</p>
<p>In my shared DAL code, I use a helper method that just does:</p>
<pre><code> foreach (IDataParameter param in cmd.Parameters)
{
if (param.Value == null) param.Value = DBNull.Value;... | <p>Try setting it to <code>DbNull.Value</code>.</p>
| 20,539 |
<p>I am designing a web site but it is behind a firewall and such services like <a href="http://validator.w3.org/" rel="nofollow noreferrer">http://validator.w3.org/</a> will not work.</p>
<p>Are there any free apps I could run on Windows or Mac OS X that will validate html and css?</p>
| <p>Use the HTML Validator plugin for Firefox</p>
<p><a href="http://users.skynet.be/mgueury/mozilla/download.html" rel="nofollow noreferrer">http://users.skynet.be/mgueury/mozilla/download.html</a></p>
<p>It will even work on HTML files on your PC</p>
| <p>the w3 validator does have a 'validate by direct input' option (which I use constantly) however TravisO's answer is worthy as the chosen answer :)</p>
| 37,618 |
<p>Say I've got two scheduled processes: A and B.</p>
<p>Given that B should not run until A has completed, how might I gracefully enforce this dependency?</p>
<p>Approaches that have been considered:</p>
<ol>
<li><p>Have A schedule B upon completion. This has the downside of B never being scheduled if for some reas... | <p>Your option 1 directly answers your question: if B is dependent on A, and A fails, A not scheduling B means that B can't happen.</p>
<p>Unless B merely has to run after A does, whether or not A was successful.</p>
<p>In that case, something like the following (in bash) would work:</p>
<pre><code>A && B
</... | <p>You could modify step 3: Create your two processes to run in isolation, and then create a third process that runs the other two.</p>
| 21,600 |
<p>i want to be a good developer citizen, <a href="http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx" rel="nofollow noreferrer">pay my taxes</a>, and disable things if we're running over Remote Desktop, or running on battery.</p>
<p>If we're running over remote desktop (or equivalently in a Terminal ser... | <p>I believe you can check <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.powerstatus(VS.80).aspx" rel="noreferrer">SystemInformation.PowerStatus</a> to see if it's on battery or not.</p>
<pre><code>Boolean isRunningOnBattery =
(System.Windows.Forms.SystemInformation.Powe... | <p>I don't believe it's exposed in managed code, but you can use the Win32 GetSystemPowerStatus via pinvoke to get this info.</p>
<p>As an aside, you may want to consider using the GetCurrentPowerPolicies or similar to determine the users preferences relating to performance/power management. </p>
| 29,843 |
<p>This might be on the "discussy" side, but I would really like to hear your view on this.</p>
<p>Previously I have often written data access classes that handled both reading and writing, which often led to poor naming, like FooIoHandler etc. The rule of thumb that classes that are hard to name probably are poorly d... | <p>ORM might be your best solution.<br>
Or use a repository type pattern, with a "thingContext" object that is responsible for state persistence.</p>
<p>Personally, I use the activeRecord pattern, where save logic is baked into a base class, but I'm leaving it in favor of an nHibernate style repository pattern. The al... | <p>When given the choice I generally subclass the reader to create the writer. </p>
| 4,923 |
<p>I have a memory of talking to people who have got so far in using Ruby on Rails and then had to abandon it when they have hit limits, or found it was ultimately too rigid. I forget the details but it may have had to do with using more than one database.</p>
<p>So what I'd like is to know is what features/requireme... | <p>Rails (not ruby itself) is proud to be "Opinionated Software".</p>
<p>What this means in practice is that the authors of rails have a certain target audience in mind (themselves basically) and aim rails specifically at that. If X feature isn't needed for that target audience, it doesn't get added.</p>
<p>Off the t... | <p>Orion's answer is right on. There are few hard limits to AR/Rails: deploying to Windows, AR connectors that aren't frequently used, e.g. Firebird, ), but even the things he mentioned, multiple databases and DB servers, there are gems and plugins that address those for legacy, sharding, and other reasons.</p>
<p>Th... | 21,745 |
<p>In AJAX applications that need to poll the server in regular intervals (like a chat applications), what is the recommended minimum time between two calls, so that the update is done as quickly as possible? What times are considered as hogs for the server and the client?</p>
| <p>The answer to this question is very much dependent on:</p>
<ol>
<li>How much data is sent in each poll</li>
<li>How many users you will have online at a time</li>
<li>How much bandwidth your server can handle</li>
<li>How "fresh" the data on your client needs to be</li>
</ol>
<p>Without knowing any of these specif... | <p>There is no real limit, other than the number of simultaneous users you expect to burden your server load with. You can probably dynamically tune this on the client end by keeping track of average response times.</p>
<p>In order to do this properly, under a decent load, you're betting off using <a href="http://en.w... | 31,318 |
<p>I have created a Custom Server Control (Inherited from GridView).</p>
<p>On the page, the GridView is DataBound to a DataSet, so I do not know at design time what columns will be present in my GridView.</p>
<p>Now, what I want to do is, to add a textbox in every Cell for the GridView Header row, and those textboxe... | <p>Why not store the values in the ViewState and read them back (refill the text boxes) on the postback?</p>
| <p>You don't have to worry about the textbox's values, just their ID and when you create them; control state(...hmmm...or maybe the viewstate) will take care of the rest, as long as you create and "supply" the page with the same number of textboxes and their respective (unique(!)) ID's.</p>
<p>You can do this is both ... | 41,311 |
<p>What internal web service did your company implement first? What did you learn?</p>
| <p>One of the first movers was the "Customer base system". </p>
<p>The common authority for all customers in the company.</p>
<p>EDIT:<br>
regarding the comment:<br>
It did indeed open up for more SOA. It's about 3-5years ago (before me) and currently it was publicly known last year that the SOA helped the company sw... | <p>Let me see if I can get this conversation going. My company implemented a wrapper around the most common Active Directory look-up needs. I imagine this might be one of the most common things to do first in Microsoft/.NET shops.</p>
<p>Anybody implement a library of utility services? Write a facade to some SAP modul... | 38,080 |
<p>Consider a <em>hypothetical</em> method of an object that does stuff for you:</p>
<pre><code>public class DoesStuff
{
BackgroundWorker _worker = new BackgroundWorker();
...
public void CancelDoingStuff()
{
_worker.CancelAsync();
//todo: Figure out a way to wait for BackgroundWorke... | <p>If I understand your requirement right, you could do something like this (code not tested, but shows the general idea):</p>
<pre><code>private BackgroundWorker worker = new BackgroundWorker();
private AutoResetEvent _resetEvent = new AutoResetEvent(false);
public Form1()
{
InitializeComponent();
worker.Do... | <p>oh man, some of these have gotten ridiculously complex. all you need to do is check the BackgroundWorker.CancellationPending property inside the DoWork handler. you can check it at any time. once it's pending, set e.Cancel = True and bail from the method.</p>
<p>// method here
private void Worker_DoWork(object s... | 15,042 |
<p>can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos.</p>
<p>Background reading on Kerberos would also be useful </p>
<p>Thanks</p>
<p>Peter</p>
| <p>mod_auth_kerb is a good start: <a href="http://modauthkerb.sourceforge.net/" rel="nofollow noreferrer">http://modauthkerb.sourceforge.net/</a>. If you need Active Directory support, look here: <a href="http://support.microsoft.com/?id=555092" rel="nofollow noreferrer">http://support.microsoft.com/?id=555092</a>.</p>... | <p>I found mod_auth_spnego also quite okay, as it can use SSPI on windows instead of requiring MIT Kerberos. <a href="http://sourceforge.net/projects/modgssapache/" rel="nofollow noreferrer">mod_spnego</a></p>
| 6,504 |
<p>I'm having trouble trying to map nested conditions onto an intuitive interface.</p>
<p>eg. How would you represent ((Condition1 AND Condition2) OR (Condition1 AND Condition5)) AND Condition4</p>
| <p>Here's a screenshot of prototype I did for a linux app a few years ago. You could click on the +/- icons to add rows to a group and click on the "add new..." and "remove last..." buttons to remove the bottom-most group. </p>
<p>Above each group was a couple of menubuttons that had the choices of "AND items that mat... | <p>The best interface I've seen for this was a home-grown control that drew a tree to clearly show the order of operations. I've never seen a third-party control that did this but I haven't looked for one either.</p>
| 14,368 |
<p>Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the 'Visual Studio Command Prompt'. When starting this command prompt it sets various environment variables that the C++ compiler, cl, uses when compiling.</p>
<p>This is not always desirable. If, for example, I ... | <p>The compilers can be used from command line (or makefiles) just like any other compilers. The main things you need to take care of are the INCLUDE and LIB environment variables, and PATH. If you're running from cmd.exe, you can just run this .bat to set the environment:</p>
<p><blockquote>C:\Program Files\Microso... | <p>My version of opening the visual studio command line for Visual Studio Command Prompt in <a href="/questions/tagged/visual-studio-2010" class="post-tag" title="show questions tagged 'visual-studio-2010'" rel="tag">visual-studio-2010</a>. Used internally to build a library/project and then perform some extra steps wi... | 10,999 |
<p>After Visual Studio 2005 displays the splash screen it locks up on me. No error, no cpu utilization, just a frozen splash screen. I've tried it in both /safemode and /resetsettings</p>
<p>I'm sure it's one of the services on my machine, just wonder if anyone else has had the problem and can help me with the hunt?... | <p>Have you tried running it in <a href="http://msdn.microsoft.com/en-us/library/xee0c8y7(VS.80).aspx" rel="nofollow noreferrer">safe mode</a> - if that doesn't let you sort it out you can try the /resetsettings switch, which has sorted out similar problems for me in the past.</p>
<p>/resetuserdata can also help.</p>
| <p>Try starting up with the log command:</p>
<pre><code>devenv.exe /Log c:\vs.log
</code></pre>
<p>And see if anything is noted in it.</p>
<p>Another thing to try is to run VS in a temporary user account to see if the problem is strictly with your user environment or is system-wide. See <a href="https://stackoverfl... | 21,056 |
<p>I am trying to create 1 Parent Drop Down, that has 2 dependent child drop down lists using JAVASCRIPT.</p>
<p>My html page is at - <a href="http://www.larkgrove.com/entryform/entryform.html" rel="nofollow noreferrer">http://www.larkgrove.com/entryform/entryform.html</a></p>
<p>I am using the Dynamic Options Lists ... | <p>I know you are using the Dynamic options script, but I thought that I would put up a quick from scratch solution. The code is a little verbose, but I am hoping it will be easier to see whats going on this way. The final working page is here: <a href="http://ryanscook.com/Files/DropDownListTest.htm" rel="nofollow nor... | <p>Well, first of all, let's have a look at your code:</p>
<pre><code><script type="text/javascript">
var TESTLIST = new DynamicOptionList("PARENT1","CHILD1","CHILD2");
TESTLIST.forValue("A").forValue("A").forValue("A").addOptionsTextValue("C","C","D","D");
</script>
<select name="PARENT1">
<o... | 47,239 |
<p>Is there a way to get Visual Studio to display strings as verbatim strings (prefixed with '@')? I'd like to easily cut strings containing file paths from Visual Studio into Explorer or other apps.</p>
<p>Clarification: when VS displays a string in the auto, watch, immediate, etc. window, I'd like it to be formatted... | <p>You can click on the magnifier in VS 2008 debugger variable display and select "Text Visualizer" which will give you the text in an unmassaged format.</p>
| <p>You may need to clarify your question. My first thought was that you just need to prefix the string with '@' to make them verbatim, but you already know that.</p>
<pre><code>string s = @"c:\my folder\";
</code></pre>
<p>What exactly are you trying to do with the string?</p>
| 44,474 |
<p>To create a new event handler on a control you can do this</p>
<pre><code>c.Click += new EventHandler(mainFormButton_Click);
</code></pre>
<p>or this</p>
<pre><code>c.Click += mainFormButton_Click;
</code></pre>
<p>and to remove an event handler you can do this</p>
<pre><code>c.Click -= mainFormButton_Click;
</... | <p>I found a solution on the <a href="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/576f69e7-55aa-4574-8d31-417422954689/" rel="noreferrer">MSDN forums</a>. The sample code below will remove all <code>Click</code> events from <code>button1</code>.</p>
<pre><code>public partial class Form1 : Form
{
... | <p>I found this answer and it almost fit my needs. Thanks to SwDevMan81 for the class. I have modified it to allow suppression and resumation of individual methods, and I thought I'd post it here.</p>
<pre><code>// This class allows you to selectively suppress event handlers for controls. You instantiate
// the sup... | 11,720 |
<p>I'm looking for a free/open source collaborative project manager that can be deployed internally in my workplace that would act similar to Codeplex or Sourceforge. Does anyone know of something like this, and if so do you have experience with it.</p>
<p><strong>Requirements:</strong></p>
<ul>
<li>Open Source <em>o... | <p>I like redmine for this: <a href="http://www.redmine.org" rel="noreferrer">http://www.redmine.org</a>. The only thing it's missing from your criteria is voting, but there might even be a plugin for this.</p>
<p>Trac is also popular (<a href="http://trac.edgewall.org" rel="noreferrer">http://trac.edgewall.org</a>) ... | <p><a href="http://www.assembla.com/" rel="nofollow noreferrer">Assembla</a> and <a href="http://beanstalkapp.com/" rel="nofollow noreferrer">BeanStalk</a> are nice, both have things like; wiki, discussion, alerts, chat, ticketing, Trac, Git and Subversion</p>
| 10,895 |
<p>From the wikipedia entry on NP-Complete:</p>
<p>"The easiest way to prove that some new problem is NP-complete is first to prove that it is in NP, and then to reduce some known NP-complete problem to it"</p>
<p>I'm pretty sure that I understand this: If I have a problem, I can show that it is NP-Complete if I: </... | <p><a href="http://en.wikipedia.org/wiki/Cook%27s_theorem" rel="noreferrer">Cook's Theorem</a></p>
<p>The class NP can be defined as the class of problems decidable by a nondeterministic Turing machine in polynomial time. This theorem shows that <strong>SAT is NP-complete</strong> by encoding the operation of any nond... | <p>To give you the essence of the proof (which is several pages of hard going in Garey & Johnson's <em>Computers and Intractibility</em>):</p>
<p>Any computational problem can be expressed as a Turing machine.</p>
<p>It is possible to express the Turing machine as a logic problem, satisfying certain complexity co... | 39,395 |
<p>I have a website with a mix of ASP (classic) and ASP.NET pages.</p>
<p>For some reason Visual Studio (specifically 2008 Pro) keeps trying to compile the ASP classic pages.</p>
<p><strong><em>How do I prevent it from trying to compile the .asp pages?</em></strong></p>
<p>Reason: I'm getting a ton of errors on a sp... | <p>Have you installed Service Pack 1? It addresses some issues with classic ASP.</p>
| <p>What is in the @Page directive on those classic ASP pages? Have you tried inserting <code><% @Page language="vbscript" %></code> Maybe this does it already?</p>
| 34,969 |
<p>What are the ways that you use to model and retrieve hierarchical info in a database? </p>
| <p>The definitive pieces on this subject have been written by Joe Celko, and he has worked a number of them into a book called Joe Celko's Trees and Hierarchies in SQL for Smarties.</p>
<p>He favours a technique called directed graphs. An introduction to his work on this subject can be found <a href="http://web.archiv... | <p>If you're using SQL Server 2005 then <a href="https://web.archive.org/web/20210927200924/http://www.4guysfromrolla.com/webtech/071906-1.shtml" rel="nofollow noreferrer">this link</a> explains how to retrieve hierarchical data.</p>
<p>Common Table Expressions (CTEs) can be your friends once you get comfortable using... | 5,977 |
<p>I have some configuration values for an asp.net web app. They will be maintained by a system admin once the system goes live. Should I store these values in the database or in a config file? Is there a best practice for this sort of thing?</p>
| <p>It's easy and convenient to create a robust interface to edit the values in the database.</p>
<p>It's less easy to create a good one for the config file.</p>
<p>So I would usually you want to store everything which you would like your users/administrators to be able to edit later in the database. Everything which ... | <p>Depending on the context of the config information, you could choose to leave it in the web.config or you could create maintenance tables for it in the database. I would typcially keep things more backend specific, like connection strings, ftp locations, usernames/passwords(for the application, not user permissions)... | 30,856 |
<p>When is a good idea to save information in a XML file and when in a own-format file?</p>
<p>For XML (or other standard) I see:</p>
<ul>
<li>(+) Standard format.</li>
<li>(-) It's tedious to hand modify.</li>
</ul>
<p>For own-format files I see:</p>
<ul>
<li>(-) We need to build a own-parser (non-standard).</li>
... | <p>Use XML when it's a good fit in various ways:</p>
<ul>
<li>Need to share between different applications which are all capable of handling XML</li>
<li>Natural tree-like structure</li>
<li>Primarily data easily represented as text (binary data is a bit of a kludge in text-based formats)</li>
<li>Extensibility is imp... | <p>The ease of editing isn't a major issue, as pointed out above: there are lot of good (and free for some) XML editors around.</p>
<p>Another potential issue is verbosity, although the answer for large files is to gzip them: in lot of languages, it is nearly transparent.</p>
<p>XML is good in a number of ways: the s... | 45,446 |
<p>How can I test the same regex against different regular expression engines?</p>
| <p>The most powerful free online regexp testing tool is by far <a href="http://regex101.com/" rel="nofollow noreferrer">http://regex101.com/</a> - lets you select the RE engine (PCRE, JavaScript, Python), has a debugger, colorizes the matches, explains the regexp on the fly, can create permalinks to the regex playgroun... | <p>RegExBuddy so far I concur with and endorse.</p>
| 5,221 |
<p>I noticed that many people here use <a href="http://macromates.com/" rel="nofollow noreferrer">TextMate</a> for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for.</p>
<p>So, what ... | <p>Don't neglect the 'mate' command line tool. You can use it to pipe output into TextMate, so if you do the following...</p>
<pre><code>diff file1.py file2.py | mate
</code></pre>
<p>...it will not only open in TextMate, but it is smart enough to know that you're looking at a diff and highlight lines on screen.</p>
... | <p>The <code>mate</code> command line tool is great, you can open an individual file or my favourite use of it is to open a directory of files as a project (e.g. <code>mate .</code>)</p>
| 5,390 |
<p>I have been rather successful in promoting JQuery within my organization. No small feat on it's own. However, one of the ideas being kicked around here to make it part of our app is to create an ASP.net server side control. (We are going to be sticking with WebForms for the foreseeable future.)</p>
<p>I'm not too w... | <p>I know Microsoft (along with Nokia) is "mainstreaming" jQuery and will be integrating it with future versions of Visual Studio. You may want to explore how they'll be officially using it so you can tailor your setup now, and hopefully ease your transition to "official MS jQuery" down the road.</p>
| <p>I found Scott Hanselman's <a href="http://www.hanselman.com/blog/jQuerytoshipwithASPNETMVCandVisualStudio.aspx" rel="nofollow noreferrer">blog post</a> with a sample app that has ASP.net AJAX + JQuery. It's a simple app, but it includes all the javascript with script tags. I don't see any advisement to use a server ... | 21,054 |
<p>I want to do this (no particular language):</p>
<pre><code>print(foo.objects.bookdb.books[12].title);
</code></pre>
<p>or this:</p>
<pre><code>book = foo.objects.bookdb.book.new();
book.title = 'RPC for Dummies';
book.save();
</code></pre>
<p>Where foo actually is a service connected to my program via some IPC, ... | <p>I think the way to do what you are requesting is to have all object communication regarded as message passing. This is how object methods are handled in ruby and smalltalk, among others. </p>
<p>With message passing (rather than method calling) as your object communication mechanism, then operations such as calling... | <p>You shouldn't do it! It is very important for programmers to see and feel the difference between an IPC/RPC and a local method call in the code. If you make it so, that they don't have to think about it, they won't think about it, and that will lead to very poorly performing code.</p>
<p>Think of:</p>
<pre><code>f... | 24,005 |
<p>I have set of names and addresses that have been entered into and excel spreadsheet, but the problem is that the many people that entered the addresses entered them in many different non-standard formats. I want to scrub the addresses before transferring all of of them to my database. Looking around, all I really ... | <p>Since I work in the mailing business ...</p>
<p>A mailable address is not geo-coding. One allows the USPS to deliver mail to and the other tells you where on earth that point is. The USPS does not geo-code their mailable addresses. It's useful for marking areas/regions of people for targeting.</p>
<p>You're not ... | <p>Most of the software that I've worked with to do this is very expensive (or to put it another way, marketing departments are naive and have huge budgets). </p>
<p>This sort of work is a precursor to Geo-coding. This <a href="http://en.wikipedia.org/wiki/Geocoding" rel="nofollow noreferrer">linked Wiki article</a>... | 37,209 |
<p>How can I get a full list of Groups in my Active Directory?</p>
| <p>Check out System.DirectoryServices (An ASP.NET 2.0 reference):</p>
<p>C#-example to get groups: </p>
<pre><code>using System.DirectoryServices;
public class test
{
private void main()
{
foreach (string @group in GetGroups())
{
Debug.Print(@group);
}
}
public... | <p>Microsoft .NET Framework provides a standard library for working with Active Directory: <strong><a href="http://msdn.microsoft.com/en-us/library/ms682458(VS.85).aspx" rel="nofollow noreferrer">System.DirectoryServices namespace</a></strong> in the System.DirectoryServices.dll.</p>
<p>Microsoft recommends using two ... | 41,881 |
<p>When using Aspect Oriented Programming with Policy injection, how do you deal with policy errors gracefully in your design?</p>
<p>In Aspect Oriented Programming the objects should be unconcerned with how a particular policy is configured, but a particular policy may throw particular errors. What's the most gracef... | <p>If you consider the policy to be an "aspect" of the system then the specific aspect should handle everything that has to do with that policy. The objects should be unaware of the specific policy. This way, if you you need to change the policy in the future, you won't need to change anything in the objects.</p>
| <p>Why not have your aspect that injects the policy validate it/handle errors that may occur?</p>
| 22,754 |
<p>I'm printing a Soma cube I found on Thingiverse -- it's a puzzle toy I remember from the early 1970s, and the kind of thing that ought to be really easy-peasy to print. Each of the seven pieces is made of four cubes (or three for one piece) joined face to face in every possible combination, so that they can be asse... | <blockquote>
<p>What's causing this warping/lifting?</p>
</blockquote>
<p>The warping and lifting is caused by insufficient adhesion. This can be caused by an incorrect first layer (it is difficult to see the raft, but generally, rafts have no solid bottom, so less adhesion as there is less material), e.g. not sufficie... | <ol>
<li><p>What has worked for me is to keep the bed temperature constant at 60 °C. Use a higher extrusion temperature for the first layer to promote adhesion. (Differences in PLA composition could cause these temperatures to vary.)</p>
</li>
<li><p>Sometimes it helps to have an bed temperature for the 1st layer as ... | 1,975 |
<p>As much as we would all like to say it is a benefit to programmers to be language agnostic, is it really feasible to support multiple enterprise Web applications of the same type all written in different languages? Think about how complicated a CMS or e-commerce system can be -- now imagine supporting three differen... | <p><a href="http://racket-lang.org/" rel="noreferrer">Racket</a> (<a href="http://racket-lang.org/new-name.html" rel="noreferrer">formerly Dr Scheme</a>) has a nice editor, several different Scheme dialects, an attempt at visual debugging, lots of libraries, and can run on most platforms. It even has some modes specifi... | <p>LispMe works on a Palm Pilot, take it anywhere, and scheme on the go. GREAT way to learn scheme.</p>
| 8,403 |
<p>I'm using <code>.htaccess</code> and <code>mod_rewrite</code> to point to files that reside behind the DocumentRoot. My folder structure looks like this:</p>
<pre><code>home/
webroot/
other_files/
</code></pre>
<p>I have a <code>.htaccess</code> file in webroot with the following content:</p>
<pre>
Rewrit... | <p>I believe you need to add a section with </p>
<pre><code><Directory "/home/other_files">
(options)
</Directory>
</code></pre>
<p>to your server configuration before apache will be able to serve anything from it. For an example, my DocumentRoot is /var/www but there is this section in the default ava... | <p>Just so you know why that rule doesn't work:</p>
<p>The reason that it isn't able to rewrite to <code>/home/other_files/file.html</code> is that mod_rewrite is parsing the path as <code>/home/webroot/home/other_files/file.html</code> since from mod_rewrite's point of view the preceding slash is equivalent to your do... | 2,985 |
<p>I am trying to set one bindable variable to be bound to another. Essentially I want to create an alias. I would give up, but this seems like something that would be good to know.</p>
<p>essentially, I want changes in model.configView to be reflected in view, so that things bound to view.... behave the same as thi... | <p>Not quite enough code here to really say what's going on, however you have made <code>view</code> bindable and that does not automatically mean that all of <code>view</code>'s children are bindable. You'll have to go into <code>view</code> and make <code>lblThisLabel</code> bindable too.</p>
<p>Also it is hard for... | <p>Moreover, I think that even if, with your actual code, <code>view</code> changes should be detected, <code>view</code> won't be updated if assigned <code>model.configView</code> property is not bindable as well...</p>
| 42,031 |
<p>Situation: A PHP application with multiple installable modules creates a new table in database for each, in the style of mod_A, mod_B, mod_C etc. Each has the column section_id.</p>
<p>Now, I am looking for all entries for a specific section_id, and I'm hoping there's another way besides "Select * from mod_a, mod_b... | <p>If the tables are changing over time, you can inline code gen your solution in an SP (pseudo code - you'll have to fill in):</p>
<pre><code>SET @sql = ''
DECLARE CURSOR FOR
SELECT t.[name] AS TABLE_NAME
FROM sys.tables t
WHERE t.[name] LIKE 'SOME_PATTERN_TO_IDENTIFY_THE_TABLES'
</code></pre>
<p>-- or this</p>
<p... | <p>I was going to suggest the same think as borjab. The only problem with that is that you will have to update all of these queries if you add another table. The only other option I see is a stored procedure.</p>
<p>I did think of another option here, or at least an easier way to present this. You can also use a vi... | 12,979 |
<p>Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is <code>no</code> (<em>due to type erasure</em>), but I'd be interested if anyone can see something I'm missing:</p>
<pre><code>class SomeContainer<E>
{
E createContents()
{
re... | <p>You are correct. You can't do <code>new E()</code>. But you can change it to</p>
<pre><code>private static class SomeContainer<E> {
E createContents(Class<E> clazz) {
return clazz.newInstance();
}
}
</code></pre>
<p>It's a pain. But it works. Wrapping it in the factory pattern makes... | <p>You can with a classloader and the class name, eventually some parameters.</p>
<pre><code>final ClassLoader classLoader = ...
final Class<?> aClass = classLoader.loadClass("java.lang.Integer");
final Constructor<?> constructor = aClass.getConstructor(int.class);
final Object o = constructor.newInstance(... | 10,078 |
<p>I am trying to get the DB2 data provider from a 32-bit .Net application to connect to DB2 running as a 32-bit application on Vista 64 (is that confusing enough yet)? Unfortunately, I am getting the following error:</p>
<blockquote>
<p>SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, token... | <p>Are you required to have it run as x86? I had similar issues with web apps under Visual Studio's dev web server (which is x86), but switching over to IIS (x64) worked for me. Since I was deploying to IIS x64, I called it a day at that point.</p>
<p>I tried tracing with Filemon and Regmon, but didn't get any denied ... | <p>I uninstalled the previous 32bit version, reinstalled as 64bit, and now I get a completely different error. Its mentioned as requiring FP2 to fix, but since I'm using Express-C, I can't install the fixpack (IBM doesn't provide fixpacks for free DB2 products). Anyway, thanks for the help. At least I can come close... | 4,901 |
<p>I currently use Notepad++ for most of my development. I have been checking out other, more full-featured options and would like to switch (I'm in particular a fan of Aptana so far) but there is one thing about Notepad++ that I really like and I haven't been able to get so far. </p>
<p>My current workflow is somet... | <p>I think you're doing things a bit strange.</p>
<p>You already have all your information in an SVN repository, so why not take advantage of that?</p>
<p>You keep a working copy on your computer for development and testing. Save and commit your changes to SVN. On your server, do an SVN <code>export</code> (or <code>... | <p>Eclipse has a plugin called <a href="http://www.eclipse.org/dsdp/tm/" rel="nofollow noreferrer">RSE</a> allow you to work on remote sources thru ssh,ftp etc.
You can use <a href="http://www.eclipse.org/pdt" rel="nofollow noreferrer">PDT</a> but I guess it may work on Aptana as well.</p>
<p>I'm using the Zend Studio... | 30,920 |
<p>I have written a console application that sets the size of the console and output buffer. My problem is that after the program ends I cannot resize my cmd.exe window the way I did before. After the program sets the size of the window it retains that size no matter what I do afterwards. </p>
| <p>It works for me in C#. </p>
<pre><code>namespace CSharpTest
{
class Program
{
static void Main(string[] args)
{
System.Console.WindowHeight = 50;
System.Console.WindowWidth = 100;
System.Console.BufferHeight = 6000;
System.Console.BufferWidth ... | <p>It is not clear what you mean. But are you setting the default values for all Cmd consoles when you change the size - That would make new cmd consoles that size too.</p>
<p>Could we have a bit more information about what you mean please.</p>
| 43,506 |
<p>What experience can you share about using multiple AJAX libraries?</p>
<p>There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed i... | <p>You could use all those libraries, but I highly recommend against it. Downloading and executing that much JavaScript will most likely choke the browser and slow down your user's experience. It would be much better from a user's perspective and a developer's to pick one. Less context/architecture switching and less c... | <p>Ruby on Rails uses both prototype and Scriptaculous by default, as there is little overlap between the two. I've also used yui snippets in addition to that and have never had a problem. Load times are an issue, but the libraries are usually cached, so it's only on the first page loaded.</p>
| 8,522 |
<p>Are there LaTeX packages for (more or less) easily drawing Gantt diagrams?</p>
<p>Thanks.</p>
| <p>The <a href="http://www.ctan.org/pkg/pgfgantt" rel="noreferrer">pgfgantt</a> package is quite easy to use and does linking.</p>
| <p>There is the <a href="http://www.ctan.org/tex-archive/graphics/pstricks/contrib/pst-gantt/" rel="nofollow noreferrer">pst-gantt package</a>. The bad news is, that you have to draw dependencies between the tasks yourself. So you need to use the <code>\psline</code> macro to draw lines and arrows.</p>
| 20,712 |
<p>I want to expand my programming horizons to Linux. A good, dependable basic toolset is important, and what is more basic than an IDE?</p>
<p>I could find these SO topics:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/2756/lightweight-ide-for-linux">Lightweight IDE for linux</a> and</li>
<li><a href="ht... | <h2>Initially: confusion</h2>
<p>When originally writing this answer, I had recently made the switch from Visual Studio (with years of experience) to Linux and the first thing I did was try to find a reasonable IDE. At the time this was impossible: no good IDE existed.</p>
<h2>Epiphany: UNIX is an IDE. <em>All of it.... | <blockquote>
<p><a href="https://stackoverflow.com/questions/24109/c-ide-for-linux#219039">why wouldn't you also use it for C++?
CDT meets every requirement you've
mentioned.</a></p>
</blockquote>
<p>I didn't use eclipse at first because I wasn't sure that it was equally good at giving me the means of developing... | 4,386 |
<p>Unable to find a SQL diff tool that meets my needs, I am writing my own. Between the INFORMATION_SCHEMA and sys tables, I have a mostly-complete working version. But one thing I can't find in the metadata is the <em>definition</em> of a trigger, you know, the actual SQL code. Am I overlooking something?</p>
<p>T... | <p>sp_helptext works to get the sql that makes up a trigger.</p>
<p>The text column in the syscomments view also contains the sql used for object creation.</p>
| <p>this query return trigger with its name and body.</p>
<pre><code>Select
[tgr].[name] as [trigger name],
[tbl].[name] as [table name] ,
OBJECT_DEFINITION(tgr.id) body
from sysobjects tgr
join sysobjects tbl
on tgr.parent_obj = tbl.id
WHERE tgr.xtype = 'TR'
</code></pre>
| 6,566 |
<p>In the application I'm writing, one of the methods allows for the numbers the user entered to be turned into letters.</p>
<p>For example, the user will be entering grades (as doubles) and the program will decide (when the criteria is met) to return the letter associated with the number. Initially, I had it written ... | <p>Your question is confusing. </p>
<blockquote>
<p>And since its in an array...</p>
</blockquote>
<p>but none of your examples include an array. Your method would work fine as</p>
<pre><code>public string ToGrade(double score)
{
if (score >= 95.0)
return "A+";
else if (score >= 90.0)
... | <pre><code>var list = [
[95.0, "A+"],
[90.0, "A"],
[85.0, "B+"],
[80.0, "B"],
[75.0, "C+"],
[70.0, "C"],
[65.0, "D+"],
[60.0, "D"]
];
for (var i in list)
if (score >= list[0])
return list[1];
return "F";
</code></pre>
| 42,510 |
<p>In some editors there exist plugins implementing a feature called "hungry backspace" or "hungry delete".</p>
<p>If this mode is active in a text editor then one hit to the backspace key will automatically delete all whitespace chars backwards from the current cursor position up to the first non-whitespace character... | <p>Alt-Del is probably as close as you're going to get without writing a plugin yourself. Others have asked for this feature (coming from intelliJ) but so far it doesn't exist, or it's not published.</p>
<p>-Adam</p>
| <p>In SciTE, and Eclipse (3.4), Ctrl+Shift+Del with the caret after the last visible character will delete these spaces. Ie. it deletes from caret to end of line.</p>
<p>Actually, in SciTE I don't need to do that, since I have set it up to automatically remove these trailing spaces when saving.</p>
<p>Note: In Prefer... | 38,436 |
<p>How can I use Doxygen to create the HTML documentation as a single, very long file? I want something like the RTF output, but as HTML.</p>
<p>The reason: I need my API published as a single, printable, document. Something that can be loaded into Word, converted to PDF, etc.</p>
| <p>I think you can use <a href="https://www.msweet.org/htmldoc/index.html" rel="nofollow noreferrer">HTMLDOC</a> to convert the generated html files to a single html file. (I did not try it myself)</p>
<p>The <a href="https://www.msweet.org/htmldoc/htmldoc.html" rel="nofollow noreferrer">manual</a> includes the follow... | <p>I don't think there's an option that will produce the output as a single HTML file, but the RTF output may be suitable if you need an editable output format (I haven't tried this myself so I don't know how well this works).</p>
<p>If you want good quality printable output, then Doxygen can output LaTeX format (set ... | 48,909 |
<p>Are there any <strong>good</strong> grid-hosting companies out there that offer .NET stacks? Something like MediaTemple - which won't host the worlds fastest websites, but for the price is far better than "shared hosting". I've used Rackspace's Mosso, but it sucked - it never felt like a normal .NET stack (caching w... | <p>Try <a href="http://www.gogrid.com" rel="noreferrer">gogrid.com</a> they seem to have a very nice following in the cloud computing circles.</p>
| <p>can talk a bit more about the not so normal .net experience? I was thinking to go for Mosso...</p>
| 2,631 |
<p>I'm currently maintaining some flex code and noticed very many functions which are declared like:</p>
<pre><code>private function exampleFunc():void {
....
}
</code></pre>
<p>These functions are in the <em>global scope</em>, and aren't part of any specific class, so it's a bit unclear to me what effect declari... | <p>The actionscript functions that are included in your mxmlc code will we available as a part of your mxmlc component, which behind the scenes is compiled into a class. Therefore marking them as private makes them inaccessible. </p>
<p>Here is an example to make that clear, say you have the following component, we'll... | <p>What do you mean by global scope? Are these functions declared in the main MXML file?</p>
<p>In general, private means that functions can only be called from within the class that declares them.</p>
| 37,722 |
<p>I want to create a class which implements IEnumerable<T> but, using reflection, generates T's and returns them via IEnumerable<T>, where T' is a entirely constructed subclass of T with some properties hidden and others read-only. </p>
<p>Okay., that might not be very clear. Let me explain this via the... | <p><a href="http://www.castleproject.org/dynamicproxy/index.html" rel="nofollow noreferrer">Castle.DynamicProxy</a> will help you accomplish this.
What you would do is create an interceptor that inherits T. You would store the collection of hidden and read-only properties. When a getter or setter is called, the interc... | <p>You just can't hide properties, even by creating subclassed proxies. You could at least construct a different type dynamically, which holds good properties, but it would not be a <code>T</code>.</p>
<p>But returning an object list could be sufficient if you just need to use databinding.</p>
| 16,244 |
<p>I am trying to help a small business that has an application that could benefit from occasional (or temporary) database expertise. The problem is, this company has all their IP in this database, so they are rightfully hesitant to give someone access it. </p>
<p>They would typically meet and gain trust in person, ... | <p>As the others have mentioned, NDA's are a good idea, that covers you from the standpoint of WHAT they see...</p>
<p>However, I can feel that you are also concerned about any potential "damage" the person could do to your database if they make mistakes. To get around, and protect from this is a bit harder, but ther... | <p>consultants sign NDAs all the time, and the good ones take them seriously because a consultant's reputation is <em>all he has</em></p>
<p>while not a DBA, i can highly recommend <a href="http://www.nov8r.com/about.aspx" rel="nofollow noreferrer">this fellow</a> as I have known him all my life ;-)</p>
| 37,463 |
<p>I'm looking for a high performance Java library for fuzzy string search.</p>
<p>There are numerous algorithms to find similar strings, Levenshtein distance, Daitch-Mokotoff Soundex, n-grams etc.</p>
<p>What Java implementations exists? Pros and cons for them? I'm aware of Lucene, any other solution or Lucene is be... | <p>Commons Lang has an implementation of <a href="http://commons.apache.org/lang/apidocs/org/apache/commons/lang3/StringUtils.html#getLevenshteinDistance%28java.lang.CharSequence,%20java.lang.CharSequence%29" rel="noreferrer">Levenshtein distance</a>.</p>
<p>Commons Codec has an implementation of <a href="http://commo... | <p>You can try bitap. I was playing with bitap written in ANSI C and it was pretty fast there is java implementation in <a href="http://www.crosswire.org" rel="nofollow noreferrer">http://www.crosswire.org</a>. </p>
| 42,443 |
<p>How can i release the memory that I used for a variable (e.g. a long string) in C?</p>
| <p>Assuming that you allocated the memory dynamically (using <code>malloc</code> or another memory allocator) you free it using <code>free</code>. If the memory was statically allocated, you can't free it.</p>
| <p>I'd suggest you have a look at <a href="http://www.and.org/ustr/" rel="nofollow noreferrer">ustr</a>, which is a string API that you can use with automatic, constant and dynamicly allocated strings ... only two of which you can actually "free", but all of which you can treat the same way and pass to ustr_free().</p>... | 23,622 |
<p>There are so many little options and settings within Microsoft Visual Studio. Which adjustments do you recommend to others?</p>
| <p><strong>Line Numbers</strong></p>
<ul>
<li>Tools > Options</li>
<li>Text Editor > All Languages > General</li>
<li>Display: Line Numbers</li>
</ul>
<p><img src="https://i.stack.imgur.com/urAYz.png" alt="Visual Studio Line Numbers"></p>
| <p>Besides, Line Numbers, the first thing I always do in a newly-installed IDE is set the <strong><code>Edit.GoToDefinition</code></strong> keyboard shortcut.</p>
<p>Tools > Options > Keyboard</p>
| 22,934 |
<p>I have a CR-10S 500 and want to change a capacitor on it to improve and solve temperature issues. This capacitor that needs to be changed should be labeled as "C4" as mentioned on <a href="https://www.jozerworx.com/creality-cr-10s-c4-capacitor-diy-fix-tutorial/" rel="nofollow noreferrer">this</a> post but it's not p... | <p>You are looking for a capacitor that must be connected to Pin 4 of the LM2596.</p>
<p>Maybe you could provide a better picture of that area so we could see the different tracks on the board.</p>
<p>The LM2596 is in the center of the right side of the board (it is also labeled with LM2596D). The pins should be cou... | <h1>You are looking at the wrong board</h1>
<p>Your board might on the surface look like a Creality v 2.0 board, and is indeed from the same family of boards. After trying to discern the parts and finally resorting to google image search, I almost had to maniacally laugh:</p>
<p>The currently latest version is the <a h... | 1,098 |
<p>I'm currently working on an application where we have a SQL-Server database and I need to get a full text search working that allows us to search people's names.</p>
<p>Currently the user can enter a into a name field that searches 3 different varchar cols. First, Last, Middle names</p>
<p>So say I have 3 rows wit... | <p>If you're just searching people's names, it might be in your best interest to not even use the full text index. Full text index makes sense when you have large text fields, but if you're mostly dealing with one word per field, I'm not sure how much extra you would get out of full text indexes. Waiting for the full... | <p>FreeTextTable should work.</p>
<pre><code>INNER JOIN FREETEXTTABLE(Person, (LastName, Firstname, MiddleName), @SearchString)
</code></pre>
<p>@SearchString should contain the values like 'Phillip Fry' (one long string containing all of the lookup strings separated by spaces).</p>
<p>If you would like to search f... | 3,776 |
<p>I've been impressed by the screencasts for Rails that demonstrate the built-in web server, and database to allow development and testing to occur on the local machine. How can I get an instance of Apache to execute a project directory as its DocumentRoot, and maybe serve up the files on port 8080 (or something simil... | <p>Your Mac comes with both an Apache Web Server and a build of PHP. It's one of the big reasons the platform is well loved by web developers.</p>
<p>Since you're using Code Igniter, you'll want PHP 5, which is the default version of PHP shipped with 10.5. If you're on a previous version of the OS hop on over to <a ... | <p>You could use a low up front setup package such as <a href="http://www.apachefriends.org/en/index.html" rel="nofollow noreferrer">XAMPP</a> and run it as a separate instance. There are many other similar projects as well.</p>
| 14,415 |
<p>Is there any way to validate the width and height of image when uploaded?
using javascript of server side ? like jsp, aspx etc?</p>
| <p>If you're using the Java platform, you can use <a href="http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html" rel="nofollow noreferrer">ImageIO</a> to read the image, then use <code>getHeight</code> and <code>getWidth</code> on the <a href="http://java.sun.com/javase/6/docs/api/java/awt/image/BufferedIma... | <p>I've done this by execing the Image Magick "identify" command.</p>
<p>Easy enough if you're using Unix - although I think it runs on Windows too.</p>
<p>I doubt you can do it client-side.</p>
| 22,507 |
<p>We have inherited VB6 dll which we need to make changes to. We have the code but don't have VB6 compiler. How can we rebuild the dll? Where can we download the VB6 environment/compiler from?
Thanks in advance.</p>
| <p>VB6 is still available as a part of the MSDN subscription.</p>
| <p>You can import the legacy VB6 code into a newer version of Visual Studio.</p>
<p>Just open the VB6 project using <em>File → Open → Convert</em> and it'll automatically upgrade the VB6 code to the current version.</p>
| 28,454 |
<p>How to export pictures in Microsoft Word to TIFF file using Visual Studio Tools for Office? I can obtain a reference to the pictures as InlineShape object collection, the hard part now is how to save them as TIFF images.</p>
| <p>OK guys, I got the problem solved. Here's the code snippet:</p>
<pre><code> private void SaveToImage(Word.InlineShape picShape, string filePath)
{
picShape.Select();
theApp.Selection.CopyAsPicture();
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(typ... | <p>Well. not sure if this is helpful, but you if you are okay with jpegs, then one really cool technique for extracting images from Word 2007 file is as follows:</p>
<ol>
<li>Rename the .docx file to .zip.</li>
<li>Under the (now) zip file, go to the following path: word/media.</li>
<li>All the images in the document ... | 20,501 |
<p>in the out of the project template solution (Dynamic Data Web Application), I have the model created and all is good. - Get the list of the tables, and the select edit etc.</p>
<p>But my database has linking tables that just contain forgien keys - so the list template just displays the fk value</p>
<p><img src="h... | <p>you can reference the metaModel via the dataContext</p>
<pre><code>MetaModel refMetaModel = MetaModel.GetModel(typeof(yourdataContextName));
MetaTable refMetaModel;
refMetaModel = refMetaModel.GetTable("yourTableName");
</code></pre>
<p>PS looked at your code and this works in your sceanrio. You can get the table... | <p>Uselful to use this as well from the Linq to Entities Model - </p>
<p>Using the dataContext - you can get the acutal data most useful.</p>
<p>The metaModel allows access to the dataModel which gives you the underlying ddl type information </p>
<pre><code>//use the datacontext to get the underlying data
usin... | 38,871 |
<p>What books have helped you get a grasp of n-Tier development (Presentation Layer, UI Business Objects, Data Business Objects, and Data sets)? </p>
<p>I'd prefer books, but blogs and other sites are welcome suggestions too. I've inherited a n-Tier designed application at a new job and although it's taken me some t... | <p>Reading <a href="http://martinfowler.com/books.html#eaa" rel="noreferrer">Patterns of Enterprise Application Architecture</a> (PoEAA) was a great eye-opener for me. It's geared towards the web, and goes into great detail in explaining how all those tiers ought to interact.</p>
<p>IIRC, examples are in both C# and ... | <p>books are great for specifics and details of certain solutions/approaches, but the <a href="http://en.wikipedia.org/wiki/Separation_of_concerns" rel="nofollow noreferrer">Separation of Concerns</a> principle is sufficient to logically derive the n-tier architecture</p>
| 49,655 |
<p>Based on geographical data in classic GIS formats. These matrices are a basic input for different vehicle routing problems and such. They can usually be produced an best time or shortest distance basis.</p>
| <p><a href="http://www.codeplex.com/quickgraph" rel="nofollow noreferrer">QuickGraph</a></p>
| <p><a href="http://thinkgeo.com/" rel="nofollow">ThinkGeo</a> has a routing extension that you can use to build a matrix with. This does involve some extra work.</p>
| 16,202 |
<p>-Edit-
FYI.. I am converting b&w documents scanned in as greyscale or color. </p>
<p>1)The first solution worked, it just reversed black & white (black background, white text). It also took nearly 10 minutes.<br>
2)The JAI solution in the 2nd answer didn't work for me. I tried it before posting here.</p>
... | <p>Most likely, you want something like <a href="http://image4j.sourceforge.net/javadoc/net/sf/image4j/util/ConvertUtil.html" rel="nofollow noreferrer">this</a> to convert to 1 bit before you save to TIFF with CCITT compression.</p>
<p>To expound a little bit - be aware that converting from other bit depths to 1 bit i... | <p>As plinth said, you have to do the conversion, Java won't do it magically for you...
If the PNG image is already black & white (as it seems, looking at your comment), using a threshold is probably the best solution.</p>
<p>Somebody seems to have the same problem: <a href="http://forums.java.net/jive/thread.jspa... | 39,301 |
<p>Py3k <a href="http://mail.python.org/pipermail/python-list/2008-December/518408.html" rel="nofollow noreferrer">just came out</a> and has gobs of <a href="http://docs.python.org/3.0/whatsnew/3.0.html" rel="nofollow noreferrer">neat new stuff</a>! I'm curious, what are SO pythonistas most excited about? What featur... | <p>There are a few things I'm quite interested in:</p>
<ul>
<li><em>Text and data</em> instead of <em>unicode and 8 bit</em></li>
<li><a href="http://www.python.org/dev/peps/pep-3132" rel="noreferrer">Extended Iterable Unpacking</a></li>
<li><a href="http://www.python.org/dev/peps/pep-3107/" rel="noreferrer">Function ... | <p>Just about all of them as I am taking the release of Python 3 as motivation to learn the language.</p>
| 44,298 |
<p>Although the general case is undecidable, many people still do solve problems that are equivilent well enough for day to day use.</p>
<p>In cohen's phd thesis on computer viruses, he showed how virus scanning is equivilent to the halting problem, yet we have an entire industry based around this challenge.</p>
<p>I... | <blockquote>
<p>Is solving the halting problem easier than people think?</p>
</blockquote>
<p>I think it is exactly as difficult as people think.</p>
<blockquote>
<p>Will types become turing complete over time?</p>
</blockquote>
<p><a href="http://en.wikipedia.org/wiki/C%2B%2B#Templates" rel="noreferrer">My dear... | <p>The Halting Problem is really only interesting if you look at it in the general case, since if the Halting problem were decidable, all other undecidable problems would also be decidable via reduction.</p>
<p>So, my opinion on this question is, no, it is not easy in the cases that matter. That said, in the real wor... | 6,196 |
<p>Recently, I read an article entitled <a href="http://alumnit.ca/~apenwarr/log/?m=200809#08" rel="nofollow noreferrer">"SATA vs. SCSI reliability"</a>. It mostly discusses the very high rate bit flipping in consumer SATA drives and concludes "A 56% chance that you can't read all the data from a particular disk now". ... | <p>That article significantly exaggerates the problem by misunderstanding the source. It assumes that data loss events are independent, ie that if I take a thousand disks, and get five hundred errors, that's likely to be one each on five hundred of the disks. But actually, as anyone who has had disk trouble knows, it's... | <p>56% chance I can't read something, I doubt it. I run a mix of RAID 5 and other goodies and just good backup practices but with Raid 5 and a hot spare I haven't ever had data loss so I'm not sure what all the fuss is about. If you're storing parity information ... well you're creating a RAID system using software, a ... | 11,206 |
<p>Expanding this question on how I learnt to pass from <a href="https://stackoverflow.com/questions/137375/"> problem description to code </a> Two people mentioned TDD.</p>
<p>Would it be good for a starter to get into TDD ( and avoid bad habits in the future ? ) Or would it be too complex for a stage when understan... | <p>TDD is meant to be simpler than the "traditional" method (of not testing it till the end) - because the tests clarify what you understand of the problem. If you actually didn't have a clear idea of what the problem was, writing tests is quite hard. </p>
<p>So for a beginner, writing tests gets the thinking juice go... | <p>Yes! Definitely. </p>
| 16,643 |
<p>According to the C# compiler and the Silverlight 2 documentation, Silverlight doesn't provide a FindName method for the DataTemplate class. I want to find a Border that's inside a ContentPresenter. What's the best way in SilverLight 2?</p>
| <p>If the border is inside a DataTemplate, not a ControlTemplate, then the only way I've been able to do that in the past is to use VisualTreeHelper to locate the element I need.</p>
| <p>Not totally sure I understand the scenario, but since you mention the DataTemplate I'm assuming you're using a template. </p>
<p>If you're using a template then what you do is give your border a name (x:Name="border") and then override the OnApplyTemplate method. In that method you use GetTemplateChild and pass the... | 36,666 |
<p>Some background: In Germany (at least) invoice numbers have to follow certain rules:</p>
<ol>
<li>The have to be ordered</li>
<li>They have to be continuous (may not have gaps)</li>
</ol>
<p>Since a few months they are allowed to contain characters. Some customers want to use that possibility and customers don't k... | <p>In order to avoid starting at 0 - just start at 10000. Forget about the zero-padding.</p>
<p>You have to consider when the number is going to be allocated.</p>
<p>If you allocate the number when the invoice is first opened for edit, for instance the number 10014 is allocated, and the user cancels the invoice then ... | <p>For my invoices, they always consist of the last digit of the year followed by a 4-digit invoice number starting at 4096, so you would get a value like 85021. This was to easily handle billing my (up to) 15 clients twice a month.</p>
<p>It's irrelevant now since I raise only about 6 invoices a year (I went permane... | 40,089 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.