instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>How can I start an interactive console for Perl, similar to the <code>irb</code> command for Ruby or <code>python</code> for Python?</p>
<p>You can use the perl debugger on a trivial program, like so:</p> <pre><code>perl -de1 </code></pre> <p>Alternatively there's <a href="http://search.cpan.org/~sukria/perlconsole-0.4/perlconsole" rel="noreferrer"><em>Alexis Sukrieh</em>'s Perl Console</a> application, but I haven't used it.</p>
<p>You can do it online (like many things in life) here:</p> <p><a href="https://www.tutorialspoint.com/execute_perl_online.php" rel="nofollow noreferrer">https://www.tutorialspoint.com/execute_perl_online.php</a></p>
9,939
<p>We often hear/read that one should avoid dynamic casting. I was wondering what would be 'good use' examples of it, according to you?</p> <p>Edit:</p> <p>Yes, I'm aware of <a href="https://stackoverflow.com/questions/28002/regular-cast-vs-staticcast-vs-dynamiccast">that other thread</a>: it is indeed when reading o...
<p>This recent thread gives an example of where it comes in handy. There is a base Shape class and classes Circle and Rectangle derived from it. In testing for equality, it is obvious that a Circle cannot be equal to a Rectangle and it would be a disaster to try to compare them. While iterating through a collection of ...
<p>My current toy project uses dynamic_cast twice; once to work around the lack of multiple dispatch in C++ (it's a visitor-style system that could use multiple dispatch instead of the dynamic_casts), and once to special-case a specific subtype.</p> <p>Both of these are acceptable, in my view, though the former at lea...
4,773
<p>I would like to use <code>as</code> and <code>is</code> as members of an enumeration. I know that this is possible in VB.NET to write it like this:</p> <pre><code>Public Enum Test [as] = 1 [is] = 2 End Enum </code></pre> <p>How do I write the equivalent statement in C#? The following code does not compile:...
<p>Prefixing reserved words in C# is done with @.</p> <pre><code>public enum Test { @as = 1, @is = 2 } </code></pre>
<p>It does seem like a bad idea though - like setting FIVE to equal 6.</p> <p>Why not just use a predetermined prefix so that te names are unique and future maintainers of your code understand what you are doing?</p>
4,495
<p>SharePoint 2007 (both Moss and Wss) exposes document libraries via web dav, allowing you to create documents via essentially file system level activities (e.g. saving documents to a location).</p> <p>SharePoint also seems to expose lists via the same web dav interface, as directories but they are usually empty. Is...
<p>In short: No. </p> <p>Longer answer: Kinda. Any item stored in sharepoint is in a list, including files. But not all lists have files. A document library is a list with each element being a file+metadata. Other lists (like announcments) are just metadata. Only lists that contain files are exposed via webdav, and ev...
<p>Agreed. The only thing exposed to webdav is a list item's attachment (or a library's documents). Even if you bring up a file's properties in explorer, there's no options for list data.</p> <p>If you're working with Office 2007 documents, you can create a <a href="http://msdn.microsoft.com/en-us/library/ms550037.asp...
9,838
<p>It finally started to annoy me enough to ask this question: how do I do a basic diff between two revisions of a file in CVS? Usually I want to compare the latest revision and some random old one. I'm using the Eclipse CVS plugin. When I use "compare with->Another branch or version..." from the selected file's (lates...
<p>The answer is to show the file's history using context menu->Team->Show history, then choose two revisions and context menu for the selection->compare with each other.</p>
<p>There seems to be two main ways:</p> <p><strong>context menu->Team->Show history</strong></p> <p>which shows a linear history and you can select and compare between them, however it can be very bloated and hard to read when your project has lots of branches / tags. Personally i have found it less useful than:</p> ...
9,715
<p>Is there a plugin for targetting .NET 1.1 with VS 2008?</p>
<p>Try using ClearType, not Standard font smoothing. </p> <p>It's in Display properties, Appearance, Effects.</p>
<p>Could it be a problem with the color combination? Some fonts look really ugly on high contrast combinations with a black background.</p> <p>Also, can you see the difference in the fonts in any other application?</p> <p>Which font is it?</p>
6,648
<p>I have a case where a VB.Net winforms app needs to play WMV files from across the network. The user running the app cannot be given direct access to the network share. Through impersonation, I can see that the files exist (without impersonation, File.Exists returns false for the files on the network share). When I t...
<p>Have you tried using <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.setthreadprincipal.aspx" rel="nofollow noreferrer"><code>SetThreadPrincipal</code></a> method off <code>AppDomain</code>?</p> <p>Example:</p> <p><code>IPrinicipal userPrincipal = new MyCustomPrincipal();</code></p> <p><code>App...
<p>I suppose you tried using </p> <pre><code>[DllImport("advapi32.dll", SetLastError=true)] public static extern int LogonUser(string pszUsername, string pszDomain, string pszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); </code></pre> <p>to log in the network share.</p> <p>In my experience ...
8,885
<p>Has anyone successfully implemented a Java based solution that uses Microsoft SQL Server 2005 Reporting Services? Reporting Services comes with a set of Web Services that allow you to control the creation of a report, execution of a report, etc and I am just starting development on a POC of this integration. A cou...
<p>My experience with RS would lead me to suggest you go with just about anything else. I think the web services portion would work fine but I'd be concerned about how RS manages memory and how many reports you need to be running at once before making any decisions. I'm fighting with memory management problems today wi...
<p>we've successfully implemented that: JBoss 5 -> IIS proxy -> MS Reporting Services 2008 (via webservice).</p> <p>There are few pitfalls: MS RS 2008 does not support 'Anonymous' access anymore (2005 does), and does enforce using NTLM authentication. That is still a challenge in Java world, there is no good NTLM libr...
9,372
<p>I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see:</p> <ul> <li>Free/low cost</li> <li>Simple method for users to subscribe to KB (or just sections) ...
<p>I second Luke's answer.</p> <p>I can Recommend <a href="http://www.atlassian.com/software/confluence/" rel="noreferrer">Confluence</a> and here is why: I tested extensively many commercial and free Wiki based solutions. Not a single one is a winner on all accounts, including confluence. Let me try to make your ques...
<p>We've been using a combination of </p> <ul> <li>TWiki</li> <li>OpenGrok for the codebase</li> <li>usenet</li> <li>LotusNotes based system</li> </ul> <p>As long as there is a google search appliance pointed at these things I think it's ok to have any or many versions as long as people use them</p>
2,474
<p>I am stress testing a .NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as they would during the normal course of their jobs....
<p>This is just something that I thought of, but check to see how much memory SQL Server is using when you have 20+ users - one of the limitations of the Express version is that it is <a href="http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx" rel="nofollow noreferrer">limited to 1GB of RAM</a>. So i...
<p>Update: Looks like SQL Server express is not the problem as they were using the same product in previous version of the application. I think your next step is in identifying the bottlenecks. If you are sure it is in the database layer, I would recommend taking a profiler trace and bringing down the execution time of...
8,352
<p>I need to keep the files &amp; folders on two Windows-based, non-domain machines synchronized across a public network. </p> <p>I was thinking rsync over SSH - but I was wondering if there is a simpler solution? Any possibility of using the sync framework over SFTP/SCP/SSH? </p> <p>Or I'm open to better ideas?</...
<p>Figured I'd post what I finally went with - WinSCP - <a href="http://winscp.net" rel="nofollow noreferrer">http://winscp.net</a></p> <p>Connects via GUI to an SFTP server + supports Local/Remote/Both synchronization + scriptable with command-line/batch interface.</p>
<p>You could set up shared folders over a secure VPN with <a href="http://www.hamachi.cc" rel="nofollow noreferrer">Hamachi</a>, then use a folder syncing app to sync them up.</p>
4,516
<p>I've been thinking about alternatives to support materials for FDM printers, such as multi axis printers, dual head with soluble support material or printing in a gel/liquid which traps the material in place. Then it occurred to me that it might be possible to use the surface tension of a liquid to act as support ma...
<h1>It's not feasible as described with normal FDM technology.</h1> <p>FDM bases on depositing material in a single path. This needs the deposited material to stay at the same XY coordinates for subsequent paths. And exactly here is where a floating piece fails: a free-floating piece is by its very definition unrestric...
<p>I just had the same idea and googled it. My idea was to submerge the whole print platform in the water and lower it down so that the water level and the current layer line are always at the same height. Maybe a pump would be required to counteract the plastic displacing water. Completely floating parts of the print ...
1,536
<p>I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding. For example:</p> <pre><code>declare @value decimal(18,2) set @value = 123.456 </code></pre> <p>This will automatically round <code>@value</code> to be <code>123.46</code>, which is good in most cases. However,...
<pre><code>select round(123.456, 2, 1) </code></pre>
<pre><code>select convert(int,@value) </code></pre>
6,567
<p>Is there an easy way to return data to web service clients in JSON using java? I'm fine with servlets, spring, etc.</p>
<p>To me, <a href="http://xstream.codehaus.org/json-tutorial.html" rel="noreferrer">the best Java &lt;-> JSON parser is XStream</a> (yes, I'm really talking about json, not about xml). XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and ...
<p>For RESTful web services in Java, also check out the <a href="http://www.restlet.org/" rel="nofollow noreferrer">Restlet API</a> which provides a very powerful and flexible abstraction for REST web services (both server and client, in a container or standalone), and also integrates nicely with Spring and JSON.</p>
8,203
<p><strong>Edit</strong>: Solved, there was a trigger with a loop on the table (read my own answer further below).</p> <hr> <p>We have a simple delete statement that looks like this:</p> <pre><code>DELETE FROM tablename WHERE pk = 12345 </code></pre> <p>This just hangs, no timeout, no nothing.</p> <p>We've looked ...
<p>One piece of information missing is the number of indices on the table you are deleting the data from. As SQL Server uses the Primary Key as a pointer in every index, any change to the primary index requires updating every index. Though, unless we are talking a high number, this shouldn't be an issue.</p> <p>I am g...
<p>Ok, this is embarrasing.</p> <p>A collegue had added a trigger to that table a while ago, and the trigger had a bug. Although he had fixed the bug, the trigger had never been recreated for that table.</p> <p>So the server was actually doing nothing, it just did it a huge number of times.</p> <p>Oh well...</p> <p...
7,994
<p>I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world.</p> <p>If you know of a good example of design pattern usage (preferably in a OSS program so we can have a look :) then please list it below.</p>
<p>An ah-ha moment for me for the observer pattern was to realize how closely associated it is with events. Consider a Windows program that needs to acheive loosely communications between two forms. That can easily be accomplished with the observer pattern.</p> <p>The code below shows how Form2 fires an event and any ...
<p>Composite is used extensively in UI. Components can be leaf components e.g. buttons and labels or composites e.g. panels, that can contain other leaf or composite components. From the point of view of the client, all components are treated the same, which greatly simplifies the client code.</p>
5,682
<p>I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable.</p> <p>I know that's possible by using keyword <em>system</em> like that :</p> <pre><code>#!/usr/bin/env ruby directory = '/home/paulgreg/' system 'ls ' + directory </code></pre> <p>but is that possible b...
<p>No, that will just concatenate the output from <code>ls</code> and the contents of <code>directory</code>.</p> <p>But you can do this:</p> <pre><code>#!/usr/bin/env ruby directory = '/home/paulgreg/' `ls #{directory}` </code></pre>
<p>Nick is right, but there is no need to assemble the args piecewise:</p> <pre><code>directory = '/Volumes/Omg a space/' system('/bin/ls', directory) </code></pre>
6,295
<p>Often while editing config files, I'll open one with vi and then when I go to save it realize that I didn't type</p> <pre><code>sudo vi filename </code></pre> <p>Is there any way to give vi sudo privileges to save the file? I seem to recall seeing something about this while looking up some stuff about vi a while a...
<p><code>%</code> is replaced with the current file name, thus you can use:</p> <pre><code>:w !sudo tee % </code></pre> <p>(<code>vim</code> will detect that the file has been changed and ask whether you want to it to be reloaded. Say yes by choosing <code>[L]</code> rather than OK.)</p> <p>As a shortcut, you can de...
<p>A quick hack you can consider is doing a chmod on the file you're editing, save with vim, and then chmod back to what the file was originally.</p> <pre><code>ls -l test.file (to see the permissions of the file) chmod 777 test.file [This is where you save in vim] chmod xxx test.file (restore the permissions you foun...
2,340
<p>I want to create a regexp in Emacs that matches exactly 3 digits. For example, I want to match the following:</p> <pre><code>123 345 789 </code></pre> <p>But not</p> <pre><code>1234 12 12 23 </code></pre> <p>If I use <code>[0-9]+</code> I match any single string of digits. I thought <code>[0-9]{3}</code> wou...
<p>If you're entering the regex interactively, and want to use <code>{3}</code>, you need to use backslashes to escape the curly braces. If you don't want to match any part of the longer strings of numbers, use <code>\b</code> to match word boundaries around the numbers. This leaves:</p> <pre><code>\b[0-9]\{3\}\b </...
<p>It's pretty simple:</p> <pre><code>[0-9][0-9][0-9] </code></pre>
9,495
<p>I'm using Excel VBA to a write a UDF. I would like to overload my own UDF with a couple of different versions so that different arguments will call different functions. </p> <p>As VBA doesn't seem to support this, could anyone suggest a good, non-messy way of achieving the same goal? Should I be using Optional argu...
<p>Declare your arguments as <code>Optional Variants</code>, then you can test to see if they're missing using <code>IsMissing()</code> or check their type using <code>TypeName()</code>, as shown in the following example:</p> <pre><code>Public Function Foo(Optional v As Variant) As Variant If IsMissing(v) Then ...
<p>VBA is messy. I'm not sure there is an easy way to do fake overloads:</p> <p>In the past I've either used lots of Optionals, or used varied functions. For instance </p> <pre><code>Foo_DescriptiveName1() Foo_DescriptiveName2() </code></pre> <p>I'd say go with Optional arguments that have sensible defaults unless ...
8,999
<p>I'm building a listing/grid control in a <code>Flex</code> application and using it in a <code>.NET</code> web application. To make a really long story short I am getting XML from a webservice of serialized objects. I have a page limit of how many things can be on a page. I've taken a data grid and made it page, ...
<p>Thanks for the answers guys.</p> <p>@Theo: I tried the replace several different ways. For some reason it would never error, but never update the list.</p> <p>@Matt: I figured out a solution. The issue wasn't coming from what you suggested, but from how the delete works with Lists (at least how I have it in this...
<p>I don't immediately see the problem, so I can only venture a guess. The <code>delete</code> line that you've got is looking for the first item <em>at the top level</em> of the list which has an attribute "Id" with a value equal to <code>idOfReplacee</code>. Ensure that you don't need to dig deeper into the XML str...
3,213
<p>I am developing console application in .Net and I want to change a behavior a little based on information that application was started from cmd.exe or from explorer.exe. Is it possible?</p>
<pre><code>Process this_process = Process.GetCurrentProcess(); int parent_pid = 0; using (ManagementObject MgmtObj = new ManagementObject("win32_process.handle='" + this_process.Id.ToString() + "'")) { MgmtObj.Get(); parent_pid = Convert.ToInt32(MgmtObj["ParentProcessId"]); } string parent_process_name = Proces...
<p>The <a href="http://msdn.microsoft.com/en-us/library/ms682489(VS.85).aspx" rel="nofollow noreferrer">CreateToolhelp32Snapshot Function</a> has a Process32First method that will allow you to read a <a href="http://msdn.microsoft.com/en-us/library/ms684839(VS.85).aspx" rel="nofollow noreferrer">PROCESSENTRY32 Structur...
7,699
<p>Is there an algorithm or some heuristic to decide whether digital audio data is <a href="http://en.wikipedia.org/wiki/Clipping_(audio)#Digital_clipping" rel="nofollow noreferrer">clipping</a>?</p>
<p>The simple answer is that if any sample has the maximum or minimum value (-32768 and +32767 respectively for 16 bit samples), you can consider it clipping. This isn't stricly true, since that value may actually be the correct value, but there is no way to tell whether +32767 really should have been +33000.</p> <p>F...
<p>What Adam said. You could also add some logic to detect maximum amplitude values over a period of time and only flag those, but the essence is to determine if/when the signal hits the maximum amplitude.</p>
7,637
<p>Does anyone have a decent algorithm for calculating axis minima and maxima? </p> <p>When creating a chart for a given set of data items, I'd like to be able to give the algorithm: </p> <ul> <li>the maximum (y) value in the set </li> <li>the minimum (y) value in the set </li> <li>the number of tick marks to appear ...
<p>OK, here's what I came up with for one of our applications. Note that it doesn't deal with the "optional value" scenario you mention, since our optional value is always 0, but it shouldn't be hard for you to modify.</p> <p>Data is continually added to the series so we just keep the range of y values up to date by i...
<p>I can recommend the following:</p> <ul> <li>Set a visually appealing minimum number of major lines. This will depend on the nature of the data that you're presenting and the size of the plot you're doing, but 7 is a pretty good number</li> <li>Choose the exponent and the multiplier based on a progression of 1, 2, 5...
7,487
<p>I was in the process of printing a 16 hour print, but I must have failed to copy the G-code correctly, because the print stopped after 107 of 223 layers. Looking at the G-code, It also stops there. </p> <p>However, I had the full G-code on my computer, and decided to try and resume the print from layer 108. It seem...
<p>According to the RepRap.org <a href="http://reprap.org/wiki/G-code" rel="nofollow noreferrer">list of G-Code commands</a>, see <strong><a href="http://reprap.org/wiki/G-code#G0_.26_G1:_Move" rel="nofollow noreferrer">G0 &amp; G1: Move</a></strong>:</p> <blockquote> <p>The <code>Ennn</code> command is <em>The amou...
<p>Is the hotend temperature set correctly? If you only preheat the hotend but then turn it off, it will behave exactly as you described (while you're above <code>EXTRUDE_MINTEMP</code> it will behave normally, but once the temperature drops too low it will continue doing the XYZ-moves, but stop extruding). Perhaps you...
230
<p>I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet.</p> <p>The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The problem is that the code...
<p>You should really use a fixed-width field for your length.</p> <ul> <li>When the program on the receiving end has to read the length field of your packet, how does it know where the length stops?</li> <li>If the length of a packet can potentially reach 4 GB, does a 1-3 byte overhead really matter?</li> <li>Do you s...
<p>Try this loop:</p> <pre><code>{ extern char byte_stream[]; int bytes = offset_in_packet; int n = length_of_packet; /* Under 4 billion, so this can be represented in 32 bits. */ int t; /* 32-bit number used for temporary storage. */ int i; unsigned char curByte; for (i = 0; i &lt; 4; i+...
5,538
<p>I was wondering; which logging libraries for Delphi do you prefer?</p> <ul> <li><a href="http://www.raize.com/devtools/codesite/" rel="noreferrer">CodeSite</a></li> <li><a href="http://www.gurock.com/products/smartinspect/" rel="noreferrer">SmartInspect</a></li> <li><a href="http://log4delphi.sourceforge.net/" rel=...
<p>I've used Codesite and it has been fantastic. On one project, a word-processor, I could easily output a million debug lines, all structured, and Codesite helped greatly with its auto-collapsing indented output. For any task where you have to know what really is happening "underneath" a process that can't be interrup...
<p>I am looking into Codesite as well. I built my own in the past but I really like the featrues in Codesite. The Raize componenets are very well written and always quality stuff.</p>
9,859
<p>How do I write code where a company icon appears on the left side next to the URL address in the browser's address bar?</p>
<p>You are looking for a <a href="https://stackoverflow.com/questions/6642/preferred-way-to-use-favicons#6645">Favicon</a>.</p>
<p>load a file on the webserver called <a href="https://stackoverflow.com/favicon.ico">favicon.ico</a></p>
3,135
<p>I have a collection of classes that inherit from an abstract class I created. I'd like to use the abstract class as a factory for creating instances of concrete implementations of my abstract class. </p> <p>Is there any way to hide a constructor from all code except a parent class.</p> <p>I'd like to do this basic...
<p>You can make the sub classes child classes, something like this:</p> <pre><code>public abstract class AbstractClass { public static AbstractClass MakeAbstractClass(string args) { if (args == "a") return new ConcreteClassA(); if (args == "b") return new ConcreteClassB(...
<p>What you need to do is this to prevent the default constructor to be create. The internal can be change to public if the classes are not in the same assembly.</p> <pre><code>public abstract class AbstractClass{ public static AbstractClass MakeAbstractClass(string args) { if (args == "a") return Conc...
4,053
<p>I have built an MSI that I would like to deploy, and update frequently. Unfortunately, when you install the MSI, and then try to install a newer version of the same MSI, it fails with a message like "Another version of this product is already installed. Installation of this version cannot continue..." appears. The M...
<p>I have built numerous MSIs with VS 2005 Pro that do this correctly.</p> <p>Are you sure that the 'Version' property of the <strong>deployment project</strong> has been incremented? This property is independent of the version of the assemblies in the application, and this is the error message you will see if the Ver...
<p>Had the same problem when going from XP to Win7. To solve it I had to set DetectNewerInstalledVersion to False. Also, as mentioned by others, you need to inc the version of the setup project.</p> <p>Good luck.</p>
6,183
<p>Under FreeCAD, I sketched on the face of a solid as follows :</p> <p><a href="https://i.stack.imgur.com/Qe4nu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qe4nu.png" alt="sketch"></a></p> <p>My problem is, when I use "Pad a selected sketch", the solid created comprises also the original solid...
<p>Ok, I got help on <a href="http://forum.freecadweb.org/viewtopic.php?f=3&amp;t=19756" rel="nofollow noreferrer">this forum thread</a></p> <p>Using <code>Part Extrude</code> instead of <code>Pad a selected sketch</code> on the sketch will create an independent solid.</p> <p>It also turns out that, instead of creati...
<p>If you just select the face, and pad the face (versus padding the solid), you should not have this problem. </p>
483
<p>I have a file that I want to include in Python but the included file is fairly long and it'd be much neater to be able to split them into several files but then I have to use several include statements.</p> <p>Is there some way to group together several files and include them all at once?</p>
<ol> <li>Put files in one folder. </li> <li>Add &#95;&#95;init&#95;&#95;.py file to the folder. Do necessary imports in &#95;&#95;init&#95;&#95;.py</li> <li><p>Replace multiple imports by one:</p> <p>import folder_name </p></li> </ol> <p>See <a href="http://docs.python.org/tut/node8.html#SECTION008400000000000000000...
<p>Yes, take a look at the "6.4 Packages" section in <a href="http://docs.python.org/tut/node8.html" rel="nofollow noreferrer">http://docs.python.org/tut/node8.html</a>:</p> <p>Basically, you can place a bunch of files into a directory and add an __init__.py file to the directory. If the directory is in your PYTHONPA...
7,641
<p>We have an existing C++ application that we are going to gradually replace with a new Java-based system. Until we have completely reimplemented everything in Java we expect the C++ and Java to have to communicate with each other (RMI, SOAP, messaging, etc - we haven't decided).</p> <p>Now my manager thinks we'll n...
<p>There is <a href="http://laurentschneider.com/wordpress/2008/08/read-uncommitted.html" rel="noreferrer">an example on Laurent Schneider's blog</a> of using the DBMS_XA package inside Oracle to permit multiple sessions to work in the same transaction. So it would be possible to have Java and C++ sessions participati...
<p>I believe JBoss Transaction Manager supports 2pc tx propagation across web service calls. You could, I suppose integrate your systems that way, but the performance would stink.</p>
6,563
<p>I'd like to attach a piece I printed out of PLA to a small titanium rod. I've previously used Superglue (cyanoacrylate) to glue PLA pieces to each other with great success, but the problem is that if you don't apply it perfectly cleanly, it leaves very noticeable stains on the PLA.</p> <p>Can anyone recommend a goo...
<p>I've been a fan of epoxies for unusual adhesion problems. I found on <a href="https://rads.stackoverflow.com/amzn/click/B000FW6322" rel="nofollow noreferrer">Amazon a product with titanium</a> in the name, but there's a caution regarding polypropylene plastics. </p> <p><a href="https://i.stack.imgur.com/DfKGn.jpg" ...
<p>A glue gun would IMO work very well, and you can use transparent (or almost transparent) glue sticks to minimize ugly looking stains.</p> <p>Things glued together usually break before the glue (in my experience) and it's cheap, you can get one for $10 with some glue sticks. It's fun too, I glue everything since I b...
812
<p>I've encountered the term "multi-agent computing" as of late, and I don't quite get what it is. I've read a book about it, but that didn't answer the fundamental question of what an agent was.</p> <p>Does someone out there have a pointer to some reference which is clear and concise and answers the question without ...
<p>A multi-agent system is a concept borrowed from AI. It's almost like a virtual world where you have agents that are able to observe, communicate, and react. To give an example, you might have a memory allocation agent that you have to ask for memory and it decides whether or not to give it to you. Or you might have ...
<p>You can find a concentration of white papers concerning agents <a href="http://recursionsw.com/About_Us/wp_mobileagents.html" rel="nofollow noreferrer">here</a>.</p>
5,623
<p>I've been tasked with updating a series of applications which are performance critical VB.NET apps that essentially just monitor and return networking statistics. I've only got three requirements: <em>convert it to C#, make it fast, and make it stable</em></p> <p>One caveat is that we <em>"may"</em> migrate from a ...
<p>First off, I would put some time into trying out a few <a href="http://www.google.com/search?q=VB.NET+to+C%23+converter&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" rel="nofollow noreferrer">VB.NET to C# converters</a>. You're basically porting syntax, and there's no r...
<p><strong>I might be misunderstanding the issue</strong>, but if it is a network monitoring system, why isn't it written as a "dedicated" Windows service? </p> <p>VB.NET shouldn't be much slower than C#. I'm not 100% certain if there is any big differences in the generated IL-code, but the only advantage (and justifi...
3,119
<p>Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific formats) dates in C# <strong>should</strong> be as easy as </p> <pre><code>DateTime.ParseExact(theDate, "yyyy/MM/dd"); </code></pre> <p>but no, C# forces you to create an IFormatProvider.</p> <p>Is there an app.config friendly way...
<p>The IFormatProvider argument can be null.</p>
<p>//Convert date to MySql compatible format</p> <p>DateTime DateValue = Convert.ToDateTime(datetimepicker.text);</p> <p>string datevalue = DateValue.ToString("yyyy-MM-dd");</p>
9,023
<p>Say I have three files (template_*.txt):</p> <ul> <li>template_x.txt</li> <li>template_y.txt</li> <li>template_z.txt</li> </ul> <p>I want to copy them to three new files (foo_*.txt). </p> <ul> <li>foo_x.txt </li> <li>foo_y.txt </li> <li>foo_z.txt</li> </ul> <p>Is there some simple way to do that with one command...
<pre> for f in template_*.txt; do cp $f foo_${f#template_}; done </pre>
<p>Yet another way to do it:</p> <pre><code>$ ls template_*.txt | sed -e 's/^template\(.*\)$/cp template\1 foo\1/' | ksh -sx </code></pre> <p>I've always been impressed with the ImageMagick <a href="http://www.imagemagick.org/script/convert.php" rel="nofollow noreferrer">convert</a> program that does what you expect ...
4,598
<p>Background: At my company we are developing a bunch applications that are using the same core dll's. These dll's are using Spring.net's IoC-container to wire things up (auto-wiring). All applications are using the same spring configuration file, and this configuration file points to many classes in many different dl...
<p>If none of the code from the assembly is ever used, then eventually the pages from that assembly will be moved from memory into the page file in favour of actively used pages. In which case, the overall long-term effect is likely to be minor. Although, there will be a negative effect on startup time.</p>
<p>of course loading dll's w/o using them causes slower startup time due to reading the assembly from disk and evidence/security checks. But if memory is your concern you at least can be sure, you won't waste more memory than the size of your assemblies if you really don't use any types within. Of course if those types...
9,550
<p>I'm asking this question purely from a usability <code>standpoint</code>!</p> <p>Should a website <code>expand/stretch</code> to fill the viewing area when you resize a browser window?</p> <p>I know for sure there are the obvious cons:</p> <ul> <li>Wide columns of text are hard to read.</li> <li>Writing html/css ...
<p>Raw HTML does just that. Are you changing your data so that it doesn't render so good in random sized windows?</p> <p>In the olden days, everyone had VGA screens. Now, that resolution is most uncommon. Who knows what resolutions are going to be common in the future? And why expect a certain minimum width or hei...
<p>Paragraph widths larger than your display make a web site completely unusable. You have to jiggle the horizontal scrollbar back and forth for every single line you read. I'm doing a web design subject at university and the textbook calls the designs which adapt to your screen width <i>fluid layout</i>.<p> I'm design...
4,700
<p>I'm trying to compile over 100 java classes from different packages from a clean directory (no incremental compiles) using the following ant tasks:</p> <pre><code>&lt;target name="-main-src-depend"&gt; &lt;depend srcdir="${src.dir}" destdir="${bin.dir}" cache="${cache.dir}" ...
<blockquote> <p>It will be nice to know; what can cause or causes a StackOverflowError during compilation of Java code?</p> </blockquote> <p>It is probable that evaluating the long expression in your java file consumes lots of memory and because this is being done in conjunction with the compilation of other cla...
<p>That's quite odd, 100 classes really isn't that many. What is the compiler doing when the stack overflows? Is there a useful stack trace generated? What happens if you run <code>javac</code> directly on the command line instead of thorugh ant?</p> <p>One possible workaround is to simply increase the size of the sta...
3,762
<p>How can I insert compilation timestamp information into an executable I build with Visual C++ 2005? I want to be able to output something like this when I execute the program:</p> <blockquote> <p>This build XXXX was compiled at dd-mm-yy, hh:mm.</p> </blockquote> <p>where date and time reflect the time when the p...
<p>Though not your exact format, <strong>DATE</strong> will be of the format Mmm dd yyyy, while <strong>TIME</strong> will be of the format hh:mm:ss. You can create a string like this and use it in whatever print routine makes sense for you:</p> <pre><code>const char *buildString = "This build XXXX was compiled at " _...
<p>Visual C++ also supports <code>__TIMESTAMP__</code> which is almost exactly what you need. That being said, the tough part about build timestamps is keeping them up to date, that means compiling the file in which <code>__TIMESTAMP__</code> is used on every rebuild. Not sure if there's a way to set this up in Visua...
4,537
<p>Being new to 3D printing, I started using Cura (which came with my Ender 3v2) to slice models I found on Thingiverse. I know that there are other slicers and have heard positive things about PrusaSlicer.</p> <p>I know that settings will have different names, but I am asking more about the setup. What things, setting...
<p>Basically all slicers work very similarly, it is a matter of preference, being accustomed, or wanting to use a certain (set of) features. Their job is to prepare the object to be sliced in layers to be executed by the printer you use. For every slicer to work properly, you need to configure the printer settings corr...
<p>PrusaSlicer already has pre-tuned profiles for the Ender 3 v2 in the Configuration Assistant. It also has tuned print settings from SUPERDETAIL (0.08 mm layer height) to SUPERDRAFT (0.28 mm layer height) so it shouldn't be too hard to set up.</p>
1,897
<p>I'm looking to 3D print a structure that won't deform in high heat, up to about 220&nbsp;&deg;C. The filament itself can be 3D printed all the way up to about 380&nbsp;&deg;C. </p> <p>PEI seems like it could be a viable option. I found some <a href="https://www.matterhackers.com/store/l/3dxtech-thermax-pei-175mm-05...
<p>Your expected operating temperature exceeds the glass transition temperature by 3&nbsp;&deg;C. This implies that the structure will become weak and can deform under load. </p> <p>Note that you cannot simply print PEI on a normal machine, it requires a special high temperature capable printer with hot end temperatur...
<p>An easier but less simple solution might be to make a PLA 'pattern' that is the right size and shape, then use that to cast your item in aluminium (melting point ~ 660C) using the 'investment' or 'lost PLA' process.<br> Links:- <a href="https://www.instructables.com/id/3D-Printed-Lost-PLA-Investment-Casting-Alumin...
1,449
<p>A Monoprice Maker Select V2, upgraded incrementally with a <a href="https://store.micro-swiss.com/products/all-metal-hotend-with-slotted-cooling-block-for-wanhao-i3" rel="nofollow noreferrer">Micro Swiss all metal hot-end</a>, machined lever, and <a href="https://www.wanhaouk.com/products/extruder-drive-gear" rel="n...
<p>The Micro Swiss hotend uses an all metal hotend. These type of hotends are more difficult to operate considering they do not have a Teflon liner that shields the filament from heat exchange from the cold end (the Teflon/PTFE tube acts as an insulator). From <a href="https://www.proto-pasta.com/blogs/how-to/avoid-clo...
<p>The Micro Swiss hotend uses an all metal hotend. These type of hotends are more difficult to operate considering they do not have a Teflon liner that shields the filament from heat exchange from the cold end (the Teflon/PTFE tube acts as an insulator). From <a href="https://www.proto-pasta.com/blogs/how-to/avoid-clo...
1,062
<p>I want to point a file dialog at a particular folder in the current user's Local Settings folder on Windows. What is the shortcut to get this path?</p>
<p>How about this, for example:</p> <pre><code>String appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); </code></pre> <p>I don't see an enum for just the Local Settings folder.</p> <p><a href="http://web.archive.org/web/20080303235606/http://dotnetjunkies.com/WebLog/nenoloje/a...
<p>Environment.GetFolderPath( Environment.SpecialFolders.LocalApplicationData);?</p> <p>I can't remember if there is a "Local Settings" folder on Windows XP anymore, it seems vaguely familiar.</p>
8,154
<p>Does anyone have any suggestions on how to mentor a junior programmer ? If you have mentored someone did you follow any process or was it quite informal ?</p> <p>If you've been mentored in the past what kind of things did you find most helpful ?</p>
<p>Try to set aside between 30-60 minutes a day to review their code together. If you can't do this, then try to get together to review their code whenever they make a code commit, unless it was very basic. Have them explain why they chose the approach they took in lieu of others. A process like this helps to establish...
<p>I have mentored several junior people under me before. My approach varied slightly based on the person a bit based on how they learned. </p> <p>In short, I gave the junior people small, self-contained projects when I could and gave them a relatively fixed time to complete the task. Once the task was complete I w...
4,471
<p>In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't have to be accessed from disk?</p> <p>I'm using SQL Serve...
<p>If you have enough RAM, SQL will do an outstanding job determining what to load into RAM and what to seek on disk. </p> <p>This question is asked a lot and it reminds me of people trying to manually set which "core" their process will run on -- let the OS (or in this case the DB) do what it was designed for.</p> <...
<p><a href="http://msdn.microsoft.com/en-us/library/ms178015(SQL.90).aspx" rel="nofollow noreferrer">DBCC PINTABLE</a> will explicitly pin a table in core if you want to make sure it remains cached.</p>
6,454
<p>My recently installed BLTouch probe regularly fails to perform ABL properly. There seem to be 3-4 failure modes:</p> <ol> <li>Probe manages some points but fails partway through, with a "probing failed" message on the LCD screen, rendering it necessary to power-cycle the printer</li> <li>Probe deploys on some poin...
<p>So it turns out there are elements from each of the previous answers that make sense here, but its not a clear picture. I've spent a whole lot of time trying to make sense of this. I also upgraded my firmware to <a href="https://www.thingiverse.com/thing:32084" rel="nofollow noreferrer">Sailfish.</a> </p> <p>For ...
<p>It sounds like you have "Origin at center" checked in your slicer's printer definition. That is generally only used with delta printers. Most Cartesian printers have the origin at the front-left corner of the build plate. Uncheck "Origin at center" and re-slice.</p> <p>Providing that you have set up your slicer wit...
1,496
<p>I had my printer printing fine when using the stock trigger switch as I used it to print the green bracket you see in the picture. </p> <p><a href="https://i.stack.imgur.com/6kxYw.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/6kxYw.jpg" alt="Photo of probe atached to hotend"></a></p> <p>My problem now ...
<p>If using <code>marlin firmware</code> center your prints.</p> <p>In my case...</p> <pre><code>#define NOZZLE_X 8 #define NOZZLE_Y -56 </code></pre> <p>Then, set the Z-Probe offset from nozzle. In my case the Z-Probe is 50mm behind the hotend.</p> <pre><code>#define SENSOR_LEFT 0 #define ...
<p>There are at least 2 options to address the problem that you have:</p> <ol> <li>Adjust end-stops so that in 0,0 position Z-sensor would still hang above the printing table. This would reduce printing surface but allow perfect calibration</li> <li>Mount extra metal plate at the table mount where it would not bump in...
421
<p>Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so? </p>
<p>Some of the comments in the answers here are slightly too generalistic. </p> <p>Whilst no, in the specific case mentioned gcc binaries won't link with a VC++ library (AFAIK). The actual means of interlinking code/libraries is a question of the ABI standard being used.</p> <p>An increasingly common standard in the ...
<p>I would guess not. Usually c++ compilers have quite different methods of name-mangling which means that the linkers will fail to find the correct symbols. This is a good thing by the way, because C++ compilers are allowed by the standard to have much greater levels of incompatibility than just this that will cause y...
6,476
<p>I've been looking for some good genetic programming examples for C#. Anyone knows of good online/book resources? Wonder if there is a C# library out there for Evolutionary/Genetic programming?</p>
<p>After developing <a href="http://code.google.com/p/evo-lisa-clone/" rel="noreferrer">my own Genetic Programming didactic application</a>, I found a complete Genetic Programming Framework called <a href="http://code.google.com/p/aforge/source/browse/#svn/trunk/Sources/Genetic" rel="noreferrer">AForge.NET Genetics</a>...
<p>I maintain a port of ECJ in C#. It's great.</p>
3,488
<p><a href="http://www.nasa.gov/mission_pages/station/research/experiments/1115.html">This article</a> states that 3D printing has been accomplished in outer space, on the International Space Station.</p> <p>I'm curious as to how this works differently from 3D printing on Earth. Are there any extra measures that neede...
<p>Most likely, the 3D-printers used on ISS does not incorporate some fundamental difference that allow them to print in zero gravity.</p> <p>Some people over at <a href="http://3dprint.com/62797/3d-printing-upside-down/" rel="noreferrer">3Dprint.com</a> raised a very similar question, and figured that when turning th...
<p>To answer your question, you have to consider how the melted filament sticks to the print bed and to other layers, and if gravity has any affect on how it sticks. The answer is that gravity does <em>not</em> have any real affect on the stick-to-itivity of the filament. Instead, the plastic bonds to the print bed sur...
151
<p>This is printing PETG extruding at 250 °C, 1st layer bed at 80 °C then 60 °C on other layers. Nozzle is 0.4 mm; printer is German Reprap X400. The all metal extruder is clean with no oozing. The print gets a blob when the wall width changes from 2 mm to 1 mm. The extruder squishes the blob out the sides of the w...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
1,870
<p>I have a project which is source controlled using Subversion and VisualSVN. Since the version of web.config is different on the server and the developers' computers I want the file to remain on the computers but to be ignored by Subversion. I added it to the svn:ignore but it still remains (and still has a red excla...
<p>you'll have to do both the remove and ignore operation</p> <ul> <li>first make a backup of your local file (like @ibz said)</li> <li>then remove the web.config from the repository.</li> <li>then copy back the web.config to the same folder</li> <li>finally use svn:ignore so that subversion does not try to add it aga...
<p>I have solved this issue using nant with ccnet. Following nant build script replaces web.test.config file with local web.config file;</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="Project1" default="build"&gt; &lt;target name="init" depends="clean" /&gt; &lt;target name="clean" /&gt; ...
7,999
<p>One of the biggest issues currently holding me back from diving full steam into unit testing is that a really large percentage of the code I write is heavily dependent on third-party COM objects from different sources that also tend to interact with each other (I'm writing add-ins for Microsoft Office using several ...
<p>The traditional approach says that your client code should use a wrapper, which is responsible for instantiating the COM object. This wrapper can then be easily mocked.</p> <p>Because you've got parts of your code instantiating the COM objects directly, this doesn't really fit. If you can change that code, you coul...
<p>It comes down to 'designing for testability'. Ideally, you should not instantiate those COM objects directly but should access them through a layer of indirection that can be replaced by a mock object.</p> <p>Now, COM itself does provide a level of indirection and you could provide a mock object that provided a sub...
9,588
<p>I'm using my printer for some baby toys. My last print was one of those <a href="https://www.thingiverse.com/thing:3556006/files" rel="nofollow noreferrer">pillars for stacking rings</a>, base 5. The basic format includes a base and a pillar coming up perpendicularly in the middle. A box with a cylinder sticking out...
<p>So you are printing at 80 mm/s speed * 0.3 mm layer height * something about 0.5 mm line width, which is about 12 mm<sup>3</sup>/s which is likely too much for many printers.</p> <p>Try keeping linear speed at 60 mm/s and, if you have a 0.4 mm nozzle, never go above 0.24 mm layer thickness if you care about strength...
<p>If you don't object to using adhesive to assemble the model, consider that you can succeed with your objective by performing a plane cut in the vertical direction. This allows you to print the model in the strongest orientation without supports. It will also result in an internal set of faces due to duplication of (...
2,096
<p>Any ideas how to display a PDF file in a WPF Windows Application? </p> <hr> <p>I am using the following code to run the browser but the <code>Browser.Navigate</code> method does not do anything!</p> <pre><code>WebBrowser browser = new WebBrowser(); browser.Navigate("http://www.google.com"); this.AddChild(browser)...
<p>You could simply host a Web Browser control on the form and use it to open the PDF.</p> <p>There's a new native WPF "WebBrowser" control in .NET 3.51, or you could host the Windows.Forms browser in your WPF app.</p>
<p>Check this out: <a href="http://itextsharp.sourceforge.net/" rel="nofollow noreferrer">http://itextsharp.sourceforge.net/</a> You may have to use a WindowsFormsHost, but since it is open source, you might be able to make it a little more elegant in WPF.</p>
7,879
<p>Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Thank you all for your thoughts. Printing directly to the serial port is likely the most flexible method. In this case we didn't want to replicate all of the work that was already built into the Intermec dll for handling the port, printer errors, etc. We were able to get this working by sending the printer the appro...
<p>Last time I had to print Barcode (despite the printer or framework) I resorted to use a True Type font with the Barcode I needed. (In my case was EAN-13 something), an european barcode.</p> <p>There are fonts where you simply write numbers (and/or letters when supported) and you get a perfect barcode any scanner ca...
4,590
<p>I've just finished building a new printer and I wanted to take advantage of a 32 bits board I ordered some time ago. The board is an MKS SBase 1.3</p> <p>I've been researching the Smoothiware firmware but somehow I'm not convinced by it yet. One of the things pulling me off is the Z-Probe behavior. On my Arduino-Ma...
<p>So, low-teck, old-style investigative work from my side.... I contacted <a href="http://www.filright.com" rel="nofollow noreferrer">a company</a> selling HDPLA and they got back to me with the following reply.</p> <blockquote> <p>We created HDPLA as an industrial PLA with special additives. As a result, our so ca...
<p>I doubt that it means very much at all. Filament manufacturers are very tight-lipped about the co-polymers that they add to their base stock in order to improve handling and performance characteristics, so it is impossible to say. The only common attribute that I can see is an advertised diameter tolerance of &plusm...
791
<p>What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)?</p> <p>Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.</p>
<p>Message Passing Interface (MPI) (<a href="http://www-unix.mcs.anl.gov/mpi/" rel="noreferrer">http://www-unix.mcs.anl.gov/mpi/</a>) is a highly scalable and robust library for parallel programming, geared original towards C but now available in several flavors <a href="http://en.wikipedia.org/wiki/Message_Passing_Int...
<p>For python you can try using <a href="http://pyprocessing.berlios.de/" rel="nofollow noreferrer">processing module</a>.</p>
4,219
<p>I am printing this piece using a 0.4 mm nozzle. It happens that the piece on the chin does not print properly.</p> <p>I have already tried the tree mode supports, touching the plate and in all the places but the same thing happens.</p> <p>I include photos of my configuration in Cura.</p> <p><a href="https://i.stack....
<p>I see that you have a minimum support angle of 60 degrees -- that may mean Cura Slicer isn't generating supports for that chin. Try changing this minimum to a lower figure -- 51 degrees or lower. From what I've read, most filaments and settings will allow 60 degrees with PLA, but this is the easy first thing to tr...
<p>You need to zoom in on the layers where the support is being generated and check if there is actually support being generated under that area.</p> <p>Additionally, I noticed your support generation setting is &quot;Touching build plate only&quot;. You should change this setting to 'everywhere' because it could be t...
1,957
<p>What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Apple Xcode.</p>
<p>Xcode includes XCTest, which is similar to <a href="http://www.sente.ch/software/ocunit/" rel="noreferrer">OCUnit</a>, an Objective-C unit testing framework, and has full support for running XCTest-based unit tests as part of your project's build process. Xcode's unit testing support is described in the <a href="ht...
<p>I hope u can use 'SenTestKit', from which u can test each and every method. </p>
5,320
<p>I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system. </p> <p>Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping the...
<ol> <li>Go into <code>Control Panel</code></li> <li><code>System and Security</code></li> <li><code>Administrative Tools</code></li> <li>Launch the <code>System Configuration</code> tool</li> </ol> <p>If you have multiple copies of Windows installed, the one you are booted with will be named such as:</p> <pre><code>...
<p>You can try use simple command line. <a href="https://technet.microsoft.com/en-us/library/cc709667%28v=ws.10%29.aspx" rel="nofollow">bcdedit</a> is what you need, just run cmd as administrator and type <code>bcdedit</code> or <code>bcdedit \v</code>, this doesn't work on XP, but hope it is not an issue.</p> <p>Anyw...
6,155
<p>I have a few lines of PowerShell code that I would like to use as an automated script. The way I would like it to be able to work is to be able to call it using one of the following options:</p> <ol> <li>One command line that opens PowerShell, executes script and closes PowerShell (this would be used for a global b...
<p>Save your script as a .ps1 file and launch it using powershell.exe, like this:</p> <pre><code>powershell.exe .\foo.ps1 </code></pre> <p>Make sure you specify the full path to the script, and make sure you have set your execution policy level to at least "RemoteSigned" so that unsigned local scripts can be run.</p>...
<p>you can use this command : powershell.exe -argument c:\scriptPath\Script.ps1</p>
4,931
<p>I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file.</p> <p>Essentially if someone modifies this file outside of the program the program should fail to load it again.<...
<p>A better solution is to store the MD5 in the configuration file. But instead of the MD5 being just of the configuration file, also include some secret "key" value, like a fixed guid, in the MD5.</p> <pre><code>write(MD5(SecretKey + ConfigFileText)); </code></pre> <p>Then you simply remove that MD5 and rehash the ...
<p>just make a const string that holds the md5 hash and compile it into your app ... your app can then just refer to this const string when validating the configuration file</p>
5,554
<p>Has anyone written an 'UnFormat' routine for Delphi?</p> <p>What I'm imagining is the <em>inverse</em> of <em>SysUtils.Format</em> and looks something like this </p> <p>UnFormat('a number %n and another %n',[float1, float2]); </p> <p>So you could unpack a string into a series of variables using format strings.<...
<p>This is called scanf in C, I've made a Delphi look-a-like for this :</p> <pre><code>function ScanFormat(const Input, Format: string; Args: array of Pointer): Integer; var InputOffset: Integer; FormatOffset: Integer; InputChar: Char; FormatChar: Char; function _GetInputChar: Char; begin if InputOffs...
<p>I tend to take care of this using a simple parser. I have two functions, one is called NumStringParts which returns the number of "parts" in a string with a specific delimiter (in your case above the space) and GetStrPart returns the specific part from a string with a specific delimiter. Both of these routines hav...
9,829
<p>I want to copy a file from A to B in C#. How do I do that?</p>
<p>The File.Copy method:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.io.file.copy.aspx" rel="nofollow noreferrer">MSDN Link</a></p>
<p>System.IO.File.Copy</p>
4,027
<p>When and how should table stats gathering be performed for Oracle, version 9 and up? How would you go about gathering stats for a large database, where stats gathering would collide with "business hours".</p>
<p>I don't agree that you should always rebuild your statistics after there have been lots of deletes or inserts. As ever, it depends. In a data warehouse situation, when re-building your materialized views you will be doing lots of deletes and inserts but the base structure of the data will not change.</p> <p>You onl...
<p>Make sure when using the estimate (sample_percent) that you gather at least 10 percent. Below that can yield very questionable results.</p>
5,741
<p>If I have to make an injection mold (for resin based raw material) using 3D printing, what raw material should I choose – PLA, ABS, HIPS etc.</p>
<p>P20 mold steel is one standard. Hardened parts are required for long life, depending on the service and material (some materials are quite abrasive). </p> <p>You can get a small number of relatively poor quality shots out of epoxy if it is properly supported by a metal box. Your best bet if you want to include 3D p...
<p>P20 mold steel is one standard. Hardened parts are required for long life, depending on the service and material (some materials are quite abrasive). </p> <p>You can get a small number of relatively poor quality shots out of epoxy if it is properly supported by a metal box. Your best bet if you want to include 3D p...
896
<p>I'm building an application that is targeting Windows, Mac and Linux soon. I was wondering where should I keep application data such as settings, etc.</p> <p>Application's installation folder is the easiest choice, but I think that might be a problem with new Vista security model. Besides, users might want differen...
<p>Each platform has its own API for finding the user's home folder, or documents folder, or preferences folder. </p> <ul> <li>Windows: SHGetFolderPath() or SHGetKnownFolderPath()</li> <li>Mac OS X and iPhone OS: NSSearchPathForDirectoriesInDomains()</li> <li>Unix: $HOME environment variable</li> </ul> <p>Don't hard...
<p>Never, ever store user data in the application folder. It's just a bad idea.</p> <p>Most operating systems have a $HOME (or %HOME%) environment variable. That would be the first place to look. </p> <p>If you want to cleanly support multiple operating systems, though, you're going to have to have some OS-specifi...
8,122
<p>On Windows I can do:</p> <pre><code>HANDLE hCurrentProcess = GetCurrentProcess(); SetPriorityClass(hCurrentProcess, ABOVE_NORMAL_PRIORITY_CLASS); </code></pre> <p>How can I do the same thing on *nix?</p>
<p>Try:</p> <pre><code>#include &lt;sys/time.h&gt; #include &lt;sys/resource.h&gt; int main(){ setpriority(PRIO_PROCESS, 0, -20); } </code></pre> <p>Note that you must be running as superuser for this to work.</p> <p>(for more info, type 'man setpriority' at a prompt.)</p>
<p>@ allain <blockquote>Can you lower your own process' priority without being superuser?</blockquote></p> <p>Sure. Be aware, however, that this is a one way street. You can't even get back to where you started. And even fairly small reductions in priority can have startlingly large effects on running time when there ...
4,926
<p>Is there a way to search the latest version of every file in TFS for a specific string or regex? This is probably the only thing I miss from Visual Source Safe... </p> <p>Currently I perform a Get Latest on the entire codebase and use Windows Search, but this gets quite painful with over 1GB of code in 75,000 file...
<p>Team Foundation Server 2015 (on-premises) and Visual Studio Team Services (cloud version) include built-in support for searching across all your code and work items.</p> <p>You can do simple string searches like <code>foo</code>, boolean operations like <code>foo OR bar</code> or more complex language-specific thin...
<p>This add-in claims to have the functionality that I believe you seek:</p> <p><a href="http://www.attrice.info/cm/tfs/index.htm" rel="nofollow noreferrer">Team Foundation Sidekicks</a></p>
6,232
<p>What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, <code>['a', 'b', 'c']</code> to <code>'a,b,c'</code>? (The cases <code>['s']</code> and <code>[]</code> should be mapped to <code>'s'</code> a...
<pre><code>my_list = ['a', 'b', 'c', 'd'] my_string = ','.join(my_list) </code></pre> <pre><code>'a,b,c,d' </code></pre> <p>This won't work if the list contains integers</p> <hr> <p>And if the list contains non-string types (such as integers, floats, bools, None) then do:</p> <pre><code>my_string = ','.join(map(st...
<p>My two cents. I like simpler an one-line code in python:</p> <pre><code>&gt;&gt;&gt; from itertools import imap, ifilter &gt;&gt;&gt; l = ['a', '', 'b', 1, None] &gt;&gt;&gt; ','.join(imap(str, ifilter(lambda x: x, l))) a,b,1 &gt;&gt;&gt; m = ['a', '', None] &gt;&gt;&gt; ','.join(imap(str, ifilter(lambda x: x, m)))...
6,653
<p>I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work:</p> <pre><code>$ umount -f /mnt/data $ umount2: Device or resource busy $ umount: /mnt/data: device is busy </code></pre> <p>If I type "<code>mount</code>", it appears that the directory i...
<p>You might try a lazy unmount:</p> <pre><code>umount -l </code></pre>
<p>Your NFS server disappeared.</p> <p>Ideally your best bet is if the NFS server comes back.</p> <p>If not, the "umount -f" should have done the trick. It doesn't ALWAYS work, but it often will.</p> <p>If you happen to know what processes are USING the NFS filesystem, you could try killing those processes and then ...
6,153
<p>Whilst refactoring some legacy C++ code I found that I could potentially remove some code duplication by somehow defining a variable that could point to any class method that shared the same signature. After a little digging, I found that I could do something like the following:</p> <pre><code>class MyClass { prot...
<p>What you have there is a pointer-to-member-function. It will solve your problem. I am surprised that your "TestSwitch" function compiles, as the calling syntax is slightly different to what you might expect. It should be:</p> <pre><code>bool res = (this-&gt;*CaseMethod)( 999, "hello world" ); </code></pre> <p>Howe...
<p>There's nothing intrinsically wrong with the localised example you've given here, but class method pointers can often be tricky to keep 'safe' if you use them in a wider context, such as outside the class they're a pointer of, or in conjunction with a complex inheritance tree. The way compilers typically manage meth...
7,998
<p>I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me based on a MySQL database? Preferably it would allow me to edit the diagram afterward since none of the foreign keys ...
<p>Try MySQL Workbench, formerly DBDesigner 4:</p> <p><a href="http://dev.mysql.com/workbench/" rel="noreferrer">http://dev.mysql.com/workbench/</a></p> <p>This has a "Reverse Engineer Database" mode:</p> <p>Database -> Reverse Engineer</p> <p><a href="https://i.stack.imgur.com/wcoq9.png" rel="noreferrer"><img src=...
<p>The "Reverse Engineer Database" mode in Workbench is only part of the paid version, not the free one.</p>
2,460
<p>How can I redirect the response to an IFrame?</p>
<p>Do you mean from the server-side? - You can't!</p> <p><strong>You'll have to do it on the client side.</strong></p> <p>Say, use a javascript that sends an <em>AJAX request</em> and then embed your response information in the <em>AJAX response</em>. And have the javascript read the response and changes the page in ...
<p>. . . not totally sure what your trying to do, but you normally control the source of an iframe through javascript</p>
9,847
<p>I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with:</p> <ul> <li>code completion</li> <li>compilation</li>...
<p>I recently learned that <a href="http://www.jetbrains.com/" rel="noreferrer">Jetbrains</a> the make of my favorite IDE (Idea) may support Objective-C (though it is unclear how much it will work for iPhone/iPad development). See the thread <a href="http://www.jetbrains.net/devnet/thread/282271?tstart=0" rel="noreferr...
<p>I believe KDevelop is the only full IDE that supports Obj-C, but I'm not even sure how fully it supports it, having never used it myself. Worth a shot, maybe.</p>
9,319
<p>Is it possible to determine the MAC address of the originator of a remote connection under Windows NT 4? The remote PC opens a socket connection into my application and I can get the IP address. However I need to determine the MAC address from the information available from the socket such as the IP address of the r...
<p>Try GetIpNetTable. This function is documented as supported as of NT 4.0 SP4.</p>
<p>Hope the machine isn't <em>too</em> remote. MAC addresses will only be known for the local network (subnet).</p>
8,836
<p>Given the constraint of only using T-Sql in Sql Server 2005, is there a better way to remove the decimal point from a money datatype than a conversion to a varchar (here implicitly) and then a replace of the decimal point?</p> <p>Here is what I have currently.</p> <pre><code>SELECT REPLACE(1.23, '.', ''), REPLACE(...
<p>Multiply by 100 and then convert to an int.</p>
<p>Could you be a little more specific about the use case? Removing the decimal point from the representation is a little unusual given that you'll lose all information about the scale. Are you assuming that there will always be two digits? If so, you could simplify multiply by 100 and then round before converting t...
2,594
<p>I want a data structure that will allow querying <em>how many items in last <strong>X</strong> minutes</em>. An item may just be a simple identifier or a more complex data structure, preferably the timestamp of the item will be in the item, rather than stored outside (as a hash or similar, wouldn't want to have prob...
<p>A simple linked list can be used for this.</p> <p>Basically you add new items to the end, and remove too old items from the start, it is a cheap data structure.</p> <p>example-code:</p> <pre><code>list.push_end(new_data) while list.head.age &gt;= age_limit: list.pop_head() </code></pre> <p>If the list will b...
<p>I think that an important consideration will be the frequency of querying vs. adding/removing. If you will do frequent querying (especially if you'll have a large collection) a B-tree may be the way to go:</p> <p><a href="http://en.wikipedia.org/wiki/B-tree" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/B...
3,609
<p>I bought a new printer, and unfortunately the left nut for the lead screw isn't tapped.</p> <p>Does anyone know the thread size, w.r.t. both pitch and lead, of the lead screws?</p>
<p>I have the Anet A8, I confirm the threads are Tr8x8(p2). This is explained as "Tr" for trapezoidal thread followed by the nominal diameter in mm. The digits after the "x" denotes the lead of the screw (how much does the nut advance per revolution). The value between the brackets "p2" denotes the pitch. This means th...
<p>The pitch no matter the screw is the distance between the threads. The lead can be different based on a one or two start threads.</p>
848
<p>I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an <code>ArrayList</code> of business objects bound to a Windows Forms <code>DataGrid</code>. I'd like the user to be able to edit the cells, and when finished, press a Save button. ...
<pre class="lang-cs prettyprint-override"><code>foreach(var row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- foreach(DataGridRow row in DataGrid1.Rows) { DoStuff(row); } //Or --------------------------------------------- for(int i = 0; i&lt; DataGrid1.Rows.Count - 1; i+...
<p>Aha, I was really just testing everyone once again! :) The real answer is, you rarely need to iterate the datagrid. Because even when binding to an ArrayList, the binding is 2 way. Still, it is handy to know how to itereate the grid directly, it can save a few lines of code now and then. </p> <p>But NotMyself ...
2,817
<p>Is there any way to have something that looks just like a file on a Windows file share, but is really a resource served up over HTTP?</p> <p>For context, I'm working with an old app that can only deal with files on a Windows file share, I want to create a simple HTTP-based service to serve the content of the files d...
<p>WebDAV (basically) takes an existing directory, and shares it over HTTP - which sounds like the opposite of what you want. </p> <p>You need something that speaks SMB/CIFS on one end, and your own code on the other. The easiest way to do that is with a userspace file system.</p> <p>To that end, here's a couple of l...
<p>This won't answer your question in any meaningful way, but maybe it will get you pointed in the right direction. Look into serving the "file(s)" via WebDAV--SharePoint uses this and its files can be accessed exactly as you want, as a file share where the transport mechanism is HTTP. Unfortunately I can't give any ...
4,405
<p>I have a flag enum below.</p> <pre><code>[Flags] public enum FlagTest { None = 0x0, Flag1 = 0x1, Flag2 = 0x2, Flag3 = 0x4 } </code></pre> <p>I cannot make the if statement evaluate to true.</p> <pre><code>FlagTest testItem = FlagTest.Flag1 | FlagTest.Flag2; if (testItem == FlagTest.Flag1) { /...
<p>In .NET 4 there is a new method <a href="http://msdn.microsoft.com/en-us/library/system.enum.hasflag%28VS.100%29.aspx" rel="noreferrer">Enum.HasFlag</a>. This allows you to write:</p> <pre><code>if ( testItem.HasFlag( FlagTest.Flag1 ) ) { // Do Stuff } </code></pre> <p>which is much more readable, IMO.</p> <p...
<p>even without [Flags], you could use something like this</p> <pre><code>if((testItem &amp; (FlagTest.Flag1 | FlagTest.Flag2 ))!=0){ //.. } </code></pre> <p>or if you have a Zero value enum</p> <pre><code>if((testItem &amp; (FlagTest.Flag1 | FlagTest.Flag2 ))!=FlagTest.None){ //.. } </code></pre>
6,143
<p>Within Ruby on Rails applications database.yml is a plain text file that stores database credentials.</p> <p>When I deploy my Rails applications I have an after deploy callback in my Capistrano recipe that creates a symbolic link within the application's /config directory to the database.yml file. The file itself ...
<p>You'll also want to make sure that your SSH system is well secured to prevent people from logging in <em>as</em> your Capistrano bot. I'd suggest restricting access to password-protected key pairs.</p> <p>Encrypting the .yml file on the server is useless since you have to give the bot the key, which would be store...
<p>If you're very concerned about security of the yml file, I have to ask: Is it stored in your version control? If so, that's another point where an attacker can get at it. If you're doing checkout/checkin over non-SSL, someone could intercept it.</p> <p>Also, with some version control (svn, for exampl), even if yo...
3,889
<p>I need to rotate an image at 12 midnight every day from a group of 5-10 images. How can I go about doing this with JavaScript or jQuery or even PHP?</p>
<p>At a basic level what you want to do is define an array of image names then take the number of days from a given point in time then modulo (remainder after division) by the number of images and access that index in the array and set the image, e.g. (untested code)</p> <pre><code>var images = new Array("image1.gif",...
<p>If you are running a linux system you can set a <a href="http://www.sitepoint.com/article/introducing-cron/" rel="nofollow noreferrer">Cron Job</a> or you can use the windows task scheduler if you are on windows</p>
9,193
<p>Anyone know how to do this without using a third party program? If there no way to do it with a add-on someone can recommend one?</p> <p>EDIT: I need to add this in the server so all users have the same signature.</p> <p>Thanks</p>
<p>You need to create your own exchange message sink to do this. Here's a classic VB example from MS KB:</p> <p><a href="http://support.microsoft.com/kb/317327" rel="nofollow noreferrer">http://support.microsoft.com/kb/317327</a></p> <p>and a VB Script one:</p> <p><a href="http://support.microsoft.com/kb/317680" rel...
<p>We used <a href="http://codetwo.com/" rel="nofollow noreferrer">CodeTwo-s</a> Exchange rules for a while on Exchange 2003.</p> <p>However there is a known problem with it: if the messages stay in the queue for 2-3 minutes, the Exchange itself sends out the message without the footer. Most of the times it's not a pr...
3,241
<p>I have not been able to print smooth and round shapes using Cura 3.3.1 (or earlier) without bumps. I think they are seams? The filament is PLA.</p> <p>Combing is enabled, which I thought makes it so that the nozzle travels over already printed areas, instead of flying over the air...<em>right</em>?</p> <p>I have b...
<p>Following on from Toon's answer, here is a run down of <a href="https://www.youtube.com/channel/UCb8Rde3uRL1ohROUVg46h1A" rel="nofollow noreferrer">Thomas Sanladerer</a>'s excellent video: <a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow noreferrer">3D printing guides: Calibration and why you mig...
<p>Have you correctly calibrated your steps per mm a.k.a. esteps? Tom made a great video about it:</p> <p><a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow noreferrer">3D printing guides: Calibration and why you might be doing it wrong</a></p>
902
<p>Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are.</p> <p>Downsides to ClickOnce:</p> <ul> <li>Consists of multiple files - Seems easier to distribute one file than manageing a bunch of file and the dow...
<p>Have you seen WiX yet?</p> <p><a href="http://wix.sourceforge.net/" rel="noreferrer">http://wix.sourceforge.net/</a></p> <p>It builds windows installers using an XML file and has additional libraries to use if you want to fancify your installers and the like. I'll admit the learning curve for me was medium-high in...
<p>Creating an installer project, with a dependency on your EXE (which in turn depends on whatever it needs) is a fairly straightforward process - but you'll need at least VS Standard Edition for that.</p> <p>Inside the installer project, you can create custom tasks and dialog steps that allow you to do anything you c...
2,564
<p>I am working to integrate unit testing into the development process on the team I work on and there are some sceptics. What are some good ways to convince the sceptical developers on the team of the value of Unit Testing? In my specific case we would be adding Unit Tests as we add functionality or fixed bugs. Unfort...
<p>Every day in our office there is an exchange which goes something like this:</p> <blockquote> <p>"Man, I just love unit tests, I've just been able to make a bunch of changes to the way something works, and then was able to confirm I hadn't broken anything by running the test over it again..."</p> </blockquote> <...
<p>Unit testing works for QA guys or your managers, not for you; so it's definitely not worth it.</p> <p>You should focus on writing correct code (whatever it means), not test cases. Let other guys worry about those.</p>
9,286
<p>Does anyone ever found/used an ASP.NET application similar to Joomla?<br /> I need to set up a quick and dirty CMS on a Windows Server and our client doesn't want us to use something else than ASP.NET.<br /></p>
<p>I've been told by a friend that <a href="http://www.umbraco.org/" rel="nofollow noreferrer">Umbraco</a> is everything you would ever want in a CMS (and it was in the list that Nathan included in his answer). This recommendation is coming from a guy who's built several CMS solutions over the years and after taking a ...
<p>Did you Look at DotNetNuke (<a href="http://www.dotnetnuke.com/" rel="nofollow noreferrer">http://www.dotnetnuke.com/</a>) Its seems to be a good Systems to Start off as a base , But I doubt I could call it a Full CMS ? (Upto the users to decide)</p>
2,703
<p>I would like to call Perl script files from my c++ program.</p> <p>I am not sure that the people I will distribute to will have Perl installed.</p> <p>Basically I'm looking for a .lib file that I can use that has an Apache like distribution license.</p>
<p>You can embed perl into your app. </p> <ul> <li><a href="http://www.linuxjournal.com/article/2901" rel="noreferrer">Perl Embedding</a> by John Quillan</li> <li><a href="http://xaxxon.slackworks.com/ep/" rel="noreferrer">C++ wrapper around Perl C API</a></li> </ul>
<p>To call perl from C++ you need to use the API, as someone else mentioned; the basic tutorial is available in the <a href="http://perldoc.perl.org/perlxstut.html" rel="nofollow noreferrer">perlxstut</a> documentation.</p> <p>Note that you will most probably need more than just a ".lib", because you'll need a lot of ...
7,163
<p>I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to shut down the machine using software ...
<p>Try this:</p> <p><code>shutdown /r /t 1 /f</code></p> <p>Alex</p>
<p>Try DShutdown.exe. It's flexible and can do all these things.</p>
9,983
<p>In Prusa i3 clones the Z axis is often problematic. Mechanically unsynchronized dual Z axises which are driven by the same stepper driver easily misalign. Using only one Z motor makes the whole gantry sag on one side. And Z lead screws that aren't perfectly straight lead to z wobble.</p> <p>The other day I had a sim...
<p>This concept already exists, it is e.g. found in some high quality 3D printers. Instead of a winch, a belt system (of several belts) is used.</p> <p>An interesting point from <a href="https://3dprinting.stackexchange.com/a/16289/8884">this answer</a> already mentions that a winch isn't a good mechanism to lower/rais...
<p>Unless your gantry is extremely heavy, I don't think this will work. The Z motion system needs to not only lift, but to hold the nozzle rigidly at the desired distance from the bed/previous layer. Otherwise I would expect poor layer bonding and possibly even collisions between the nozzle and already-printed material...
1,939
<p>I'm writing (in C# with .NET 3.5) an administrative application which will poll multiple Windows systems for various bits of data. In many cases it will use WMI, but in some cases it may need to read remote registry or remotely execute some command or script on the polled system. This polling will happen at repeatin...
<p>The answer is here:</p> <p><a href="https://stackoverflow.com/questions/40853/how-to-store-passwords-in-winforms-application#40867">How to store passwords in Winforms application?</a></p>
<p>Well it seems that your program needs to impersonate a user other than the context under which it is already running. Although, it does look like a pretty automated process, but if it's not, can you simply not ask the administrator to put in username and password at the time this 'black-sheep' computer is being poll...
6,949
<p>Can someone describe what a symbol table is within the context of C and C++?</p>
<p>There are two common and related meaning of symbol tables here.</p> <p>First, there's the symbol table in your object files. Usually, a C or C++ compiler compiles a single source file into an object file with a .obj or .o extension. This contains a collection of executable code and data that the linker can proces...
<p>Symbol table is an important data structure created and maintained by compilers in order to store information about the occurrence of various entities such as variable names, function names, objects, classes, interfaces, etc.</p>
9,458
<p>I use .NET XML technologies quite extensively on my work. One of the things the I like very much is the XSLT engine, more precisely the extensibility of it. However there one little piece which keeps being a source of annoyance. Nothing major or something we can't live with but it is preventing us from producing the...
<p>Use this code:</p> <pre class="lang-cs prettyprint-override"><code>using (var writer = XmlWriter.Create("file.xml")) { const string Ns = "http://bladibla"; const string Prefix = "abx"; writer.WriteStartDocument(); writer.WriteStartElement("root"); // set root namespace writer.WriteAttri...
<p>I'm not sure this is what you're looking for, but you can use this kind of code when you start writing to the Xml stream:</p> <pre><code>myWriter.WriteAttributeString("xmlns", "abx", null, "http://bladibla"); </code></pre> <p>The XmlWriter should remember it and not rewrite it anymore. It may not be 100% bulletpro...
4,631
<p>I haven't programmed games for about 10 years (My last experience was DJGPP + Allegro), but I thought I'd check out XNA over the weekend to see how it was shaping up.</p> <p>I am fairly impressed, however as I continue to piece together a game engine, I have a (probably) basic question.</p> <p>How much should you ...
<p>If you were to think of an event as a subscriber list, in your code all you are doing is registering a subscriber. The number of instructions needed to achieve that is likely to be minimal at the CLR level.</p> <p>If you want your code to be generic or dynamic, then you're need to check if something is subscribed ...
<p>XNA encourages the use of interfaces, events and delegates to drive something written with it. Take a look at the GameComponent related classes which set this up for you.</p> <p>The answer is, "As much as you feel comfortable with".</p> <p>To elaborate a little bit, If for example you take and inherit from the gam...
8,942