instruction stringlengths 27 22.5k | chosen stringlengths 27 28.2k | rejected stringlengths 19 24.9k | __index_level_0__ int64 0 10k |
|---|---|---|---|
<p>I am getting a 24 V based Ender 3. From the factory, it has an aluminium bed. So I also put this <a href="https://www.amazon.de/gp/product/B071ZQ6VV6/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1" rel="noreferrer">LJ12 A3-4-Z/BX Inductive NPN NO 4 mm</a> with 6-36 V operation current into the box togethe... | <p>The inductive sensors work better when you apply a higher voltage than 5 V. Usually they are rated for 6-36 V, but please do check.</p>
<p>To prevent frying your board when connecting the sensor to (12 or) 24 Volts you could optically isolate the 5 V and the (12 or) 24 V circuit with an OptoCoup... | <p>Another possibility is to create a <a href="https://en.wikipedia.org/wiki/Voltage_divider" rel="nofollow noreferrer">voltage divider</a> circuit. </p>
<blockquote>
<p>In electronics, a voltage divider (also known as a potential divider)
is a passive linear circuit that produces an output voltage (V<sub>out</sub... | 958 |
<p>A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages.</p>
<p>I was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages, something like:</p>
<pre><cod... | <p>They way I have designed the database before is to have an News-table containing basic info like NewsID (int), NewsPubDate (datetime), NewsAuthor (varchar/int) and then have a linked table NewsText that has these columns: NewsID(int), NewsText(text), NewsLanguageID(int). And at last you have a Language-table that ha... | <p>@Auron</p>
<p>thats what we apply it to. Our apps are all PHP, but gettext has a long heritage. </p>
<p>Looks like there is a <a href="http://www.gnu.org/software/autoconf/manual/gettext/Java.html" rel="nofollow noreferrer">good Java implementation</a></p>
| 6,065 |
<p>Additionally, how can I format it as a string padded with zeros?</p>
| <p>To generate the number call rand with the result of the expression "10 to the power of 10"</p>
<pre><code>rand(10 ** 10)
</code></pre>
<p>To pad the number with zeros you can use the string format operator</p>
<pre><code>'%010d' % rand(10 ** 10)
</code></pre>
<p>or the <code>rjust</code> method of string</p>
<p... | <p>Random 10 numbers:</p>
<pre><code>require 'string_pattern'
puts "10:N".gen
</code></pre>
| 5,486 |
<p>I've been put in charge of coming up with a training itinerary for my team at work for a migration from c++ to Visual Studio 2008 with C#. </p>
<p>The actual language switch I'm not too worried about, its the learning curve to Visual Studio. What does everything think would be the best way to set up a training co... | <p>We are a C++ shop, that is moving to C# for UI work (our image processing and 3D graphics code will stay in native C++). I found <a href="http://media.wiley.com/assets/264/22/0764557599_bonus_AppD.pdf" rel="nofollow noreferrer">C# for C++ Developers</a> a very quick and handy introduction to the language. Our team h... | <p>I purchased the on-demand training from pluralsight about 4 months ago and IMHO is the best training out there. </p>
<p><a href="http://www.pluralsight.com/main/olt/Courses.aspx" rel="nofollow noreferrer">link text</a></p>
| 5,615 |
<p>What is the best way to implement, from a web page a download action using asp.net 2.0?</p>
<p>Log files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the log file from the IIS server to the users local pc.... | <p>Does this help:</p>
<p><a href="http://www.west-wind.com/weblog/posts/76293.aspx" rel="noreferrer">http://www.west-wind.com/weblog/posts/76293.aspx</a></p>
<pre><code>Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment; filename=logfile.txt");
Response.Transmi... | <p><a href="http://forums.asp.net/p/1481083/3457332.aspx" rel="noreferrer">http://forums.asp.net/p/1481083/3457332.aspx</a></p>
<pre><code>string filename = @"Specify the file path in the server over here....";
FileInfo fileInfo = new FileInfo(filename);
if (fileInfo.Exists)
{
Response.Clear();
Response.AddHead... | 5,843 |
<p>Forgive this long-winded post, but I thought it would be helpful to include the back story leading up to a very scary situation on my Ender 3.</p>
<p>I was printing a job and everything started out fine just like it normally does. I'm not sure if it is related, but partway through the job, there was a power dip seve... | <p>Your onboard MOSFET has failed, you need to replace the component, yet better the board. It seems the MOSFET isn’t reacting to the signal from the microprocessor, instead it is “always on”.</p>
<p>Note that a MOSFET usually fails short, but can fail open in certain circumstances. See <a href="https://electronics.sta... | <p>My understanding is that the hot end heats until the thermistor signals to the board that it is near/at temperature.</p>
<p>On an Ender V2 with the Meanwell power supply, the unit has thermal runaway protection so if the thermistor fails the board will shut down.</p>
<p>In your case, the failed thermistor never aler... | 2,063 |
<p>Is it possible to configure <a href="http://www.apachefriends.org/en/xampp.html" rel="noreferrer">xampp</a> to serve up a file outside of the <code>htdocs</code> directory?</p>
<p>For instance, say I have a file located as follows:</p>
<p><code>C:\projects\transitCalculator\trunk\TransitCalculator.php</code></p>
... | <p>Ok, per <a href="https://stackoverflow.com/questions/1408/#2471">pix0r</a>'s, <a href="https://stackoverflow.com/questions/1408/#1413">Sparks</a>' and <a href="https://stackoverflow.com/questions/1408/#1414">Dave</a>'s answers it looks like there are three ways to do this:</p>
<hr>
<h2><a href="https://stackoverfl... | <p>Solution to allow Apache 2 to host websites outside of htdocs:</p>
<p>Underneath the "DocumentRoot" directive in httpd.conf, you should see a directory block. Replace this directory block with:</p>
<pre><code><Directory />
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>... | 2,381 |
<p>I'm a very experienced Java programmer who has spent my entire time working with Java 1.4 and earlier. Where can I find a quick reference that will give me everything I need to know about the new features in Java5 and later in a quick reference?</p>
| <p>Here's a good place to start:</p>
<p><a href="https://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html</a></p>
<p><a href="https://web.archive.org/web/20081011231920/http://java.sun.com/developer/technicalArticles/r... | <p>I can recommend Bruce Eckel's "Thinking in Java" 4th edition. He goes over a bunch of basic stuff you can skip, but his treatment of new 1.5 features is very thorough, especially the chapter on generics. And it is a good Java reference to own.</p>
| 8,858 |
<p>Are there any techniques for getting a smooth finish for parts printed with co-polyester (PET) filaments? More specifically, I am looking for an alternative that does not roughen the look of the part - such as using sandpaper - but rather works like acetone baths for ABS.</p>
<p>In particular, I want to treat Color... | <p>Ethyl acetate (sold as a MEK substitute) is supposed to work for vapor smoothing PET. It doesn't seem very toxic (it's used to decaffinate cofee and tea, and as a nail polish remover), but you might want to look more into it. There's a post on Printed Solid's blog where he vapor smoothed colorFabb XT and MadeSolid... | <p>I've found a <a href="http://www.plasticsintl.com/plastics_chemical_resistence_chart.html" rel="nofollow">chart</a> which covers several plastics and solvents and only two of them (<a href="https://en.wikipedia.org/wiki/Chloromethane" rel="nofollow">Chloromethane</a> and <a href="https://en.wikipedia.org/wiki/Chloro... | 152 |
<p>If you have a JSF <code><h:commandLink></code> (which uses the <code>onclick</code> event of an <code><a></code> to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed?</p>
| <pre><code><h:commandLink id="myCommandLink" action="#{myPageCode.doDelete}">
<h:outputText value="#{msgs.deleteText}" />
</h:commandLink>
<script type="text/javascript">
if (document.getElementById) {
var commandLink = document.getElementById('<c:out value="${myPageCode.myCommandLink... | <p>In JSF 1.2 you can specify onclick events.</p>
<p>Also, other libraries such as <a href="http://myfaces.apache.org/" rel="nofollow noreferrer">MyFaces</a> or <a href="http://www.icefaces.org" rel="nofollow noreferrer">IceFaces</a> implement the "onclick" handler.</p>
<p>What you'd need to do then is simply:</p>
<... | 9,934 |
<p>I've got the following rough structure:</p>
<pre><code>Object -> Object Revisions -> Data
</code></pre>
<p>The Data can be shared between several Objects.</p>
<p>What I'm trying to do is clean out old Object Revisions. I want to keep the first, active, and a spread of revisions so that the last change for a... | <p>Here is example SQL. If you have an Identity column, you can use this instead of "ActivityDate".</p>
<pre><code>SELECT DATEDIFF(HOUR, prev.ActivityDate, curr.ActivityDate)
FROM MyTable curr
JOIN MyTable prev
ON prev.ObjectID = curr.ObjectID
WHERE prev.ActivityDate =
(SELECT MAX(maxtbl.ActivityDate)
... | <p>Hrmm, interesting challenge. I think you can do it without a self-join if you use the new-to-2005 pivot functionality.</p>
| 7,567 |
<p>Is it possible to programmatically push files to a wireless SD card - like a www.eye.fi card?</p>
<p>I use a Mac and thought I could do this using some AppleScript - but have not found a way...</p>
<p>Derek</p>
| <p>The eye-fi card relies on image files being written to a specific directory in the card before they'll transfer them. Beyond that it works exactly like a memory card.</p>
<p>Write a file to it as if you're writing a regular memory card, and as long as it's a jpg image file of reasonable size, and in an appropriate... | <p>It looks like you can treat it just like an external hard drive (plug the memory card in and figure out where the mount point is).</p>
| 8,113 |
<p>I have a <strong>DLL</strong> with some <strong>COM objects</strong>. Sometimes, this objects <strong>crashes</strong> and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens. </p>
<p>So, How can I trace those COM objects exceptions?</p>
| <p>The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means. </p>
<p>Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of the failure... | <p>If you just want a really quick way to find out what the error code means, you could use the "Error Lookup" tool packaged with Visual Studio (details <a href="http://msdn.microsoft.com/en-us/library/akay62ya(VS.80).aspx" rel="nofollow noreferrer">here</a>). Enter the hex value, and it will give you the string descr... | 3,215 |
<p>We've been using "Drip" to try and identify why pages with UpdatePanels in them tend to use a lot of client-side memory. With a page with a regular postback, we are seeing 0 leaks detected by Drip. However, when we add an update panel to the mix, every single DOM object that is inside of the update panel appears t... | <p>According to <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FASP-NET-AJAX-Action-Alessandro-Gallo%2Fdp%2F1933988142&tag=diaryofamadma-20&linkCode=ur2&camp=1789&creative=9325" rel="nofollow noreferrer">ASP.NET AJAX in Action</a>, p. 257</p>
<blockquo... | <p>That's very likely. This was pretty much what we assumed (browser problem, not necessarily Ajax).</p>
<p>Our problem is now, with this application being accessed by many people via a Citrix environment, with each page continually creating DOM objects and not releasing them, the Citrix environment starts thrashing ... | 6,571 |
<p>I've come across a rather interesing (and frustrating) problem with IE6. We are serving up some server generated pdfs and then simply setting headers in PHP to force a browser download of the file. Works fine and all, except in IE6 but <strong>only</strong> if the windows user account is set to standard user (ie. no... | <p>some versions of IE seem to take</p>
<pre><code>header( 'Expires: 0' );
header( 'Cache-Control: must-revalidate, pre-check=0, post-check=0' );
</code></pre>
<p>way too seriously and remove the downloaded content before it's passed to the plugin to display it. </p>
<p>Remove these two and you should be fine.</p>
... | <p>As pilif already mentions, make sure to turn off the server-side gzip compression. For me this has caused problems with PDF files (among other types) and for maybe-not-so-obscure reasons also with .zip files both under Internet Explorer and FireFox.</p>
<p>As far as I could tell, the last bit of the zip footer woul... | 7,180 |
<p>I'm trying to write a simple audio player for a website, and am using the EMBED... tag to embed the audio and setting HIDDEN="true" and using various javascript commands to control the audio playback. It works fine for realplayer and mplayer but the quicktime plugin doesn't respond to javascript if the hidden bit is... | <p>First, i suggest you to use the <code>object</code> html tag which is standardized, <code>embed</code> is not.</p>
<p>Then you could simply hide your embeded audio using CSS instead of this <code>hidden</code> param.</p>
<p>Even better, you should hide it using CSS through JavaScript, because if you do it this way... | <p>I found that setting height=0 width=0 worked the same as hidden=true and solved the problem</p>
| 9,745 |
<p>Creality does offer its firmware on <a href="https://www.creality3d.cn/download/firmware_c0001" rel="noreferrer">creality3d.cn</a> as .hex files. These are pretty good as backups as one can't alter and destroy them by accident.</p>
<p>But... How do you install them?!</p>
<hr>
<p>This is about installing firmware ... | <p>Creality also does provide an installation PDF. The process they propose is twofold and might need different settings on other machines<sup>1</sup>. Spots where I assume you might need to adjust are noted with<sup>A</sup>. Note that <strong>this solution depends on CURA</strong>.</p>
<h2>1. Install the printer as a... | <p>The Prusa i3 MK3 comes with <a href="https://www.prusa3d.com/slic3r-prusa-edition/" rel="nofollow noreferrer">Slic3r, Prusa Edition</a>. It has a menu for flashing the firmware, which takes a HEX file as input.</p>
<p><a href="https://i.stack.imgur.com/L5TEH.png" rel="nofollow noreferrer"><img src="https://i.stack.... | 1,002 |
<p>When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myself. Now I'm curious to know what sort ... | <p>One approach is the so called bag-of-words model.</p>
<p>As you guessed, first you count how many times words appear in the text (usually called document in the NLP-lingo). Then you throw out the so called stop words, such as "the", "a", "or" and so on.</p>
<p>You're left with words and word counts. Do this for a ... | <p>Here is the bag of words solution with tfidfvectorizer in python 3</p>
<pre><code>#from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
import nltk
nltk.download('stopwords')
s=set(stopwords.words('english'))
train_x_cleaned = []
for i in train_x:
... | 9,598 |
<p>Is the edit control I'm typing in now, with all its buttons and rules freely available for use? </p>
<p>My web project is also .Net based.</p>
| <p>It's the <a href="http://wmd-editor.com/" rel="nofollow noreferrer">WMD</a> Markdown editor which is free and seems to be pretty easy to use. Just include the javascript for it and (in the easiest case), it just attaches to the first textarea it finds.</p>
<p>Here's some info about the <a href="http://daringfireba... | <p>The <a href="http://wmd-editor.com/" rel="nofollow noreferrer">WMD editor</a> is completely free (in the speech and beer senses of the word). It's available under an MIT-style license.</p>
| 7,502 |
<p>We are using classic asp to call a C# dll and in the C# dll we are using System.Drawing.Printing.PrinterSettings.InstalledPrinters to get a list of availabe printers. If the printers are not shared they will not show up when a user trys to print. The Local System account can see and print to them from a VB6 dll and ... | <p>As I recall, running a website uses the Network User account, which may not have permission to view local printers.</p>
<p>There was a page on MSDN that said how you can impersonate another user that might have access to the printers, but I've not been able to find it.</p>
<p>Edit: I posted too soon. <a href="http... | <p>As I recall, running a website uses the Network User account, which may not have permission to view local printers.</p>
<p>There was a page on MSDN that said how you can impersonate another user that might have access to the printers, but I've not been able to find it.</p>
<p>Edit: I posted too soon. <a href="http... | 3,554 |
<p>I have a web site in asp.net that uses a master page. In this master page I have a multiview control with one view that has all the content for the content pages and one view that has some local content to the master page where I show error messages from all content pages.</p>
<p>In this error view I have a asp.net... | <p>It seems that the problem was one of sloppiness. Someone had forgotten to delete the auto-generated Content-controls that Visual Studio throws in on all content pages where the master page has a ContentPlaceHolder-control.</p>
<p>If a content page has a Content-control, all controls that are placed in the ContentPl... | <p>Could you be accessing it before it is created? Check the page lifecycle: <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178472.aspx</a></p>
| 6,719 |
<p>Two reasons this would be useful, in case there's some other way to achieve these goals:
1) Building in the Flash IDE is really slow; I was hoping a third-party compiler would be faster.
2) It would be nice to be able to build projects on machines that don't have the Flash IDE installed.
I'm familiar with other AS3 ... | <p>To answer the original question, there is no way to compile FLAs without using the Flash IDEs. </p>
<p>The only partial solution to to use a command line script that automates opening Flash Authoring and compiling the FLA. You can find one such example here:</p>
<p><a href="http://www.mikechambers.com/blog/2004/02... | <p>There's a plugin for Eclipse called FDT. It uses the open source compiler MTASC and supports ANT. The tool is free for OpenSource developers.
Get more Infos here: <a href="http://fdt.powerflasher.com/" rel="nofollow noreferrer">http://fdt.powerflasher.com/</a></p>
<p>Hope it helps :)</p>
| 8,886 |
<p>Here's a basic regex technique that I've never managed to remember. Let's say I'm using a fairly generic regex implementation (e.g., grep or grep -E). If I were to do a list of files and match any that end in either <code>.sty</code> or <code>.cls</code>, how would I do that?</p>
| <pre><code>ls | grep -E "\.(sty|cls)$"
</code></pre>
<ul>
<li><code>\.</code> matches literally a <code>"."</code> - an unescaped <code>.</code> matches any character</li>
<li><code>(sty|cls)</code> - match <code>"sty"</code> or <code>"cls"</code> - the | is an <code>or</code> and the brackets limit the expression.</l... | <pre><code>egrep "\.sty$|\.cls$"
</code></pre>
| 6,000 |
<p>On several occasions I've wanted lettering/numbering printed as part of a design, but with the ability to make it stand out more effectively in the printed object without having to do detailed manual finishing. Is there a good material which can catch in and fill sunken (depth 0.4 mm, width 0.6-1.0 mm) lin... | <p>The great pics really help with the answerability of this question. From how catastrophic the failure is, and how it's clearly independent of any specialty needs for the particular print such as tiny bed-adhesion contacts, sharp overhangs, bridges, etc. this is definitely not a problem with temperature. Different pe... | <p>I found the solution to be the exact opposite. My bed was too low (as in too far from the hotend). All the above mentioned aside, I did also drop the flow rate on the brim and initial layer by roughly 2-3 %. Now it prints perfectly again. (your mileage may vary)</p>
| 1,448 |
<p>In C#, when you implement an interface, all members are implicitly public. Wouldn't it be better if we could specify the accessibility modifier (<code>protected</code>, <code>internal</code>, except <code>private</code> of course), or should we just use an abstract class instead?</p>
| <p>If an interface is internal, all its members will be internal to the assembly. If a nested interface is protected, only the subclasses of the outer class could access that interface.</p>
<p>Internal members for an interface outside of its declaring assembly would be pointless, as would protected members for an inte... | <p>I'm familiar with Java rather than C#, but why an earth would you want a private member within an interface? It couldn't have any implementation and would be invisible to implementing classes, so would be useless. Interfaces exist to specify behaviour. If you need default behaviour than use an abstract class.</p>
| 3,818 |
<p>How do you create a database from an Entity Data Model.</p>
<p>So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. </p>
| <p>From what I understand you are not just supposed to use EDM as a "pretty" database designer, in fact EDM does not depend on a specific storage layer. It tries to abstract that part for the developer. There are design schemas (CSDL) and storage schemas (SSDL). Anyway, don't mean to lecture you. ;)</p>
<p>There is <a... | <p>The Feature "Generate Database Schema from Model" is scheduled for a future release of Entity Framework. V1 does'nt support schema generatiorn based on EF models.</p>
| 8,607 |
<p>During my last print I noticed this jumpy behavior during heat up (blue is bed, red is hotend):</p>
<p><a href="https://i.stack.imgur.com/KlD2K.png" rel="nofollow noreferrer" title="Graph of heatbed and hotend temperature over time"><img src="https://i.stack.imgur.com/KlD2K.png" alt="Graph of heatbed and hotend tem... | <p>Since the terminal temperatures never exceed the setpoints, there's no apparent potential for disaster. Whether it's due to missing readings or to some sequencing of power (current) applied to the bed vs. the hotend, it really doesn't matter. </p>
<p>If you have a similar graph of the temperatures over an hour ... | <p>It looks like everything is ok with the real temperature, and it is just Octoprint missing some readings, like Oscar said.
But I think it is unlikely the USB cables fault, the whole print would fail in that case. I think the PI is to busy, maybe due to a Webcam streaming at high rate (try reducing the framerate). A... | 1,278 |
<p>During printing, my printer occasionally makes some mystery moves: it will very slowly move either the X or Y axis all the way to the left/front, before very slowly moving back to its original position and resuming the print as normal. I've checked my G-code files, and the moves are definitely not part of the G-code... | <p>The issue was due to a corrupt SD-card, which was occasionally having some garbage read from it. It turns out that Marlin will try interpret a corrupt move command like <code>G0 X1q3.54</code> and still read as many numbers as it can. In this example, it would be interpreted as <code>G0 X1</code> rather than (as mig... | <p>Beides a corrupt SD card that stores worng bits, leading to absurd commands, it's also possible that ithers parts in the Creatin of the file are compromised:</p>
<p>This can for example happen if the card is removed during writing - but in this case it should be mostly an incomplete file on importing into an interp... | 251 |
<p>How do you calculate the distance between 2 cities? </p>
| <p>If you need to take the curvature of the earth into account, the Great-Circle distance is what you're looking for. <a href="http://en.wikipedia.org/wiki/Great-circle_distance" rel="nofollow noreferrer">The Wikipedia article</a> probably does a better job of explaining how the formula works than me, and there's also ... | <p>You find the Lat/Lon of the city, then use a distance estimation algorithm for Lat/Lon coordinates.</p>
| 4,348 |
<p>It seems there are some missing lines on the outer wall on the Z-axis with my prints. I'm not able to pinpoint the problem. Does anyone have ideas about what might be wrong with my setup/settings?</p>
<p>Example:</p>
<p><a href="https://i.stack.imgur.com/3q1k3.jpg" rel="nofollow noreferrer" title="Printed model with... | <p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can ... | <p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p>
<ul>
<li>2-Phase stepping motor peak current of 2A</li>
<li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li>
<li>Internal 256 micro steps</li>
<li>Quiet mode</li>
<li>Fast mode</li>
<li>HS Rdson 0.29 Ω... | 2,073 |
<p>I have a z-axis which follows schematically the same principle as the makerbot one's (threaded rod and two leading rods with linear ball bearings carrying a level). It is from an old experimental lab doing physics or chemistry.</p>
<p>The axis move gorgeously about 5 cm, but then it get's stuck on either sides of t... | <p>There could be a few issues at play.</p>
<ol>
<li>The smooth rods are not parallel which is causing the bearings to bind the further you go up.</li>
<li>Part of the thread is damaged not allowing it to pass through the nut.</li>
<li>The threaded rod is bent significantly to where it either doesn't pass through the ... | <p>There could be a few issues at play.</p>
<ol>
<li>The smooth rods are not parallel which is causing the bearings to bind the further you go up.</li>
<li>Part of the thread is damaged not allowing it to pass through the nut.</li>
<li>The threaded rod is bent significantly to where it either doesn't pass through the ... | 217 |
<p>Is it possible to actually make use of placement new in portable code when using it for arrays?</p>
<p>It appears that the pointer you get back from new[] is not always the same as the address you pass in (5.3.4, note 12 in the standard seems to confirm that this is correct), but I don't see how you can allocate a ... | <p>Personally I'd go with the option of not using placement new on the array and instead use placement new on each item in the array individually. For example:</p>
<pre><code>int main(int argc, char* argv[])
{
const int NUMELEMENTS=20;
char *pBuffer = new char[NUMELEMENTS*sizeof(A)];
A *pA = (A*)pBuffer;
for... | <p>I think gcc does the same thing as MSVC, but of course this doesn't make it "portable".</p>
<p>I think you can work around the problem when NUMELEMENTS is indeed a compile time constant, like so:</p>
<p><code>
typedef A Arr[NUMELEMENTS];</p>
<p>A* p = new (buffer) Arr;
</code></p>
<p>This should use the scalar p... | 3,607 |
<p>The .NET garbage collector will eventually free up memory, but what if you want that memory back immediately? What code do you need to use in a class <code>MyClass</code> to call</p>
<pre><code>MyClass.Dispose()
</code></pre>
<p>and free up all the used space by variables and objects in <code>MyClass</code>?</p>
| <p>IDisposable has nothing to do with freeing memory. IDisposable is a pattern for freeing <em>unmanaged</em> resources -- and memory is quite definitely a managed resource.</p>
<p>The links pointing to GC.Collect() are the correct answer, though use of this function is generally discouraged by the Microsoft .NET doc... | <p>In answer to the original question, with the information given so far by the original poster, it is 100% certain that he does not know enough about programming in .NET to even be given the answer: use GC.Collect(). I would say it is 99.99% likely that he really doesn't need to use GC.Collect() at all, as most poster... | 3,341 |
<p>I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.</p>
<p>I have what I'll call "bills of materials" in version controlled files i... | <p>Make is very bad at being able to detect actual file changes, as opposed to just updated timestamps. </p>
<p>It sounds to me that the root of the problem is that the bom-checkout always modifies the timestamp of the bom, causing the dependencies to be regenerated. I would probably try to solve this problem instead ... | <p>I'm not a make expert, but I would try have $(BOMS) depend on $(SIGS), and making the $(SIGS) target execute the if/else rules that you currently have under the $(BOMS) target.</p>
<pre><code>$(DEP) : $(SIGS)
... recreate dependency
$(BOMS) : $(SIGS)
...checkout TAG=$(VER) $@
$(SIGS) :
...if $(subst .bo... | 9,705 |
<p>When compiling from source, I never know which configure flags to use to optimize the compilation for my environment. Assume the following hardware/OS:</p>
<ul>
<li>Single Core, 2 GHz Intel</li>
<li>512MB Ram</li>
<li>Debian 4</li>
</ul>
<p>I usually just go with </p>
<p><code>./configure --prefix=/usr/local</cod... | <p>I always use Debian packages. Compiling from sources can break your development environment during libraries conflicts and such problems are hard to detect.</p>
| <p>You might want to check those few options out, which may be required by a Ruby On Rails environment, in which case they should be compiled. Just make sure the directory corresponds to your current settings.</p>
<p>--with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr</p>
| 4,354 |
<p>I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show.</p>
<p>Is there a good way to hide it without resorting to silly "width = 0" sort of games? </p>
<p>Or perhaps there's a generic way to walk through the parts of a composite control like this
an... | <p>Set CancelButtonStyle.CssClass to something like "hiddenItem" and set the CSS to "display:none".</p>
<p>Otherwise you can convert the control to a template and simply delete away the cancel-button manually. When you click the control in Design-mode in Visual Studio, you get a little arrow with options and one of th... | <p>You can use the ChangePassword.CancelButtonStyle Property to set the CSS-class on the Cancel Button. Then just apply "display: none" on the specified class.</p>
| 5,442 |
<p>Does anyone know of a way to alter a computed column without dropping the column in SQL Server. I want to stop using the column as a computed column and start storing data directly in the column, but would like to retain the current values.</p>
<p>Is this even possible?</p>
| <p>Not that I know of but here is something you can do</p>
<p>add another column to the table
update that column with the values of the computed column then drop the computed column</p>
| <p>Ok, so let me see if I got this straight. You want to take a column that is currently computed and make it a plain-jane data column. Normally this would drop the column but you want to keep the data in the column.</p>
<ol>
<li>Make a new table with the primary key columns from your source table and the generated ... | 6,578 |
<p>I have up to 4 files based on this structure (note the prefixes are dates)</p>
<ul>
<li>0830filename.txt</li>
<li>0907filename.txt</li>
<li>0914filename.txt</li>
<li>0921filename.txt</li>
</ul>
<p>I want to open the the most recent one (0921filename.txt). how can i do this in a batch file?</p>
<p>Thanks.</p>
| <p>This method uses the actual file modification date, to figure out which one is the latest file:</p>
<pre><code>@echo off
for /F %%i in ('dir /B /O:-D *.txt') do (
call :open "%%i"
exit /B 0
)
:open
start "dummy" "%~1"
exit /B 0
</code></pre>
<p>This method, however, chooses the last file in alphabetic ... | <p>Use regular expression to parse the relevant integer out and compare them.</p>
| 7,504 |
<p>I heard that if you use port 443 (the port usually used for https) for ssh, the encrypted packets look the same to your isp.</p>
<p>Could this be a way to avoid traffic shaping/throttling?</p>
| <p>I'm not sure it's true that any given ssh packet "looks" the same as any given https packet.</p>
<p>However, over their lifetime they don't behave the same way. The session set up and tear down don't look alike (SSH offer a plain text banner during initial connect, for one thing). Also, typically wouldn't an http... | <p>Your ISP is probably more likely to traffic shape port 443 over 22, seeing as 22 requires more real-time responsiveness.</p>
<p>Not really a programming question though, maybe you'll get a more accurate response somewhere else..</p>
| 4,692 |
<p>Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input.</p>
| <p>Since <a href="http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#quote(java.lang.String)" rel="noreferrer">Java 1.5, yes</a>:</p>
<pre><code>Pattern.quote("$5");
</code></pre>
| <p>^(Negation) symbol is used to match something that is not in the character group.</p>
<p>This is the link to <a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference" rel="nofollow noreferrer">Regular Expressions</a></p>
<p>Here is the image info about negat... | 8,499 |
<p>I am using a rich text editor on a web page. .NET has feature that prevent one from posting HTML tags, so I added a JavaScript snippet to change the angle brackets to and alias pair of characters before the post. The alias is replaced on the server with the necessary angle bracket and then stored in the database. ... | <p>There's actually a way to turn that "feature" off. This will allow the user to post whichever characters they want, and there will be no need to convert characters to an alias using Javascript. See this article for <a href="http://mdid.org/mdidwiki/index.php?title=Disabling_Request_Validation" rel="nofollow norefer... | <p>My first comment would be to avoid using JavaScript to change the angle brackets. Bypassing this is as simple as disabling JavaScript in the browser. Almost all server-side languages have some utility method that converts some HTML characters into their entity counterparts. For instance, PHP uses htmlentities(), and... | 8,706 |
<p>I'm starting developing with Flex on my Mac but i don't find good tools to ease the development (apart from Flex Builder).</p>
<p>What is your favourite choice for Flex development on Mac?</p>
| <p>TextMate + the <a href="http://blog.simongregory.com/10/textmate-actionscript-3-and-flex-bundles/" rel="nofollow noreferrer">Flex and ActionScript 3 bundles</a> is a great combo. Throw in <a href="http://ciaranwal.sh/2008/08/05/textmate-plug-in-projectplus" rel="nofollow noreferrer">ProjectPlus</a> and you have an a... | <p>TextMate is great, but if you're looking for something free, you can hack as3 onto XCode (I've used it, and it is fine, but some of the highlighting is off, and auto-completion is weak).</p>
<p>As for a debugging environment, I would recommend XTrace (<a href="http://mabblog.com/xtrace.html" rel="nofollow noreferre... | 4,737 |
<p>The default Python install on OS X 10.5 is 2.5.1 with a FAT 32 bit (Intel and PPC) client. I want to setup apache and mysql to run django. In the past, I have run Apache and MySQL to match this install in 32 bit mode (even stripping out the 64 bit stuff from Apache to make it work).</p>
<p>I want to upgrade Python ... | <p>Personally, I wouldn't worry about it until you see a problem. Messing with the default python install on a *Nix system can cause more trouble than it's worth. I can say from personal experience that you never truly understand what python has done for the nix world until you have a problem with it.</p>
<p>You can... | <p>Essentially, yes. I was not sure you could do it like that (current version does not do it like that). When using the python install script, however, there is no option (that I can find) to specify where to put directories and files (eg --prefix). I was hoping to match the current layout of python related files so a... | 4,969 |
<p>The <code>Open</code> button on the open file dialog used in certain windows applications includes a dropdown arrow with a list of additional options — namely <code>Open With..</code>. </p>
<p><a href="https://i.stack.imgur.com/GLM3T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GLM3T.pn... | <p>I used the draggable search in Spy++ (installed with VS) to look at the split open button on the file-open dialog of VS.</p>
<p>This revealed that it's an ordinary windows button with a style which includes BS_DEFSPLITBUTTON. That's a magic keyword which gets you to some interesting places, including</p>
<p><a h... | <p>Since I found the control in Windows itself, I was hoping to find it built-in somewhere already so I didn't have to add anything to my code-base to use it. But the split button at <a href="http://blogs.msdn.com/jfoscoding/articles/491523.aspx" rel="nofollow noreferrer">this link</a> (found via the msdn suggestion) ... | 5,098 |
<p>I have a 12 V/30 A power supply. Will a RAMPS 1.4 shield burn if I use that power supply with it?</p>
| <p>Voltage and current behave differently and it is important to remember two essential points:</p>
<ul>
<li>PSU voltage specifications <em><strong>should never be exceeded</strong></em>, else the circuit will (most likely) be damaged, and;</li>
<li>PSU current specifications <em><strong>can be exceeded</strong></em>, ... | <p>No, it won't burn if you use a power supply that put out 12 Volts and tolerates up to 30 Amps.</p>
| 2,113 |
<p>What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%?</p>
<p>I'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't really matter that much.</p>
<p>... | <p>I made this function in JavaScript. It returns the color is a css string. It takes the percentage as a variable, with a range from 0 to 100. The algorithm could be made in any language:</p>
<pre><code>function setColor(p){
var red = p<50 ? 255 : Math.round(256 - (p-50)*5.12);
var green = p>50 ? 255 : ... | <p>Because it's R-G-B, the colors go from integer values of -1 (white), to -16777216 for black. with red green and yellow somewhere in the middle that. Yellow is actually -256, while red is -65536 and green is -16744448. So yellow actually isn't between red and green in the RGB notation. I know that in terms of wav... | 4,466 |
<p>I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.</p>
<p>For example, my .net method:</p>
<pre><code>public double CalculateSomethingReallyComplex(double a, double b) {...}
</code></pre>
<p>I ... | <p>There are two methods - you can used Visual Studio Tools for Office (VSTO):</p>
<p><a href="http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx</a></p>
<p>or you can use COM:</p>
<p><a href="http://blogs.msdn.com/eric... | <p>There are two methods - you can used Visual Studio Tools for Office (VSTO):</p>
<p><a href="http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx</a></p>
<p>or you can use COM:</p>
<p><a href="http://blogs.msdn.com/eric... | 7,800 |
<p>I keep looking around for 3D scanning software but can't find anything I like. Any suggestions? I'm more looking for a free app so I can use my android phone, but am open to desktop based solutions too.</p>
| <h2>1. Meshroom</h2>
<p><a href="https://alicevision.org/" rel="nofollow noreferrer">https://alicevision.org/</a></p>
<p>Meshroom can take any number of overlapping photographs and turn them into a 3D model. Those pictures can be taken from any phone, or even a drone. For best results, you will need to know the make/mo... | <p>I personally use <a href="https://scann3d.it/" rel="nofollow noreferrer">SCANN3D</a>. It is available on Android but I don't know if it is for desktop too.</p>
| 2,031 |
<p>I have the following html code: </p>
<pre><code><h3 id="headerid"><span onclick="expandCollapse('headerid')">&uArr;</span>Header title</h3>
</code></pre>
<p>I would like to toggle between up arrow and down arrow each time the user clicks the span tag. </p>
<pre><code>function expandCol... | <p>When the HTML is parsed, what JQuery sees in the DOM is a <code>UPWARDS DOUBLE ARROW</code> ("⇑"), not the entity reference. Thus, in your Javascript code you should test for <code>"⇑"</code> or <code>"\u21d1"</code>. Also, you need to change what you're switching to:</p>
<pre><code>function expandCollapse(id) {
... | <p>Maybe you're not getting an exact match because the browser is lower-casing the entity or something. Try using a carat (^) and lower-case "v" just for testing.</p>
<p>Edited - My first theory was plain wrong.</p>
| 4,983 |
<p>Even though I have a robust and fast computer (Pentium Dual Core 2.0 with 2Gb RAM), I'm always searching for lightweight software to have on it, so it runs fast even when many apps are up and running simultaneously.</p>
<p>On the last few weeks I've been migrating gradually to Linux and want to install a free light... | <p><a href="http://projects.gnome.org/gedit/" rel="nofollow noreferrer">gedit</a></p>
<ul>
<li>Syntax highlighting</li>
<li>Fast, lightweight</li>
<li>Tabs</li>
<li>GUI</li>
</ul>
| <p>any of the popular editors can be turned into an ide.</p>
<p>I use Vi on the console and have used various gui editors over the years. This doesn't just go for linux I use Crimson Editor on windows as a C/python/z80asm ide.</p>
| 2,486 |
<p>I'm using <code>IIS 5.1</code> in Windows XP on my development computer. I'm going to set up HTTPS on my company's web server, but I want to try doing it locally before doing it on a production system.</p>
<p>But when I go into the Directory Security tab of my web site's configuration section, the "Secure communica... | <p>I'm having a similar issue. You might be able to do something like this:</p>
<pre><code>SET arithabort arith_overflow off
SET @the_date = CAST(@date_string AS DATETIME)
IF @the_date is NULL
set @the_date = getdate()
SET arithabort arith_overflow on
</code></pre>
<p>However, this doesn't work well in a select.... | <p>Found <a href="http://blog.sqlauthority.com/2007/07/12/sql-server-validate-field-for-date-datatype-using-function-isdate/" rel="nofollow noreferrer">this in the second result</a> in Google when searching for "validate date string sql".</p>
<pre><code>----Invalid date
SELECT ISDATE('30/2/2007')
RETURNS : 0 (Zero)
--... | 3,051 |
<p>I've just tried to make some small labels with embossed lettering. Base is 1.5 mm, with letters and a perimeter protruding by another 1 mm. After printing, I realised that Cura is not giving me a top layer, all I get is an inner and outer wall for the perimeter and the lettering:</p>
<p><a href="https://i.stack.img... | <p>What is happening here is that Cura is struggling with the quantised extrusion width. This behaviour can be improved in the slicer, they have a issue tracked here <a href="https://github.com/Ultimaker/Cura/issues/1303" rel="nofollow noreferrer">https://github.com/Ultimaker/Cura/issues/1303</a> and 2.4 beta has impro... | <p>Try Cura 2.4.0-beta2: there is option named "Fill Gaps Between Walls" under "Shell" settings, set it to "everywhere". In stable Cura 2.3.1 this option is missing.</p>
| 440 |
<p>I saw this cool <a href="http://www.thingiverse.com/thing:1231999" rel="nofollow noreferrer">Nuka-Cola bottle opener</a>. I made it:</p>
<p><a href="https://i.stack.imgur.com/ysVvW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ysVvW.jpg" alt="3D print of Nuka-Cola bottle opener"></a> </p>
<p>... | <p>I had a similar issue as described in <a href="https://3dprinting.stackexchange.com/questions/3461/why-does-my-domed-print-have-a-thin-shell">this question</a>. Curiously, yours is almost opposite as my raised lettering was OK, but the surrounding areas were poorly filled.</p>
<p>I came to the conclusion that Slic3... | <p>The proper term here is Under Extrusion.</p>
<p>There are a lot of reasons this can happen. For my Ultimaker, over time it developed very bad underextrusion due to the build up of carbon. I had to do atomic pulls / increase the extrusion multiplier. </p>
<p>I would ...</p>
<ol>
<li><p>verify that you move exactly... | 516 |
<p>I'm using an Ender 5 with standard PLA and Creality slicer 4.8.2.</p>
<p>How can I deliberately maximise stringing, and if possible get it to be as consistent as possible.</p>
<p>My aim is to have "thousands of hair like threads strung between two rocky pillars".</p>
<p>If possible I'd like to do this in t... | <ol>
<li>Eliminate retraction in slicer.</li>
<li>Print at a higher hot end temperature; something like +10°C higher than recommenced temperature.</li>
<li>Slow down speed hot end moves when not printing.</li>
<li>Maximize hot end movement without printing where you want strings.</li>
</ol>
| <p>Slicers will perform a retraction when moving from one solid to another, the value of which is part of the settings. I've not researched if a specific slicer will allow a negative retraction, but if it's possible, it's likely to create adjustable stringing.</p>
<p>If negative retraction is not possible, one can iden... | 2,187 |
<p>Is it possible to have one application binary build for multiple mobile devices (on <a href="http://brew.qualcomm.com/brew/" rel="nofollow noreferrer">BREW</a> platform), rather than making a separate build for each device using build script with conditional compilation.</p>
<p>In particular is is possible to use s... | <p>Yes, it is possible, we were able to do this at my previous place of work. What's required is tricky though:</p>
<ol>
<li>Compile for the lowest common denominator BREW version. Version 1.1 is the base for all current handsets out there.</li>
<li>Your code must be able to handle multiple resolutions. The methods fo... | <p>Another idea might be to have the handsets divided into 2 to 4 categories based on say screen dimensions and create builds for them. It is a much faster route too as you will be able to support all the handsets you want to support with much lesser complexity.</p>
<p>Another thing to see is the BREW versions on the ... | 9,676 |
<p>Are there any open-source libraries that all programmers should know about? I'm thinking
something general, a sort of extension to the standard <code>java.util</code> that contains basic functions that are useful for all kinds of application.</p>
| <ul>
<li><p>Apache Commons</p></li>
<li><p>Log4j</p></li>
<li><p>Google collections</p></li>
</ul>
| <p><a href="http://jexcelapi.sourceforge.net/" rel="nofollow noreferrer">JXL</a> for Excel workbook creation/edition. I work in a bank and the multipurpose report tool for diary work is Excel. Whatever appliction we do must import/export from/to Excel. The only fail it's that it has memory problems with large workbooks... | 8,973 |
<p>I've had a tough time setting up my replication server. Is there any program (OS X, Windows, Linux, or PHP no problem) that lets me monitor and resolve replication issues? (btw, for those following, I've been on this issue <a href="https://stackoverflow.com/questions/8166/mysql-replication-if-i-dont-specify-any-data... | <p>To monitor the servers we use the free <a href="http://www.maatkit.org/tools.html" rel="nofollow noreferrer">tools from Maatkit</a> ... simple, yet efficient.</p>
<p>The binary replication is available in 5.1, so I guess you've got some balls. We still use 5.0 and it works OK, but of course we had our share of issu... | <p>We use mysql replication to replicate data to close to 30 servers. We monitor them with nagios. You can probably check the replication status and use an event handler to restart it with 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; Start Slave;'. That will fix the error, but you'll lose the insert that caused the error. </p... | 5,590 |
<p>I want to know what exactly is the sequence of calls that occurs when a getter/setter created through Class::MethodMaker is called?</p>
<p>How much costlier are getter/setters defined by MethodMaker than the native ones (overwritten in the module)?</p>
| <p>I don't have a simple answer for your question regarding Class::MethodMaker performance. As a previous answer mentioned, you can use the debugger to find out what's going on under the hood. However, I know that Class::MethodMaker generates <em>huge</em> amounts of code at install time. This would indicate three sepa... | <p>The real question is: does it matter?</p>
<p>It's yet another accessors generating module. These modules all have a speed/functionality trade-off. Just pick one that offers everything you need. It's not like accessors are likely to become a bottleneck in your application.</p>
| 8,745 |
<p>I'd like to learn how to program in Assembler. I've done a bit of assembly before (during my A-Level Computing course) but that was very definitely a simplified 'pseudo-assembler'. I've borrowed my Dad's old Z80 Assembler reference manual, and that seems quite interesting so if possible I'd like to have a go with Z8... | <blockquote>
<p>I've found a few bits of software that suggest they might do this - but they either
refuse to compile, or don't seem to work properly. Has anyone got any suggestions?</p>
</blockquote>
<p>Write one. You're best off picking a nice, simple instruction set (Z80 should be perfect). I remember doing thi... | <p>Take a look at <a href="http://www.z80.info/z80emu.htm" rel="nofollow noreferrer">Thomas Scherrer Z80 Emulators</a> for a listing of potential emulators you could use.</p>
| 4,717 |
<p>I have a bit of an odd request. I am studying the vulnerability of 3D printers and would like to know if there is a way to disable the limit switches on, for example, an Ender 3 in the G-code.</p>
<p>Ideally, the exploit would be used by plugging in the malicious code via SD card into the 3D printer. I have found wa... | <h2>Ethics and justification:</h2>
<p>If you have physical access to the device you could just... physically damage the device. Running arbitrary G-code is just more complicated</p>
<p>Most printer farms have a strict no outside G-code policy for good reason. Because direct physical access to the printer does not provi... | <h2>Potential threat?</h2>
<p>I can imagine that this is a potential threat for printers that are operated in an environment where there are lots of people using the printer where there is access to the SD card (e.g. schools, libraries or maker spaces). It would literally take a file on the SD card to be run the next t... | 2,089 |
<p>I've been reading a lot about closures and I think I understand them, but without clouding the picture for myself and others, I am hoping someone can explain closures as succinctly and clearly as possible. I'm looking for a simple explanation that might help me understand where and why I would want to use them.</p>... | <p><a href="http://mrevelle.blogspot.com/2006/10/closure-on-closures.html" rel="noreferrer">Closure on closures</a></p>
<blockquote>
<p>Objects are data with methods
attached, closures are functions with
data attached.</p>
</blockquote>
<pre><code>def make_counter():
i = 0
def counter(): # counter() is ... | <p>The best explanation I ever saw of a closure was to explain the mechanism. It went something like this:</p>
<p>Imagine your program stack as a degenerate tree where each node has only one child and the single leaf node is the context of your currently executing procedure.</p>
<p>Now relax the constraint that each... | 3,479 |
<p>In a recent sharepoint project, I implemented an authentication webpart which should replace the NTLM authentication dialog box. It works fine as long as the user provides valid credentials. Whenever the user provides invalid credentials, the NTLM dialog box pops up in Internet Explorer.</p>
<p>My Javascript code w... | <p><a href="https://stackoverflow.com/users/2199/mark-brackett">Mark</a>'s comment is correct; The NTLM auth prompt is triggered by a 401 response code and the presence of NTLM as the first mechanism offered in the WWW-Authenticate header (Ref: <a href="http://curl.haxx.se/rfc/ntlm.html" rel="nofollow noreferrer">The N... | <p>I was able to get this working for all browsers except firefox. See my blog post below from a few years ago. My post is aimed at IE only but with some small code changes it should work in Chrome and safari. </p>
<p><a href="http://steve.thelineberrys.com/ntlm-login-with-anonymous-fallback-2/" rel="nofollow">http... | 4,939 |
<p>I've heard that creating a new process on a Windows box is more expensive than on Linux. Is this true? Can somebody explain the technical reasons for why it's more expensive and provide any historical reasons for the design decisions behind those reasons?</p>
| <p>mweerden: NT has been designed for multi-user from day one, so this is not really a reason. However, you are right about that process creation plays a less important role on NT than on Unix as NT, in contrast to Unix, favors multithreading over multiprocessing.</p>
<p>Rob, it is true that fork is relatively cheap w... | <p>All that plus there's the fact that on the Win machine most probably an antivirus software will kick in during the CreateProcess... That's usually the biggest slowdown.</p>
| 7,013 |
<p>I'd like to use a different icon for the demo version of my game, and I'm building the demo with a different build config than I do for the full verison, using a preprocessor define to lockout some content, use different graphics, etc. Is there a way that I can make Visual Studio use a different icon for the app Ic... | <p>According to <a href="http://msdn.microsoft.com/en-us/library/aa381033(VS.85).aspx" rel="noreferrer">this page</a> you may use preprocessor directives in your *.rc file. You should write something like this</p>
<pre><code>#ifdef _DEMO_VERSION_
IDR_MAINFRAME ICON "demo.ico"
#else
IDR_MAINFRAME ICON "full.ico"
#endif... | <p>This will get you halfway there: <a href="http://www.codeproject.com/KB/dotnet/embedmultipleiconsdotnet.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/embedmultipleiconsdotnet.aspx</a></p>
<p>Then you need to find the Win32 call which will set the displayed icon from the list of embedded icons... | 9,839 |
<p>Recently thanks to rails' popularity, many people start using activerecord as model. however, before I heard of rails (my peer group was not a fan of open source stuff, we were taught in a .NET school...) and while I was doing my final year project, i found this definition for a model</p>
<blockquote>
<p>The mode... | <p>Martin Fowler described this pattern in Patterns of Enterprise Application Architecture together with two other patterns or architectures. These patterns are good for different situations and different amounts of complexity.</p>
<p>If you want to so only simple stuff you can use Transaction Script. This is an archi... | <p>The great thing about using the Rails ActiveRecord as a model in MVC is that it gives you an automatic ORM (Object Relational Mapper) and easy way to create associations between models. As you have pointed out, MVC can sometimes be lacking.</p>
<p>Therefore, for some complex transaction involving many models, I'd s... | 8,048 |
<p>I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage.</p>
<p>I created a task to run under my admin user, and to start the program, <em>cmd</em> with the arguments <em>/... | <p>Use an enum:</p>
<pre><code>public enum Foo {
INSTANCE;
}
</code></pre>
<p>Joshua Bloch explained this approach in his <a href="http://sites.google.com/site/io/effective-java-reloaded" rel="noreferrer">Effective Java Reloaded</a> talk at Google I/O 2008: <a href="http://www.youtube.com/watch?v=pi_I7oD_uGI#t=28... | <p>Sometimes a simple "<strong><code>static Foo foo = new Foo();</code></strong>" is not enough. Just think of some basic data insertion you want to do.</p>
<p>On the other hand you would have to synchronize any method that instantiates the singleton variable as such. Synchronisation is not bad as such, but it can lea... | 9,613 |
<p>I have an absolutely positioned <code>div</code> containing several children, one of which is a relatively positioned <code>div</code>. When I use a <code>percentage-based width</code> on the child <code>div</code>, it collapses to <code>0 width</code> on IE7, but not on Firefox or Safari.</p>
<p>If I use <code>pixe... | <p>The parent <code>div</code> needs to have a defined <code>width</code>, either in pixels or as a percentage. In Internet Explorer 7, the parent <code>div</code> needs a defined <code>width</code> for child percentage <code>div</code>s to work correctly.</p>
| <p>The <code>div</code> needs to have a defined width:</p>
<pre><code><div id="parent" style="width:230px;">
<div id="child1"></div>
<div id="child2"></div>
</div>
</code></pre>
| 2,231 |
<p>When using a filament based printer, what operator behaviors increase the frequency at which a bed must be relevelled between prints?</p>
| <h1>Mechanical interaction</h1>
<h2>Operator induced regular actions</h2>
<p>When an operator reaches into the machine and operates something on the bed, this can induce errors that slowly accumulate. The most typical operation would be to remove something from the printbed, cleaning the printbed or swapping the printb... | <p>The only ones I have found are.</p>
<p>Manually putting pressure on the bed when removing prints.</p>
<p>Removing the bed covering, eg a glass plate</p>
<p>Damaging the bed in some way. For example my bed has high spots on it (always has). This means that if I remove the glass plate I use and put it back, it sits sl... | 2,148 |
<p>I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970.</p>
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
#include <time.h>
... | <p>I have written portable replacement for time.h (currently just localtime(), gmtime(), mktime() and timegm()) which uses 64 bit time even on 32 bit machines. It is intended to be dropped into C projects as a replacement for time.h. It is being used in Perl and I intend to fix Ruby and Python's 2038 problems with it... | <p>By 2038, time libraries should all be using 64-bit integers, so this won't actually be that big of a deal (on software that isn't completely unmaintained).</p>
<p>COBOL programs might be fun though.</p>
| 5,690 |
<p>I'm currently working on a ray-tracer in C# as a hobby project. I'm trying to achieve a decent rendering speed by implementing some tricks from a c++ implementation and have run into a spot of trouble.</p>
<p>The objects in the scenes which the ray-tracer renders are stored in a KdTree structure and the tree's node... | <p>Firstly, if you're using C# normally, you can't suddenly get a null reference due to the garbage collector moving stuff, because the garbage collector also updates all references, so you don't need to worry about it moving stuff around.</p>
<p>You can pin things in memory but this may cause more problems than it so... | <p>Is it really prohibitive to store the pair of array reference and index?</p>
| 5,920 |
<p>I am looking for a text editor to be used in a web page. Where users can format the text and get a WYSIWYG experience. Doesn't need to be too fancy. But has to be easy to use and integrate into the page. Has to generate HTML as output. Support AJAX (one I checked works only with standard form submit) and has to be s... | <p>Well it depends what platform you are on if you are looking for server-side functionality as well, but the defacto badass WYSIWYg in my opinion is <a href="http://www.fckeditor.net/" rel="noreferrer">FCKeditor</a>. I have worked with this personally in numerous environments (both professional and hobby level) and ha... | <p>Using fck for some tine now, after "free text box", or something like that. Had problems only once, when I put fck inside asp.net ajax updatepanel, but found fix on forums. Problem was solved in next release.<br>
I would like to see some nice photo browser in it, because fck comes only with simple browser that displ... | 4,150 |
<p>I have been attempting to get my Anet to print for a couple months now. Haven't had a huge amount of time but when I have I've worked on it. A lot of the problems I have had I have been able to trouble shoot, for example for a while I was unable to get any filament to lay, and I have since fixed this issue. Now howe... | <p>The skirt <em>looks</em> ok, which tends to rule out the most extreme flow or blockage issues. However, skirt/bottom layer can be over-squashed so not ideal for calibration.</p>
<p>I assume this is intended to be a 100% layer rather than infill. It looks like you're achieving about 50% infill, which is a good clue.... | <p>I had similar issues with my A8 at first. If it <em>did</em> work fine and now it does not, then it is not a firmware issue. My issues were resolved when I got a <em>new</em> nozzle. If the tip is worn out or squished from crashing into the bed, no amount of cleaning is going to solve it. Also the filament it came w... | 1,322 |
<p>And why would I use one over the other in my code?</p>
| <blockquote>
<p><strong>Caution: This answer appears to be out of date.</strong> It was posted before .NET 4 became available, which apparently introduced some optimizations regarding <code>Type</code> and thus rendered the information in this answer obsolete. See <a href="https://stackoverflow.com/a/1438443/240733">... | <p>In .NET 4.0 Beta 1 <code>RuntimeTypeHandle</code> just wraps <code>RuntimeType</code>.
It seems all benefits of using it as a cheap <code>Type</code> proxy have gone.</p>
<h3>Evidence for the above claim:</h3>
<ul>
<li>Microsoft's <a href="https://referencesource.microsoft.com/#mscorlib/system/runtimehandles.cs" ... | 6,158 |
<p>My first attempt to print in ABS has been an unmitigated disaster, and I could do with some advice before I try again.</p>
<p>I've been trying to print a <a href="https://www.thingiverse.com/thing:4067324" rel="noreferrer">Bean Hopper Extension for Melitta Barista TS Smart</a> coffee machine, but every time the laye... | <p>First of all, the bed should be at 100-110 °C and fan 0 %.</p>
<p>I had <em>incredibly</em> good results by using a (sacrificial) "draft shield" as shown below together with a large brim (10 mm). It creates a warmer micro-climate which keeps the print a bit warmer, with much less warping. My printer bed ba... | <p>You make no mention of a heated enclosure, so I assume you aren't using one. ABS undergoes significant contraction as it cools down. If you're not using an enclosure, the temperature differences between the heated bed, the cool middle of the print, and the heat of the freshly-printed plastic will cause severe warp... | 1,964 |
<p>My printer is ignoring the "Z offset" setting in Cura and the "Bed Z" stored in the printer LCD settings? It has been working before but after a firmware update of my printer, it doesn't work. Even after flashing the previous firmware back "Bed Z" changes no longer affect anything. No m... | <h2>Z offset in Cura</h2>
<p>Z offset in Cura is nothing more than an additional increase/decrease in height calculated throughout the whole file. This does require the installment of a plugin from the Ultimaker Cura "Marketplace" called "Z Offset Setting" by developer "fieldOfView". This ... | <p>I have the same problem. You need to check your G-code to detect where's the problem.</p>
<p>Try comparing the G-code file with different values of the Z offset.</p>
<p>In my case it looks like this:</p>
<p>No offset</p>
<pre><code>;LAYER_COUNT:107
;LAYER:0
M106 S255
G1 F300 Z0.84
G0 F6000 X124.645 Y78.208 Z0.84
;TY... | 1,657 |
<p>The first time I load the website in the production web server, it start very slow, subsequent pages load very quickly (included the home page).</p>
<p>I precompiled the site, but nothing changes. </p>
<p>I don't have any code at Application start.
I don't have cached items.</p>
<p>Any ideas? How can I find out w... | <p>It's just your app domain loading up and loading any binaries into memory. Also, it's initializing static variables, so if you have a static variable that loads up a lot of data from the db, it might take a bit.</p>
| <p>This sounds very much like background compiling; though if you're precompiling, that shouldn't be an issue.</p>
<p>First thing I would look at is your ORM (if any). NHibernate, in particular, has a serious startup penalty, as it runs multiple compilers in the background at startup to turn each class in your data la... | 4,586 |
<p>I've got a lot of ugly code that looks like this:</p>
<pre><code>if (!string.IsNullOrEmpty(ddlFileName.SelectedItem.Text))
results = results.Where(x => x.FileName.Contains(ddlFileName.SelectedValue));
if (chkFileName.Checked)
results = results.Where(x => x.FileName == null);
if (!string.IsNullOrEmpty... | <p>I'd convert it into a single Linq statement:</p>
<pre><code>var results =
//get your inital results
from x in GetInitialResults()
//either we don't need to check, or the check passes
where string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) ||
x.FileName.Contains(ddlFileName.SelectedValue)
... | <pre><code>results = results.Where(x =>
(string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) || x.FileName.Contains(ddlFileName.SelectedValue))
&& (!chkFileName.Checked || string.IsNullOrEmpty(x.FileName))
&& ...);
</code></pre>
| 7,863 |
<p>Looking for an example that:</p>
<ol>
<li>Launches an EXE</li>
<li>Waits for the EXE to finish.</li>
<li>Properly closes all the handles when the executable finishes.</li>
</ol>
| <p>Something like this:</p>
<pre><code>STARTUPINFO info={sizeof(info)};
PROCESS_INFORMATION processInfo;
if (CreateProcess(path, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
{
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processI... | <p>Here is a solution for <code>CreateProcessA</code></p>
<pre><code>STARTUPINFOW initInfo = { 0 };
initInfo.cb = sizeof(initInfo);
PROCESS_INFORMATION procInfo = { 0 };
CreateProcessA(PATH_FOR_EXE, NULL, NULL, NULL, FALSE, 0, NULL, NULL, (LPSTARTUPINFOA)&initInfo, &procInfo);
</code></pre>
| 6,406 |
<p>I am converting from existing CVS repository to SVN repository. CVS repository has few brances and I'd like to rename branches while converting.</p>
<p>Wanted conversion is like this:</p>
<pre><code>CVS branch SVN branch
HEAD -> branches/branchX
branchA -> trunk
branchB -> ... | <blockquote>I am especially interested in preserving commit history. If I rename and move branches around in SVN after the conversion, will the history be preserved?</blockquote>
<p>Yes. Subversion also keeps track of changes to the directory structure, and all version history is preserved even if a file is moved in t... | <p>I am especially interested in preserving commit history. If I rename and move branches around in SVN after the conversion, will the history be preserved?</p>
| 3,513 |
<p>I have been considering taking the plunge and installing Linux on my Playstation 3. As C# is my current language of choice, the next logical step would be to install Mono.</p>
<p>I have done a little research and found that <a href="http://psubuntu.com/wiki/InstallationInstructions" rel="nofollow noreferrer">http:... | <p>Just found <a href="http://tirania.org/blog/archive/2008/Feb-26.html" rel="nofollow noreferrer">this posting</a> from Miguel de Icaza's blog. Promising that as recently as Feb 2008 he was looking into this. As he is <a href="https://stackoverflow.com/users/16929/migueldeicaza">a member of the SO community</a> now,... | <p>The PS3 features a PPC general purpose CPU.</p>
<p>You can try to cross compile mono to ppc and go from there.</p>
<p>Mono from svn has received a lot of attention regarding the ppc port, so I would advise using it instead of the 2.0 release.</p>
| 4,680 |
<p>What should I use to virtualize my desktop, vmx, xen, or vmware?</p>
<p><strong>Needs to work on a linux or windows host, sorry virtual pc.</strong></p>
<p>@Derek Park: Free as in speech, not beer. I want to be able to make a new virtual machine from my own licensed copies of windows, for that vmware is kind of ex... | <p>Try <a href="http://www.virtualbox.org/" rel="noreferrer">VirtualBox</a>. It's free, open source, and it runs on Windows, Linux, Macintosh and OpenSolaris.</p>
| <p>Um, <a href="http://info.vmware.com/content/GLP_VMwarePlayer" rel="nofollow noreferrer">VMware is free</a>.</p>
| 3,307 |
<p>I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed.</p>
<p>I was kind of hoping that this would work</p>
<pre><code>int? val = stringVal as int?;
</code></pre>
<p>But that won't work, so the way I'm doing it now is I've... | <p><code>int.TryParse</code> is probably a tad easier:</p>
<pre><code>public static int? ToNullableInt(this string s)
{
int i;
if (int.TryParse(s, out i)) return i;
return null;
}
</code></pre>
<p><strong>Edit</strong> @Glenn <code>int.TryParse</code> is "built into the framework". It and <code>int.Parse<... | <p>You should <em>never</em> use an exception if you don't have to - the overhead is horrible.</p>
<p>The variations on TryParse solve the problem - if you want to get creative (to make your code look more elegant) you could probably do something with an extension method in 3.5 but the code would be more or less the s... | 6,682 |
<p>Can I get a 'when to use' for these and others? </p>
<pre><code><% %>
<%# EVAL() %>
</code></pre>
<p>Thanks</p>
| <p>Check out the <a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/syntax.aspx#expressions" rel="noreferrer">Web Forms Syntax Reference</a> on MSDN.</p>
<p>For basics, </p>
<ul>
<li><p><% %> is used for pure code blocks. I generally only use this for if statements</p>
<blockquote>
<br/>
&n... | <p>In ASP.NET 4.0, comes <%: %> syntax for writing something html encoded.</p>
<pre><code><%: "<script>alert('Hello XSS')</script>" %>
</code></pre>
<p>The above can be used instead of the belove.</p>
<pre><code><%= Html.Encode("<script>alert('Hello XSS')</script>")%>
</cod... | 4,787 |
<p>Jeff mentioned the concept of 'Progressive Enhancement' when talking about using JQuery to write stackoverflow.</p>
<p>After a quick Google, I found a couple of high-level discussions about it.</p>
<p>Can anyone recommend a good place to start as a programmer.</p>
<p>Specifically, I have been writing web apps in ... | <p>As you've said</p>
<blockquote>
<p>To me, that seems a bit overkill, since viewing the site without Javascript will probably break most of it.</p>
</blockquote>
<p>This isn't progressive enhancement. Progressive enhancement is when the site works perfectly without JavaScript or CSS, and <em>then</em> adding (lay... | <p>Going at it from the other direction is sometimes referred to as graceful degradation. This is usually needed when the site is built first with the enhanced functionality afforded by the various technologies then modified to degrade gracefully for browsers with those technologies are not available.</p>
<p>It is al... | 2,459 |
<p>I am in charge of about 100+ documents (word document, not source code) that needs revision by different people in my department. Currently all the documents are in a shared folder where they will retrieve, revise and save back into the folder. </p>
<p>What I am doing now is looking up the "date modified" in the sh... | <p>I've worked with Word documents in SVN. With <a href="http://tortoisesvn.tigris.org/" rel="noreferrer">TortoiseSVN</a>, you can easily diff Word documents (between working copy and repository, or between two repository revisions). It's really slick and definitely recommended.</p>
<p>The other thing to do if you're ... | <p>You could do that, but if that files are binary you should always put a lock on it before editing. You won't get a conflict (which would be unresolvable).</p>
| 4,960 |
<p>I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root.</p>
<p>A couple of solutions:</p>
<ol>
<li>Each node can store a reference to the root directly (wastes memory)
<ul>
<li>I can compute the root at runtime by "going up" (wastes cycles)<... | <p>Pass the root as a parameter to whichever functions in the node that need it.</p>
<p>Edit: The options are really the following:</p>
<ol>
<li>Store the root reference in the node</li>
<li>Don't store the root reference at all</li>
<li>Store the root reference in a global</li>
<li>Store the root reference on the st... | <p>You could derive a class from TreeView and then add a singleton static property. That way you are effectively adding a global field that references the single instance of the class but have the benefit of it being namespace scoped to that class.</p>
| 9,366 |
<p>I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output.</p>
<p>So far the only input required is a password for sudo - and gksudo handles that fine.
But I haven't found an easy way to show a message... | <p>I believe <a href="http://live.gnome.org/Zenity" rel="noreferrer">Zenity</a> will do what you want. It's specifically designed for displaying GTK dialogs from the command line, and it's available as an <a href="http://packages.ubuntu.com/hardy/zenity" rel="noreferrer">Ubuntu package</a>.</p>
| <p>Kdialog and dialog are both good, but I'd recommend Zenity. Quick, easy, and much better looking the xmessage or dialog. </p>
| 2,870 |
<p>Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations?</p>
<p>This is what I want to re-write:</p>
<pre><code>foreach (Type t in this.GetType().Assembly.GetTypes())
if (t is IMyInterface)
; //do stuff
</code></pre>
| <p>Mine would be this in c# 3.0 :)</p>
<pre><code>var type = typeof(IMyInterface);
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => type.IsAssignableFrom(p));
</code></pre>
<p>Basically, the least amount of iterations will always be:</p>
<pre><code>loop ass... | <p>You could use some LINQ to get the list:</p>
<pre><code>var types = from type in this.GetType().Assembly.GetTypes()
where type is ISomeInterface
select type;
</code></pre>
<p>But really, is that more readable?</p>
| 4,630 |
<p>Is there a C library function that will return the index of a character in a string?</p>
<p>So far, all I've found are functions like strstr that will return the found char *, not it's location in the original string.</p>
| <p><code>strstr</code> returns a pointer to the found character, so you could use pointer arithmetic: (Note: this code not tested for its ability to compile, it's one step away from pseudocode.)</p>
<pre><code>char * source = "test string"; /* assume source address is */
... | <p>If you are not totally tied to pure C and can use string.h there is strchr()
<a href="http://www.cplusplus.com/reference/clibrary/cstring/strchr.html" rel="nofollow noreferrer">See here</a></p>
| 2,680 |
<p>So, I know that try/catch does add some overhead and therefore isn't a good way of controlling process flow, but where does this overhead come from and what is its actual impact?</p>
| <p>I'm not an expert in language implementations (so take this with a grain of salt), but I think one of the biggest costs is unwinding the stack and storing it for the stack trace. I suspect this happens only when the exception is thrown (but I don't know), and if so, this would be decently sized hidden cost every ti... | <p>Let us analyse one of the biggest possible costs of a try/catch block when used where it shouldn't need to be used:</p>
<pre><code>int x;
try {
x = int.Parse("1234");
}
catch {
return;
}
// some more code here...
</code></pre>
<p>And here's the one without try/catch:</p>
<pre><code>int x;
if (int.TryParse... | 7,553 |
<p>I have played with the idea of using a wiki (MediaWiki) to centralize all project information for a development project. This was done using extensions that pull information from SVN (using <a href="http://svnkit.com/" rel="nofollow noreferrer">SVNKit</a>) and by linking to Bugzilla to extract work assigned to a de... | <p>I think this would be extremly useful. Depending on the size of a project team members come and go. And a wiki is a good tool to keep the history and the "spirit" of a project available to new team members. I did that in many projects, and though the projects were already finished, all the informations are available... | <p>The other classic integration would be your source code repository, e.g. svn, or cvs. <a href="http://trac.edgewall.org/" rel="nofollow noreferrer">trac</a> is an existing product that does exactly this - it combines a wiki, custom bug tracker, and integrates nicely with svn.</p>
| 7,213 |
<p>How do you actually perform datetime operations such as adding date, finding difference, find out how many days excluding weekends in an interval? I personally started to pass some of these operations to my postgresql dbms as typically I would only need to issue one sql statement to obtain an answer, however, to do ... | <p>While for most datetime operations I would normally convert to Unixtime and perform addition subtraction etc. on the Unixtime integer, you may want to look at the Zend framework Zend_Date class. </p>
<p>This has a lot of the functionality you describe. Although Zend is billed as a "framework" it works exceptionally... | <p>to get working days/holidays, postgresql CTE ftw -- see <a href="http://osssmb.wordpress.com/2009/12/02/business-days-working-days-sql-for-postgres-2/" rel="nofollow">http://osssmb.wordpress.com/2009/12/02/business-days-working-days-sql-for-postgres-2/</a></p>
| 8,053 |
<p>I have a script that has a part that looks like that:</p>
<pre><code>for file in `ls *.tar.gz`; do
echo encrypting $file
gpg --passphrase-file /home/$USER/.gnupg/backup-passphrase \
--simple-sk-checksum -c $file
done
</code></pre>
<p>For some reason if I run this script manually, works perfectly fine and ... | <p>It turns out that the answer was easier than I expected. There is a <code>--batch</code> parameter missing, gpg tries to read from /dev/tty that doesn't exist for cron jobs. To debug that I have used <code>--exit-on-status-write-error</code> param. But to use that I was inspired by exit status 2, reported by echoing... | <p>make sure the user that is running the cron job has the permissions needed to encrypt the file. </p>
| 6,102 |
<p>I know the answer is not going to be simple, and I already use a couple of (I think ugly) cludges. I am simply looking for some elegant answers.</p>
<p>Abstract class:</p>
<pre><code>public interface IOtherObjects;
public abstract class MyObjects<T> where T : IOtherObjects
{
...
public List<T> ... | <p>In your case MyObjectsA and MyObjectsB don't have common predecessor. Generic class is template for <em>different</em> classes not a common base class. If you want to have common properties in different classes use interfaces. You can't call <em>ToList</em> in a loop cause it has different signature in different cla... | <p>Generics are used for static time type checks <strong>not</strong> runtime dispatch. Use inheritance/interfaces for runtime dispatch, use generics for compile-time type guarantees.</p>
<pre><code>interface IMyObjects : IEnumerable<IOtherObjects> {}
abstract class MyObjects<T> : IMyObjects where T : IOth... | 7,682 |
<p>I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary in Visual C++'s debugger and just tell... | <p>Without the PDB symbols for that application you're going to have a tough time making heads or tails of what is going on and where. I think any source code information is going to be only in that PDB file that was created when whoever built that application.</p>
<p>This is assuming that the PDB file was EVER create... | <p>Short of any other answers, I would try attaching to the executable process in Visual Studio, setting a break point in your code and when you step into the process you don't have source to, it should ask for a source file.</p>
| 5,095 |
<p>I develop exclusively on VMs. I currently run Boot Camp on a MacBook Pro and do all my development on a series of Virtual PC VMs for many different environments. This <a href="http://www.andrewconnell.com/blog/articles/UseVirtualPCsDifferencingDisksToYourAdvantage.aspx" rel="nofollow noreferrer">post by Andrew Conne... | <p>There's actually a way to turn that "feature" off. This will allow the user to post whichever characters they want, and there will be no need to convert characters to an alias using Javascript. See this article for <a href="http://mdid.org/mdidwiki/index.php?title=Disabling_Request_Validation" rel="nofollow norefer... | <p>My first comment would be to avoid using JavaScript to change the angle brackets. Bypassing this is as simple as disabling JavaScript in the browser. Almost all server-side languages have some utility method that converts some HTML characters into their entity counterparts. For instance, PHP uses htmlentities(), and... | 8,707 |
<p>I would like to read the text and binary attachments in a saved Outlook message (.msg file) from a Java application, without resorting to native code (JNI, Java Native Interface). </p>
<p><a href="http://poi.apache.org/hsmf/index.html" rel="noreferrer">Apache POI-HSMF</a> seems to be in the right direction, but it'... | <ul>
<li><p>You could use Apache POIFS, which
seems to be a little more mature,
but that would appear to duplicate the efforts of POI-HSMF.</p></li>
<li><p>You could use POI-HSMF and contribute changes to get the
features you need working. That's
often how FOSS projects like that expand.</p></li>
<li><p>You
could use ... | <p>Have you tried to use Jython with the Python win32 extensions (<a href="http://www.jython.org/Project/" rel="nofollow noreferrer">http://www.jython.org/Project/</a> + <a href="http://python.net/crew/mhammond/win32/" rel="nofollow noreferrer">http://python.net/crew/mhammond/win32/</a>)?
If this is for a "personal" o... | 9,157 |
<p>In some VB6 code, I have a handler for a TreeView's Collapse event:</p>
<pre><code>Private Sub MyTree_Collapse(ByVal Node as MSComCtlLib.Node)
</code></pre>
<p>This is called whenever a node in the tree is collapsed, whether by the user or programmatically. As it turns out, through some roundabout execution, it m... | <p>I think that like many events in VB, it can't be switched off.</p>
<p>Just set a boolean flag as you've suggested.</p>
| <p>I would declare the flag variable as STATIC in the Sub. This avoids making the variable global and makes it keep its value between calls.</p>
| 3,594 |
<p>I was noticing on a print I had just done that the quality was not up to typical snuff. I had just started using a roll of PLA filament that I had been keeping on a shelf without a wrapper for a couple months. How long can you store filament before it gets too hydrated from the air to print? I expected more than a c... | <p>In <strong>theory</strong>, most filaments don't go bad within a year. However, praxis shows, that averse conditions can impact the filaments over time and age them to unusability.</p>
<p>Among the damaging factors is heat, but most filaments also are hygroscopic and absorb water to some small degree, or even heavil... | <p>To answer your question: it depends on the relative humidity. Generally, a few weeks in a semi-arid environment. But, it'll still print really well. If you're looking for really tight filament diameter tolerances, a week or even less could change the diameter .001 or more if there is moisture in the air. I've used P... | 1,103 |
<p>This would be a question for anyone who has code in the App_Code folder and uses a hardware load balancer. Its true the hardware load balancer could be set to sticky sessions to solve the issue, but in a perfect world, I would like the feature turned off.</p>
<p>When a file in the App_Code folder, and the site is n... | <p>Do you have the <machinekey> node on both servers set to the same value?</p>
<p>You can override the machine.config file in web.config to set this. This needs to match otherwise you can get strange situations like this.</p>
| <p>If it's a hardware load balancer, you shouldn't have an issue, because all that is known there is the request URL, in which the server would compile the requested page and serve it.</p>
<p>the only issue i can think of that you might have is with session and view state.</p>
| 7,355 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.