instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>What would you suggest would be the best operating system for a web server?</p> <p>If possible, please enumerate the advantages and disadvantages if there are any...</p>
<p>Use an operating system you have an administrator account for.</p> <p>A mainstream flavour of Linux is a great choice for stability, but if no one knows how to look after it it's a bad idea. The same goes for any other platform you can name.</p>
<p>It really depends on the function of the webserver. What services should it provide? Should there be a homepage, and what language should that be in, etc.</p>
16,028
<p>I am developing a C# program, and i have one function that consumes too much CPU. I would like to know a way to control this by code (not with any external application) and restrict the percentage of CPU usage. For example, if it uses 90% of the CPU usage, to make my app consume only a 20%, even if it becomes slowe...
<p>I don't know if you can do that, but you can change the thread priority of the executing thread via the <a href="http://msdn.microsoft.com/en-us/library/system.threading.thread.priority.aspx" rel="noreferrer">Priority</a> property. You would set that by:</p> <pre><code>Thread.CurrentThread.Priority = ThreadPriorit...
<p>You can slow down a loop by calling Thread.Sleep(milliseconds) within the loop. That hands the CPU back to the scheduler. </p> <p>But 'consuming too much CPU' makes me think you might have more fundamental problems. Is this thread polling and waiting for something else? If so, you should consider the use of Eve...
31,272
<p>I have a file I need to rename to that of an existing file. This is a copy, modify, replace original operation on an existing JAR file. I've got the first two steps done, I just need help with the replace original bit. What's the best way to rename the new version of the JAR to that of the old. The old JAR doesn't n...
<p>You're going to need to create two <code>java.io.File</code> objects: one for the new file, one for the old file.</p> <p>Lets call these <code>oldFile</code> and <code>newFile</code>.</p> <pre><code>oldFile.delete() newFile.renameTo(oldFile); </code></pre> <p>Edit: mmyers beat me to it.</p>
<p>Is there a problem with <a href="http://java.sun.com/javase/6/docs/api/java/io/File.html#delete()" rel="nofollow noreferrer">deleting</a> the old one and <a href="http://java.sun.com/javase/6/docs/api/java/io/File.html#renameTo(java.io.File)" rel="nofollow noreferrer">renaming</a> the new one?</p>
33,870
<p>I'm convinced from <a href="http://www.masukomi.org/talks/unit_testing_talk_2/index.xul?data=slide_data.txt#page2" rel="nofollow noreferrer">this presentation</a> and other commentary here on the site that I need to learn to Unit Test. I also realize that there have been many questions about what unit testing is he...
<p>The idea of unit testing is to test small sections of code with each test. In an event based system, one form of unit testing you could do, would be to test how your event handlers respond to various events. So your unit test might set an aspect of your program into a specific state, then call the event listener met...
<p>An approach I've found helpful for procedural code is to use TextTest. It's not so much about unit testing, but it helps you do automated regression testing. The idea is that you have your application write a log then use texttest to compare the log before and after your changes. </p>
9,874
<p>We have the standard Subversion trunk/branches/tags layout. We have several branches for medium- and long-term projects, but none so far for a release. This is approaching fast.</p> <p>Should we:</p> <ol> <li>Mix release branches and project branches together?</li> <li>Create a releases folder? If so, is there a b...
<p>I recommend the following layout, for two reasons: - all stuff related to a given project is within the same part of the tree; makes it easier for people to grasp - permissions handling may be easier this way</p> <p>And by the way: It's a good idea with few repositories, instead of many, because change history...
<p>Releases is the same as tags... Have you got multiple projects inside your trunk? In that case, I would copy the same folders inside tags</p> <p>So</p> <pre><code>trunk fooapp stuff... barapp stuff... tags fooapp 1.0.0 1.0.1 barapp 1.0.0 </code></pr...
7,188
<p>I've been considering experimenting with game development and XNA. I'm already an expert C/C++ programmer. I read through some C# books, but haven't done any development in C# yet.</p> <p>What's a good resource for learning XNA, from the point of view of someone who's already an expert programmer?</p>
<p>I'll second reimers and the creators.xna.com samples as a good way to get a handle on how to quickly whip things up.</p> <p>On the other side of the spectrum, I highly recommend <a href="http://nick.gravelyn.com/tile-engine-series/" rel="nofollow noreferrer">Nick Gravelyn's Tile Engine tutorials</a>. It's a differe...
<p>I would say that a library called XNA Debug Terminal should be of some help to you. It is open source and can be setup in seconds. It allows you to see the value of any variable, invoke any method, watch values changing in real-time, and more by simply typing c# code into a terminal-like display that appears atop yo...
13,146
<p>Is there anyway to get Eclipse to automatically look for static imports? For example, now that I've finally upgraded to Junit 4, I'd like to be able to write:</p> <pre><code>assertEquals(expectedValue, actualValue); </code></pre> <p>hit <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>O</kbd> and have Eclipse add:</p> <...
<p>I'm using Eclipse Europa, which also has the Favorite preference section: </p> <blockquote> <p>Window > Preferences > Java > Editor > Content Assist > Favorites</p> </blockquote> <p>In mine, I have the following entries (when adding, use "New Type" and omit the <code>.*</code>): </p> <pre><code>org.hamcrest.Ma...
<p>In Eclipse 4.9, you can static import existing invocations using a quick fix.</p> <blockquote> <p>A new quick fix has been implemented that allows the user to convert static field accesses and static methods to use a static import. It's also possible to replace all occurrences at the same time.</p> </blockquote> ...
36,776
<p>I have an executable that is started by a windows service, this program will be run on a customers machine and will need to connect to a remote share to perform a particular task. This share is specified by the customer via a UI, so we do not know this in advance meaning it can't be "hard-coded", or the share mapped...
<p>If you can change your windows service so that it runs under the Network Service account, then your executable will be able to access network shares (this is one reason why the Network Service account was created).</p> <p>The Local System and Local Service accounts do not have any network credentials, and thus can'...
<p>Why can't you use another account? There is a network service account built into Windows, specifically for services that need network access.</p> <p>Anyway, be very careful when having a service start an exe.</p> <p>If the write access to the folder with the exe is not disabled, a user can replace that exe with (f...
31,090
<p>I recently got a Dremel 3D20, and I understand it only takes PLA filament according to the Dremel site. However, I was wondering if anyone has successfully used TPU filament or knows it will work fine. I’m more than happy to use other software to change the temperature, I just don’t want to gunk up or otherwise ru...
<p>TPU wants in general two things of your printer:</p> <ul> <li>A Printing Temperature of (over many makers) 195-230 °C</li> <li>A Direct Drive (extruder on the printhead)</li> </ul> <blockquote> <p>Bowden extruders are not ideal for printing flexible filaments such as NinjaFlex due to the excessive distance bet...
<p>I've never used a Dremel printer, thus I cannot guarantee that my solution will work fine, but you might want to give a try to the <a href="https://ultimaker.com/en/products/ultimaker-cura-software" rel="nofollow noreferrer">Ultimaker Cura</a> slicer. </p> <p>Ultimaker printers have Bowden tubes, like the Dremel, u...
1,156
<p>I'm adding some functionality to my site so that users can upload their own profile pictures, so I was wondering about whether to store them in the database as a BLOB, or put them in the file system.</p> <p>I found a question similar to this here: <a href="https://stackoverflow.com/questions/3748/storing-images-in-...
<p>To answer parts of your question:</p> <blockquote> <p>How do clients go with caching images from the DB vs from the filesystem?</p> </blockquote> <p>For a database: Have a last_modified field in your database. Use the Last-Modified HTTP header so the client's browser can cache properly. Be sure to send the app...
<p>What would be more convenient, from the perspective of serving them, writing the code to serve them, backup procedures, etc.? You want the right answer for you, not the right answer for someone else.</p>
42,097
<p>Using C# in Visual Studio 2008 and stepping through a function in the debugger I get to the end of a function and am on the final curly brace } and about to return. Is there a way to find out what value the function is about to return?</p> <p>This is necessary if the return value is calculated such as:</p> <pre><c...
<p>It's a little low level, but if you switch to disassembly then you can single step through the instructions and see what the return value is being set to. It is typically set in the @eax register.</p> <p>You can place a breakpoint on the ret instructions and inspect the register at that point if you don't want to ...
<p>I'd actually recommend refactoring the code to put the individual function returns in local variables. That way, yourself and others don't have to jump through hoops when debugging the code to figure out a particular evaluation. Generally, this produces code that is easier to debug and, consequently, easier for othe...
19,943
<p>I noticed that doxygen uses the graphviz library for creating diagrams. Have you ever used graphviz for generating documentation? Is it worth learning the graphviz for documentation purposes outside the scope of doxygen? Or am I better off to sticking with a standard data modeling package like Visio?</p> <p>I under...
<p>The graphviz is very very simple language/format for creating graphs. If the capabilities are enough for you I would recommend it (Its so easy, that I would estimate the time to learn with at most 1 hour).</p>
<p>FYI Microsoft Visio addin to layout diagrams with Graphviz: <a href="http://www.calvert.ch/graphvizio/" rel="nofollow">http://www.calvert.ch/graphvizio/</a></p>
39,005
<p>Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than another, etc?</p> <p>I would especially appreciate information about those concepts and their relation to the PHP-unive...
<p>I built one of the first SOAP servers, including code generation and WSDL generation, from the original spec as it was being developed, when I was working at Hewlett-Packard. I do NOT recommend using SOAP for anything.</p> <p>The acronym "SOAP" is a lie. It is not Simple, it is not Object-oriented, it defines no Ac...
<p>An old question but still relevant today....due to so many developers in the enterprise space still using it.</p> <p>My work involves designing and developing IoT (Internet of Things) solutions. Which includes developing code for small embedded devices that communicate with the Cloud. </p> <p>It is clear REST is n...
10,223
<p>Taking <a href="https://stackoverflow.com/questions/262182/why-arent-voting-machines-open-source">shs's question</a> a step further... Why isn't all government sponsored software open source? <strong>I can see excluding some for security purposes, but the rest?</strong> Didn't we as tax payers already pay for it? ...
<p>My wishful thinking is that if the software is created by government employees or custom software created for the government by a contractor, it should be automatically in the public domain (as all government published documents are). If the government bought the software from a company, even if it included some cu...
<p>Trust - Plain and simple. A government cannot open itself to anyone modifying it's code.</p> <p>For example: A coder could knowingly introduce a buffer overflow into the linux kernal. They know it's location, the payload required and bang instant compromise. This also offers deniability, as it appears as "just a...
32,816
<p>I'm building a JSF+Facelets web app, one piece of which is a method that scans a directory every so often and indexes any changes. This method is part of a bean which is in application scope. I have built a subclass of TimerTask to call the method every X milliseconds. My problem is getting the bean initialized. ...
<p>If your code calls <a href="http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/context/FacesContext.html" rel="noreferrer">FacesContext</a>, it will not work outside a thread associated with a JSF request lifecycle. A FacesContext object is created for every request and disposed at the end of the...
<p>Using listeners or load-on-startup, try this: <a href="http://www.thoughtsabout.net/blog/archives/000033.html" rel="nofollow noreferrer">http://www.thoughtsabout.net/blog/archives/000033.html</a></p>
40,667
<p>Based on a few posts I've read concerning version control, it seems people think pessimistic locking in a version control system is a bad thing. Why? I understand that it prevents one developer from submitting a change while another has the file checked out, but so what? If your code files are so big that you con...
<ol> <li>Go play with Source Safe and have a developer leave for a two week vacation. Add to that the VSS admins not being around. Now you have a fix to be posted but you can't because of the developer</li> <li>If you have multiple features and/or bug fixes being worked on. No matter how small your code is broken up, y...
<p>Software developers are always optimists -- just look at their estimating skils!</p> <p>In practice we find conflicts are rare and the benefits of not having to worry about locking outweigh the occasional conflict resolution step.</p>
16,980
<p>I'm impressed with the simplicity of Microsoft's Virtual Earth Street Address search service.</p> <p>My requirement is to type rough address info with no comma separators into a simple text box, press a find button, wait a few seconds and then observe a result picklist.</p> <p>I mocked up something <a href="http:/...
<p>In addition to the baud rate, you may also need to set other options like: character_size, flow_control, parity and stop_bits. To write your data to the serial port you can do the following:</p> <pre><code>boost::asio::write(port, boost::asio::buffer(commands, 4)); </code></pre> <p>The libraries acceptance of buff...
<p>If you are wondering why his example gives a compile error, change CSIZE to C_SIZE on both lines. This is probably the only good example program on the web.<br> <a href="https://stackoverflow.com/questions/12641149/serial-port-configuration-using-boost-asio">Thanks</a>. </p>
33,586
<p>In C++, is (int) ch equivalent to int(ch). </p> <p>If not, what's the difference?</p>
<p>They are the same thing, and also the same as <code>(int)(ch)</code>. In C++, it's generally preferred to use a named cast to clarify your intentions:</p> <ul> <li>Use <code>static_cast</code> to cast between primitive types of different sizes or signednesses, e.g. <code>static_cast&lt;char&gt;(anInteger)</code>.<...
<p>If you want to be super-nasty, then if you write something like:</p> <pre><code>#define int(x) 1 </code></pre> <p>Then (int)x has the meaning you expect, while int(x) will be 1 for any value of x. However, if anyone ever did this, you should probably hurt them. I can also quite believe that somewhere in the standa...
32,914
<p>I am unlucky to be in charge of maintaining some old Yahoo! Store built using their RTML-based platform.</p> <p>Recently I've noticed that HTML code generated by some RTML functions is sprinkled all over with "padding images" (or whatever is the conventional name for those 1x1 pixel images used to enforce layout). ...
<p>The only way I see is to have your own website front-end that will filter whatever you want from the RTML site....</p> <p>for example, your rtml site is at <a href="http://rtmlusglysite.yahoo.com/store/XYZ01134" rel="nofollow noreferrer">http://rtmlusglysite.yahoo.com/store/XYZ01134</a> , you could host a simple PH...
<p>I have shared a link official RTML guide from yahoo. Hope it will help. Thanks!</p> <p><a href="https://stackoverflow.com/questions/5464944/list-of-available-rtml-books-and-resources">List of available RTML books and resources</a></p>
32,007
<p>Is there a simple method of parsing XML files in C#? If so, what?</p>
<p>I'd use <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml" rel="noreferrer">LINQ to XML</a> if you're in .NET 3.5 or higher.</p>
<p>You can use <a href="https://github.com/wojtpl2/ExtendedXmlSerializer" rel="nofollow noreferrer">ExtendedXmlSerializer</a> to serialize and deserialize.</p> <p><strong>Instalation</strong> You can install ExtendedXmlSerializer from <a href="https://www.nuget.org/packages/ExtendedXmlSerializer/" rel="nofollow norefe...
7,964
<p>I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr_accessor data persist and be available to the rake task? W...
<p>I assume you are asking whether data that is stored in attributes of ActiveRecord objects stemming from Web requests will be available when accessing them via a Rake task?</p> <p>No. They won't. That data won't even be available to the next web request. That data won't even be there if you load the same record t...
<p>Of course it'll be lost, where do you think data goes when it dies? To a data h(e)aven from where it can always return?</p> <p>I'd like to know what you need the data for, but the ultimate answer is probably that the data belongs into the db, unless it's large binary data such as images, where you should save it in...
20,205
<p>There is a way to know the flash player version installed on the computer that runs our SWF file with Action Script 3.0?</p>
<p>If you are programming from within the IDE the following will get you the version</p> <pre> trace(Capabilities.version); </pre> <p>If you are building a custom class the following should help. Make sure that this following code goes into a file named VersionCheck.as</p> <blockquote> <pre> package { import fla...
<p>It's in <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Capabilities.html#version" rel="nofollow noreferrer">flash.system.Capabilities.version</a></p>
14,771
<p>Some code that rounds up the division to demonstrate (C-syntax):</p> <pre><code>#define SINT64 long long int #define SINT32 long int SINT64 divRound(SINT64 dividend, SINT64 divisor) { SINT32 quotient1 = dividend / divisor; SINT32 modResult = dividend % divisor; SINT32 multResult = modResult * 2; SINT32 qu...
<p>This functionality is introduced in <a href="http://lxr.linux.no/linux+v2.6.22/lib/div64.c" rel="noreferrer">/linux/lib/div64.c</a> as early as kernel v2.6.22.</p>
<p><code>ldiv</code> ?</p> <p>Edit: reread title, so you might want to ignore this. Or not, depending on if it has an appropriate non-library version.</p>
5,593
<p>I'm trying to create a database scripter tool for a local database I'm using.</p> <p>I've been able to generate create scripts for the tables, primary keys, indexes, and foreign keys, but I can't find any way to generate create scripts for the table defaults.</p> <p>For indexes, it's as easy as </p> <pre><code>fo...
<p>Try using <a href="https://learn.microsoft.com/en-US/dotnet/api/microsoft.sqlserver.management.smo.scripter?view=sql-smo-160" rel="nofollow noreferrer">Scripter</a> object with DriAll option set:</p> <pre><code>Server server = new Server(@&quot;.\SQLEXPRESS&quot;); Database db = server.Databases[&quot;AdventureWorks...
<p><strong>Addition to the Pavel's answer.</strong></p> <p>I needed to get the script for a invidual table only. 1. I wanted to pass the table schema name and table name as parameter and generate script. 2. assign the script to a variable rather than writing to file.</p> <p>code for a individual table:</p> <pre><cod...
34,567
<p>I'm using (GNU) Make in my project. I'm currently putting one makefile per directory and specify the subdirectories using SUBDIRS. It's been suggested to me that this is not the ideal way of using make, that using a one toplevel make file (or several, split up using include). I've tried migrating/using this layout i...
<p>The first thing you should keep in mind (just to eliminate any misunderstanding) is that we're not talking about a single vs. multiple makefiles. Splitting your makefile in one per subdirectory is probably a good idea in any case.</p> <p>Recursive makefiles are bad primarily because you partition your dependency tr...
<p>The issue with recursive make is the time overhead of evaluating all the different make files vs. evaluating one large make file. Part of this is just spawning processes but also (IIRC) you tend to be forced into assuming that other makes files did something and rebuilding when you don't really need to.</p> <p>My t...
41,352
<p>I have a base class with an optional virtual function</p> <pre><code>class Base { virtual void OnlyImplementThisSometimes(int x) {} }; </code></pre> <p>When I compile this I get a warning about the unused param x. Is there some other way I should have implemented the virtual function? I have re-written it li...
<p>Ignoring the design issues you can get around the compiler warning about an unused variable by omitting the variable name, for example:</p> <pre><code>virtual void OnlyImplementThisSometimes(int ) { } </code></pre> <p>Mistakenly implementing the wrong method signature when trying to override the virtual function i...
<p>The simplest answer to this is shown below:</p> <pre><code>class Base { virtual void OnlyImplementThisSometimes(int x) { x;} }; </code></pre> <p>A simple reference to the variable which does absolutely nothing will remove all warnings (from VC++ at highest level anyway).</p>
32,542
<p>I'm running <a href="http://www.git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> on a file, but the change is at the end of a long line.</p> <p>If I use cursor keys to move right, it loses colour-coding&mdash;and worse the lines don't line up&mdash;making it harder to track the change.</p> <p>Is there a wa...
<p>The display of the output of <code>git diff</code> is handled by whatever pager you are using.</p> <p>Commonly, under Linux, <code>less</code> would be used.</p> <p>You can tell git to use a different pager by setting the <code>GIT_PAGER</code> environment variable. If you don't mind about paging (for example, you...
<p>When in trouble, I often resort to DiffMerge. Excellent diff tool that has in-line diff highlighting. Also, in the latest versions they added a mode to have an horizontal mode.</p> <p>I haven't been able to configure git to use it, though. So I do have to muck around to get both versions of the file first. </p>
16,484
<p>What I want to do is to remove all accents and umlauts from a string, turning "lärm" into "larm" or "andré" into "andre". What I tried to do was to utf8_decode the string and then use strtr on it, but since my source file is saved as UTF-8 file, I can't enter the ISO-8859-15 characters for all umlauts - the editor i...
<pre><code>iconv("utf-8","ascii//TRANSLIT",$input); </code></pre> <p>Extended <a href="http://php.net/manual/en/function.iconv.php#83238" rel="noreferrer">example</a></p>
<p>For Arabic and Persian users i recommend this way to remove diacritics:</p> <pre><code> $diacritics = array('َ','ِ','ً','ٌ','ٍ','ّ','ْ','ـ'); $search_txt = str_replace($diacritics, '', $diacritics); </code></pre> <p>For typing diacritics in Arabic keyboards u can use this Asci(those codes are Asci not Unico...
19,131
<p>I have a unmanaged DLL (the scilexer.dll of Scintilla code editor, used by Scintilla.Net from <a href="http://www.codeplex.com/ScintillaNET" rel="noreferrer">CodePlex</a>) that is loaded from a managed application trough the Scintilla.Net component. The windows managed application runs without problem on both 32 and...
<p>P/Invoke uses LoadLibrary to load DLLs, and if there is already a library loaded with a given name, LoadLibrary will return it. So if you can give both versions of the DLL the same name, but put them in different directories, you can do something like this just once before your first call to a function from scilexe...
<p>Unmanaged dlls can be installed into the GAC side-by-side with their managed counterparts. <a href="http://social.msdn.microsoft.com/Forums/en-US/clr/thread/d87e7dd8-c687-40ae-8f34-b862de9072c7/" rel="nofollow noreferrer">This article</a> should explain how it works.</p>
49,387
<p>I want to trim trailing whitespace at the end of all XHTML paragraphs. I am using Ruby with the REXML library.</p> <p>Say I have the following in a valid XHTML file:</p> <pre><code>&lt;p&gt;hello &lt;span&gt;world&lt;/span&gt; a &lt;/p&gt; &lt;p&gt;Hi there &lt;/p&gt; &lt;p&gt;The End &lt;/p&gt; </code></pre> <p>...
<p>Your example worked for me</p> <pre>//p/child::text()[last()]</pre>
<p>Just in case you didn't know, XSL has a <code>normalize-space()</code> function which will get rid of leading and trailing spaces.</p>
32,184
<p>I've been trying to understand <a href="http://msdn.microsoft.com/en-gb/library/system.diagnostics.process.mainwindowhandle.aspx" rel="nofollow noreferrer">Process.MainWindowHandle</a>.</p> <p>According to MSDN; "The main window is the window that is created when the process is started. After initialization, other ...
<p>@edg,</p> <p>I guess it's an error in MSDN. You can clearly see in Relfector, that "Main window" check in .NET looks like:</p> <pre><code>private bool IsMainWindow(IntPtr handle) { return (!(NativeMethods.GetWindow(new HandleRef(this, handle), 4) != IntPtr.Zero) &amp;&amp; NativeMethods.IsWindow...
<p>Actually Process.MainWindowHandle is a handle of top-most window, it's not really the "Main Window Handle"</p>
7,069
<p>I am having a frequent problems with my web hosting (its shared)</p> <p>I am not able to delete or change permission for a particular directory. The response is,</p> <pre><code>Cannot delete. Directory may not be empty </code></pre> <p>I checked the permissions and it looks OK. There are 100's of files in this fo...
<p>You can't <strong>rmdir</strong> a directory with files in it. You must first <strong>rm</strong> all files and subdirectories. Many times, the easiest solution is:</p> <pre><code>$ rm -rf old_directory </code></pre> <p>It's entirely possible that some of the files or subdirectories have permission limitations t...
<p>This could also be because your FTP client might not be showing the hidden files (like cache, or any hiddn files that your application might create), while the hidden files are preventing you from deleting the directory. (though, in your case, I am not sure if this is the cause .. .it could be permission issue with ...
9,914
<p>I have this Perl software that is supposed to run 24/7. It keeps open a connection to an IMAP server, checks for new mail and then classifies new messages.</p> <p>Now I have a user that is hibernating his XP laptop every once in a while. When this happens, the connection to the server fails and an exception is trig...
<p>I think that you're dealing with an OS-level exception, not something thrown from Perl. The relevant Perl module is making a call to something in a DLL (I presume), and the exception is getting thrown. Your best bet would be to boil this down to a simple, replicable test case that triggers the exception (you might...
<p>Your user is not the exception but rather the rule. My laptop is hibernated between work and home. At work, it is on on DHCP network; at home, it is on another altogether. Most programs continue to work despite a confusing multiplicity of IP addresses (VMWare, VPN, plain old connection via NAT router). Those tha...
45,960
<p>I have written a simple HTTP Proxy server in C# that I would like to integration/functional test. Is there a product already created that I could use to do this? If not, what is the best way to write my own tests for this (I already have unit tests)?</p>
<p>To test the integration by delivering a webpage you could try one of the following:</p> <ul> <li><a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a></li> <li><a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WaTiN</a></li> <li><a href="http://wtr.rubyforge.org/" rel="nofollo...
<p>Slightly offtopic: Having seen a share of custom HTTP proxies, the usual feature their authors forget (and later discover that they need) is the support for the CONNECT method. Without CONNECT your proxy can't be used for TLS/SSL connections. Also, software that tunnels their non-HTTP traffic via the proxy won't wor...
12,966
<p>This SQL query was generated by Microsoft Access 2003, and works fine when run, but fails when trying to run from a Macro. Is there any obvious error within the query, or any reason it would not work?</p> <pre><code>SELECT tblAuction.article_no, tblAuction.article_name, tblAuction.subtitle, tblAuction.current_bid, ...
<p>You could store your session in a <a href="http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx" rel="nofollow noreferrer">SQL database</a>, thus the application restart would not lose your sessions.</p> <p>Having precompiled non updatable code to deploy would make your xcopy faster alright but app pool wou...
<p>If you're deploying files to the bin folder or the web.config, this will automatically reset the site for very good reasons.</p>
41,911
<p>In my ASP.NET 1.1 application, I am compressing and replacing the hidden Viewstate variable with an alternate compressed value, stored in a hidden field called __VSTATE. This works well but on a few occasions, submitting a page causes the common "potentially dangerous Request.Form value ..." error.</p> <p>I examine...
<p>My first guess is that it looks like a "OnSomething=" javascript event declaration.</p> <p>It's a little weird that only the capital O triggers the error, did you test on the lowercase o as well?</p> <p>Can you try these: "OnClick=", "abc OnClick=", "onclick=", "abc onclick=", "anw=", "bnw=", ...</p> <hr> <p>If ...
<p>You've got the essence of the reason. Here's the best link in a response I got from another site:</p> <p><a href="http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.security/browse_thread/thread/d91d89511401e979" rel="nofollow noreferrer">http://groups.google.com/group/microsoft.public.dotnet.f...
34,820
<p>Is there anyway to decompile java webstart application? </p>
<p>Start the application, then fetch the JAR(s) from the webstart cache. Proceed to decompile like with any other Java application.</p>
<p>Just rename the files with a .jar extension :)</p>
33,623
<p>Is there a standard way to see how much stack space your app has and what the highest watermark for stack usage is during a run?</p> <p>Also in the dreaded case of actual overflow what happens? </p> <p>Does it crash, trigger an exception or signal? Is there a standard or is it different on all systems and compiler...
<p>On <strong>Windows</strong> a stack overflow <strong>exception</strong> will be generated.</p> <p>The following windows code illustrates this:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;windows.h&gt; void StackOverFlow() { CONTEXT context; // we are interested control registers context.ContextFla...
<p>Some compilers support stackavail() function, which returns the amount of remaining free space of the stack. You can use this function before calling functions in your programs that require a lot of stack space, to determine if it is safe to call them</p>
24,358
<p>I basically have a page which shows a "processing" screen which has been flushed to the browser. Later on I need to redirect this page, currently we use meta refresh and this normally works fine. </p> <p>With a new payment system, which includes 3D secure, we potentially end up within an iframe being directed bac...
<p>So I added the following to my redirected pages. Luckily they have nothing posted at them so can be simply redirected. Also the use of javascript is ok as it is required to get to that point in the site.</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; if (top.frames.length&gt;0) ...
<p>I'm doing something similar to keep an old site inside it's frameset:</p> <pre><code>&lt;SCRIPT TYPE="text/JavaScript"&gt; if (window == top){top.location.replace("/foo.html");} &lt;/SCRIPT&gt; </code></pre> <p>So to break out of the iframe, just change == to !=</p> <p>I see that you're using setTimeout in yo...
34,179
<p>I am using a BAUDrate of 115200 since I cannot make a connection to my printer with the advised 250000 rate. Are there any downsides or limits I reach earlier given by the lower BAUDrate?</p>
<p><a href="https://learn.sparkfun.com/tutorials/serial-communication/rules-of-serial" rel="nofollow noreferrer">Baud rate</a> is the rate at which information is transferred in a communication channel, given as a number of bits per second (bps). So a baud rate of 250000 is capable of transferring a <em>maximum</em> of...
<p>If your printer doesn't have an SD card then the whole communication between computer and arduino is performed "live". There is kinda buffer of data which arduino can swallow. Then it needs to process it (and then can send some reports to your app) and then arduino is ready to get new "set" of instructions to work o...
342
<p>For my web application running on LAMP, I need to be able to deploy database migrations and code changes on multiple servers and be able to test deployment afterwards, all of this automatically done by scripts.</p> <p>Currently I'm torn between using directly my build tool (<a href="http://phing.info/trac/" rel="no...
<p>For PHP projects, Phing is the way to go. Deployment is definitely one of its intended usage, considering that in PHP there isn't any "real" build process - as scripts are not compiled.</p> <p>From the official site: </p> <blockquote> <p>If you find yourself writing custom scripts to handle the packaging, de...
<p>What have I used? </p> <ul> <li>svn post-commit hook</li> <li>shell script to rsync</li> <li>perl cgi script to svn switch across systems</li> </ul> <p>It doesn't seem like any of these would be acceptable for you though, given your statement "I also feel that shell scripts are hard to maintain and not very reada...
41,617
<p>Static metaprogramming (aka "template metaprogramming") is a great C++ technique that allows the execution of programs at compile-time. A light bulb went off in my head as soon as I read this canonical metaprogramming example:</p> <pre><code>#include &lt;iostream&gt; using namespace std; template&lt; int n &gt; s...
<p><em>[Answering my own question]</em></p> <p>The best introductions I've found so far are chapter 10, "Static Metaprogramming in C++" from <em>Generative Programming, Methods, Tools, and Applications</em> by Krzysztof Czarnecki and Ulrich W. Eisenecker, ISBN-13: 9780201309775; and chapter 17, "Metaprograms" of <em>C...
<p>google Alexandrescu, Modern C++ Design: Generic Programming and Design Patterns Applied</p>
13,744
<p>By default sqlplus truncates column names to the length of the underlying data type. Many of the column names in our database are prefixed by the table name, and therefore look identical when truncated.</p> <p>I need to specify select * queries to remote DBAs in a locked down production environment, and drag back s...
<p>One thing you can try is to dynamically generate "column x format a20" commands. Something like the following:</p> <pre><code>set termout off set feedback off spool t1.sql select 'column ' || column_name || ' format a' || data_length from all_tab_cols where table_name='YOUR_TABLE' / spool off @t1.sql set pagesize...
<p>I had the same problem trying to implement this feature in <a href="http://code.google.com/p/vorax/" rel="nofollow">VoraX</a>. In the next version I have in mind the following solution:</p> <pre><code>set feedback off set serveroutput on declare l_c number; l_col_cnt number; l_rec_tab DBMS_SQL.DESC_TAB2; l...
45,791
<p>What is a good free PHP script to use as a poll for a website? I'd need a simple script to show on the web page with the standard multiple option vote + bar chart graph. Also an admin interface with add / edit / delete poll would be required.</p>
<p>I have used <a href="http://www.proxy2.de/scripts.php" rel="nofollow noreferrer">Advanced Poll</a> a fair bit, and found it to be pretty good, and do pretty much exactly what you described.</p> <p>Ben</p>
<p><a href="http://prestopoll.sourceforge.net/" rel="nofollow noreferrer">Presto Poll</a> is somewhat popular. It supports both databases and flat files for data storage and has a simple but thorough admin section.</p>
38,219
<p>I am looking for all addresses related to:</p> <ul> <li>3.x eclipse itself (milestones and/or integration builds)</li> <li>3.x other components (GEF, GMF, EMF, ...)</li> </ul> <p>In the spirit of <a href="https://stackoverflow.com/questions/18557/how-does-stackoverflow-work-the-unofficial-faq#119658">answering my ...
<p><strong>Update September 2009</strong>: see also <strong><a href="https://stackoverflow.com/questions/138004/do-you-know-update-site-addresses-for-latest-eclipse-3-5-components/1464210#1464210">addresses for eclipse 3.6 Helios</a></strong></p> <hr> <p>For eclipse itself, the <a href="http://wiki.eclipse.org/Eclips...
<p>How about this one for Eclipse 3.5? <a href="http://download.eclipse.org/releases/galileo" rel="nofollow noreferrer">http://download.eclipse.org/releases/galileo</a></p>
16,691
<p>I'm trying to find a way to generate an enums class dynamically from lookup tables in a database and still have the convenience of a normal class (i.e. intellisense). </p> <p>I've spent the past few hours trying to figure out how to get a custom BuildProvider to work inside an ASP.NET Web Application. The code wo...
<p>what is the point of an enum class for a dynamic lookup table? your code references will always be static anyway...</p> <p>if the initial population of the lookup table is static, make an enum for that and don't reference any other values in the code</p>
<p>If MSDN is saying you can't do it, I'd take another approach. Maybe write a small Console application that writes your Enums.cs file and run it through the "Pre-build event command line". Then, every time you build the web application, the Enums class gets recreated and should be accessible through Intellisense. </p...
35,283
<p>I've just started one of my courses, as classes just began 2 weeks ago, and we are learning Scheme right now in one for I assume some reason later on, but so far from what he is teaching is basically how to write in scheme. As I sit here trying to stay awake I'm just trying to grasp why I would want to know this, a...
<p>It's a functional programming language and will do well broaden your experience.</p> <p>Even if you don't use it in the real world doesn't mean it doesn't have any value. It will help you master things like recursion and help to force you to think of problems in different ways than you normally would.</p> <p>I <e...
<p>My problem was when learning this we learned clisp right along with it. I couldn't keep the two strait to save my life.</p> <p>What I did learn from them though was how to write better c and java code. This is simply because of the different programming style I learned. I have adapted more of the functional style i...
12,397
<p>Consider these two function definitions:</p> <pre><code>void foo() { } void foo(void) { } </code></pre> <p>Is there any difference between these two? If not, why is the <code>void</code> argument there? Aesthetic reasons?</p>
<p>In <strong>C</strong>: </p> <ul> <li><code>void foo()</code> means "a function <code>foo</code> taking an unspecified number of arguments of unspecified type" </li> <li><code>void foo(void)</code> means "a function <code>foo</code> taking no arguments"</li> </ul> <p>In <strong>C++</strong>: </p> <ul> <li><code...
<p>In C, you use a void in an empty function reference so that the compiler has a prototype, and that prototype has "no arguments". In C++, you don't have to tell the compiler that you have a prototype because you can't leave out the prototype.</p>
7,391
<p>My app crashes when I do the following in the applicationDidFinishLaunching event in the app delegate:</p> <pre><code>_textures[mytex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"a.png"]]; </code></pre> <p>However when I replace <code>@"a.png"</code> with</p> <pre><code>@"/Users/MyUserName/Desktop/M...
<p><code>+[UIImage imageNamed:]</code> will look in your app bundle's resources to find the image. If you add an image to Xcode it will be default be added to the resource copy phase of your project. If you want to make sure it is being copied into your app bundle look at the list on the left side of your Xcode editor,...
<p>You need to make sure a.png is imported as a resource into xCode. If you have done that then referencing it as just "a.png" should work.</p>
31,790
<p>I need to pad the output of an integer to a given length.</p> <p>For example, with a length of 4 digits, the output of the integer 4 is "0004" instead of "4". How can I do this in C# 2.0?</p>
<p>Use the string.Format command.</p> <pre><code>output = String.Format("{0:0000}", intVariable); </code></pre> <p>More details: <a href="http://msdn.microsoft.com/en-us/library/fht0f5be.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/fht0f5be.aspx</a></p>
<p><strong>In modern .NET 5.0+</strong> (2021 update)</p> <pre><code>int myint = 100; string zeroPadded = $&quot;{myint:d8}&quot;; // &quot;00000100&quot; string leftPadded = $&quot;{myint,8}&quot;; // &quot; 100&quot; string rightPadded = $&quot;{myint,-8}&quot;; // &quot;100 &quot; </code></pre...
23,882
<p>I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've typed. When I try this the page reloads (the action is #) but any new...
<p>I guess I put the answer here. What I found was that doing this: setTimeout('frm.submit();', 2000); caused the page to reload but didn't submit the form. When I did this: frm.submit(); The form was submitted and the data was passed. I don't know why the first way didn't work, but I don't need to know that...
<p>Might the server be voiding out the input values. Say if your page on the server looks like this:</p> <pre><code>&lt;form action="/page.cgi"&gt; ... &lt;input name="Fieldx" value=""/&gt; &lt;/form&gt; </code></pre> <p>I think it'll void out the field. Or this the server action might be setting it indirectly. I...
16,925
<p>I have a web page that has a web form for signing up. I want to remove fields. I've tried removing the field code from the .asp file but obviously there are other things that I need to remove along those lines. I have full access to all the code but I need help knowing where things are linked as far as making the fo...
<p>If they're just .ASP files, you should be fine removing the field tag, along with any references to it.</p> <p>I.e. you'd delete this line:</p> <pre><code>&lt;asp:TextBox id="text1" runat="server" /&gt; </code></pre> <p>and do a search for the 'id' attribute in the rest of the file (a find on 'text1' in this case...
<p>If everything to do with that for in in the same ASP page, it's easy. You can do a simple text search for the names and/or IDs of each form field. Sometimes they're referenced in a javascript block, so you'll have to comment-out some of the form validation code referencing those fields.</p> <p>If they've used some...
31,631
<p>Folks, </p> <p>I'm working on a little piece of rich client software that I'd like to distribute for free. That is, I'd still like to make money on it, but I'd like the revenue to come from advertising.</p> <p>Do you know of an advertising platform that works well for client apps? I'd like the ads to be completely...
<p>It's true that using Google Adsense would be against TOS, but you could roll your own ad-engine. For instance, you could create an Amazon affiliate account, and show books that match keywords in your little advertising space. (anyone who clicked on the book and bought would earn you money per sale) Anything affiliat...
<p>Opera tried this. They don't do it any more. I suspect that it wasn't very effective. That said, if you make this work, then great.</p>
17,397
<p>I'm trying to have the same KDE Konsole experience within Mac OS X.</p> <p>Here's my (overly complicated?) setup:</p> <ul> <li>I have Control and Command swapped at the System Preferences level. (Can't live without this)</li> <li>Parallels lets you, at the Parallels application level, also reverse Control and Com...
<p>The solution you're looking for is <strong><a href="http://pqrs.org/macosx/keyremap4macbook/index.html">KeyRemap4MacBook</a></strong>. There is a Tiger, Leopard, Snow Leopard, and Lion version.</p> <p>Once installed, goto <strong>System Preferences</strong> -> <strong>KeyRemap4MacBook</strong></p> <p>Then select ...
<p>You can customize the command keys used for an individual application in System Preferences > Keyboard &amp; Mouse > Keyboard Shortcuts. I think (if I understand correctly what you're trying to do) that this might allow you to accomplish your goal. You could remap all of Terminal's command keys to use control inst...
10,117
<p>I have been scouring the web for a code sample that shows how to use pbuffer with GLUT but I could not find anything... </p> <p>I am puzzled with the context switching between pbuffer and the rendering window. I guess that I will have to use glutSetWindow to switch between the two rendering surface but I am not too...
<p>The short answer is that there's no <em>good</em> way of doing it.</p> <p>The longer answer is that pbuffers are not cross-platform, so you necessarily have to use platform-specific APIs to access them. How you switch between rendering surfaces depends on your platform; on Windows you'd use wglMakeCurrent() and the...
<p>Mike F's answer lead me to a good <a href="http://ati.amd.com/developer/ATIpbuffer.pdf" rel="nofollow noreferrer">explanation from ATI about the pbuffers</a>. Thanks!</p> <p>I did not find any mention of GLUT functions to switch context, only wgl* functions. I must have misunderstood the purpose of glutSetWindow.</...
23,472
<p>In Firefox a Reload seems to reload everything while on IE the Refresh reloads just the HTML part of the current page. In IE you need to press Ctrl-F5 for a complete reload. </p> <p>Why this difference and is it somewhere an article explaining this difference more thoroughly?</p>
<p>Firefox employs a cache like all modern browsers, so it doesn't load everything on refresh. Different browser engines handle caching somewhat differently, but it mostly depends on the headers you are sending.</p> <p>You should check the w3 page on <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html" rel...
<p>Ctrl-F5 is reload without cache, in IE.<br/>F5 should reload images too, as long as the browser detects that they're changed.</p>
45,212
<p>When go to export a model using Fusion 360 or Meshmixer, I see that there are two options. Could the final model be affected by the format chosen at the time of saving?</p> <p><a href="https://i.stack.imgur.com/xIEXt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xIEXt.png" alt="enter image description h...
<p>The two formats contain the same information about the model, but the binary format is <strong>much more compact</strong>, so it will produce smaller files from the same part but they should work the same. That's to say, if you take the exact same model, save it as a binary STL and as an ASCII STL, the binary STL fi...
<p>The other answers on this thread seem kind of hand-wavy, so I'll give my input.</p> <p>At its simplest, all we're dealing with here is two different formats of encoding the same data. The 3D file is identical, just described by the file data in different terms.</p> <p>That being said, there is a multitude of differe...
1,453
<p>I get a mysql error:</p> <p><strong>#update (ActiveRecord::StatementInvalid) "Mysql::Error: #HY000Got error 139 from storage engine:</strong></p> <p>When trying to update a text field on a record with a string of length 1429 characters, any ideas on how to track down the problem?</p> <p>Below is the stacktrace. <...
<p>Maybe it's this bug: <a href="http://bugs.mysql.com/bug.php?id=10035" rel="nofollow noreferrer">#1030 - Got error 139 from storage engine</a>, but it would help if you'd post the query which should come directly after the error message.</p>
<p>It seemed to be a very weird mysql error, where the text was being truncated to 256 characters (for a text type) and throwing the above error is the string was 1000 characters or more. modifying the table column to be text again fixed the issue, or it just fixed it self.. i'm still not sure.</p> <p>Update: Changing...
19,747
<p>I’m looking for some links to further info on how EE handles Member Groups in relation to the MSM.</p> <p>In my case, I have two membership sites. Generally speaking, the two sites serve the same overall group of people, so the fact that the MSM shares the member database works in my favor. What I’m unclear about i...
<hr> <h2>I know this is ages old, but an answer was never given/accepted. Maybe this will help someone else who stumbles on this who uses straight EE.</h2> <hr> <p>Ian,</p> <p>I am doing a similar thing with 6 sites and multiple markets throughout those sites now.</p> <p>Here is what I am doing. I hope it helps. <...
<p>Your membership database would span across both sites, so there would not be an instance of a user being a member of site A and not site B - by registering on either site, their account is created for all other partner sites.</p> <p>Membership groups can have per site preferences - so a group could have higher priv...
48,362
<p>As the printer ages, the constant motion of the print head wears out the conductors inside the cable. Creating all sorts of fun debugging scenarios.</p> <p>Is there such a thing as a bundled cable, with all the necessary wires, for the stepper motor (in the case of direct drives), hot end, thermistor, etc... and whe...
<p>People have used parallel port cables (DB25) for a while. They are cheap enough and have enough pins for most uses.</p> <p><a href="https://i.stack.imgur.com/6LaNG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6LaNG.jpg" alt="enter image description here" /></a></p> <p>Obviously you will need to...
<p>Have you thought of using a ribbon cable? I have/ have had similar issues with a large print area CoreXY. I'm not sure if the ribbon cable can handle the motor current or heater current but pairing up wires may help. One other issue you may have is electrical interference if you have bed leveling that uses a servo...
2,112
<p>I would like to be able to display some dynamic text at the mouse cursor location in a win32 app, for instance to give an X,Y coordinate that would move with the cursor as though attached. I can do this during a mousemove event using a TextOut() call for the window at the mouse coordinates and invalidate a recta...
<p>You can do this via ToolTips - check out <a href="http://msdn.microsoft.com/en-us/library/6b4cb3a5(VS.80).aspx" rel="nofollow noreferrer">CToolTipCtrl</a>.</p> <p>If you want flicker free tracking ToolTips then you will need to derive your own classes from CToolTipCtrl that use the <a href="http://msdn.microsoft.co...
<p>You can overwrite OnSetCursor to get a dynamic mouse cursor. I just found a German tutorial.</p> <p><a href="https://web.archive.org/web/20050320074845/http://www.cpp-tutor.de/mfc/mfc/kap7/tut/tut4.htm" rel="nofollow noreferrer">German tutorial</a></p> <p><a href="http://translate.google.com/translate?hl=de&amp;sl...
8,890
<p>I've found what seems to be the C# equivalent of a <a href="http://thedailywtf.com/Articles/The_FOR-CASE_paradigm.aspx" rel="nofollow noreferrer">FOR-CASE</a> structure in a project I'm working on:</p> <pre><code>foreach (string param in params.Split(';')) { string[] parts = param.Split('='); string key = p...
<p>I don't think the code in your question is anything like the code you linked to....</p> <p>The code in the question looks like something I might do if I wrote a command line tool. </p> <p>Am I stupid for not seeing whats wrong with the code in the question?</p> <p>An alternative is to use reflection to fill param...
<p>Or Regex:</p> <pre><code>string parms = "param1=1;param2=2;param3=3"; string[] parmArr = parms.Split(';'); string parm1 = Regex.Replace(parmArr[0], "param1=", ""); string parm2 = Regex.Replace(parmArr[1], "param2=", ""); string parm3 = Regex.Replace(parmArr[2], "param3=", ""); </code></pre>
43,504
<p>I have seen the following methods of putting JavaScript code in an <code>&lt;a&gt;</code> tag:</p> <pre><code>function DoSomething() { ... return false; } </code></pre> <ol> <li><code>&lt;a href="javascript:;" onClick="return DoSomething();"&gt;link&lt;/a&gt;</code></li> <li><code>&lt;a href="javascript:DoSomethin...
<p>I quite enjoy <a href="http://web.archive.org/web/20190822202858/http://www.javascripttoolbox.com/bestpractices/" rel="nofollow noreferrer">Matt Kruse's Javascript Best Practices article</a>. In it, he states that using the <code>href</code> section to execute JavaScript code is a bad idea. Even though you have st...
<p>Method #2 has a syntax error in FF3 and IE7. I prefer methods #1 and #3, because #4 dirty the URI with '#' although causes less typing... Obviously, as noted by other responses, the best solution is separate html from event handling.</p>
30,506
<p>I met with a strange problem about sqlite3. I obtained different connections of the same database file using open() method. connection 1 begins a transaction, and connection 2 begins another transaction, which is to update several records of a table. Then connection 1 commit the transaction, followed by connection 2...
<p>If you read the SQLite documentation, you will see that it supports multiple connections for reading only, you cannot write to the database from mulitple connections, because it's not designed for that.</p> <p><a href="http://www.sqlite.org/faq.html#q5" rel="noreferrer">http://www.sqlite.org/faq.html#q5</a></p>
<p>Unless you use BEGIN IMMEDIATE to initiate your transactions, you run the risk of having to rollback and retry them. A BEGIN does not do any locking; subsequent UPDATE or INSERT gets the lock, and you need to check the result code to see if they fail. See this page on <a href="http://www.sqlite.org/lang_transaction....
49,299
<p>In past few months, there are a devastatingly few number of users that cast up votes, and many of users aren't coming back to site, and existing users don't have so much reputation, because no one is voting up great questions / answers.</p> <p>So... let me start like this..</p> <p><a href="https://3dprinting.stack...
<p>I completely agree! I just posted <a href="https://3dprinting.meta.stackexchange.com/questions/197/3d-printing-se-beta-status">my own reminder</a>, focusing more on efforts to get us out of Beta.</p> <p>I'm sorry you can feel discouraged sometimes, I think a lot of users around the Stack Exchange network can feel t...
<p>Hmm yeah we might have a minor problem. I know most of my rep is disportionately from question acceptance and unusually low for +1s. I wonder if it has to do with any active member being able to be on the top 50 list their first month, thus people maybe hoarding their upvotes trying to be number one? </p>
36
<p>I have a dictionary of 200,000 items (the keys are strings and the values are integers).</p> <p>What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)?</p> <pre><code> a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a[0]) b.sort...
<p>You can't sort dictionaries. You have to sort the list of items.</p> <p>Previous versions were wrong. When you have a numeric value, it's easy to sort in reverse order. These will do that. But this isn't general. This only works because the value is numeric.</p> <pre><code>a = { 'key':1, 'another':2, 'key2':...
<p>You can use something like this:</p> <pre><code>dic = {'aaa':1, 'aab':3, 'aaf':3, 'aac':2, 'aad':2, 'aae':4} def sort_compare(a, b): c = cmp(dic[b], dic[a]) if c != 0: return c return cmp(a, b) for k in sorted(dic.keys(), cmp=sort_compare): print k, dic[k] </code></pre> <p>Don't know how ...
19,043
<p>I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown) on the textblock, I want to display the popup. I would think that I could do this with an EventTrigger on the Popup, but I can't use setters in an EventTrigger, I can only start storyboards. I want to do this strictly in XAML, because t...
<p>I did something simple, but it works.</p> <p>I used a typical ToggleButton, which I restyled as a textblock by changing its control template. Then I just bound the IsChecked property on the ToggleButton to the IsOpen property on the popup. Popup has some properties like StaysOpen that let you modify the closing b...
<p>another way to do it:</p> <pre><code>&lt;Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"&gt; &lt;StackPanel&gt; ...
47,136
<p>Is keeping JMS connections / sessions / consumer always open a bad practice?</p> <p>Code draft example:</p> <pre><code>// app startup code ConnectionFactory cf = (ConnectionFactory)jndiContext.lookup(CF_JNDI_NAME); Connection connection = cf.createConnection(user,pass); Session session = connection.createSession(...
<p>That is a very common and acceptable practice when dealing with long lived connections. For many JMS servers it is in fact preferable to creating a new connection each time it is needed. </p>
<p>In our app, we will have connections/sessions/consumers/producers open for months at a time. We've had to work with our vendor (BEA) to make that work reliably. But any troubles with that is a bug the vendor needs to fix.</p>
34,528
<p>I am developing a State Machine Workflow using C# and WF in visual studio 2008. On one of my states I need to wait for multiple events to happen until the workflow can transition to the next state. As an example think of a unanimous voting scenario. I cannot find a way to do this. Does anyone have a solution or ...
<p>PHP's cookie functions automatically prefix the $domain with a dot. If you don't want this behavior you could use the <a href="http://us2.php.net/header" rel="noreferrer">header</a> function. For example:</p> <pre><code>header("Set-Cookie: cookiename=cookievalue; expires=Tue, 06-Jan-2009 23:39:49 GMT; path=/; dom...
<p>I was having a problem to set cookies on wordpress and this helped me, the domain value was the key to get it working in all the pages</p> <pre><code>$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; setcookie("cookie_name", 'cookie_value', 0, '/', $domain); </code></pre>
45,322
<p>if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil.</p> <pre><code>if not assigned (Form1) then begin Application.CreateForm(Tform1, Form1); try // Do something finally Form1.Release end; end; </code></pre> <p>To be a...
<p>Put the line </p> <pre><code> Form1 := nil; </code></pre> <p>just after the call to Release.</p> <p>Release is just posting a CM_RELEASE message to the Form which allows the Form to finish what's in its queue (event handlers) before handling the CM_RELEASE message which means normally just calling Free.<br> ...
<p>In Delphi Win32, the appropriate way to free objects is to call </p> <pre><code>FreeAndNil(Form1) </code></pre> <p>This does both jobs in a single call.</p> <p>However, I have a sneaking feeling there's more to your question than meets the eye. Are you using Delphi for .NET - and if so, which version?</p>
34,584
<p>I have this html...</p> <pre><code>&lt;select id="View" name="View"&gt; &lt;option value="1"&gt;With issue covers&lt;/option&gt; &lt;option value="0"&gt;No issue covers&lt;/option&gt; &lt;/select&gt; </code></pre> <p>It won't let me insert code like this...</p> <pre><code>&lt;select id="View" name="View"&g...
<p>The "best" approach is probably to <em>use</em> the helpers:</p> <pre><code>var selectList = new SelectList(data, "ValueProp", "TextProp", data[1].ValueProp); ... Html.DropDownList("foo", selectList) </code></pre> <p>Where "data" could be an array of anonymous types, such as:</p> <pre><code>var data = new[] { n...
<p>See this blog post, it worked for me</p> <p><a href="http://weblogs.asp.net/ashicmahtab/archive/2009/03/27/asp-net-mvc-html-dropdownlist-and-selected-value.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/ashicmahtab/archive/2009/03/27/asp-net-mvc-html-dropdownlist-and-selected-value.aspx</a></p>
41,806
<p>I'm administering a svn repo for a project where the source wasn't imported with a single top level directory. As a result, there are about 15 separate 'projects' instead of one. How can I merge these into one folder while maintaining the change history?</p> <p>*hint: svn move doesn't work in this case.</p> <p>[ed...
<p>If you don't care about retaining all the history of one of the repositories, you can just create a new directory under one project's repository, then import the other.</p> <p>If you care about retaining the history of both, then you can use 'svnadmin dump' to dump one repository, and 'svnadmin load' to load it int...
<p>You could create a new top-level project that uses svn:externals to point to all the other projects and places them in appropriate subdirectories. </p> <ul> <li>devs will only need to check out your new top-level project (svn will automatically follow the svn:externals and pull in the others)</li> <li>the full vers...
43,147
<p>I keep running across this loading image</p> <p><a href="http://georgia.ubuntuforums.com/images/misc/lightbox_progress.gif" rel="nofollow noreferrer">http://georgia.ubuntuforums.com/images/misc/lightbox_progress.gif</a></p> <p>which seems to have entered into existence in the last 18 months. All of a sudden it is...
<p>You can get many different AJAX loading animations in any colour you want here: <a href="http://www.ajaxload.info/" rel="noreferrer">ajaxload.info</a></p>
<p>I think it's just a general extension to the normal clock-face style loading icon. The Firefox <a href="http://en.wikipedia.org/wiki/Throbber" rel="nofollow noreferrer">throbber</a> is the first example of that style that I remember coming across; the only real difference between that and the current trend of strai...
7,679
<p>I have an iframe. The content is wider than the width I am setting so the iframe gets a horizontal scroll bar. I can't increase the width of the iframe so I want to just remove the scroll bar. I tried setting the scroll property to "no" but that kills both scroll bars and I want the vertical one. I tried setting...
<pre><code>scrolling="yes" horizontalscrolling="no" verticalscrolling="yes" </code></pre> <p>Put that in your iFrame tag.</p> <p>You don't need to mess around with trying to format this in CSS.</p>
<pre><code>&lt;iframe style="overflow:hidden;" src="about:blank"/&gt; </code></pre> <p>should work in IE. IE6 had issues supporting overflow-x and overflow-y.</p> <p>One other thing to note is that IE's border on the iframe can only be removed if you set the "frameborder" attribute in camelCase.</p> <pre><code>&lt;...
9,290
<p>I'm having a really hard time printing on my aluminum heated bed... Cleaning it just results in it being scratched (trying to scrape dried hairspray/glue/etc off) and I don't think it is particularly flat either.</p> <p>I was thinking of stopping by the dollar store on my way home and getting several picture frames...
<p>Picture frame glass (generally float glass) will work well enough, but count on it eventually cracking/getting chipped. It's always very flat (due to the way the production process works).</p> <p>Taking it up to 100-110C for printing ABS should not be a problem, but you'll want to avoid sharp changes in temperature...
<p>I was driving down the street the other day and saw a very nice OLD and LARGE mirror on a lawn at a garage sale. It was about 36" x 28". </p> <p>Sale price? $5.00</p> <p>I'm going to be using it for my MPCNC machine to allow me to print large prints on glass. The reason I like the OLD mirrors is that they are ...
360
<p>Hej, </p> <p>assuming I have a code that looks like this:</p> <pre><code>List&lt;User&gt; userList = GetUserByName (u =&gt; u.Name == name); DoSomethingWithTheUsers (userList.ToArray ()); </code></pre> <p>Now I want to know the type of the objects in the Array in the method <em>DoSomethingWithTheUsers (object[] m...
<p>The array type will be an array of User, i.e. User[]. Why not just use Type.GetElementType() on the GetType() of the array? I.e. using your example:</p> <pre><code>myObjects.GetType().GetElementType() </code></pre>
<p>Thats what I would expect but I what I want is: <em>User</em> I need to save the FullName of the type for later, and I wondered if there is a better way, then removing the <em>[]</em> by string replace (or something like that)</p>
40,460
<p>Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ?</p>
<p>I would say that depends on the nature of your problem. Different problem domains could require almost arbitrary error messages, while other trivial tasks just can return NULL or -1 on error. </p> <p><em>The problem with error return codes is that you're polluting/masking the error since it can be ignored (sometime...
<p>try/catch/finally does the job admirably. </p> <p>It allows the programmer to handle specific conditions as well as general failures gracefully.</p> <p>All said and done I'm sure that each is as good as any other.</p>
9,170
<p>We have various reporting services reports which are scheduled to automatically generate reports and email them to a distribution list. This works really well but they appear to come from <code>MSRepSvc@ourdomain.com</code>. </p> <p>This is all well and good but the PHB would like them to look like they are coming ...
<p>Sorry, you can't.</p> <p>Because it use SMTP, you are limited to the protocol. The setting are defined in the <a href="http://msdn.microsoft.com/en-us/library/ms159155(SQL.90).aspx" rel="nofollow noreferrer">.config files</a> and are not configurable at run time or in the app or in a report/subscription.</p> <p>Ou...
<p>Are you using a data-driven subscription, or just a simple subscription type in RS to distribute your report?</p> <p>I believe with a data-driven subscription, you can provide a custom table with information that can be used by the subscription engine to specify properties of the subscription, including the paramet...
45,508
<p>I'm working on a drop in assembly that has predefined pages and usable controls. I am having no difficulties with creating server controls, but I'm wondering what the "best practices" are with dealing with pages in an assembly. Can you compile a page into an assembly and release it as just a dll? How would this b...
<p>Your best bet if you want to be able to code it and treat it like a real page is to implement a <a href="http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx" rel="nofollow noreferrer">VirtualPathProvider</a>. Using a virtualpathprovider would allow you to embed the actual aspx as a r...
<p>You can add an httpHandler element to web.config pointing to your page. Something like:</p> <pre><code>&lt;httpHandlers&gt; &lt;add verb="*" path="login.aspx" type="MyPages.LoginPage, MyPages" /&gt; &lt;/httpHandlers&gt; </code></pre>
12,819
<p>I love PrusaSlicer but I am having a problem. As you can see in the picture the head makes movements that seem useless<a href="https://i.stack.imgur.com/1CLrS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1CLrS.png" alt="Previsualisation" /></a></p> <p>(blue lines that come out of the print in t...
<p>I found the solution : It was the option &quot;avoid crossing perimeters&quot; that seems to do exactly the contrary of what it means. Thank you all for your answers.</p>
<p>Enable Z-Hop. I don't know what the actual parameter is called but it should say something like &quot;Z-Hop&quot;.</p>
1,759
<p>I'm looking for a way to embed an image in a library (Windows-only). I don't want to go the 'traditional' way of putting it in the resources (because of special circumstances that make it not so convenient to mess around with the resource handle.</p> <p>Ideally, there would be something like xpm files: a 'text' rep...
<p>Google for a bin2c utility (something like <a href="http://stud3.tuwien.ac.at/~e0025274/bin2c/bin2c.c" rel="noreferrer">http://stud3.tuwien.ac.at/~e0025274/bin2c/bin2c.c</a>). It takes a file's binary representation and spits out a C source file that includes an array of bytes initialized to that data.</p> <p>Just...
<p>The open source application Hexy is designed specifically for this. It runs on windows and linux. <a href="https://github.com/tristan2468/Hexy" rel="nofollow">https://github.com/tristan2468/Hexy</a></p>
27,869
<p>How can I send an email from C++? Is there a good cross-platform (MS Windows, Linux etc) library that I can use? I'm using GCC (cygwin on MS Windows).</p>
<p>Look at <a href="http://sourceforge.net/projects/vmime/" rel="nofollow noreferrer">VMime</a>.</p> <blockquote> <p>VMime is an all-in-one Internet mail library. This well designed, powerful C++ class library allows you to parse/build/modify MIME messages. With the messaging module, you can connect to POP3/IMAP/SMT...
<p>Look at <a href="http://sourceforge.net/projects/vmime/" rel="nofollow noreferrer">VMime</a>.</p> <blockquote> <p>VMime is an all-in-one Internet mail library. This well designed, powerful C++ class library allows you to parse/build/modify MIME messages. With the messaging module, you can connect to POP3/IMAP/SMT...
16,011
<p>In Delphi 2006, I am showing a modal form. User input in that form can change data that might be displayed currently on the parent form which is the mainform. To reflect those changes I need to force a repaint of some ownerdrawn components on the mainform. I tried to do that like this from the modal form:</p> <pre>...
<p>Maybe worth mentioning that if you are using a skinning library that can affect things too. I found that I had to get the skinning library to refresh, not the form.</p>
<p>Is it possible that you are doing something in the child form to block messages? Does adding:</p> <pre><code>Application.ProcessMessages; </code></pre> <p>to your code make any difference?</p>
36,772
<p>tldr: Can someone show me how to properly format this Python iMAP example so it works?</p> <p>from <a href="https://docs.python.org/2.4/lib/imap4-example.html" rel="nofollow noreferrer">https://docs.python.org/2.4/lib/imap4-example.html</a></p> <blockquote> <pre><code>import getpass, imaplib M = imaplib.IMAP4()...
<pre><code>import imaplib # you want to connect to a server; specify which server server= imaplib.IMAP4_SSL('imap.googlemail.com') # after connecting, tell the server who you are server.login('email@gmail.com', 'password') # this will show you a list of available folders # possibly your Inbox is called INBOX, but chec...
<p>Instead of <code>M.login(getpass.getuser(email@gmail.com), getpass.getpass(password))</code> you need to use <code>M.login('email@gmail.com', 'password')</code>, i.e. plain strings (or better, variables containing them). Your attempt actually shouldn't have worked at all, since <a href="https://docs.python.org/2/lib...
40,710
<p>I need to test a JDBC connection to a database. The java code to do that should be as simple as:</p> <pre><code>DriverManager.getConnection("jdbc connection URL", "username", "password"); </code></pre> <p>The driver manager will lookup the appropriate the driver for the given connection URL. However I need to be a...
<p>From the article <a href="http://www.kfu.com/~nsayer/Java/dyn-jdbc.html" rel="noreferrer">Pick your JDBC driver at runtime</a>; I am just going to post the code here for reference.</p> <p>The idea is to trick the driver manager into thinking that the driver was loaded from the system classloader. To do this we use ...
<p>The problem is <code>DriverManager</code> performs &quot;tasks using the immediate caller's class loader instance&quot;. See Guideline 6-3 of <a href="http://java.sun.com/security/seccodeguide.html" rel="nofollow noreferrer">Secure Coding Guidelines for the Java Programming Language, version 2.0</a>. The system clas...
36,774
<p>I need to know how to return a default row if no rows exist in a table. What would be the best way to do this? I'm only returning a single column from this particular table to get its value. </p> <p>Edit: This would be SQL Server. </p>
<p>One approach for Oracle:</p> <pre><code>SELECT val FROM myTable UNION ALL SELECT 'DEFAULT' FROM dual WHERE NOT EXISTS (SELECT * FROM myTable) </code></pre> <p>Or alternatively in Oracle:</p> <pre><code>SELECT NVL(MIN(val), 'DEFAULT') FROM myTable </code></pre> <p>Or alternatively in SqlServer:</p> <pre><code>SE...
<p>Insert your default values into a table variable, then update this tableVar's single row with a match from your actual table. If a row is found, tableVar will be updated; if not, the default value remains. Return the table variable.</p> <pre><code> ---=== The table &amp; its data CREATE TABLE dbo.Rates ( ...
36,279
<p>We have a Linux server application that is comprised of a number of open-source tools as well as programs we've written ourselves. Ideally we would like to be able to install this application on any common Linux distribution.</p> <p>In the past, we've written perl scripts to automate installs of this application. U...
<p>Instead of the installer approach, I think a better way than having a single script that does it at install time is to have a build system which generates .deb or .rpm files suitable for installation on each system you have to support.</p> <p>A poor man's way of going at that might be to use <a href="http://www.asi...
<p>Autopackage now merged with Listaller project. Documentation's not really thorough yet but seems to be working.</p>
31,674
<p>I have a *.MDB database file, and I am wondering if it is possible or recommended to work against it using LINQ in C#. I am also wondering what some simple examples would look like.</p> <p>I don't know a lot about LINQ, but my requirements for this task are pretty simple (I believe). The user will be passing me a f...
<p>What you want is a LINQ to ODBC provider, or a LINQ to JET/OLEDB provider.</p> <p>Out of the box, MS doesn't make one. There may be a 3rd party who does.</p>
<p>LINQ to SQL only works for SQL Server databases. What you need is the Microsoft Entity Framework. This makes object oriented access to your mdb. From this you can run LINQ queries.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa697427(vs.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-...
37,815
<p>I'm writing my first Perl app -- an AOL Instant Messenger bot that talks to an Arduino microcontroller, which in turn controls a servo that will push the power button on our sysadmin's server, which freezes randomly every 28 hours or so. </p> <p>I've gotten all the hard stuff done, I'm just trying to add one last b...
<p>The Perl built-in is <a href="http://perldoc.perl.org/functions/select.html" rel="noreferrer"><code>select()</code></a>, which is a pass-through to the <code>select()</code> system call, but for sane people I recommend <a href="http://search.cpan.org/dist/IO/lib/IO/Select.pm" rel="noreferrer"><code>IO::Select</code>...
<p>I found that <a href="http://search.cpan.org/dist/IO/lib/IO/Select.pm" rel="nofollow noreferrer">IO::Select</a> works fine as long as STDOUT gets closed, such as when the upstream process in the pipeline exits, or input is from a file. However, if output is ongoing (such as from "tail -f") then any partial data buf...
3,495
<p>I'm using Cura to slice prints from a biodegradable polyester called PCL (<a href="https://en.wikipedia.org/wiki/Polycaprolactone" rel="nofollow noreferrer">Polycaprolactone</a>).</p> <p>I need to print @ ~70 °C but extruder does not run until nozzle reaches 175 °C.</p> <p>Which setting to change so extruder will tu...
<p>70 °C is a specialty filament. It is well below the <code>MIN_TEMP</code> defined in any sane firmware. In Marlin, you <strong>can't</strong> turn on the extruder in any way, while this is online.</p> <p>You do need to define your firmware to allow such a print - either by dropping the value in the firmware or disab...
<p>In Cura Machine Settings, add <code>M302 S70</code>.</p> <p>Apparently, <code>M302 P1</code> and <code>M302 S0</code> do nothing, you need to define a non-zero minimum, and in my case, 70. Thanks to 0scar and Trish for your help.</p>
1,849
<p>Is it possible for me to create and destroy a TXMLDocument by myself in Borland C++ Builder? I've tried but borland keeps telling me that TXMLDocument is (and must be) an IDE managed component. </p> <p>Also, the only reason that I want to do this is that TXMLDocument sort of crashes: I get the TXMLDocument and 'Get...
<p>You need to do something like this instead:</p> <pre><code>_di_IXMLDocument Doc = NewXMLDocument(); </code></pre> <p>I can't remember the gory details of why, but that should point you in the right direction.</p> <p>There's more info on the Codegear website <a href="http://dn.codegear.com/article/29241" rel="nof...
<p>Try this :</p> <pre><code>#include &lt;oxmldom.hpp&gt; #include &lt;XMLDoc.hpp&gt; #include &lt;xmldom.hpp&gt; #include &lt;XMLIntf.hpp&gt; try { CoInitialize(0); _di_IXMLDocument xmlDoc; xmlDoc = LoadXMLData( s1 ); s1 = xmlDoc-&gt;XML-&gt;Text; CoUninitialize(); mylog( Fun + String::Format...
45,512
<p>I started playing around with Linq today and ran into a problem I couldn't find an answer to. I was querying a simple SQL Server database that had some employee records. One of the fields is the full name (cn). I thought it would be interesting to group by the first name by splitting the full name at the first space...
<p>Split has no translation into SQL.</p> <p>So, how to do this string manipulation without split? Cheat like hell (untested):</p> <pre><code>string oneSpace = " "; string fiftySpace = " "; var query = from person in db.Persons let lastname = person.cn.Replace(o...
<p>The reason your first attempt didn't work is because LINQ to SQL uses Expression Trees to translate your query into SQL. As a result any code that isn't directly translatable into SQL is an exception - this includes the call to Split.</p>
17,268
<p>For example, I want just the "filename" of a file in a field. Say I have myimage.jpg I only want to display "myimage" How do I get just that? </p>
<p>Use the List functions to your advantage.</p> <pre><code>&lt;cfset FileName = ListDeleteAt(FileFullName, ListLen(FileFullName, "."), ".")&gt; </code></pre> <p>Be aware that this only works for file names that actually <em>have</em> a file extension (that is defined as the thing after the last dot). To make it safe...
<p>So you first need to find the position of the last fullstop (there could be more than one fullstop in the full filename). I don't think Coldfusion has a find function that works backwards, so reverse the string first:</p> <pre><code>&lt;cfset Position = Find(".", Reverse(FullFileName))&gt; </code></pre> <p>If that...
26,446
<p>I have a string like this that I need to parse into a 2D array:</p> <pre><code> str = &quot;'813702104[813702106]','813702141[813702143]','813702172[813702174]'&quot; </code></pre> <p>the array equiv would be:</p> <pre><code>arr[0][0] = 813702104 arr[0][1] = 813702106 arr[1][0] = 813702141 arr[1][1] = 813702143 #......
<p>I would try <code>findall</code> or <code>finditer</code> instead of <code>match</code>.</p> <p>Edit by Oli: Yeah <code>findall</code> work brilliantly but I had to simplify the regex to:</p> <pre><code>r"'(?P&lt;main&gt;\d+)\[(?P&lt;thumb&gt;\d+)\]',?" </code></pre>
<p>Modifying your regexp a little,</p> <pre><code>&gt;&gt;&gt; str = "'813702104[813702106]','813702141[813702143]','813702172[813702174]" &gt;&gt;&gt; imgRegex = re.compile(r"'(?P&lt;main&gt;\d+)\[(?P&lt;thumb&gt;\d+)\]',?") &gt;&gt;&gt; print imgRegex.findall(str) [('813702104', '813702106'), ('813702141', '81370214...
45,056
<p>What are the "magic numbers" people refer to regarding print resolution on the Monoprice Select Mini?</p>
<p>The "magic numbers" are optimal values that work particularly well for the layer height. Michael O'Brien derived these numbers by reverse engineering the <a href="https://hackaday.io/project/12696-monoprice-select-mini-electro-mechanical-upgrades/log/44772-x-y-z-a-motors-stepper-driver-investigation" rel="noreferre...
<p>Though this approach is logical on paper, in the real world it doesnt work as well. Even if you do choose a magic number for the layer height, you cant gurentee that your print head, once homed at the beginning of a print, is using a full step of the motor. Its more common to be on a half step than a full step with ...
576
<p>Is there a Winform caching library out there? I need to pass a few datasets aroung in a Winform Application, and probably persist to storage upon close.</p> <p>I've seen some samples around via Google, using System.Web.</p> <p>What's the recommendation and where can I get some details. I am using VS 2008 for 2.0. ...
<p>Starting with .NET 2.0 you can use the System.Web.Caching.Cache class with non-ASP.NET apps. The Microsoft recommended approach these days though is to use the Enterprise Library Caching Application Block.</p>
<p>If you want to persist the dataset to some temporary storage mechanism then DataSet does support ToXml() and FromXml() capabilities (I forget the exact method names). </p>
22,469
<p>I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form.</p> <p>It should display the average speed while typing and keep the last average when the keystrokes are idle...
<p>Here's a tested implementation,which seems ok, but I don't guarantee the math.</p> <p>A Demo: <a href="http://jsfiddle.net/iaezzy/pLpx5oLf/" rel="noreferrer">http://jsfiddle.net/iaezzy/pLpx5oLf/</a></p> <p>And the code:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C/...
<p>a horribly simple, <strong>untested</strong> implementation:</p> <pre><code>var lastrun = new Date(); textarea.onkeyup = function() { var words = textarea.value.split(' '); var minutes_since_last_check = somefunctiontogetminutesdifference(new Date(), lastrun); var wpm = (words.length-1)/minutes_since_la...
20,263
<p>Is there a .NET variable that returns the "All Users" directory?</p>
<p>You'll want to use the <code>system.environment</code> variables.<br> Most of the predefined ones are <a href="http://msdn.microsoft.com/en-us/library/system.environment.getenvironmentvariable.aspx" rel="nofollow noreferrer">shown here</a>. </p> <p>For the "<strong>All Users</strong>" you would use:</p> <pre><cod...
<p>Or, </p> <pre><code>Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) </code></pre> <p>You can then pass this result to System.IO.Directory.GetParent() to get the root "All Users" folder.</p>
4,317
<p>I'm trying to sign an XPI on linux (no gui) using the NSS cert db (cert8.db and key3.db) i copied from another server of mine, on which I can sign XPI's just fine. </p> <p>On the new box I can sign with a brand new test certificate ok, but when i try to use the old cert db, it complains with:</p> <p>signtool: PROB...
<p>im not sure if this is what you need, but here it is: <a href="http://www.mercille.org/snippets/xpiSigning.php" rel="nofollow noreferrer">http://www.mercille.org/snippets/xpiSigning.php</a></p>
<p>If the certificate chain has an intermediate CA that also needs to be there.</p> <p>NSS is rather picky when it comes to the chain and also needs the certs to have been marked as trusted.</p>
16,401
<p>How can I convince Firefox (3.0.1, if it matters) to send an If-Modified-Since header in an HTTPS request? It sends the header if the request uses plain HTTP and my server dutifully honors it. But when I request the same resource from the same server using HTTPS instead (i.e., simply changing the http:// in the UR...
<blockquote> <p>HTTPS requests are not cached so sending an If-Modified-Since doesn't make any sense. The not caching is a security precaution.</p> </blockquote> <p>The not caching <strong>on disk</strong> is a security pre-caution, but it seems it indeed affects the <strong>If-Modified-Since</strong> behavior (glan...
<p>HTTPS requests are not cached so sending an <strong>If-Modified-Since</strong> doesn't make any sense. The not caching is a security precaution.</p>
3,721