instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am an experienced .NET applications developer. All of my development experience has been with desktop apps with WinForms/WPF. </p> <p>The last time I worked with ASP was back in 1998. A lot has changed with ASP.NET, and I realize this. I am wondering what is the best resource for ramping up <strong>quickly</s...
<p>I always recommend this site:</p> <p><a href="http://www.asp.net/learn/" rel="nofollow noreferrer">ASP .NET Learn</a></p> <p>It's the official ASP .NET site, there you'll find really good videos that will help you to get up developing quickly in ASP .NET</p>
<p>Personally I find that the best way is to start digging in, find either an existing project to enhance or start out building something. The best way for me anyway is to have a problem to solve, by doing this it makes life a lot easier. At least that is the way I learn new technologies.</p> <p>There are many good ...
42,554
<p>I need to add localization to the exceptions thrown by my application as a lot are ApplicationExceptions and handled and logged to an error report. Ideally I want to create a new Exception, imheriting from ApplicationException that I can pass the resource key as well as arguments to, so that the exception messsage ...
<p>Here is a sample of what I do. EmillException inherits from ApplicationException.</p> <pre><code> namespace eMill.Model.Exceptions { public sealed class AccountNotFoundException : EmillException { private readonly string _accountName; public AccountNotFoundException(string accountName) ...
<p>have a look at this: </p> <p><a href="http://visualstudiomagazine.com/features/article.aspx?editorialsid=2562" rel="nofollow noreferrer">http://visualstudiomagazine.com/features/article.aspx?editorialsid=2562</a></p> <p>I don't have to deal with localization but it makes allot of sense.</p>
36,659
<p>I am trying to send my dynamically created silverlight 2 page/image to a an ASP.net web service to render it as an bitmap image.</p> <p>I can see many examples how to get the XAML using javascript (<a href="http://www.thedatafarm.com/blog/2008/01/31/ConvertingSilverlightInkPresenterImagesToAPNGFile.aspx" rel="nofol...
<p>Yes, <a href="http://www.albahari.com/queryexpress.aspx" rel="noreferrer">QueryExpress</a> is a great, lightweight tool (which also can be used from a USB stick) for browsing and querying SQL Server databases.</p>
<p>I'm using and I really like <a href="http://www.linqpad.net/" rel="nofollow noreferrer">LINQPad</a></p>
23,222
<p>Taking advice from <A href="http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read">this post</a>, I purchased a copy of 'The C Programming Language' and am happily reading my way through. </p> <p>However, all the stuff I've written in the past has been interpr...
<p>Well, Visual Studio is the standard on Windows, and there are free versions available. However it does have a bunch of Microsoft specific extensions. For learning though, developing console apps are pretty easy and also fairly close to the standard K&amp;R style C.</p> <p>However, way back in the day I used to use ...
<p>You could use a C++ compiler, such as gcc, to compile your C code. Here's a good article with links to free C compilers/IDEs:</p> <p><a href="http://computerprogramming.suite101.com/article.cfm/freeprogrammingtools" rel="nofollow noreferrer">http://computerprogramming.suite101.com/article.cfm/freeprogrammingtools</...
43,882
<p>I have a project that I am building with Netbeans 6.1 and I am using SVN. I deleted some files on the local machine then attempted to commit my changes to th SVN repository. The commit fails with the error message</p> <blockquote> <p>Entry for 'C:\path\to\project\myfile' has no URL</p> </blockquote> <p>Where myf...
<p>An svn update will bring the file back, fixing your local repo. </p> <p>You should then be able to do an "svn delete" on the file, which tells your local repo that the file is to be deleted, and also deletes it from the file system. </p> <p>You should then be able to commit the changes back to the repo.</p>
<p>I had the same problem and the reason was that I deleted the file externaly. If you delete it using NetBeans, then commit work fine.</p>
30,000
<p>So creating a Windows service using Visual Studio is fairly trivial. My question goes a bit deeper as to what actually makes an executable installable as a service &amp; how to write a service as a straight C application. I couldn't find a lot of references on this, but I'm presuming there has to be some interface...
<p>Setting up your executable as a service is part of it, but realistically it's usually handled by whatever installation software you're using. You can use the command line SC tool while testing (or if you don't need an installer).</p> <p>The important thing is that your program has to call StartServiceCtrlDispatcher...
<p>Hope this helps:</p> <p><a href="http://support.microsoft.com/kb/251192" rel="nofollow noreferrer">http://support.microsoft.com/kb/251192</a></p> <p>It would seem that you simple need to run this exe against a binary executable to register it as a service.</p>
6,307
<p>By deterministic I vaguely mean that can be used in critical real-time software like aerospace flight software. Garbage collectors (and dynamic memory allocation for that matter) are big no-no's in flight software because they are considered non-deterministic. However, I know there's ongoing research on this, so I w...
<p>I know I might get a lot of down-votes for this reply, but if you are already trying to avoid dynamic memory in the first place, because you said it's a no-no, why do you use GC at all? I'd never use GC in a real-time system where predictable runtime speed is the major concern. I'd avoid dynamic memory wherever poss...
<p>I know azul systems has a jvm whose GC is hardware assisted. It can also run concurrently and collect massive amounts of data pretty fast.</p> <p>Not sure how deterministic it is though.</p>
26,738
<p>I have a chart with a series that denotes a large set (1000's) of discrete measurements. Some of these are bad measurements and I want to colour the line for the series based on another set of data that describes how accurate the measurements are. Bad measurements should be red and good measurements green and the in...
<p>It is easy enough to colour a chart line in VBA. Here are some notes.</p> <pre><code>Dim cht As Chart Dim sc As Series Dim blnBad As Boolean Dim j j = 85 'RGB orange ' blnBad = False 'This is a chart called Chart 1, it would be possible ' 'to use the charts collection ' Set cht = ActiveSheet.ChartObjects("Chart ...
<p>Are you locked into VBA? One way this could be accomplished is by open up your OOXML .xlsx document archive (it is actually a Zip archive). Then you have free access to the XML data that makes up the document itself. This could be ran through an XSL style sheet or any other script of your choosing and then rezipped....
36,810
<p>Everyone has accidentally forgotten the <code>WHERE</code> clause on a <code>DELETE</code> query and blasted some un-backed up data once or twice. I was pondering that problem, and I was wondering if the solution I came up with is practical.</p> <p>What if, in place of actual <code>DELETE</code> queries, the appli...
<p>That is fine if you want to do that, but it seems like a lot of work. How many people are manually changing the database? It should be very few, especially if your users have an app to work with.</p> <p>When I work on the production db I put EVERYTHING I do in a transaction so if I mess up I can rollback. Just h...
<p>The pitfall is that it's unnecessarily complicated and someone will inadvertently forget too check the flag in their query. There's also the issue of potentially needing to delete something immediately instead of wait for the scheduled job to run.</p>
12,837
<p>The one-liner should:</p> <ul> <li>solve a real-world problem</li> <li>not be extensively cryptic (should be easy to understand and reproduce)</li> <li>be worth the time it takes to write it (should not be too clever)</li> </ul> <p>I'm looking for practical tips and tricks (complementary examples for <code>perldoc...
<p><em>The problem</em>: A media player does not automatically load subtitles due to their names differ from corresponding video files.</p> <p><em>Solution</em>: Rename all *.srt (files with subtitles) to match the *.avi (files with video).</p> <pre><code>perl -e'while(&lt;*.avi&gt;) { s/avi$/srt/; rename &lt;*.srt&g...
<p>At some time I found that anything I would want to do with Perl that is short enough to be done on the command line with 'perl -e' can be done better, easier and faster with normal Z shell features without the hassle of quoting. E.g. the example above could be done like this:</p> <pre><code>srt=(*.srt); for foo in ...
13,707
<p>Prusa MK3 heatbed power cable shorted out (on the Einsy side) and it looks like I need to replace the Einsy. Should I replace the heatbed too? I don’t know electronics well and am worried I will just fry a new Einsy.</p> <p>Heatbed end: <a href="https://i.stack.imgur.com/1pA7t.jpg" rel="nofollow noreferrer" title="H...
<p>It's common for modeling software to flip normals, causing what you describe. You said,</p> <blockquote> <p>I only care about the externally facing faces.</p> </blockquote> <p>But are you sure they are truly externally facing? Turn on normals in Blender and ensure that all the arrows/pointers are external.</p> <p>An...
<p>Okay, so like suggested I put it into 3D Builder (A free Windows 3D modeling program). I imported it as an stl, then exported it as an stl and imported that stl into Cura. And lo and behold all problems were gone! If you are having a similar issue give that a try! The 3D Builder program and similar ones are designed...
1,892
<p>Recently my RAMPS power connector caught fire while heating the heated bed. I suspect this was a defect caused by the connector, and de-soldered/removed it as best I could. I'm not an electrical engineer, so I'm looking for advice on whether It is possible to re-solder the power connectors directly onto the board, ...
<p>The blue clips stick in the connector on the extruder end of the feed tube. They are to keep it from opening as the printer extrudes and retracts filament.</p> <p>To install them, push them in between the white part of the fitting on the feed tube (not the hot end). You should only need one or two, and they are all...
<p>The clips or collet clips as they are called are to secure the Bowden tube more solidly to improve printer extrusion; more specifically: extruder retraction performance.</p> <p>E3D has explained this very nicely on their site under <a href="https://e3d-online.com/blog/2017/10/27/bowden-tube-physics/" rel="nofollow ...
1,625
<p>How exactly using VB6 can I can call any Windows shell command as you would from the command-line?</p> <p>For example, something as trivial as:</p> <pre><code>echo foo </code></pre>
<p>Here's how you do it :</p> <pre><code>Shell "cmd echo foo", vbNormalFocus </code></pre>
<p>Only use double quotes: <code>""...""</code></p> <p>Example - send confirmation pass to make a task:</p> <pre><code>shell (""echo pass|schtasks /create /TR "C:\folder\...\program.exe" /more_parameters"") </code></pre> <p>because the first <code>"</code> are closed in <code>"C:\...</code> and the string would stop...
37,095
<p>What Inversion of Control Container framework would you recommend to a beginner in this area?</p>
<p>James Kovacs did a dnrtv <a href="http://www.dnrtv.com/default.aspx?showID=126" rel="nofollow noreferrer">screencast</a> where he shows how to create your own IOC container. I recommend this to a beginner not because it's necessarily the one you want to use but because it shows the basics of why you need an IOC cont...
<p>I have done some evaluation of the <a href="http://www.springframework.net/" rel="nofollow noreferrer">Spring.NET port</a>. It offers AOP, config-file setup of the container, and other cool stuff. I think their site is well organized and the docs are well written.</p>
39,084
<p>Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC.</p>
<p>If you build your images from scratch you can do it with VMware (or insert your favorite VM software here).</p> <p>Build and install your linux box as you'd like it, then run the AMI packaging/uploading tools <em>in</em> the guest. Then, just keep backup copies of your VM image in sync with the different AMI's you ...
<p>It's a bit of a square peg in a round hole ... kind of like running MS-Office on Linux. </p> <p>Depending on how you value your time, it's cheaper to just get another PC and install Linux and Xen.</p>
15,626
<p>Is there any way to change the default tab size in a .NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste.</p> <p>Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control. From what I can understand, the SelectionTabs...
<p>You can set it by setting the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.selectiontabs.aspx" rel="noreferrer">SelectionTabs</a> property.</p> <pre><code>private void Form1_Load(object sender, EventArgs e) { richTextBox1.SelectionTabs = new int[] { 100, 200, 300, 400 }; } <...
<p>I'm using this class with monospaced fonts; it replaces all TABs with spaces.</p> <p>All you have to do is to set the following designer properties according to your requirements:</p> <ul> <li>AcceptsTab = True TabSize</li> <li>ConvertTabToSpaces = True</li> <li>TabSize = 4</li> </ul> <p><strong>PS</strong>: As @Too...
18,630
<p>I'm trying to convert a multipage color tiff file to a c# CompressionCCITT3 tiff in C#. I realize that I need to make sure that all pixels are 1 bit. I have not found a useful example of this online.</p>
<p>You need this conversion as CCITT3 and CCITT4 don't support color (if I remember right).</p>
<p>I saw the above code, and it looked like it was converting every pixel with manual logic.</p> <p>Would this work for you?</p> <p>Imports System.Drawing.Imaging</p> <p>'get the color tif file</p> <p>Dim bmpColorTIF As New Bitmap("C:\color.tif")</p> <p>'select the an area of the tif (will grab all frames)</p> <p...
6,624
<p>Model of the printer is unknown, got it as present, probably something generic cartesian on arduino mega and ramps boards stitched together and with marlin firmware.</p> <p>I've used accepted answer from here to try moving this thing from terminal. <a href="https://3dprinting.stackexchange.com/questions/3112/how-to...
<p>Mine is a wild guess, but judging from:</p> <pre><code>echo:Unknown command: "starto" ok echo:Unknown command: "SD init failstartuthor" ok echo:Unknown command: " (none, default config)50.00 Z2.50 E2rBy00.00 Y0.00 Z0.00echo" ok echo:Unknown command: "Unknown command" ok echo:Unknown command: " "starto"own comm" ok ...
<p>Mine is a wild guess, but judging from:</p> <pre><code>echo:Unknown command: "starto" ok echo:Unknown command: "SD init failstartuthor" ok echo:Unknown command: " (none, default config)50.00 Z2.50 E2rBy00.00 Y0.00 Z0.00echo" ok echo:Unknown command: "Unknown command" ok echo:Unknown command: " "starto"own comm" ok ...
805
<p>I have a structure which I create a custom constructor to initialize the members to 0's. I've seen in older compilers that when in release mode, without doing a memset to 0, the values are not initialized.</p> <p>I now want to use this structure in a union, but get errors because it has a non-trivial constructor.<...
<p>Question 1: Default constructors do initialize POD members to 0 according to the C++ standard. See the quoted text below.</p> <p>Question 2: If a constructor must be specified in a base class, then that class cannot be part of a union.</p> <p>Finally, you can provide a constructor for your union:</p> <pre><code>u...
<p>You'll have to wait for C++0x to be supported by compilers to get this. Until then, sorry.</p>
41,588
<p>Get the following error periodically in an IIS application:</p> <blockquote> <p>Failed to load resources from resource file.</p> </blockquote> <p>The full error message in the Application Event Log is:</p> <blockquote> <p>Event Type: Error<br> Event Source: .NET Runtime<br> Event Category: None<br>...
<p>Do you have .NET 1.1 and .NET 2.0 apps running on the web server? We had some instances of a similar nature around here and the resolution we found was to create two app pools, one for 1.1 apps and one for 2.0 apps and to assign each application accordingly.</p>
<p>Do you get a different error without the ISAPI filter in place?</p>
4,569
<p>I'm looking for a Python module that would take an arbitrary block of text, search it for something that looks like a date string, and build a DateTime object out of it. Something like <a href="http://search.cpan.org/~sartak/Date-Extract-0.03/lib/Date/Extract.pm" rel="noreferrer">Date::Extract</a> in Perl</p> <p>T...
<p>The nearest equivalent is probably the <a href="http://labix.org/python-dateutil" rel="noreferrer">dateutil</a> module. Usage is:</p> <pre><code>&gt;&gt;&gt; from dateutil.parser import parse &gt;&gt;&gt; parse("Wed, Nov 12") datetime.datetime(2008, 11, 12, 0, 0) </code></pre> <p>Using the fuzzy parameter should ...
<p>Why no give <a href="http://code.google.com/p/parsedatetime/" rel="nofollow noreferrer">parsedatetime</a> a try?</p>
36,227
<p>How would I set the "overwrite as needed" setting on Event logs other than Application/Security/System? Specifically I'd like to apply this to the Powershell and Windows Powershell Logs, in addition to any other future logs that may be added. This needs to be applied to both server 2003 &amp; 2008.</p>
<p>I don't believe their is a GPO for this. But most group policies simply modify the registry.</p> <p>You could create an adm template that modified the settings, or you could simply write a script to adjust the settings.</p> <pre><code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\PowerShell </code...
<p>Right now you'd need to use SDM Software's GPO cmdlets. That's the only way from within PowerShell to modify the settings within a GPO. But there's no way that I know of to make a change to "any logs which might be added" - I don't think you can modify the system defaults (although I could be wrong - it's not someth...
41,589
<ul> <li>I'm getting back into .NET after numerous years in PHP/MySQL</li> <li>back in 2002 on Microsoft projects we always used Visual SourceSafe and everyone hated it</li> <li>in all my PHP/MySQL projects we used SVN and everyone loved it</li> <li>in modern day .NET projects do teams still use Visual SourceSafe, has ...
<p>We use SVN for our .Net projects, using the <a href="http://tortoisesvn.tigris.org/" rel="nofollow noreferrer">Tortoise SVN</a> client. There are also tools to integrate with Visual Studio such as <a href="http://ankhsvn.open.collab.net/" rel="nofollow noreferrer">Ankhsvn</a>.</p>
<p>VSS has made improvements with the release of VSS 2005, and later several fixes to make it compatible with VS2008, however the gold standard for Visual Studio 2005 and 2008 is Team Foundation Server. MS brands Team Foundation Server ( TFS ), as the server backend to Visual Studio's suite of products.</p> <p>The dow...
41,491
<p>Is there any way to create the <em>query parameters</em> for doing a <em>GET request</em> in JavaScript?</p> <p>Just like in Python you have <a href="http://web.archive.org/web/20080926234926/http://docs.python.org:80/lib/module-urllib.html" rel="noreferrer"><code>urllib.urlencode()</code></a>, which takes in a dic...
<p>Here you go:</p> <pre><code>function encodeQueryData(data) { const ret = []; for (let d in data) ret.push(encodeURIComponent(d) + '=' + encodeURIComponent(data[d])); return ret.join('&amp;'); } </code></pre> <p>Usage:</p> <pre><code>const data = { 'first name': 'George', 'last name': 'Jetson', 'age'...
<p>This <a href="http://web.archive.org/web/20120407213044/http://www.phpbuilder.com:80/board/showthread.php?t=10318476" rel="nofollow noreferrer">thread</a> points to some code for escaping URLs in php. There's <code>escape()</code> and <code>unescape()</code> which will do most of the work, but the you need add a co...
13,672
<p>This question was inspired by a similar question: <a href="https://stackoverflow.com/questions/197675/how-does-delete-know-the-size-of-the-operand-array">How does delete[] “know” the size of the operand array?</a></p> <p>My question is a little different: <strong>Is there any way to determine the size of a C++ arr...
<p><code>delete []</code> does know the size that was allocated. However, that knowledge resides in the runtime or in the operating system's memory manager, meaning that it is not available to the compiler during compilation. And <code>sizeof()</code> is not a real function, it is actually evaluated to a constant by ...
<p>You could just create an extra element of the array and then apply the most unlikely number that will be stored in the array. Then you can determine the number of elements through some function by passing that number. </p> <p>In the case of declaring and initializing an array at the moment of creation, you can then...
24,080
<p>I've exposed several web services in our product using Java and WS-Security. One of our customers wants to consume the web service using ColdFusion. Does ColdFusion support WS-Security? Can I get around it by writing a Java client and using that in ColdFusion?</p> <p>(I don't know much about ColdFusion).</p>
<p>I'm assuming you mean you need to pass the security in as part of the SOAP header. Here's a sample on how to connect to a .Net service. Same approach should apply w/ Java, just the url's would be different.</p> <pre><code>&lt;cfset local.soapHeader = xmlNew()&gt; &lt;cfset local.soapHeader.TheSoapHeader = xmlElemN...
<p>I've never done any ws-security, and don't know if ColdFusion can consume it or not, but to answer your secondary question:</p> <blockquote> <blockquote> <p>Can I get around it by writing a java client and using that in coldfusion?</p> </blockquote> </blockquote> <p>Yes, absolutely. ColdFusion can easily u...
20,375
<p>Is there a way in PHP to make asynchronous HTTP calls? I don't care about the response, I just want to do something like <code>file_get_contents()</code>, but not wait for the request to finish before executing the rest of my code. This would be super useful for setting off "events" of a sort in my application, or t...
<p>The answer I'd previously accepted didn't work. It still waited for responses. This does work though, taken from <a href="https://stackoverflow.com/questions/962915/how-do-i-make-an-asynchronous-get-request-in-php">How do I make an asynchronous GET request in PHP?</a></p> <pre><code>function post_without_wait($url,...
<p>Well, the timeout can be set in milliseconds, see "CURLOPT_CONNECTTIMEOUT_MS" in <a href="http://www.php.net/manual/en/function.curl-setopt" rel="nofollow noreferrer">http://www.php.net/manual/en/function.curl-setopt</a></p>
15,148
<p>I would have thought that it would be clear cut whether memory allocation is faster in managed code than in native code - <a href="https://stackoverflow.com/questions/173591/what-myths-have-you-heard-about-regarding-the-net-framework">but there seems to be some controversy</a>. Perhaps memory management under a Vir...
<p>Take a read of <a href="http://msdn.microsoft.com/en-us/library/ms973852.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms973852.aspx</a></p> <p>It goes into some details on how memory allocation works in .NET and briefly compares it to the C++ model.</p> <p>In summary, memory allocation i...
<p>Listen to Jeff Richter of Wintellect, he's an authority on the subject:</p> <p><a href="http://www.dotnetrocks.com/default.aspx?showNum=361" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=361</a></p>
20,938
<p>In the <a href="http://herdingcode.com/" rel="nofollow noreferrer">herding code</a> podcast 14 someone mentions that stackoverflow displayed the queries that were executed during a request at the bottom of the page. </p> <p>It sounds like an excellent idea to me. Every time a page loads I want to know what sql stat...
<p>If you put .ToString() to a var query variable you get the sql. You can laso use this in Debug en VS2008. <a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" rel="nofollow noreferrer">Debug Visualizer</a></p> <p>ex:</p> <pre><code>var query = from p in db.Table ...
<p>From Linq in Action</p> <blockquote> <p>Microsoft has a Query Visualizer tool that can be downloaded separetly from VS 2008. it is at <a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-s...
4,895
<p>I'm using an XmlSerializer to deserialize a particular type in mscorelib.dll</p> <pre><code>XmlSerializer ser = new XmlSerializer( typeof( [.Net type in System] ) ); return ([.Net type in System]) ser.Deserialize( new StringReader( xmlValue ) ); </code></pre> <p>This throws a caught <code>FileNotFoundException</co...
<p>I'm guessing now. but:</p> <ol> <li>The system might be generating a serializer for the whole of mscorlib, which could be very slow.</li> <li>You could probably avoid this by wrapping the system type in your own type and serialising that instead - then you'd get a serializer for your own assembly.</li> <li>You migh...
<p>The delay is because, having been unable to find the custom serializer dll, the system is building the equivalent code (which is very time-consuming) on the fly.</p> <p>The way to avoid the delay is to have the system build the DLL, and make sure it's available to the .EXE - have you tried this?</p>
3,321
<p>I'm trying to figure out the best way to store user uploaded files in a file system. The files range from personal files to wiki files. Of course, the DB will point to those files by someway which I have yet to figure out. </p> <p>Basic Requirements:</p> <ul> <li>Fairy Decent Security so People Can't Guess File...
<p>One technique is to store the data in files named after the hash (SHA1) of their contents. This is not easily guessable, any backup program should be able to handle it, and it easily sharded (by storing hashes starting with 0 on one machine, hashes starting with 1 on the next, etc).</p> <p>The database would contai...
<p>Just in terms of one aspect of your question (security): the best way to safely store uploaded files in a filesystem is to ensure the uploaded files are out of the webroot (i.e., you can't access them directly via a URL - you have to go through a script).</p> <p>This gives you complete control over what people can ...
27,822
<p>I have a PHP script that sends out critical e-mails that needs to reach its destination. I know how to check whether the e-mail sent successfully, the only issue is knowing whether it actually got to its recipient.</p> <p>Any suggestions? If there is no way of knowing, how would you handle this situation?</p>
<p>If you make the email HTML based, you can include images in it which contain URLs with information unique to the recipient. You could structure your application so that these URLs trigger some code to mark that particular email as read before returning the required image data.</p> <p>To be totally effective, the im...
<p>If I remember right as long as you send successfully, you can be assured that it has at least been accepted by the receiving mail server.</p>
22,396
<p>I'm writing a web application which uses windows authentication and I can happily get the user's login name using something like:</p> <pre><code> string login = User.Identity.Name.ToString(); </code></pre> <p>But I don't need their login name I want their DisplayName. I've been banging my head for a couple hours n...
<p>How about this:</p> <pre><code>private static string GetFullName() { try { DirectoryEntry de = new DirectoryEntry("WinNT://" + Environment.UserDomainName + "/" + Environment.UserName); return de.Properties["displayName"].Value.ToString(); } catch { return ...
<p>There is a CodePlex project for <a href="http://www.codeplex.com/LINQtoAD" rel="nofollow noreferrer">Linq to AD</a>, if you're interested.</p> <p>It's also covered in the book <em><a href="https://rads.stackoverflow.com/amzn/click/com/0672329832" rel="nofollow noreferrer" rel="nofollow noreferrer">LINQ Unleashed fo...
30,601
<p>I'm trying to parse a html page and extract 2 values from a table row. The html for the table row is as follows: -</p> <pre><code>&lt;tr&gt; &lt;td title="Associated temperature in (ºC)" class="TABLEDATACELL" nowrap="nowrap" align="Left" colspan="1" rowspan="1"&gt;Max Temperature (ºC)&lt;/td&gt; &lt;td class="TABLE...
<p>Try </p> <pre><code>&lt;tr&gt;\s* &lt;td[^&gt;]*&gt;.*?&lt;/td&gt;\s* &lt;td[^&gt;]*&gt;\s*(?&lt;value&gt;\d+)\s*&lt;/td&gt;\s* &lt;td[^&gt;]*&gt;\s*(?&lt;time&gt;\d{2}:\d{2}:\d{2})\s*&lt;/td&gt;\s* &lt;/tr&gt;\s* </code></pre>
<p>When you write <code>&lt;td[^&lt;]+?&gt;</code> I guess you really mean <code>&lt;td[^&gt;]*&gt;</code></p> <p>That is "opening brace, td, maybe stuff other than <em>closing</em> brace..."</p>
34,187
<p>I'm trying to build a web page with a number of drop-down select boxes that load their options asynchronously when the box is first opened. This works very well under Firefox, but not under Internet Explorer.</p> <p>Below is a small example of what I'm trying to achieve. Basically, there is a select box (with the...
<p>I like <a href="http://www.gtk.org/" rel="nofollow noreferrer">GTK+</a> personally but that or any of the ones you mentioned should be OK. I don't know which is the best in terms of least RAM usage.</p>
<p>I think you should try Html Application.It is something like web page it contain DHTML,java script,ActiveX but it is execute like .exe .</p> <p><strong>Edit:</strong> Sorry for advice you html application.I just know it can run on windows only.</p>
13,830
<p><strong>EDIT:</strong> This was formerly more explicitly titled: - "<strong>Best solution to stop Kontiki's KHOST.EXE from loading automatically at start-up on Windows XP?</strong>"</p> <p>Essentially, whenever the <strong><a href="http://www.channel4.com/4od/index.html" rel="nofollow noreferrer">40D</a></strong> a...
<p>for the vb script you would use something like this:</p> <pre><code>Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") 'repeat the line below for each key to delete WSHShell.RegDelete "[Location of Key]" </code></pre> <p>Just drop the code into a text file and re-name it something like shutdown,vbs...
<p>Why not just copy the executable to some other name, and put a do-nothing exe in its place. Then change your shortcuts to the copied and renamed EXE. If the program is sensitive to its name, then point your shortcuts to a VBS file to temporarily rename the EXE file.</p>
13,625
<p>My Anet A8 was working and printing great until my hotbed connector snapped and shorted out my motherboard. After replacing the connections to my hotbed and my motherboard I can't print anything because the filament flow is very inconsistent. It often laying down nothing. See my included picture. </p> <p>I've tried...
<p>Thanks everyone for the tips. I posted this question on another board and it was suggested my extruder was clogged. After unclogging everything works great again. </p>
<p><em>Please note that the problems you faced are typical for the Anet A8, the connectors are underrated for the application. Also, do note that the stock firmware does not have thermal runaway protection, which is considered to be very unsafe and could potentially lead to burning down your house! Please flash a firmw...
1,067
<p>I'm on laptop (Ubuntu) with a network that use HTTP proxy (only http connections allowed).<br> When I use svn up for url like 'http://.....' everything is cool (google chrome repository works perfect), but right now I need to svn up from server with 'svn://....' and I see connection refused.<br> I've set proxy confi...
<p>In <code>/etc/subversion/servers</code> you are setting <code>http-proxy-host</code>, which has nothing to do with <code>svn://</code> which connects to a different server usually running on port 3690 started by <code>svnserve</code> command.</p> <p>If you have access to the server, you can setup <code>svn+ssh://<...
<p>when you use the svn:// URI it uses port 3690 and probably won't use http proxy</p>
10,827
<p>How do I perform a join between two DataTables in a Dataset?</p> <p>I created a DataRelation between two tables….then what?</p> <p>I'm looking at one explanation on how to do it (<a href="http://www.emmet-gray.com/Articles/DataTableJoins.htm" rel="nofollow noreferrer">http://www.emmet-gray.com/Articles/DataTableJo...
<p>See if this helps</p> <pre><code>DataTable person = new DataTable(); person.Columns.Add("Id"); person.Columns.Add("Name"); DataTable pet = new DataTable(); pet.Columns.Add("Id"); pet.Columns.Add("Name"); pet.Columns.Add("OwnerId"); DataSet ds = new DataSet(); ds.Tables.AddRange(new[] { person, pet }); ds.Relatio...
<p>I was finding the solution for the same problem. Well, I have given up and use SQL to do a join.</p> <p>Someone has written some custom code to achieve joining DataTable. Maybe they are helpful for you: <a href="http://www.emmet-gray.com/Articles/DataTableJoins.htm" rel="nofollow noreferrer">http://www.emmet-gray.c...
42,909
<p>Let's make this very easy. What I want:</p> <pre><code>@array = qw/one two one/; my @duplicates = duplicate(@array); print "@duplicates"; # This should now print 'one'. </code></pre> <p>How to print duplicate values of a array/hash?</p>
<pre><code>sub duplicate { my @args = @_; my %items; for my $element(@args) { $items{$element}++; } return grep {$items{$_} &gt; 1} keys %items; } </code></pre>
<p>I'm going golfing!</p> <pre><code>sub duplicate { my %count; grep $count{$_}++, @_; } @array = qw/one two one/; my @duplicates = duplicate(@array); print "@duplicates"; # This should now print 'one'. # or if returning *exactly* 1 occurrence of each duplicated item is important sub duplicate { my %coun...
31,832
<p>I'm looking for help getting started working programmatically with audio.</p> <p>Specifically, the platform I'm working with exposes APIs to extract audio data from a resource (like an MP3), or to play back arbitrary data as audio. In both cases the actual data is byte arrays of 32bit floats representing 44.1 KHz s...
<p>As some has pointed out in the comments, what you want to look into is <a href="http://en.wikipedia.org/wiki/Pulse-code_modulation" rel="noreferrer">PCM audio</a>.</p> <p>In a nutshell, <a href="http://en.wikipedia.org/wiki/Sound" rel="noreferrer">sound</a> is a wave that travels through air. In order to capture th...
<p>I posted a similar question recently: <a href="https://stackoverflow.com/questions/5175874/where-can-i-find-good-tutorials-on-writing-audio-dsp-filters-lowpass-etc">good audio dsp tutorials</a>.</p> <p>The golden link is certainly <a href="http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt" rel="nofollow noreferre...
47,800
<p>Question: </p> <p>Should I write my application to directly access a database Image Repository or write a middleware piece to handle document requests.</p> <p>Background:</p> <p>I have a custom Document Imaging and Workflow application that currently stores about 15 million documents/document images (90%+ single...
<p>Oftentimes scalability and performance are ultimately married to each other in the sense that six months from now management comes back and says "Function Y in Application X is running unacceptably slow, how do we speed it up?" And all too the often the answer is to upgrade the back end solution. And when it comes t...
<p>I agree with gabriel1836. However, an added benefit would be that you could for a time run a hybrid system for a time since you aren't going to convert 14 millions documents from your proprietary system to you home grown system overnight. </p> <p>Also, I would strongly encourage you to store the documents outside o...
29,190
<p>Is there a way using the iPhone SDK to get WiFi information? Things like Signal Strength, WiFi Channel and SSID are the main things I'm looking for.</p> <p>Only interested in Wifi info, not cellular.</p>
<p>Based on <a href="http://openradar.appspot.com/radar?id=306" rel="nofollow noreferrer">this</a> bug report and <a href="https://stackoverflow.com/questions/339089/can-the-iphone-sdk-obtain-the-wi-fi-ssid-currently-connected-to">this</a> SO question, I'm guessing there's no supported way to do this atm.</p> <p>EDIT:...
<p>The WiFinder iPhone application does it somehow...</p>
45,830
<p>I need to include or exclude a subreport based on a condition. I'm using iReport to create JasperReports. I.e., if a subreport has values, I need to include that subreport, otherwise not. Can anyone please send a sample or tell me how to resolve this.</p>
<p>you can in the master report get data from your data source that allows you to identify if the subreport should be included, then use the 'printWhenExpression' field on the subreport element to check that data.</p> <p>I use this regularly - for example the printWhenExpression field may contain:</p> <pre><code>new ...
<p>From my knowledge, if there aren't any data printed in the subreport, Jasper eliminates the blank space. In other words, if your subreport would normally occupy half a page, but there is no data, then the empty space is eliminated. I'm not sure this is what you mean by including or excluding the report. </p> <p>Ano...
48,396
<p>I'm uploading files to my <code>public/files</code> folder of a Rails application on a constant basis through a web interface.</p> <p>I don't want to keep these in source control since they go for almost 2 GBs, so every time I do a <code>cap deploy</code> it will save those files away in <code>releases/</code> and ...
<p>You could make files a symlink to another directory on your machine, for examples the /shared directory at the same level as /current and /releases.</p> <p>Check out capistrano manages the /log and /tmp directories.</p>
<p>Now we can simply use :linked_files in deploy.rb:</p> <pre><code>set :linked_files, %w{config/database.yml} </code></pre> <p>In this case, the file [target_dir]/shared/config/database.yml must exist on the server.</p>
32,926
<p>I want to extract 'James\, Brown' from the string below but I don't always know what the name will be. The comma is causing me some difficuly so what would you suggest to extract James\, Brown?</p> <p>OU=James\, Brown,OU=Test,DC=Internal,DC=Net</p> <p>Thanks</p>
<p>A regex is likely your best approach</p> <pre><code>static string ParseName(string arg) { var regex = new Regex(@"^OU=([a-zA-Z\\]+\,\s+[a-zA-Z\\]+)\,.*$"); var match = regex.Match(arg); return match.Groups[1].Value; } </code></pre>
<p>If the format is always the same:</p> <pre><code>string line = GetStringFromWherever(); int start = line.IndexOf("=") + 1;//+1 to get start of name int end = line.IndexOf("OU=",start) -1; //-1 to remove comma string name = line.Substring(start, end - start); </code></pre> <p>Forgive if syntax is not quite right ...
46,477
<p>Do you know of software which is capable of emulating networking conditions such as constrained bandwidth, latency, closed ports, congestion, collision?</p> <p>Platform-specific is fine, but I'd like to be able to emulate hundreds or thousands of nodes under varying network conditions.</p>
<p>Fiddler can do constrained bandwidth and latency simulations.</p>
<p><a href="http://snad.ncsl.nist.gov/nistnet/" rel="nofollow noreferrer">NIST Net</a> can do some crazy network emulation.</p>
32,823
<p>Since Object Initializers are very similar to JSON, and now there are Anonymous Types in .NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string.</p> <p>Use Object Initializers to create an Anonymous Type:</p> <pre><code>var person = new { ...
<p>There are languages for .NET that have duck-typing but it's not possible with C# using Dot.Notation since C# requires that all member references are resolved at compile time. If you want to use the Dot.Notation, you still have to define a class somewhere with the required properties, and use whatever method you want...
<p>What is the application for this?</p> <p>I would not go down this road for a few reasons. </p> <ul> <li><p>First; it may require a lot of support code using reflection and such to create the transparent method that you are talking about.</p></li> <li><p>Second, like you said, C# is a strongly typed language and th...
24,352
<p>I know that embedding CSS styles directly into the HTML tags they affect defeats much of the purpose of CSS, but sometimes it's useful for debugging purposes, as in:</p> <pre><code>&lt;p style="font-size: 24px"&gt;asdf&lt;/p&gt; </code></pre> <p>What's the syntax for embedding a rule like:</p> <pre><code>a:hover ...
<p>I'm afraid it can't be done, the pseudo-class selectors can't be set in-line, you'll have to do it on the page or on a stylesheet.</p> <p>I should mention that <em>technically</em> you <em>should</em> be able to do it <a href="http://www.w3.org/TR/css-style-attr#cascading" rel="noreferrer">according to the CSS spec...
<p>If that <code>&lt;p&gt;</code> tag is created from JavaScript, then you do have another option: use JSS to programmatically insert stylesheets into the document head. It does support <code>'&amp;:hover'</code>. <a href="https://cssinjs.org/" rel="nofollow noreferrer">https://cssinjs.org/</a></p>
15,973
<p>Calling the <a href="http://pear.php.net/package/Mail/" rel="nofollow noreferrer">Pear Mail class</a> in some instances automatically attempts to read <code>/dev/urandom</code>, however access is restricted due to an <code>open_basedir</code> setting. Is it safe to add <code>/dev</code> to <code>open_basedir</code>...
<p><a href="http://www.amazon.co.uk/gp/reader/0596007736/ref=sib_dp_pt/026-8599590-2045232#reader-link" rel="nofollow noreferrer">Java in a Nutshell</a> by O'Reilly</p>
<p>you can download the entire api documentation as a static website from <a href="http://java.sun.com/javase/downloads/?intcmp=1281" rel="nofollow noreferrer" title="here">here</a>. I use it a lot when im away from an internet connection.</p>
29,314
<p>Where can I find the source code for SQLMembershipProvider (.NET2.0)? Is it available?</p>
<p>The source code has been released. <a href="http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx" rel="noreferrer">See ScottGu's blog for further details</a></p>
<p>i guess it's not freely available. but as long as it's just for educational purposes and you don't want to make money out of it, microsoft will not sue you if you use reflector to have a look at it ;)</p>
38,223
<p>I'm setting the cookie expiration using the following code:</p> <hr> <pre><code>// remove existing cookies. request.Cookies.Clear(); response.Cookies.Clear(); // ... serialize and encrypt my data ... // now set the cookie. HttpCookie cookie = new HttpCookie(AuthCookieName, encrypted); cookie.Expires = DateTime.N...
<p>The problem here doesn't really lie with ASP.NET but with the amount of information that is provided in the http request by browsers. The expiry date would be unobtainable regardless of the platform you are using on the server side.</p> <p>As you have summarised yourself in your question the Expires property of the...
<p>The version problem discussed in the link was not helpful. Basically ASP.NET cookie sucks. I had to store the expiration date time inside the cookie myself and check it in every request.</p>
24,153
<p>I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding).</p> <p>I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that us...
<p>I recently had to write network protocol code that accesses 3-bit fields. Octal comes in handy when you want to debug that. </p> <p>Just for effect, can you tell me what the 3-bit fields of this are?</p> <pre><code>0x492492 </code></pre> <p>On the other hand, this same number in octal:</p> <pre><code>022222222...
<p>Octal is and was most useful with the first available display hardware (7-segment displays). These original displays did not have the decoders available later.</p> <p>Thus the digital register outputs were grouped to fit the available display which was capable of only displaying eight(8) symbols: 0,1,2 3,4,5,6,7 .<...
6,635
<p>My client wants to sign the application code. He gave me an .spc file for signing a .NET desktop application. How should I use it within the app?</p> <p>Thanks</p>
<p><a href="http://ellisweb.net/2008/08/signing-code-using-pvk-and-spc-files" rel="noreferrer">http://ellisweb.net/2008/08/signing-code-using-pvk-and-spc-files/</a></p>
<p>You sign the assembly before you send it to your customer. You can do this automatically in Visual Studio in the project settings.</p>
36,400
<p>I am creating my textbox with these options. I can Copy / Cut / Paste / Undo, but when I hit <strong>Select All</strong> it doesn't select all. I can right click and click <strong>Select All</strong> but <kbd>CTRL</kbd> + <kbd>A</kbd> doesn't do anything. Why?</p> <pre><code>wnd = CreateWindow(&quot;EDIT&quot;, 0, ...
<p>I tend to use MFC (forgive me) instead of Win32 so I cannot answer this definitively, but I noticed this comment added to a page on an MS site concerning talking with an Edit control (a simple editor within the Edit control):</p> <blockquote> <p>The edit control uses <code>WM_CHAR</code> for accepting characters, no...
<p>Could it be that something else is stealing <kbd>Ctrl</kbd>+<kbd>A</kbd>? Use Spy++ to verify that it reaches your edit control.</p>
37,218
<p>We have got a custom <code>MembershipProvider</code> in <code>ASP.NET</code>. Now there are 2 possible scenario the user can be validated:</p> <ol> <li><p>User login via <code>login.aspx</code> page by entering his username/password. I have used <strong>Login control</strong> and linked it with the <code>MyMembersh...
<p>After validation is successful, you need to sign in the user, by calling FormsAuthentication.Authenticate: <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.authenticate.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.security.formsauthenticat...
<p>You are right in the case of storing the auth information as a cookie directly. But using a strong hash function (e.g. MD5 + SHA1) is great and secure. By the way, if you use sessions (which is also just a hash cookie) you could attach auth information to it.</p>
6,300
<p>How do I find out which process is listening on a TCP or UDP port on Windows?</p>
<h1><a href="https://en.wikipedia.org/wiki/PowerShell" rel="noreferrer">PowerShell</a></h1> <h2>TCP</h2> <pre><code>Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess </code></pre> <h2>UDP</h2> <pre><code>Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess </...
<p>For Windows, if you want to find stuff listening or connected to port 1234, execute the following at the cmd prompt: </p> <pre><code>netstat -na | find "1234" </code></pre>
7,056
<p>I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant.<br> For exemple:</p> <pre><code>Label l = new Label("Cat"); </code></pre> <p>Would become:</p> <pre><code>Label l = new Label(Constants.CAT); </code></pre> <p>And in <cod...
<p>Eclipse does do this automatically. Right-click the file, choose "Source", then "Externalize strings"</p> <p>This doesn't do exactly what you requested (having the strings in a Constants.java file as Strings) but the method used is very powerful indeed. It moves them into a properties file which can be loaded dyn...
<p>You may want to check out the <a href="http://jackpot.netbeans.org/" rel="nofollow noreferrer">Jackpot source transformation engine</a> in NetBeans which would allow you to script your source transformations. </p>
19,395
<p>I have three tables: page, attachment, page-attachment</p> <p>I have data like this:</p> <pre><code>page ID NAME 1 first page 2 second page 3 third page 4 fourth page attachment ID NAME 1 foo.word 2 test.xsl 3 mm.ppt page-attachment ID PAGE-ID ATTACHMENT-ID 1 2 ...
<p>Change your "inner join" to a "left outer join", which means "get me all the rows on the left of the join, even if there isn't a matching row on the right."</p> <pre><code>select page.name, count(page-attachment.id) as attachmentsnumber from page left outer join page-attachment on page.id=page-id group by pa...
<p>Use this:</p> <pre><code>SELECT p.name,( SELECT COUNT(*) FROM [page-attachment] pa WHERE pa.[PAGE-ID] = p.id) as attachmentsnumber FROM page p </code></pre>
5,737
<p>I'm using an Informix (Version 7.32) DB. On one operation I create a temp table with the ID of a regular table and a serial column (so I would have all the IDs from the regular table numbered continuously). But I want to insert the info from the regular table ordered by ID something like: </p> <pre><code>CREATE TE...
<p>In Informix when using a SELECT as a sub-clause in an INSERT statement, you are <strong>limited to a subset of the SELECT syntax</strong>. </p> <p>The following SELECT clauses are not supported in this case:</p> <ul> <li>INTO TEMP</li> <li>ORDER BY</li> <li>UNION. </li> </ul> <p>Additionally, the FROM clause o...
<p>It makes no sense to order the rows as you insert into a table. Relational databases do not allow you to specify the order of rows in a table. </p> <p>Even if you could, SQL does not guarantee a query will return rows in any order, such as the order you inserted them. You must specify an <code>ORDER BY</code> cl...
32,935
<p>When a user on our site loses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that they can change later.</p> <p>The applicatio...
<p>There's always <a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership.generatepassword.aspx" rel="noreferrer"><code>System.Web.Security.Membership.GeneratePassword(int length, int numberOfNonAlphanumericCharacters</code>)</a>.</p>
<p>Insert a Timer: timer1, 2 buttons: button1, button2, 1 textBox: textBox1, and a comboBox: comboBox1. Make sure you declare:</p> <pre><code>int count = 0; </code></pre> <hr> <p>Source Code:</p> <pre><code> private void button1_Click(object sender, EventArgs e) { // This clears the textBox, resets the coun...
7,869
<p>I've been using extension methods quite a bit recently and have found a lot of uses for them. The only problem I have is remembering where they are and what namespace to use in order to get the extension methods.</p> <p>However, I recently had a thought of writing the extension methods in the System namespace, Syst...
<p>From the Framework Design Guidelines (2nd Edition):</p> <p>DO NOT put extension methods in the same namespace as the extended type, unless it is for adding methods to interfaces, or for dependency management. </p> <p>While this doesn't explicitly cover your scenario, you should generally avoid extending a Framewor...
<p>I put my extention methods in a namespace depending on the visibility I want them to have. That way they are easier to discover, and I usually get fewer namespace imports.</p>
41,672
<p>What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken at newlines? Is it broken into fixed-length chunks? How do you best store arbitrarily long chunks of text?</p>
<p>nvarchar(max) ftw. because over complicating simple things is bad, mmkay?</p>
<p>If you need to worry about keeping things like formatting strings, quotes, and other "cruft" in the text, as code would likely have, then the special characters need to be completely escaped first - otherwise on submission the db, they might end up causing an invalid command to be issued.</p> <p>Most scripting lang...
12,103
<p>What's the best way to unit test large data sets? Some legacy code that I'm maintaining has structures of a hundred members or more; other parts of the code that we're working on create or analyze data sets of hundreds of samples.</p> <p>The best approach I've found so far is to serialize the structures or data se...
<p>If what you are trying to achieve is, in fact, a unit test you should mock out the underlying data structures and simulate the data. This technique gives you complete control over the inputs. For example, each test you write may handle a single data point and you'll have a very concise set of tests for each condit...
<p>This is still a viable approach. Although, I would classify this as a functional test, or just not a pure unit test. A good unit test would be to take a sampling of those records that gives to a good distribution of the edge cases you may encounter, and write those up. Then, you have your last "acceptance" or "funct...
29,141
<p>My company has developed (and still continues to develope) a large ASP.NET business application. Our platform is ASP.NET 2.0 using some ASP.NET Ajax. We're <strong>extensively using third-party components</strong>, like webgrids, comboboxes, treeviews, calendar and scheduling controls etc.</p> <p>Now, I don't know ...
<p>If they use the ASP.NET Control Model (That will be about 99,9% of controls written by ASP.NET Control vendors), they have to rewrite their controls. How much work there is in that, is very different depending of there arhitecture of their controls - the more ajax they already use, the more posible it is that they e...
<p>The ISV market definitely has smoe catching up to do with MVC, but that makes sense - it isn't RTM yet (although the last preview at least had an explicit "go live" licence). Regular Webforms controls will pretty-much need re-writing.</p> <p>I don't imagine it will take long for the major players to catch up, but i...
27,241
<p>I have a digital certificate that identifies an user. I need to use it to Digitally sign pdf files.</p> <p>Does anyone have an example that does not uses a third party component? I need to get this done but it would be nice to fully understand how things are done.</p> <p>C# Examples please :)</p>
<p>The open source <a href="http://itextsharp.sourceforge.net/" rel="noreferrer">iTextSharp</a> library will allow you to do this. Here's a <a href="http://www.codeproject.com/Articles/14488/E-signing-PDF-documents-with-iTextSharp" rel="noreferrer">post</a> explaining how to digitally sign a pdf file. If you don't want...
<p>Lost my first answer. May want to give DocQ a try to <a href="https://docq.com/" rel="nofollow noreferrer" title="digitally sign a PDF">link text</a> They have their own cert and can do this for you for free/cheap to seal and encrypt PDFs. They also have an API you can use. </p>
49,539
<p>I've been Googling around for .htaccess redirection information, but nothing I find is quite what I'm looking for.</p> <p>Basically, I want a solution that will take a site example.com and allow you to enter URL's like:</p> <pre><code> 123.example.com ksdfkjds.example.com dsf38jif348.example.com </code></pre> <...
<p>Try something like this:</p> <pre><code># If we're not on http://example.com RewriteCond %{HTTP_HOST} .+\.example.com # Add the host to the front of the URL and chain with the next rule RewriteRule ^(.*)$ ${HOST}$1 [C,QSA] # Make the host a directory RewriteRule ^(.*)\.example\.com(.*)$ http://example.com/$1$2 [Q...
<p>If you just want them to be the entrance:</p> <pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ RewriteRule ^ http://example.com/%1 [L,R] </code></pre> <p>Otherwise:</p> <pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ RewriteRule ^ /%1%{REQUEST_URI} [L] </code></pre>
34,444
<p>I wrote some code with a lot of recursion, that takes quite a bit of time to complete. Whenever I "pause" the run to look at what's going on I get: </p> <blockquote> <blockquote> <p>Cannot evaluate expression because the code of the current method is optimized.</p> </blockquote> </blockquote> <p>I think I ...
<p>The Debugger uses FuncEval to allow you to &quot;look at&quot; variables. FuncEval requires threads to be stopped in managed code at a GarbageCollector safe point. Manually &quot;pausing&quot; the run in the IDE causes all threads to stop as soon as possible. Your highly recursive code will tend to stop at an unsafe...
<p>I believe that what you are seeing is a result of the optimisations - sometimes a variable will be reused - particularly those that are created on the stack. For example, suppose you have a method that uses two (local) integers. The first integer is declared at the start of the method, and is used solely as a coun...
15,972
<p>Yesterday I wanted to add a boolean field to an Oracle table. However, there isn't actually a boolean data type in Oracle. Does anyone here know the best way to simulate a boolean? Googling the subject discovered several approaches</p> <ol> <li><p>Use an integer and just don't bother assigning anything other tha...
<p>I found <a href="http://www.techrepublic.com/article/oracle-tip-choosing-an-efficient-design-for-boolean-column-values/" rel="noreferrer">this</a> link useful.</p> <p>Here is the paragraph highlighting some of the pros/cons of each approach.</p> <blockquote> <p>The most commonly seen design is to imitate the man...
<p>In our databases we use an enum that ensures we pass it either TRUE or FALSE. If you do it either of the first two ways it is too easy to either start adding new meaning to the integer without going through a proper design, or ending up with that char field having Y, y, N, n, T, t, F, f values and having to remembe...
4,991
<p>Given the following class: </p> <pre><code>class TestClass { public void SetValue(int value) { Value = value; } public int Value { get; set; } } </code></pre> <p>I can do </p> <pre><code>TestClass tc = new TestClass(); Action&lt;int&gt; setAction = tc.SetValue; setAction.Invoke(12); </code></pre> <p>which is...
<p>You could create the delegate using reflection :</p> <pre><code>Action&lt;int&gt; valueSetter = (Action&lt;int&gt;)Delegate.CreateDelegate(typeof(Action&lt;int&gt;), tc, tc.GetType().GetProperty("Value").GetSetMethod()); </code></pre> <p>or create a delegate to an anonymous method which sets the property;</p> <pr...
<p>Properties are really wrappers around methods in .Net, so using reflection you should be able to get the delegate (set_PROPERTY and get_PROPERTY) and then execute them...</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo(VS.85).aspx" rel="nofollow noreferrer">System.Reflecti...
36,950
<p>The problem is simple, but I'm struggling a bit already.</p> <pre><code>Server server = new Server(8080); Context context = new Context(server, "/", Context.NO_SESSIONS); context.addServlet(MainPageView.class, "/"); context.addServlet(UserView.class, "/signup"); server.start(); </code></pre> <p>That's a pretty s...
<p>I'm not sure why using Guice make's Justin's option not work for you. What exactly is getting injected in? I'm not sure if this would help you at all because it is very similar to what Justin wrote above but if you do it this way, Jetty will do the actually instantiating.</p> <pre><code>Context context = new Cont...
<p>Use the <code>Context.addServlet</code> overload that takes a <code>ServletHolder</code>. <code>ServletHolder</code> is a class that accepts either a Class or a Servlet instance.</p> <pre><code>Servlet myServlet = new MyServlet(); ServletHolder holder = new ServletHolder(myServlet); context.addServlet(holder, "/")...
10,100
<p>A friend of mine asked me today if there is any open-source or commercially available Webmail/Email "engine". When I asked her what she meant by engine, I got a list of features her boss asked for - </p> <ul> <li>Web interface to login &amp; access e-mails</li> <li>Ability to send/receive/forward e-mails using the ...
<p>When starting any tests, Rails first loads any fixtures you have (in test/fixtures) and recreates the database with them.</p> <p>20-30 seconds sounds <em>very</em> slow though. Do you have a lot of fixtures that need to be loaded before your tests run, or is your database running slow?</p>
<p>It seems like Test::Unit is the simplest, but also one of the slowest ways to do unit testing with Ruby. One of alternatives is <a href="http://rubyforge.org/projects/zentest/" rel="nofollow noreferrer">ZenTest</a>.</p>
41,856
<p>I currently use RCS' merge command to do 3-way merges, but one thing has always annoyed me about it. If I use the -A option, the same change made in both files shows up as a conflict:</p> <p>&lt;&lt;&lt;&lt;&lt;&lt;&lt; file1<br> file1 line 1<br> ||||||| orig<br> orig line 1<br> =======<br> file2 line 1<br> &gt;>>>...
<p>Looks like diff3 has some interesting options.</p> <p>On ubuntu:</p> <pre> -m --merge Output merged file instead of ed script (default -A). </pre> <p>You asked for non-graphical, but vimdiff and gvimdiff can do 3 adjacent windows.</p>
<p>KDiff3 is graphical, but it does have an "--auto" option that, when called from the command line, will perform the merge and show the GUI only if a conflict occurs. I know that means you still need a GUI, but kdiff3 can still be useful from the command line. I use it that way all the time (on Windows - not sure abou...
49,735
<p>Are the two events the same or are there differences that we should take note when coding the keyboard presses?</p>
<p>My answer here is just based on experimenting with different applications, not programming per se. </p> <p>Handle the keydown. Let that be the trigger for your logic. That's what the user would expect based on interacting with other applications. </p> <p>For example, try a key down in Notepad, and you'll see t...
<p>The key down event happens as soon as the user presses a key, the key up event happens when they release the key after pressing it.</p> <p>So if you use the key up event, and the user presses a key and holds it for 5 seconds, nothing will happen until they let go of it.</p> <p><em>(Note: I know nothing about .net,...
32,601
<p>I've got an embedded Windows Media player in an HTML page, and when the audio gets to the end, it just starts again from the beginning.</p> <p>According to the documentation, there's an <code>autorewind</code> parameter/attribute and also a <code>loop</code>.</p> <p>The problem is, I've set both of those to <code>...
<p>WTH! param name=PlayCount value=1</p>
<p>compare your html code with this:</p> <p>stolen from <a href="http://www.programmingforums.org/post147977.html" rel="nofollow noreferrer">http://www.programmingforums.org/post147977.html</a></p> <blockquote> <pre><code>&lt;object width="320" height="290" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id="med...
32,603
<p>Can anyone help me to check, whether the MS Access DB is Password protected or not before opening the DB.</p> <p>Like for Excel we have "<strong>ProtectContents</strong>"readonly Boolean property in <strong>vb.net</strong></p> <p>Thank you.</p>
<p>It depends what you mean by "from scratch". <a href="http://docs.google.com/" rel="nofollow noreferrer">Google Docs</a> provides a pretty good text editor in JS. Is that what you mean ?</p>
<p>Of course you can do it and it is not very difficult. But before reinventing the wheel please take a look at all the existing ones. Many of them are really very well written and open source.</p>
48,897
<p>I've been using Visual Studio as my main IDE for a while now (I still use Emacs for some personal projects, though).</p> <p>I like the way Emacs formats C/C++ code and I'd like to convince Visual Studio use similar conventions for C# code. For instance, in Emacs, a C function call looks like:</p> <pre><code>functi...
<p>Tools > Options > Text Editor > C# > Formatting</p> <p>and</p> <p><a href="http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Formatting" rel="noreferrer">http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Formatting</a></p>
<p>See also this extension that will automate the process each time a file is saved : <a href="https://visualstudiogallery.msdn.microsoft.com/3ea1c920-69c4-441f-9979-ccc2752dac56" rel="nofollow">https://visualstudiogallery.msdn.microsoft.com/3ea1c920-69c4-441f-9979-ccc2752dac56</a></p>
36,863
<p>I need to get the name of the machine my .NET app is running on. What is the best way to do this?</p>
<p>Whilst others have already said that the <a href="http://msdn.microsoft.com/en-us/library/system.environment.machinename.aspx" rel="noreferrer">System.Environment.MachineName</a> returns you the name of the machine, beware...</p> <p>That property is only returning the NetBIOS name (and only if your application has ...
<p><s>Try <a href="http://msdn.microsoft.com/en-us/library/system.environment.machinename.aspx" rel="nofollow noreferrer">Environment.MachineName</a>.</s> Ray actually has the <strong>best</strong> <a href="https://stackoverflow.com/questions/103460/whats-the-best-way-to-determine-the-name-of-your-machine-in-a-net-app#...
12,903
<p>My company is using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe" rel="nofollow noreferrer">Visual SourceSafe</a> (VSS) and Visual Studio 2005 (soon 2008). They want to switch to <a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System" rel="nofollow noreferrer">CVS</a>, but the develope...
<p>Screaming at VSS for lost source code, etc. Seriously though, it is a very different model (<a href="http://en.wikipedia.org/wiki/Optimistic_replication#Examples" rel="nofollow noreferrer">optimistic locking</a>), so you will probably lose some productivity for the first little while. I would probably look at using ...
<p>My hack is as follows:</p> <p>I am mainly a Java developer and I use Eclipse/RAD. The support for CVS is great and is very easy to work with.</p> <p>For the C# work I do I tried to find a CVS plugin for Visual Studio but was unhappy with the one I found. In the end, I decided to use Eclipse to handle the versionin...
7,570
<p>I recently bought a 3d printer and right now i am printing a normal cube just to try it out. However I was wondering, when it has the last part left of the printing where it needs to create the roof, how will the filament stay there and not just fall down as there is nothing underneath?</p> <p>Will I need to check ...
<p>If you are printing a solid cube with infill, then the infill will support the "roof".</p> <p>If you are printing a hollow cube, then indeed, you should enable "support" to print a support structure under any overhangs.</p> <p>Depending on the angle, you may not need supports. Generally, FDM printers can print ove...
<p>If you are printing a solid cube with infill, then the infill will support the "roof".</p> <p>If you are printing a hollow cube, then indeed, you should enable "support" to print a support structure under any overhangs.</p> <p>Depending on the angle, you may not need supports. Generally, FDM printers can print ove...
543
<p>I was wondering if I could access the iPhones Core Location framework over a website?</p> <p>My goal is to build a webapp/website that the iPhone would browse to, then upload its current GPS location. This would be a simple site primary for friends/family so we could locate each other. I can have them manually ente...
<p>Why not simply use W3C <a href="https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/GettingGeographicalLocations/GettingGeographicalLocations.html" rel="nofollow noreferrer">GeoLocation</a> API available in mobile Safari? This will work on ipod touch as well (suburb...
<p>We built a really thin iphone client app that simply calls a predefined .js file on our site. Works like a charm. </p> <p>See arisgames.org for the project.</p>
4,678
<p>Has anyone used ruby in 64-bit environments in various platforms (HP=UX, Solaris, AIX etc.) in a commercial production environment that heavily relies on database.</p> <p>Have you faced any issues / bugs during these times?</p> <p>I know that overall things look ok. Compilation, deployment etc. I would like to kno...
<p>I have no issues with Debian on a 64 bit platform. The only issues I've had with 64 bit linux environments is related to things like the flash plugin for Firefox. </p> <p>Edit: I used Debian on a server and a laptop. The firefox problem was only on the laptop. (For obvious reasons)</p>
<p>I run both 32 bit and 64 bit ruby on Solaris 10. Compiling extensions for 64-bit AMD64 can be a little tricky. There exists a <a href="http://www.theeggeadventure.com/wikimedia/index.php/Ruby_Sybase_Solaris" rel="nofollow noreferrer">Sybase driver, which works but has a couple of bugs</a>. The Oracle driver is a l...
10,769
<p>I need to create S/MIME messages using C# (as specified in RFC 2633, "S/MIME Version 3 message specification", and RFC 3335). The only S/MIME library I can find is a commercial library (<a href="http://www.example-code.com/csharp/smime.asp" rel="noreferrer">http://www.example-code.com/csharp/smime.asp</a>), which is...
<p>I've written my own MIME library with support for S/MIME called <a href="http://github.com/jstedfast/MimeKit">MimeKit</a> which is far more robust than anything based on System.Net.Mail which is horrendously broken.</p> <p>It supports raw 8bit headers, rfc822 group addresses, scraping names out of rfc822 comments i...
<p>I haven't used this S/MIME library, but my application uses another library from the same vendor and it works fine:</p> <p><a href="http://www.chilkatsoft.com/mime-dotnet.asp" rel="nofollow noreferrer">http://www.chilkatsoft.com/mime-dotnet.asp</a></p> <p>Their library to do the p7s signatures is separate, which m...
15,496
<p>I'm starting to investigate T4 for Code Generation.</p> <p>I get that you have a basic template in which you can embed little chunks of c#/vb which can perform clever stuff...</p> <pre><code>&lt;#@ template language="VB" debug="True" hostspecific="True" #&gt; &lt;#@ output extension=".vb" debug="True" hostspecific...
<p>It seems that you can mix static output with template code in Class Blocks. Here is an example with C#:</p> <pre><code>&lt;#@ template language="C#" #&gt; &lt;# HelloWorld(); #&gt; &lt;#+ private string _field = "classy"; private void HelloWorld() { for(int i = 1; i &lt;= 3; i++) { #&gt;...
<p>It seems that you can mix static output with template code in Class Blocks. Here is an example with C#:</p> <pre><code>&lt;#@ template language="C#" #&gt; &lt;# HelloWorld(); #&gt; &lt;#+ private string _field = "classy"; private void HelloWorld() { for(int i = 1; i &lt;= 3; i++) { #&gt;...
24,996
<p>What are the best online code beautifier and formatter out there? I'm not asking for highlighters. Any language will do.</p>
<p>CSS: <a href="http://www.codebeautifier.com/" rel="nofollow noreferrer">code beautifier</a></p> <p>HTML: <a href="http://infohound.net/tidy/" rel="nofollow noreferrer">HTML Tidy</a>, <a href="http://www.cleanuphtml.com/cleanup.html" rel="nofollow noreferrer">CleanUp HTML</a> or the general purpose <a href="http://p...
<p>Use <a href="http://gist.github.com" rel="nofollow noreferrer">gist.github.com</a>. There is a multi-language support(java, c, c++, c#, vb, haskell, ruby, javascript, lua, HTML, SQL, Tcl, Perl, JSON, groovy...)</p> <p>Here is a sample <a href="https://gist.github.com/2027501" rel="nofollow noreferrer">"Generate Liq...
25,292
<p>How do I call onclick on a radiobutton list using javascript?</p>
<p>How are you generating the radio button list? If you're just using HTML:</p> <pre><code>&lt;input type="radio" onclick="alert('hello');"/&gt; </code></pre> <p>If you're generating these via something like ASP.NET, you can add that as an attribute to each element in the list. You can run this after you populate you...
<p>The other answers did not work for me, so I checked <a href="https://docs.telerik.com/devtools/aspnet-ajax/controls/button/client-side-programming/overview" rel="nofollow noreferrer">Telerik's official documentation</a> it says you need to find the button and call the <code>click()</code> function:</p> <pre><code>f...
47,330
<p>Occasionally, while printing, my <em>y</em> axis will slip and the layer will, from that point forward, be shifted, ruining the print.</p> <p>What might be the causes of an axis slipping? I have tried cooling the motor which seemed to have been getting warm, and the belts are not too tight.</p> <p>This does not ha...
<p>In my experience, the most common reason for positional offset during printing, is the <em>motor skipping steps due to physical impact</em>. </p> <p>Your stepper motors do not give <em>positional feedback</em> to your printer. So, if you forcefully move your motor during print, then the printer will not notice, and...
<p>My Y axis runs on a channel and I believe there was some grit or metal flakes in the channel left over from manufacturing. The wheels in the channel got stuck on the debris and caused the belt to slip. It made a horrible grinding noise when this happened.</p> <p>So I blew out the channel with pressurized air and te...
184
<p>If I have the following Linq code:</p> <pre><code>context.Table1s.InsertOnSubmit(t); context.Table1s.InsertOnSubmit(t2); context.Table1s.InsertOnSubmit(t3); context.SubmitChanges(); </code></pre> <p>And I get a database error due to the 2nd insert, Linq throws an exception that there was an error. But, is there ...
<p>For those who still have a problem with this, (I still get it from time to time) here's the steps I did to get rid of the ambiguous reference warning in ReSharper.</p> <ol> <li>First I went to all my class libraries and made sure that all references to my other class libraries had the <em>Copy Local</em> property s...
<p>I encountered the same problem. The issue I had was caused by a custom build provider (from an open source library I'm using called <a href="http://www.codeplex.com/PageMethods" rel="nofollow noreferrer">PageMethods</a>) and the fact that all my .aspx pages inherit from a BasePage class which lives in the App_Code f...
23,321
<p>I need to keep as much as I can of large file in the operating system block cache even though it's bigger than I can fit in ram, and I'm continously reading another very very large file. ATM I'll remove large chunk of large important file from system cache when I stream read form another file.</p>
<p>In a POSIX system like Linux or Solaris, try using posix_fadvise.</p> <p>On the streaming file, do something like this:</p> <pre><code>posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL); while( bytes &gt; 0 ) { bytes = pread(fd, buffer, 64 * 1024, current_pos); current_pos += 64 * 1024; posix_fadvise(fd, 0, curr...
<p>Buy more ram (it's relatively cheap!) or let the OS do its thing. I think you'll find that circumventing the OS is going to be more trouble than it's worth. The OS will cache as much of the file as needed, until yours or any other applications needs memory. </p> <p>I guess you could minimize the number of processes...
15,900
<p>I have this script:</p> <pre><code>select name,create_date,modify_date from sys.procedures order by modify_date desc </code></pre> <p>I can see what procedures were modified lately. I will add a "where modify_date >= " And I'd like to use some system stored procedure, that will generate me : drop + create scripts...
<p>This ain't pretty, but it works. Run the output from it manually or execute it with sp_executesql.</p> <pre><code>SELECT OBJECT_DEFINITION(object_id), 'drop procedure [' + name + ']' FROM sys.procedures WHERE modify_date &gt;= @date </code></pre> <p>You will have to worry about lost rights as well. </p>
<p>You could use a cursor to iterate through each record: </p> <pre><code>DECLARE @spName NVARCHAR(128) DECLARE myCursor CURSOR FOR SELECT name FROM sys.procedures ORDER BY modify_date DESC OPEN myCursor FETCH NEXT FROM myCursor INTO @spName WHILE @@fetch_status = 0 BEGIN -- Process each stored procedure with a dy...
22,633
<p>What are possible causes for a large number of sleeping connections to a MySQL Server? I'm using CodeIgniter with persistent connections disabled.</p>
<p>Even though the app doesn't keep the connection open, the OS lets it hang around. See <a href="http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/" rel="nofollow noreferrer">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/</a></p>
<p>could be a timeout issue</p>
33,457
<p>In VS2008, Is it possible to launch the executable for a project that is not the active project in the solution? (i.e. its name is not in bold).</p> <p>Not debugging it - just launching it. As far as I can see, you just have to drop in to Windows Explorer and double click the .exe! Am I missing a menu item or short...
<p>You can right-click a project to debug it. Right-click project -> Debug -> Start New Instance.</p> <p><strong>EDIT:</strong> I'm not sure of a way to do this outside of debug mode. That is essentially what the facility of the 'Active Project' is for. I typically set the active project and then use Shift+F5 to la...
<p>You can right-click a project to debug it. Right-click project -> Debug -> Start New Instance.</p> <p><strong>EDIT:</strong> I'm not sure of a way to do this outside of debug mode. That is essentially what the facility of the 'Active Project' is for. I typically set the active project and then use Shift+F5 to la...
47,348
<p>I have a Rails project which I neglected to build tests for (for shame!) and the code base has gotten pretty large. A friend of mine said that RSpec was a pain to use unless you use it from the beginning. Is this true? What would make him say that?</p> <p>So, considering the available tests suites and the fact that...
<p>This question <a href="http://www.ruby-forum.com/topic/164025#new" rel="noreferrer">came up recently</a> on the RSpec mailing list, and the advice we generally gave was:</p> <ul> <li>Don't bother trying to retro-fit specs to existing, working, code unless you're going to change it - it's exhausting and, unless the ...
<p>You can start writing "characterization tests". With this,you might what to try out the pretentious gem <a href="https://github.com/jedld/pretentious" rel="nofollow">here</a>:</p> <p>It is still a work in progress though.</p>
13,656
<p>I would like to trash the mail received by a single qmail alias. I don't want any mail delivery errors, and I want qmail to be happy about having delivered the mail.</p> <p>How can I do this, preferably without adding another local email account?</p>
<p>Create an alias by creating a file /var/qmail/aliases/.qmail-<em>blackhole</em> with this content:</p> <pre><code>|cat &gt;/dev/null </code></pre> <p>Then redirect whatever you want to this ‘blackhole’ alias (or use whatever you want in place of ‘blackhole’). Merely using /dev/null won’t work (<code>Unable_to_writ...
<p>A meta-question: why would this get rated down? Is it not appropriate for the site?</p>
14,661
<p>I am trying to sort a list using delegates but I am getting a signature match error. The compiler says I cannot convert from an 'anonymous method' </p> <pre><code>List&lt;MyType&gt; myList = GetMyList(); myList.Sort( delegate (MyType t1, MyType t2) { return (t1.ID &lt; t2.ID); } ); </code></pre> <p>What am I missi...
<p>I think you want:</p> <pre><code>myList.Sort( delegate (MyType t1, MyType t2) { return (t1.ID.CompareTo(t2.ID)); } ); </code></pre> <p>To sort you need something other than "true/false", you need to know if its equal to, greater than, or less than.</p>
<p>Make sure if your ID property is the default value data type, such as Int or String. If the ID is an object reference type, that object should implement IComparer or IComparer.</p>
28,543
<p>Perl has OOP features, but they are somewhat rarely used. How do you create and use Perl objects with methods and properties?</p>
<p>You should definitely take a look at <a href="http://search.cpan.org/perldoc?Moose" rel="noreferrer"><code>Moose</code></a>.</p> <pre><code>package Point; use Moose; # automatically turns on strict and warnings has 'x' =&gt; (is =&gt; 'rw', isa =&gt; 'Int'); has 'y' =&gt; (is =&gt; 'rw', isa =&gt; 'Int'); sub cle...
<p>On one foot, each class is a package; you establish (multiple, if desired) inheritance by setting the package variable <a href="http://perldoc.perl.org/perltoot.html#Inheritance" rel="nofollow noreferrer">@ISA</a> (preferably at compile time); you create an object from an existing piece of data (often, but not alway...
2,945
<p>What do the result codes in SVN mean? I need a quick reference.</p>
<p>For additional details see the SVNBook: <a href="http://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.status.html" rel="noreferrer">"Status of working copy files and directories"</a>.</p> <p>The common statuses:</p> <blockquote> <p><strong>U</strong>: Working file was updated</p> <p><strong>G</strong>: Changes ...
<p>Whenever you don't have access to documentation (<a href="http://svnbook.red-bean.com/en/1.8/" rel="noreferrer">SVNBook</a>), type (Linux):</p> <pre><code>svn help status | grep \'\?\' svn help status | grep \'\!\' svn help status | grep \'\YOUR_SYMBOL_HERE\' </code></pre> <p>or insert the following function in yo...
2,424
<p>I have just upgraded my board to TH3D's <a href="https://www.th3dstudio.com/product/ezboard-lite/" rel="nofollow noreferrer">EZBoard Lite</a> with their <a href="https://www.th3dstudio.com/knowledgebase/ezboard-installation-guide/" rel="nofollow noreferrer">Unified Firmware (U2.R1.15)</a> and whilst dialling in all ...
<p>There are multiple ways to achieve this:</p> <h2>In G-code</h2> <p>You don't necessarily need to do that in firmware, TH3D is based on Marlin firmware and is just a monolithic implementation for most popular printers and boards that helps novice users to easily configure their printer, but in the meantime it hides o...
<p>I dont know if you managed to solve this but if not I was facing the same issue and managed to do it just by searching all sketches for those parameters in Arduino IDE. They are not all in configuration.h like shown in the Teaching Tech video. Most of them are in configuration_backend.h and some in conditionals_LCD....
1,546
<p>I'm designing a language. First, I want to decide what code to generate. The language will have lexical closures and prototype based inheritance similar to javascript. But I'm not a fan of gc and try to avoid as much as possible. So the question: Is there an elegant way to implement closures without resorting to all...
<p>This would be a better question if you can explain what you're trying to avoid by not using GC. As I'm sure you're aware, most languages that provide lexical closures allocate them on the heap and allow them to retain references to variable bindings in the activation record that created them. </p> <p>The only alter...
<p>Create multiple stacks?</p>
11,485
<p>Is it ever appropriate to abandon the "getMyValue()" and "setMyValue()" pattern of getters and setters if alternative function names make the API more obvious?</p> <p>For example, imagine I have this class in C++:</p> <pre><code> public class SomeClass { private: bool mIsVisible; public: void draw(); ...
<p>Have a read of the article "<a href="http://www.pragprog.com/articles/tell-dont-ask" rel="noreferrer">Tell, Don't Ask</a>" over at the Pragmatic Programmers web site and I think you'll see that the second example is the way to go.</p> <p>Basically, you shouldn't be spreading the logic out through your code which is...
<p>Implicitly, the 'show' and 'hide' functions you list are both setters</p> <p>For booleans, I'd think that a single tool like you've shown would be good. However, a .show and .hide function also look like commands, not functions that change the state of the object.</p>
21,126