instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos.</p> <p>Background reading on Kerberos would also be useful </p> <p>Thanks</p> <p>Peter</p>
<p>mod_auth_kerb is a good start: <a href="http://modauthkerb.sourceforge.net/" rel="nofollow noreferrer">http://modauthkerb.sourceforge.net/</a>. If you need Active Directory support, look here: <a href="http://support.microsoft.com/?id=555092" rel="nofollow noreferrer">http://support.microsoft.com/?id=555092</a>.</p>
<p>I found mod_auth_spnego also quite okay, as it can use SSPI on windows instead of requiring MIT Kerberos. <a href="http://sourceforge.net/projects/modgssapache/" rel="nofollow noreferrer">mod_spnego</a></p>
6,504
<p>I'm starting to work with my model almost exclusively in WCF and wanted to get some practical approaches to versioning these services over time. Can anyone point me in the right direction?</p>
<p>There is a good writeup on <a href="http://blogs.msdn.com/craigmcmurtry/archive/2006/07/23/676104.aspx" rel="noreferrer">Craig McMurtry's WebLog</a>. Its from 2006, but most of it is still relevant.</p> <p>As well as a decision tree to walk through the choices, he shows how to implement those changes using Windows Communication Foundation</p>
<p>While not an instant answer for you, I found the book <a href="https://rads.stackoverflow.com/amzn/click/com/0596101627" rel="nofollow noreferrer" rel="nofollow noreferrer">Learning WCF</a> very useful; in it there's a small section on versioning (which is similar to Craig McMurtry's advice posted by Espo). If you're looking for a general intro book, it's very good. Her website has lots of good stuff too: <a href="http://dasblonde.net/" rel="nofollow noreferrer">Das Blonde</a></p> <p><strong>Edit:</strong> No sure why her site isn't responding; it's been a while since I've visited, so maybe she shut it down. No sure.</p>
5,762
<p>I've already asked this question somewhere else but unfortunately I had little luck.</p> <p>So... my Ender 3 Pro extruder just started skipping steps, as in the gears (and the gear pinion) will rotate but the filament won't flow. It all started when I changed PLA filament to a new roll; I thought it might have been the roll faulty so I've tried a spool that had been working fine until 2 hours before it all started. Nope, skipping with that one as well.</p> <p>Here's what I've tried doing so far:</p> <ul> <li>Replaced the stock PTFE tubing with Capricorn tubing.</li> <li>Checked that the tubing is tight and does not have play.</li> <li>Replaced the whole extruder system (except for the extruder motor) with a metal Creality system.</li> <li>Performed various cold pulls.</li> <li>Replaced the nozzle.</li> <li>Upped the extruding temperature from 195&nbsp;°C to 205&nbsp;°C.</li> <li>Checked that there's the correct distance between the bed and the nozzle.</li> <li>Yelled at the printer.</li> <li>Asked for advice to my cats.</li> </ul> <p>None of the above worked, and my cats looked funny at me. Print settings as below:</p> <ul> <li>Filament diameter in the slicer 1.75mm (yes I've checked).</li> <li>Temperature: 195&nbsp;°C, upped to 205&nbsp;°C.</li> <li>Print speed: from 20&nbsp;mm/s for the first layers to 50&nbsp;mm/s for the infill.</li> </ul> <p>I've also reverted back to the old PTFE tubing as I noticed that the Capricorn was giving too much resistance to the filament. Nope, still skipping.</p> <p>I've noticed that the extruder gear grips quite firmly onto the filament, so much so that when it starts slipping it actually eats away the filament until it breaks. It's almost like there's a clog somewhere but the tubing is clear, the hot end is clear (I've cleared it and checked multiple times), and the nozzle is brand new.</p> <p>What else can I try? Have I missed something? Apart from the changes listed above (carried out after the extruder started skipping), the printer is absolutely stock, firmware and everything.</p> <p><strong>UPDATE:</strong> I've changed the factory hot end bloc with a brand new one, changed PTFE tubing one again, making sure it's as close as possible to the nozzle (unscrew nozzle 1/2 turn, fit PTFE, screw nozzle in) but it didn't change anything at all. </p> <p>The extruder still skips steps as it can't push the filament out of the nozzle. Pushing it manually feels nice and smooth until it hits the nozzle, where I can feel too much resistance.</p> <p><strong>UPDATE 2:</strong> I've modifed the following parameters on the EEPROM to limit the filament flow:</p> <pre><code>M203 Z5.00 E25.00 M201 E1000 </code></pre> <p>I've also crancked the temperature up to 220°C but it made no difference whatsoever. What I've noticed is that, after cleaning hot end and tubing, it starts skipping after 1 hour of printing, every single time without fail.</p> <p><strong>UPDATE 3:</strong> I've checked the input voltage from the PSU and it's 24V; the Vref for the extruder is 0.744V, so everything looks as expected.</p> <p><strong>UPDATE 4:</strong> The extruder idler pulley has a compression washer to hold it in place without impeding idle spinning; it is usually mounted in the order idler pulley, compression washer and bolt. I've noticed that the pulley wasn't spinning freely this way, so I inverted the order to compression washer, idler pulley and bolt. The bolt head is small enough not to stop the pulley from spinning.</p> <p>I've also increased the pressure the spring arm excise on the idler pulley, so that the toothed pulley grips more firmly on the filament.</p> <p>This way I've managed to improve things although not solve them. It's been printing for the last 3 and a half hour without skipping but it's not a solution, as the toothed gear is chewing too aggressively on the filament. In just one hour a good deposit of PLA shavings has formed on the extruder, and I had to blow it away, and this never happened before this all started.</p>
<p>So, after some day of yelling and disassembling, I figured out what was the issue. As many were suggesting, I indeed had an issue with the tubing lifting from the nozzle. it was lifting, so PLA was slowly infiltrating where it wasn't supposed to be to the point it created a blockage, resulting in skipping.</p> <p>However, no amount of cleaning and reseating the tubing got rid of it. i've also changed, again, nozzle, tubing and pneumatic fittings to higher quality ones to no avail.</p> <p>I got absolutely fed up and bought a direct drive conversion kit. One of the cheap ones, reusing most of the stock hardware, including stock extruder and gears. The idea, for me, behind it was that the mass of the extruder, and the much shorter length of tubing, meant that the tubing had no space to move around and let the PLA out.</p> <p>It looks like it's working so far, I'm 6 hours in on a 10 hours print with no skipping at all. I also managed to ease the pressure that the extruder arm excise on the filament, so it's not being chewed anymore and I'm not seeing any PLA shavings so far.</p>
<p>I my case helps reducing printing speed, from 100% to 80%. Looks like the filament is cooling noozle to fast. In some large prints at the begining (on first layers) I'm reducing speed to 60%. This looks like the background temperature is not the same in the center and at the borders.</p>
1,631
<p>I've encountered multiple third party .Net component-vendors that use a licensing scheme. On an evaluation copy, the components show up with a nag-screen or watermark or some such indicator. On a licensed machine, a <strong>Licenses.licx</strong> is created - with what appears to be <em>just</em> the assembly full name/identifiers. This file has to be included when the client assembly is built.</p> <ul> <li>How does this model work? Both from component-vendors' and users' perspective.</li> <li>What is the .licx file used for? Should it be checked in? <em>We've had a number of issues with the wrong/right .licx file being checked in and what not</em></li> </ul>
<p>Almost everything about .Net licensing is explained <a href="http://www.developer.com/net/csharp/article.php/3074001" rel="noreferrer">here</a>. No need to rewrite, I think.</p> <p>It is better to exclude license files from project in source control, if you can. Otherwise, editing visual components may be pain in the ass. Also, storing license files in source control repository is not a need.</p> <p>Hope this helps.</p>
<p>This was a good article on the topic: <a href="http://www.textcontrol.com/en_US/blog/archive/20091015/">Click Here</a></p> <p>In order to deploy an application with licensed components like TX Text Control, the EXE file must be licensed properly.</p> <p>The .NET licensing mechanism recommends to add the licenses to the EXE - the calling assembly. </p> <p><strong>---- What happens in detail?</strong></p> <p>If you drag and drop a TextControl from the Visual Studio toolbox to a form, Visual Studio creates a licenses.licx file and includes the license information. This file is located in the same folder like your project file.</p> <p><strong>Important: The licenses.licx file does not include the license string itself. It just contains information about the licensed components</strong>. In case of TX Text Control (TXTextControl.TextControl), the following string is addded:</p> <pre><code>TXTextControl.TextControl, TXTextControl, Version=15.0.700.500, Culture=neutral, PublicKeyToken=6b83fe9a75cfb638 </code></pre> <p>As you can see, it contains the namespace and control name, the assembly version, culture information and the unique public key token. Based on that information, the License Compiler (lc.exe) compiles the real license string that will be embedded into the executable assembly. The lc.exe is a small utility of the .NET Framework SDK which is used by Visual Studio during the build process.</p> <p><strong>---- What if I am using TX Text Control in a user control?</strong></p> <p>In this case, you need to add the license to the main executable as well. Therefore, you can simply drag and drop a TextControl to a dummy form of the main project, so that the licenses.licx file and the references are added automatically.</p> <p>After that, you can remove the TextControl from that form again. Or you can simply copy or create a licenses.licx file to the main project folder. In this case, you need to add a reference to TX Text Control manually as well.</p>
7,442
<p>In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser?</p>
<p>Check out <a href="http://www.bsalsa.com/downloads.html" rel="nofollow noreferrer">http://www.bsalsa.com/downloads.html</a>. This is a series of Delphi components (free source code, you can see an example of this here: <a href="http://staruml.cvs.sourceforge.net/staruml/staruml/staruml/components/plastic-components/src/embeddedwb.pas?revision=1.1&amp;view=markup" rel="nofollow noreferrer">http://staruml.cvs.sourceforge.net/staruml/staruml/staruml/components/plastic-components/src/embeddedwb.pas?revision=1.1&amp;view=markup</a> - it's the starUML projects code) and they have, among other things, a way to get at the history, favorites, etc using the IE MSHTML interfaces. It's written in Object Pascal but it shouldn't be too hard to figure out what's going on. If you download the "Embedded Web Browser Components Package" take a look at the stuff in EmbeddedWB_D2005\Source - there's all sorts of goodies there.</p>
<p>It doesn't look like it's possible.</p> <p>My suggestion would be to catch the <strong>Navigated</strong> event and maintain your own list. A possible problem with that is when the user clicks <em>back</em> in the browser, you don't know to unwind the stack.</p>
7,836
<p>I've searched on the Internet for comparisons between <a href="http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29" rel="noreferrer">F#</a> and <a href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29" rel="noreferrer">Haskell</a> but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other?</p>
<p>Haskell is a "pure" functional language, where as F# has aspects of both imperative/OO and functional languages. Haskell also has lazy evaluation, which is fairly rare amongst functional languages.</p> <p>What do these things mean? A pure functional language, means there are no side effects (or changes in shared state, when a function is called) which means that you are guaranteed that if you call f(x), nothing else happens besides returning a value from the function, such as console output, database output, changes to global or static variables.. and although Haskell can have non pure functions (through monads), it must be 'explicitly' implied through declaration.</p> <p>Pure functional languages and 'No side effect' programming has gained popularity recently as it lends itself well to multi core concurrency, as it is much harder to get wrong with no shared state, rather than myriad locks &amp; semaphores.</p> <p>Lazy evaluation is where a function is NOT evaluated until it is absolutely necessary required. meaning that many operation can be avoided when not necessary. Think of this in a basic C# if clause such as this:</p> <pre><code>if(IsSomethingTrue() &amp;&amp; AnotherThingTrue()) { do something; } </code></pre> <p>If <code>IsSomethingTrue()</code> is false then <code>AnotherThingTrue()</code> method is never evaluated.</p> <p>While Haskell is an amazing language, the major benefit of F# (for the time being), is that it sits on top of the CLR. This lends it self to polyglot programming. One day, you may write your web UI in ASP.net MVC, your business logic in C#, your core algorithms in F# and your unit tests in Ironruby.... All amongst the the .Net framework.</p> <p>Listen to the Software Engineering radio with Simon Peyton Jones for more info on Haskell: <a href="http://www.se-radio.net/2008/08/episode-108-simon-peyton-jones-on-functional-programming-and-haskell/" rel="noreferrer">Episode 108: Simon Peyton Jones on Functional Programming and Haskell</a></p>
<p>Well, for one I'd say a main advantage is that F# compiles against the .NET platform which makes it easy to deploy on windows. I've seen examples which explained using F# combined with ASP.NET to build web applications ;-)</p> <p>On the other hand, Haskell has been around for waaaaay longer, so I think the group of people who are real experts on that language is a lot bigger. </p> <p>For F# I've only seen one real implementation so far, which is the Singularity proof of concept OS. I've seen more real world implementations of Haskell.</p>
6,674
<p>So I was listening to the latest Stackoverflow podcast (<a href="https://blog.stackoverflow.com/2008/08/podcast-19/">episode 19</a>), and Jeff and Joel talked a bit about scaling server hardware as a website grows. From what Joel was saying, the first few steps are pretty standard:</p> <ol> <li>One server running both the webserver and the database (the current Stackoverflow setup)</li> <li>One webserver and one database server</li> <li>Two load-balanced webservers and one database server</li> </ol> <p>They didn't talk much about what comes next though. Do you add more webservers? Another database server? Replicate this three-machine cluster in a different datacenter for redundancy? Where does a web startup go from here in the hardware department?</p>
<p>A reasonable setup supporting an "average" web application might evolve as follows:</p> <ol> <li>Single combined application/database server</li> <li>Separate database on a different machine</li> <li>Second application server with DNS round-robin (poor man's load balancing) or, e.g. <a href="http://www.danga.com/perlbal/" rel="noreferrer">Perlbal</a></li> <li>Second, replicated database server (for read loads, requires some application logic changes so eligible database reads go to a slave)</li> </ol> <p>At this point, evaluating the current state of affairs would help to determine a better scaling path. For example, if read load is high and content doesn't change too often, it might be better to emphasise caching and introduce dedicated front-end caches, e.g. <a href="http://www.squid-cache.org/" rel="noreferrer">Squid</a> to avoid un-needed database reads, although you will need to consider how to maintain <a href="http://en.wikipedia.org/wiki/Cache_coherency" rel="noreferrer">cache coherency</a>, typically in the application.</p> <p>On the other hand, if content changes reasonably often, then you will probably prefer a more spread-out solution; introduce a few more application servers and database slaves to help mitigate the effects, and use object caching, such as <a href="http://www.danga.com/memcached/" rel="noreferrer">memcached</a> to avoid hitting the database for the less volatile content.</p> <p>For most sites, this is probably enough, although if you do become a global phenomenon, then you'll probably want to start considering having hardware in regional data centres, and using tricks such as geographic load balancing to direct visitors to the closest "cluster". By that point, you'll probably be in a position to hire engineers who can really fine-tune things.</p> <p>Probably the most valuable scaling advice I can think of would be to avoid worrying about it all far too soon; concentrate on developing a service people are going to want to use, and making the application reasonably robust. Some easy early optimisations are to make sure your database design is fairly solid, and that indexes are set up so you're not doing anything painfully crazy; also, make sure the application emits cache-control headers that direct browsers on how to cache the data. Doing this sort of work early on in the design can yield benefits later, especially when you don't have to rework the entire thing to deal with cache coherency issues.</p> <p>The second most valuable piece of advice I want to put across is that you shouldn't assume what works for some other web site will work for you; check your logs, run some analysis on your traffic and profile your application - see where your bottlenecks are and resolve them.</p>
<p>If your interested in caching and using .Net, look into the <a href="http://msdn.microsoft.com/en-us/library/cc309103.aspx" rel="nofollow noreferrer">application caching block</a> in enterprise library (of course use this along with the other points above).</p>
5,714
<p>I have been developing web/desktop applications for about 6 years now. During the course of my career, I have come across application that were heavily written in the database using stored procedures whereas a lot of application just had only a few basic stored procedures (to read, insert, edit and delete entity records) for each entity. </p> <p>I have seen people argue saying that if you have paid for an enterprise database use its features extensively. Whereas a lot of "object oriented architects" told me its absolute crime to put anything more than necessary in the database and you should be able to drive the application using the methods on those classes? </p> <p>Where do you think is the balance?</p> <p>Thanks, Krunal</p>
<p>I'm in the object oriented architects camp. It's not necessarily a crime to put code in the database, as long as you understand the caveats that go along with that. Here are some:</p> <ol> <li>It's not debuggable</li> <li>It's not subject to source control</li> <li>Permissions on your two sets of code will be different</li> <li>It will make it more difficult to track where an error in the data came from if you're accessing info in the database from both places</li> </ol>
<p>Well, this one is difficult. As a programmer, you'll want to avoid TSQL and such "Database languages" as much as possible, because they are horrendous, difficult to debug, not extensible and there's nothing you can do with them that you won't be able to do using code on your application.</p> <p>The only reasons I see <em>for</em> writing stored procedures are:</p> <ol> <li>Your database isn't great (think how SQL Server doesn't implement LIMIT and you have to work around that using a procedure.</li> <li>You want to be able to change a behaviour by changing code in just one place without re-deploying your client applications.</li> <li>The client machines have <strong>big</strong> calculation-power constraints (think small embedded devices).</li> </ol> <p>For most applications though, you should try to keep your code in the application where you can debug it, keep it under version control and fix it using all the tools provided to you by your language.</p>
4,286
<p>Does .NET come with a class capable of representing extremely large integers, such as 100 factorial? If not, what are some good third party libraries to accomplish this?</p>
<p>.NET 4 has a <a href="http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx" rel="noreferrer">BigInteger</a> class</p> <blockquote> <p>Represents an arbitrarily large signed integer.</p> <p>The BigInteger type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. This type differs from the other integral types in the .NET Framework, which have a range indicated by their MinValue and MaxValue properties.</p> </blockquote>
<p>Mono has a public BigInteger implementation already:</p> <p><a href="http://www.go-mono.com/docs/index.aspx?link=T:Mono.Math.BigInteger" rel="nofollow noreferrer">http://www.go-mono.com/docs/index.aspx?link=T:Mono.Math.BigInteger</a></p> <p>You can just grab the Mono.Security assembly to use it; since its a Mono class library it should be MIT licensed too.</p>
4,502
<p>I know I did something stupid. I just had to have a SLA 3d printer. The issue being I live in a one bedroom apartment. In the months of owning it I have made lots of amazing pieces, I also for the first time in my life have not only allergies, but sever allergies. I thought I had the flu, and has been most of the last 2-3 months. After making the connection to the symptoms appearing after I got the printer, I sealed the resin vat and removed all cleaning station items from my living space. I had thought I had done "enough" by sealing the printers door, and making sure I could not smell any chemicals, and getting a chemical grade air filter. </p> <p>It's been 2 days, and I'm instantly recovering from my symptoms, and have discontinued allergy medication. </p> <p>Other than not own this type of printer, what kind of setup do I need so that I can safely use this printer? Does anyone sell enclosures or setups for businesses or homes that will solve this issue? </p> <p>I can move the cleaning station to my balcony, as it also has a sink and space. Placing the printer even in an enclosure outside would be hard due to the humidity and extreme pollen we get here. </p>
<p>First things first: Resin is very aggressive. It can very easily make you hypersensitive, even to the fumes of it. So step 1 is easy:</p> <h2>Limit exposure</h2> <p>Wear gloves when working with resin. As you live with your printer in the same room, bottle up the resin right after use and only open it during use to prevent buildup over time and exposure. To further reduce the exposure, leave the room while printing if possible and ventilate the room after bottling the resin again. Possibly even wear breathing protection during operation.</p> <h2>Enclose and seal the machine</h2> <p>To keep the vapors away from you, the machine needs to be enclosed airtight. Any lids need to get a seal, non-opening joints of the frame need to be sealed with a sealant like silicone. Often it is hard to retrofit an enclosure to seal up the workspace.</p> <p>If you want to enclose the full machine, I suggest using glass sheets and silicone sealant for the whole inside. Brace the construction from the outside with L-profiles along the corners and joints. The most tricky part will be the opening hatch and wiring/ducting access hole. The opening seal needs a sealing lid all around that gets compressed on closing the machine up and some kind of lock to keep it this way. The air filtration and wire access are just hard to make because of their circular shape. You might want to use a wooden or metal base plate, so it is best to put ventilation through the base. In case of wood, afterward coat the inside surface with a thin layer of an airtight material, such as epoxy resin or silicone.</p> <h2>Low presssure operation by ventilating the machine</h2> <p>The next best thing to isolating the machine workspace from the air completely is to make it a low-pressure operation. This means that you evacuate the air from the machine. The imperfect seals now work against a high pressure outside and low pressure inside, meaning that the flow in any non-sealed spot only knows one direction: into the machine.</p> <h3>Ventilation outside...</h3> <p><a href="https://3dprinting.stackexchange.com/a/8595/8884">Fred's answer</a> provides good basics on how to do this in general by using parts for Laser evacuation. This is also the most space-economic way.</p> <h3>...and filtering.</h3> <p>But there are (partial) indoor solutions even, based on ventilating the air from the printer into a multi-stage air filter could reduce or eliminate the amount of chemical exposure. This is not a slim piece of foam, it is a boxy setup with about 3 to 6 stages of filtering. Among dry-filters, a paint-filter in combination with an active coal one should eliminate a large portion of irritants from the stream, but might still need to be vented outside to reduce exposure even more. A 'wet' air filter, where the exhaust of the machine is pearled through a basin of a cleaning liquid (often water or a solvent like isopropylic alcohol) like in an aquarium could help to catch even more chemicals but is bulky.</p>
<p>One of the options you have would be to create a negative pressure in your working area. This would be accomplished by installing a fan with the flow direction to the outside. The inside portion of the fan should have ducting that terminates near your printer. You could place your printer in something elaborate, or in something as simple as a large cardboard box and attach the ducting to the box.</p> <p>As the fan operates, air would be pulled from an open window elsewhere in the room and travel into the cardboard box. It would carry fumes from the printer to the fan and out of the building.</p> <p>I have a CO2 laser which generates large amounts of smoke. Part of the installation includes a powerful blower not placed in the window, but with ducting from the machine and to a panel in the window frame. I used scrap plastic to make a baffle that accepted the ducting while blocking the rest of the window.</p> <p><a href="https://i.stack.imgur.com/95i9o.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/95i9o.jpg" alt="laser cutter blower"></a></p> <p>Squirrel-cage blowers provide powerful airflow but you may not need something as expensive as a laser cutter blower. A boat bilge blower might be sufficient to provide clearing airflow for your printer.</p> <p><a href="https://i.stack.imgur.com/XeNCj.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/XeNCj.jpg" alt="bilge blower"></a></p> <p>Additionally, a small bilge blower such as that shown above will use smaller diameter ducting, which would be easier to find and less expensive. The bilge blower in the picture provides for an in and out attachment, while the not-really-a-laser-cutter blower in the picture does not. A true laser cutter blower has ducting attachments for input and output.</p> <p>One characteristic of this type of clearing system is that outside air will possibly change the temperature of the room/building. During the winter, the rest of my house got noticeably cooler while the exhaust fan was operating.</p>
1,265
<p>Real strange.</p> <p>I cannot find a tool that enables one to display a SVN repository in graphical form.<br /> I would like the ability to see changes in revision / time , branch / time graphs.</p> <p>Does anyone know of one. <strong>Ideally it would be platform neutral or even better web based</strong>.</p> <p>Solutions offered so far in brief:</p> <ul> <li>svn-graph</li> <li><a href="http://www.atlassian.com/software/fisheye/" rel="nofollow noreferrer">Fisheye</a> ( you want how much !£?* )</li> </ul>
<p><a href="http://www.atlassian.com/software/fisheye/" rel="noreferrer">Fisheye</a>, from Atlassian, looks at an SVN repository and can show you a few graphs. Also provides a handy web interface for blame, diff, etc.</p> <p>for example, some sample images at <a href="http://fisheye2.atlassian.com/chart/~charttype=Pie,stacktype=Author,extn=.java,extn=.js,extn=.jsp,extn=.xml/google-guice" rel="noreferrer">one of the demo servers:</a> </p> <ol> <li><img src="https://fisheye2.atlassian.com/fe/locChart.do?w=700&amp;h=400&amp;yaxistype=Full&amp;maxitems=10&amp;extn=.java&amp;extn=.js&amp;extn=.jsp&amp;extn=.xml&amp;charttype=Pie&amp;stacktype=Author&amp;context=main&amp;repname=google-guice&amp;outputtype=image" alt="pie chart"></li> <li><img src="https://fisheye2.atlassian.com/fe/locChart.do?w=700&amp;h=400&amp;yaxistype=Full&amp;maxitems=10&amp;extn=.java&amp;extn=.js&amp;extn=.jsp&amp;extn=.xml&amp;charttype=Change&amp;stacktype=Author&amp;context=main&amp;repname=google-guice&amp;outputtype=image" alt="line change"></li> </ol> <p>And if you like some pretty code metrics, <a href="http://fisheye6.atlassian.com/plugins/servlet/code-metrics/ofbiz" rel="noreferrer">here are some samples</a>.</p>
<p>You could also try <a href="http://mpy-svn-stats.berlios.de/" rel="nofollow noreferrer">MPY SVN STATS</a>. <a href="http://mpy-svn-stats.berlios.de/zope-stats/" rel="nofollow noreferrer">Here</a> is an example graph for Zope.</p>
3,407
<p>I've got a combo-box that sits inside of a panel in Flex 3. Basically I want to fade the panel using a Fade effect in ActionScript. I can get the fade to work fine, however the label of the combo-box does not fade. I had this same issue with buttons and found that their fonts needed to be embedded. No problem. I embedded the font that I was using and the buttons' labels faded correctly. I've tried a similar approach to the combo-box, but it does not fade the selected item label.</p> <p>Here is what I've done so far: Embed code for the font at the top of my MXML in script:</p> <pre><code>[Embed("assets/trebuc.ttf", fontName="TrebuchetMS")] public var trebuchetMSFont:Class; </code></pre> <p>In my init function</p> <pre><code>//register the font. Font.registerFont(trebuchetMSFont); </code></pre> <p>The combobox's mxml:</p> <pre><code>&lt;mx:ComboBox id="FilterFields" styleName="FilterDropdown" left="10" right="10" top="10" fontSize="14"&gt; &lt;mx:itemRenderer&gt; &lt;mx:Component&gt; &lt;mx:Label fontSize="10" /&gt; &lt;/mx:Component&gt; &lt;/mx:itemRenderer&gt; &lt;/mx:ComboBox&gt; </code></pre> <p>And a style that I wrote to get the fonts applied to the combo-box:</p> <pre><code>.FilterDropdown { embedFonts: true; fontFamily: TrebuchetMS; fontWeight: normal; fontSize: 12; } </code></pre> <p>The reason I had to write a style instead of placing it in the "FontFamily" attribute was that the style made all the text on the combo-box the correct font where the "FontFamily" attribute only made the items in the drop-down use the correct font. ­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Hmm, I am not sure why that isn't working for you. Here is an example of how I got it to work:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="fx.play([panel])"&gt; &lt;mx:Style&gt; @font-face { src: local("Arial"); fontFamily: ArialEm; } @font-face { src: local("Arial"); fontFamily: ArialEm; fontWeight: bold; } @font-face { src: local("Arial"); fontFamily: ArialEm; font-style: italic; } &lt;/mx:Style&gt; &lt;mx:XML id="items" xmlns=""&gt; &lt;items&gt; &lt;item label="Item 1" /&gt; &lt;item label="Item 2" /&gt; &lt;item label="Item 3" /&gt; &lt;/items&gt; &lt;/mx:XML&gt; &lt;mx:Panel id="panel" x="10" y="10" width="250" height="200" layout="absolute"&gt; &lt;mx:ComboBox fontFamily="ArialEm" x="35" y="10" dataProvider="{items.item}" labelField="@label"&gt;&lt;/mx:ComboBox&gt; &lt;/mx:Panel&gt; &lt;mx:Fade id="fx" alphaFrom="0" alphaTo="1" duration="5000" /&gt; &lt;/mx:Application&gt; </code></pre> <p>Hope this helps you out.</p>
<p>Thanks for your help. Had exactly the same problem. The trick is in the embedding the "bold" version of the font you are using. Even though the font in your ComboBox isn't set to Bold ...</p>
3,900
<p>I'm looking at improving the performance of some SQL, currently CTEs are being used and referenced multiple times in the script. Would I get improvements using a table variable instead? (Can't use a temporary table as the code is within functions).</p>
<p>You'll really have to performance test - There is no Yes/No answer. As per Andy Living's post above links to, a CTE is just shorthand for a query or subquery. </p> <p>If you are calling it twice or more in the same function, you might get better performance if you fill a table variable and then join to/select from that. However, as table variables take up space somewhere, and don't have indexes/statistics (With the exception of any declared primary key on the table variable) there's no way of saying which will be faster.</p> <p>They both have costs and savings, and which is the best way depends on the data they pull in and what they do with it. I've been in your situation, and after testing for speed under various conditions - Some functions used CTEs, and others used table variables.</p>
<p><strong>Advantages of CTE</strong></p> <p>CTE can be termed as 'Temporary View' used as a good alternative for a View in some cases. The main advantage over a view is usage of memory. As CTE's scope is limited only to its batch, the memory allocated for it is flushed as soon as its batch is crossed. But once a view is created, it is stored until user drops it. If the view is not used after creation then it's a mere waste of memory. CPU cost for CTE execution is lesser when compared to that of View. Like View, CTE doesn't store any metadata of its definition and provides better readability. A CTE can be referred for multiple times in a query. As the scope is limited to the batch, multiple CTEs can have the same name which a view cannot have. It can be made recursive.</p> <p><strong>Disadvantages of CTE</strong></p> <p>Though using CTE is advantageous, it does have some limitations to be kept in mind, We knew that it is a substitute for a view but a CTE cannot be nested while Views can be nested. View once declared can be used for any number of times but CTE cannot be used. It should be declared every time you want to use it. For this scenario, CTE is not recommended to use as it is a tiring job for user to declare the batches again and again. Between the anchor members there should be operators like UNION, UNION ALL or EXCEPT etc. In Recursive CTEs, you can define many Anchor Members and Recursive Members but all the Anchor Members must be defined before the first Recursive Member. You cannot define an Anchor Member between two Recursive Member. The number of columns, the data types used in Anchor and Recursive Members should be same. In Recursive Member, aggregate functions like TOP, operator like DISTINCT, clause like HAVING and GROUP BY, Sub-queries, joins like Left Outer or Right Outer or Full Outer are not allowed. Regarding Joins, only Inner Join is allowed in Recursive Member. Recursion Limit is 32767, crossing which results in the crash of server due to infinite loop.</p>
7,777
<p>I've been using StructureMap recently and have enjoyed the experience thoroughly. However, I can see how one can easily get carried away with interfacing everything out and end up with classes that take in a boatload of interfaces into their constructors. Even though that really isn't a huge problem when you're using a dependency injection framework, it still feels that there are certain properties that really don't need to be interfaced out just for the sake of interfacing them.</p> <p>Where do you draw the line on what to interface out vs just adding a property to the class?</p>
<p>The main problem with dependency injection is that, while it gives the appearance of a loosely coupled architecture, it really doesn't.</p> <p>What you're really doing is moving that coupling from the compile time to the runtime, but still if class A needs some interface B to work, an instance of a class which implements interface B needs still to be provided.</p> <p>Dependency injection should only be used for the parts of the application that need to be changed dynamically without recompiling the base code.</p> <p>Uses that I've seen useful for an Inversion of Control pattern:</p> <ul> <li>A plugin architecture. So by making the right entry points you can define the contract for the service that must be provided.</li> <li>Workflow-like architecture. Where you can connect several components dynamically connecting the output of a component to the input of another one.</li> <li>Per-client application. Let's say you have various clients which pays for a set of "features" of your project. By using dependency injection you can easily provide just the core components and some "added" components which provide just the features the client have paid.</li> <li>Translation. Although this is not usually done for translation purposes, you can "inject" different language files as needed by the application. That includes RTL or LTR user interfaces as needed.</li> </ul>
<p>Another item I wrestle with is <em>where should I use dependency injection?</em> Where do you take your dependency on StructureMap? Only in the startup application? Does that mean all the implementations have to be handed all the way down from the top-most layer to the bottom-most layer?</p>
4,809
<p>I have an element which may contain very big amounts of data, but I don't want it to ruin the page layout, so I set <code>max-height: 100px</code> and <code>overflow:auto</code>, hoping for scrollbars to appear when the content does not fit. </p> <p>It all works fine in Firefox and IE7, but IE8 behaves as if <code>overflow:hidden</code> was present instead of <code>overflow:auto</code>. </p> <p>I tried <code>overflow:scroll</code>, still does not help, IE8 simply truncates the content without showing scrollbars. Changing <code>max-height</code> declaration to <code>height</code> makes overflow work OK, it's the combination of <code>max-height</code> and <code>overflow:auto</code> that breaks things.</p> <p>This is also logged as an <a href="http://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=408759" rel="noreferrer">official bug in the final, release version of IE8</a></p> <p>Is there a workaround? For now I resorted to using <code>height</code> instead of <code>max-height</code>, but it leaves plenty of empty space in case there isn't much data.</p>
<p>This is a really nasty bug as it affects us heavily on Stack Overflow with <code>&lt;pre&gt;</code> code blocks, which have <code>max-height:600</code> and <code>width:auto</code>.</p> <p>It is logged as a bug in the final version of IE8 with no fix.</p> <p><a href="http://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=408759" rel="noreferrer">http://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=408759</a></p> <p>There is a really, really hacky CSS workaround:</p> <p><a href="http://my.opera.com/dbloom/blog/2009/03/11/css-hack-for-ie8-standards-mode" rel="noreferrer">http://my.opera.com/dbloom/blog/2009/03/11/css-hack-for-ie8-standards-mode</a></p> <pre class="lang-css prettyprint-override"><code>/* SUPER nasty IE8 hack to deal with this bug */ pre { max-height: none\9 } </code></pre> <p>and of course conditional CSS as others have mentioned, but I dislike that because it means you're serving up extra HTML cruft in every page request.</p>
<p>I found this : <a href="https://perishablepress.com/maximum-and-minimum-height-and-width-in-internet-explorer/" rel="nofollow">https://perishablepress.com/maximum-and-minimum-height-and-width-in-internet-explorer/</a></p> <blockquote> <p>This method has been verified in IE6 and should also work in IE5. Simply change the values to suit your needs (code commented with explanatory notes). In this example, we are setting the max-height at 333px 1 for IE and all standards-compliant browsers:</p> <p><code>* html div#division { height: expression( this.scrollHeight &gt; 332 ? "333px" : "auto" ); /* sets max-height for IE */ }</code></p> </blockquote> <p>and this works for me perfectly so I decided to share this. </p>
2,931
<p>Word wrap is one of the must-have features in a modern text editor.</p> <p>How word wrap be handled? What is the best algorithm for word-wrap?</p> <p>If text is several million lines, how can I make word-wrap very fast?</p> <p>Why do I need the solution? Because my projects must draw text with various zoom level and simultaneously beautiful appearance.</p> <p>The running environment is Windows Mobile devices. The maximum 600&nbsp;MHz speed with very small memory size.</p> <p>How should I handle line information? Let's assume original data has three lines.</p> <pre><code>THIS IS LINE 1. THIS IS LINE 2. THIS IS LINE 3. </code></pre> <p>Afterwards, the break text will be shown like this:</p> <pre><code>THIS IS LINE 1. THIS IS LINE 2. THIS IS LINE 3. </code></pre> <p>Should I allocate three lines more? Or any other suggestions? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Here is a word-wrap algorithm I've written in C#. It should be fairly easy to translate into other languages (except perhaps for <code>IndexOfAny</code>).</p> <pre class="lang-cs prettyprint-override"><code>static char[] splitChars = new char[] { ' ', '-', '\t' }; private static string WordWrap(string str, int width) { string[] words = Explode(str, splitChars); int curLineLength = 0; StringBuilder strBuilder = new StringBuilder(); for(int i = 0; i &lt; words.Length; i += 1) { string word = words[i]; // If adding the new word to the current line would be too long, // then put it on a new line (and split it up if it's too long). if (curLineLength + word.Length &gt; width) { // Only move down to a new line if we have text on the current line. // Avoids situation where wrapped whitespace causes emptylines in text. if (curLineLength &gt; 0) { strBuilder.Append(Environment.NewLine); curLineLength = 0; } // If the current word is too long to fit on a line even on it's own then // split the word up. while (word.Length &gt; width) { strBuilder.Append(word.Substring(0, width - 1) + "-"); word = word.Substring(width - 1); strBuilder.Append(Environment.NewLine); } // Remove leading whitespace from the word so the new line starts flush to the left. word = word.TrimStart(); } strBuilder.Append(word); curLineLength += word.Length; } return strBuilder.ToString(); } private static string[] Explode(string str, char[] splitChars) { List&lt;string&gt; parts = new List&lt;string&gt;(); int startIndex = 0; while (true) { int index = str.IndexOfAny(splitChars, startIndex); if (index == -1) { parts.Add(str.Substring(startIndex)); return parts.ToArray(); } string word = str.Substring(startIndex, index - startIndex); char nextChar = str.Substring(index, 1)[0]; // Dashes and the likes should stick to the word occuring before it. Whitespace doesn't have to. if (char.IsWhiteSpace(nextChar)) { parts.Add(word); parts.Add(nextChar.ToString()); } else { parts.Add(word + nextChar); } startIndex = index + 1; } } </code></pre> <p>It's fairly primitive - it splits on spaces, tabs and dashes. It does make sure that dashes stick to the word before it (so you don't end up with stack\n-overflow) though it doesn't favour moving small hyphenated words to a newline rather than splitting them. It does split up words if they are too long for a line.</p> <p>It's also fairly culturally specific, as I don't know much about the word-wrapping rules of other cultures.</p>
<p>@ICR, thanks for sharing the C# example.</p> <p>I did not succeed using it, but I came up with another solution. If there is any interest in this, please feel free to use this: <em><a href="https://web.archive.org/web/20160403050733/http://johan.andersson.net/2010/11/03/wordwrap-function-in-c/" rel="nofollow noreferrer">WordWrap function in C#</a></em>. The source is available <a href="https://github.com/anderssonjohan/snippets/tree/master/wordwrap" rel="nofollow noreferrer">on GitHub</a>.</p> <p>I've included unit tests / samples.</p>
3,819
<p><code>std::swap()</code> is used by many std containers (such as <code>std::list</code> and <code>std::vector</code>) during sorting and even assignment.</p> <p>But the std implementation of <code>swap()</code> is very generalized and rather inefficient for custom types.</p> <p>Thus efficiency can be gained by overloading <code>std::swap()</code> with a custom type specific implementation. But how can you implement it so it will be used by the std containers?</p>
<p>The right way to overload <code>std::swap</code>'s implemention (aka specializing it), is to write it in the same namespace as what you're swapping, so that it can be found via <a href="https://en.cppreference.com/w/cpp/language/adl" rel="noreferrer">argument-dependent lookup (ADL)</a>. One particularly easy thing to do is:</p> <pre><code>class X { // ... friend void swap(X&amp; a, X&amp; b) { using std::swap; // bring in swap for built-in types swap(a.base1, b.base1); swap(a.base2, b.base2); // ... swap(a.member1, b.member1); swap(a.member2, b.member2); // ... } }; </code></pre>
<p>While it's correct that one shouldn't generally add stuff to the std:: namespace, adding template specializations for user-defined types is specifically allowed. Overloading the functions is not. This is a subtle difference :-)</p> <blockquote> <p>17.4.3.1/1 It is undefined for a C++ program to add declarations or definitions to namespace std or namespaces with namespace std unless otherwise specified. A program may add template specializations for any standard library template to namespace std. Such a specialization (complete or partial) of a standard library results in undefined behaviour unless the declaration depends on a user-defined name of external linkage and unless the template specialization meets the standard library requirements for the original template. </p> </blockquote> <p>A specialization of std::swap would look like:</p> <pre><code>namespace std { template&lt;&gt; void swap(myspace::mytype&amp; a, myspace::mytype&amp; b) { ... } } </code></pre> <p>Without the template&lt;> bit it would be an overload, which is undefined, rather than a specialization, which is permitted. @Wilka's suggest approach of changing the default namespace may work with user code (due to Koenig lookup preferring the namespace-less version) but it's not guaranteed to, and in fact isn't really supposed to (the STL implementation ought to use the fully-qualified std::swap).</p> <p>There is a <a href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/b396fedad7dcdc81" rel="noreferrer">thread on comp.lang.c++.moderated</a> with a <strong>long</strong> dicussion of the topic. Most of it is about partial specialization, though (which there's currently no good way to do).</p>
3,265
<p>So I get that most of you are frowning at me for not currently using any source control. I want to, I really do, now that I've spent some time reading the questions / answers here. I am a hobby programmer and really don't do much more than tinker, but I've been bitten a couple of times now not having the 'time machine' handy...</p> <p>I still have to decide which product I'll go with, but that's not relevant to this question.</p> <p>I'm really struggling with the flow of files under source control, so much so I'm not even sure how to pose the question sensibly.</p> <p>Currently I have a directory hierarchy where all my PHP files live in a Linux Environment. I edit them there and can hit refresh on my browser to see what happens.</p> <p>As I understand it, my files now live in a different place. When I want to edit, I check it out and edit away. But what is my substitute for F5? How do I test it? Do I have to check it back in, then hit F5? I admit to a good bit of trial and error in my work. I suspect I'm going to get tired of checking in and out real quick for the frequent small changes I tend to make. I have to be missing something, right?</p> <p>Can anyone step me through where everything lives and how I test along the way, while keeping true to the goal of having a 'time machine' handy?</p>
<p>Eric Sink has a great <a href="http://www.ericsink.com/scm/source_control.html" rel="noreferrer">series of posts</a> on source control basics. His company (Sourcegear) makes a source control tool called Vault, but the how-to is generally pretty system agnostic.</p>
<p>If you are using Subversion, you check out your files <em>once</em> . Then, whenever you have made big changes (or are going to lunch or whatever), you <em>commit</em> them to the server. That way you can keep your old work flow by pressing F5, but every time you <em>commit</em> you save a copy of all the files in their current state in your SVN-repository.</p>
9,265
<p>I'm attempting to create a dataset based on the properties of an object. For example, I have an instance of a Person class with properties including ID, Forename, Surname, DOB etc. Using reflection, I'm adding columns to a new dataset based on the object properties:</p> <pre><code>For Each pi As PropertyInfo In person.GetType().GetProperties() Dim column As New DataColumn(pi.Name, pi.PropertyType) table.Columns.Add(column) Next </code></pre> <p>My problem is that some of those properies are nullable types which aren't supported by datasets. Is there any way to extract the underlying system type from a nullable type?</p> <p>Thanks.</p>
<p>Here's your answer, in VB. This may be overkill for your purposes, but it also might be useful to some other folks.</p> <p>First off, here's the code to find out if you're dealing with a Nullable type:</p> <pre><code>Private Function IsNullableType(ByVal myType As Type) As Boolean Return (myType.IsGenericType) AndAlso (myType.GetGenericTypeDefinition() Is GetType(Nullable(Of ))) End Function </code></pre> <p>Note the unusual syntax in the GetType. It's necessary. Just doing GetType(Nullable) as one of the commentors suggested did not work for me.</p> <p>So, armed with that, you can do something like this... Here, in an ORM tool, I am trying to get values into a generic type that may or not be Nullable:</p> <pre><code>If (Not value Is Nothing) AndAlso IsNullableType(GetType(T)) Then Dim UnderlyingType As Type = Nullable.GetUnderlyingType(GetType(T)) Me.InnerValue = Convert.ChangeType(value, UnderlyingType) Else Me.InnerValue = value End If </code></pre> <p>Note that I check for Nothing in the first line because Convert.ChangeType will choke on it... You may not have that problem, but my situation is extremely open-ended.</p> <p>Hopefully if I didn't answer your question directly, you can cannibalize this and get you where you need to go - but I just implemented this moments ago, and my tests are all passing. </p>
<p>@Mendelt Siebenga: You can only call GetType on the value property if the variable is not set to null; otherwise, you'll get an exception.</p> <p>What you want to do is use the "GetValueOrDefault" property and call GetType on that, since you are guaranteed it will not be null. Example:</p> <pre><code>Dim i As Nullable(Of Integer) = Nothing Dim t As Type = i.GetValueOrDefault().GetType() </code></pre>
5,711
<p>My application is using <strong>Dojo 1.1.1</strong> on an <em>SSL-only</em> website. It is currently taking advantage of <code>dijit.ProgressBar</code> and a <code>dijit.form.DateTextBox</code>.</p> <p>Everything works fabulous in <em>Firefox 2 &amp; 3</em>, but as soon as I try the same scripts in <em>IE7</em> the results are an annoying Security Information dialog:</p> <blockquote> <p>This page contains both secure and non-secure items. Do you want to display the non-secure items?</p> </blockquote> <p>I have scrutinized the page for any <em>non-HTTPS</em> reference to no avail. It appears to be something specific to <code>dojo.js</code>. There use to be an <code>iframe</code> glitch where the <code>src</code> was set to nothing, but this appears to be fixed now (on review of the source).</p> <p>Anyone else having this problem? What are the best-practices for getting <em>Dojo</em> to play well with <em>IE</em> on an <em>SSL-only</em> web server?</p>
<p>After reviewing the JavaScript sourcecode for Dijit, I thought it was likely the error results from an "insecure" refrence to a dynamically generated IFRAME. Note there are two versions of the script file, the uncompressed represents the original source (dijit.js.uncompressed.js) and the standard (dijit.js) has been compressed for optimal transfer time. </p> <p>Since the uncompressed version is the most readable, I will describe my solution based on that. At line #1023, an IFRAME is rendered in JavaScript:</p> <pre><code>if(dojo.isIE){ var html="&lt;iframe src='javascript:\"\"'" + " style='position: absolute; left: 0px; top: 0px;" + "z-index: -1; filter:Alpha(Opacity=\"0\");'&gt;"; iframe = dojo.doc.createElement(html); }else{... </code></pre> <p>What's the problem? IE doesn't know if the src for the IFRAME is "secure" - so I replaced it with the following:</p> <pre><code>if(dojo.isIE){ var html="&lt;iframe src='javascript:void(0);'" + " style='position: absolute; left: 0px; top: 0px;" + "z-index: -1; filter:Alpha(Opacity=\"0\");'&gt;"; iframe = dojo.doc.createElement(html); }else{... </code></pre> <p>This is the most common problem with JavaScript toolkits and SSL in IE. Since IFRAME's are used as shims due to poor overlay support for DIV's, this problem is extremely prevalent. </p> <p>My first 5-10 page reloads are fine, but then the security error starts popping up again. How is this possible? The same page is "secure" for 5 reloads and then it is selected by IE as "insecure" when loaded the 6th time.</p> <p>As it turns out, there is also a background image being set in the onload event for dijit.wai (line #1325). This reads something like this;</p> <pre><code>div.style.cssText = 'border: 1px solid;' + 'border-color:red green;' + 'position: absolute;' + 'height: 5px;' + 'top: -999px;' + 'background-image: url("' + dojo.moduleUrl("dojo", "resources/blank.gif") + '");'; </code></pre> <p>This won't work because the background-image tag doesn't include HTTPs. Despite the fact that the location is relative, IE7 doesn't know if it's secure so the warning is posed.</p> <p>In this particular instance, this CSS is used to test for Accessibility (A11y) in Dojo. Since this is not something my application will support and since there are other general buggy issues with this method, I opted to remove everything in the onload() for dijit.wai.</p> <p>All is good! No sporadic security problems with the page loads.</p>
<p>If your page is loading files from a non-https URL Firefox should tell you the same thing. Instead of an error the lock symbol at the bottom (in the status bar) should be crossed out. Are you sure that is not the case?</p> <p>If you see the symbol, click on it and check which files are "unsecure".</p>
8,441
<p>Sometimes I notice that if I manually command a single axis movement (typically Z, when I want better access to the extruder), I observe that several channels move together (and they maybe move slower than I expect). After one 'coupled' movement, subsequent commands have the result I'm expecting.</p> <p>What happens is as well as the Z-axis moving up, the bed moves forward, and the extruder moves to the right. I have no auto-leveling or anything else non-standard on this printer (dual Z steppers, X, Y, extruder, bed, extruder heat).</p> <p>It even happens if I simply extrude some of the time (e.g. changing filament after warming up, retract gave me some X movement)</p> <p>Printer is an ANET-A8, I'm using mainly OctoPrint, but I think I've also observed this with other PC software manual controls.</p> <p>It doesn't happen often enough for me to have identified any pattern - maybe it only happens if I've not homed first after turning the printer on, but I suspect not.</p> <p>It's not so much of a problem, as just a question for interest. Also not sure how to tag.</p>
<p>This is easily explained - it's the stepper motors getting powered up. Stepper motors even if not moving are constantly powered up and actively hold the position they are in exactly at the stepping point where they are.</p> <p>If you power down the machine or if the board disables the stepper drivers to save energy or because the power is offline then the stepper motors can get in between steps. When powering on then the movement is quite noticeable on some cheaper motors where the inrushing current can kick the motor over multiple steps before it locks down into position.</p> <p>You can test this, try to move one of the axis manually by hand (not too fast to not damage the board by providing it too much current) if the printer is powered of it does move pretty easily. Then power the printer on, it should still move pretty easily by hand. Now execute one move command on the axis via the printer board. Afterwards you should not be able to move the axis by hand anymore (or at least not without unnecessarily excessive force).</p>
<p>This is easily explained - it's the stepper motors getting powered up. Stepper motors even if not moving are constantly powered up and actively hold the position they are in exactly at the stepping point where they are.</p> <p>If you power down the machine or if the board disables the stepper drivers to save energy or because the power is offline then the stepper motors can get in between steps. When powering on then the movement is quite noticeable on some cheaper motors where the inrushing current can kick the motor over multiple steps before it locks down into position.</p> <p>You can test this, try to move one of the axis manually by hand (not too fast to not damage the board by providing it too much current) if the printer is powered of it does move pretty easily. Then power the printer on, it should still move pretty easily by hand. Now execute one move command on the axis via the printer board. Afterwards you should not be able to move the axis by hand anymore (or at least not without unnecessarily excessive force).</p>
624
<p>I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. </p> <p>Here's a paired down example of my template to illustrate the problem.</p> <pre><code>&lt;div style="float:left; width: 150px; border: 1px solid;"&gt; &lt;ul&gt; &lt;li&gt;nav1&lt;/li&gt; &lt;li&gt;nav2&lt;/li&gt; &lt;li&gt;nav3&lt;/li&gt; &lt;li&gt;nav4&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div style="float:left; width: 250px"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna .... &lt;/div&gt; </code></pre>
<p>Your simplest answer lies in the next version of css (3), which currently no browser supports.</p> <p>For now you are relegated to calculating heights in javascript and setting them on the left side. </p> <p>If the navigation is so important to be positioned in such a way, run it along the top.</p> <p>you could also do a visual trick by moving the borders to the container and the bigger inner, and make it appear to be the same size.</p> <p>this makes it look the same, but it isn't.</p> <pre><code>&lt;div style="border-left:solid 1px black;border-bottom:solid 1px black;"&gt; &lt;div style="float:left; width: 150px; border-top: 1px solid;"&gt; &lt;ul&gt; &lt;li&gt;nav1&lt;/li&gt; &lt;li&gt;nav2&lt;/li&gt; &lt;li&gt;nav3&lt;/li&gt; &lt;li&gt;nav4&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div style="float:left; width: 250px; border:solid 1px black;border-bottom:0;"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna Lorem ipsum dolor sit amet, consectetur adipisicing elit, ... &lt;/div&gt; &lt;div style="clear:both;" &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>
<p>@hoyhoy</p> <p>If a designer can make this work in html, then he can have this design. If he is a true master of web design, he will realize that this is a limitation of the media, as video is not possible in magazine ads.</p> <p>If he would like to simulate weight by giving the 2 columns equal importance, than change the borders, so that they appear to be of the same weight, and make the colors of the borders contrast to the font color of the columns. </p> <p>But as for making the physical elements the same height, you can only do that with a table construct, or setting the heights, at this point in time. To simulate them appearing the same size, they don't have to be the same size.</p>
5,624
<p>I bought some heating block cotton to insulate the exposed surface of my hot end. I thought the yellow as double-sticky but it appears to be Kapton.</p> <p>What can I use to attach it to the extruder?</p> <p><a href="https://i.stack.imgur.com/9FFOY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9FFOY.jpg" alt="enter image description here"></a></p> <p>My extruder is already covered on four sides. I want to cover the other two.<a href="https://i.stack.imgur.com/VLyKX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VLyKX.png" alt="enter image description here"></a></p>
<p>Kapton tape would be the logical material. It's unfortunate that your vendor did not supply that as a separate item, rather than sticking it to the "cotton" (I'm guessing not actually cotton, as things might get a bit scorching for cotton, so I'm assuming some type of ceramic fiber or the like.)</p>
<p>Not quite the answer to the question but closely related, so I venture. I use ordinary wool thread to insulate the hot end. I just wrap it carefully so it is covered everywhere. Very low cost, very effective. Wool can handle even the hottest extrusion temperatures easily.</p>
641
<p>Is there any way to get the ID of the element that fires an event?</p> <p>I'm thinking something like:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { $("a").click(function() { var test = caller.id; alert(test.val()); }); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type="text/javascript" src="starterkit/jquery.js"&gt;&lt;/script&gt; &lt;form class="item" id="aaa"&gt; &lt;input class="title"&gt;&lt;/input&gt; &lt;/form&gt; &lt;form class="item" id="bbb"&gt; &lt;input class="title"&gt;&lt;/input&gt; &lt;/form&gt;</code></pre> </div> </div> </p> <p>Except of course that the var <code>test</code> should contain the id <code>"aaa"</code>, if the event is fired from the first form, and <code>"bbb"</code>, if the event is fired from the second form.</p>
<p>In jQuery <code>event.target</code> always refers to the element that triggered the event, where <code>event</code> is the parameter passed to the function. <a href="http://api.jquery.com/category/events/event-object/" rel="noreferrer">http://api.jquery.com/category/events/event-object/</a></p> <pre><code>$(document).ready(function() { $("a").click(function(event) { alert(event.target.id); }); }); </code></pre> <p>Note also that <code>this</code> will also work, but that it is not a jQuery object, so if you wish to use a jQuery function on it then you must refer to it as <code>$(this)</code>, e.g.:</p> <pre><code>$(document).ready(function() { $("a").click(function(event) { // this.append wouldn't work $(this).append(" Clicked"); }); }); </code></pre>
<p>I'm working with </p> <blockquote> <p>jQuery Autocomplete</p> </blockquote> <p>I tried looking for an <code>event</code> as described above, but when the request function fires it doesn't seem to be available. I used <code>this.element.attr("id")</code> to get the element's ID instead, and it seems to work fine.</p>
7,061
<p>I want to write a front-end to an application written in C/C++. </p> <p>I use Solaris 10 and plan to port the application to some other architectures (Windows first).</p>
<p>I'd recommend taking a look at <a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> to provide some cross platform UI widgets that will work on Solaris and Windows.</p>
<p>I use <a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> myself. It makes good use of the C++ language features and uses smart pointers, so object and memory management is not that hard. In fact, it feels like writing in a scripting language.</p> <p>Coupled with a dialog editor/code generator like <a href="http://wxformbuilder.org/wp-content/uploads/wxfb_v30-beta3-002.png" rel="nofollow noreferrer">wxFormBuilder</a> or <a href="http://www.roebling.de/snap1.gif" rel="nofollow noreferrer">wxDesigner</a>, (links to screenshots) it becomes a good toolkit for rapid development.</p>
4,921
<p><strong>My setup</strong></p> <ul> <li>Ender 3</li> <li>Creality glass bed</li> <li>Creality 3D BL Touch auto bed levelling kit v1</li> <li>Creality 3D silent mainboard v4.2.7</li> <li>OctoPrint running on a Raspberry Pi 4 connected over USB (with the 5 V pin covered with a piece of tape to prevent powering the mainboard)</li> </ul> <p><strong>Problem</strong></p> <p>Despite starting with <code>G28</code> &amp; <code>G29</code> in my G-code file, and the printer &amp; BLTouch doing a proper bed levelling (the BLTouch seems to work as intended), the first layer comes out uneven. Please find some pictures below of a test print (<a href="https://thingiverse.com/thing:4077747" rel="nofollow noreferrer">this one</a>). I hope the pictures show clearly that the nozzle is too close in the bottom left, and too far in the top right (top left is also a bit far, and bottom right a bit close).</p> <p>I've done days of research, all over the web, Reddit, forums &amp; YouTube and tried numerous fixes, to no avail</p> <p><a href="https://i.stack.imgur.com/KBGqd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KBGqd.jpg" alt="total" /></a> <a href="https://i.stack.imgur.com/0AUFG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0AUFG.jpg" alt="top left" /></a> <a href="https://i.stack.imgur.com/TXjUk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TXjUk.jpg" alt="top right" /></a> <a href="https://i.stack.imgur.com/Qhg7n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qhg7n.jpg" alt="bottom left" /></a> <a href="https://i.stack.imgur.com/leTlq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/leTlq.jpg" alt="bottom right" /></a></p> <p><strong>What I've done to try to fix / debug 1: Observe z compensation</strong></p> <p>When I do a test print with a bed levelling at the start, I observe the z-axis go up and down during the print, suggesting the printer is trying to compensate based on the readings from the start of the print. It just seems it's not compensating enough (or too much).</p> <p>When I run a <code>M420 V</code> I get (which implies it has the mesh loaded):</p> <pre><code>Send: M420 V Communication timeout while idle, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves. Recv: Bilinear Leveling Grid: Recv: 0 1 2 3 4 Recv: 0 +1.245 +1.257 +1.282 +1.332 +1.342 Recv: 1 +1.187 +1.167 +1.130 +1.127 +1.147 Recv: 2 +1.082 +1.080 +1.057 +1.077 +1.085 Recv: 3 +1.202 +1.147 +1.057 +1.000 +0.957 Recv: 4 +1.192 +1.180 +1.117 +1.085 +1.027 Recv: Recv: echo:Bed Leveling ON Recv: echo:Fade Height 10.00 Recv: ok P15 B3 </code></pre> <p><strong>What I've done to try to fix / debug 2: Level the bed as much as possible</strong></p> <p>I've tried to level the bed as best as possible. As you can observe from the <code>M420 V</code> command the bed is pretty level. This was done using the Bed Level Visualizer plugin from OctoPrint.</p> <p><strong>What I've done to try to fix / debug 3: I've changed from a 3x3 grid to a 5x5 grid</strong></p> <p>As advised in several places the bed levelling is now done with a 5x5 grid. This didn't make a (noticeable) difference.</p> <p><strong>What I've done to try to fix / debug 4: I've updated the firmware</strong></p> <p>I used to run on the Creality firmware. I've downloaded new firmware from <code>marlin.crc.id.au</code> (did that today, so using <code>Ender3-v4.2.7-BLTouch-20210511.bin</code>). Didn't help.</p> <p><strong>What I've done to try to fix / debug 5: I've calibrated the Z-offset</strong></p> <p>I've done a lot of tests, tweaking the z value to the current value, where part of the bed comes too close to the nozzle, and part of the bed stays too far away. So the Z-offset is not going to be able to improve anything I believe.</p> <p><strong>What I've done to try to fix / debug 6: I've done all the regular hardware tweaks</strong></p> <p>I've checked all the common things: Belts are tight, wheels are properly tightened, nothing is wobbly, Z-axis is clean.</p> <p><strong>What I've done to try to fix / debug 7: I've tried to add M420 S</strong></p> <p>I've tried to add the <code>M420</code> command after the <code>G29</code> command (I know it shouldn't be needed, as <code>G29</code> enables bed levelling, but just wanted to make sure)</p> <p><strong>Reference: My printer M503 settings</strong></p> <pre><code>echo: G21 ; Units in mm (mm) echo: M149 C ; Units in Celsius echo:; Filament settings: Disabled echo: M200 S0 D1.75 echo:; Steps per unit: echo: M92 X80.00 Y80.00 Z400.00 E93.00 echo:; Maximum feedrates (units/s): echo: M203 X500.00 Y500.00 Z20.00 E50.00 echo:; Maximum Acceleration (units/s2): echo: M201 X500.00 Y500.00 Z100.00 E5000.00 echo:; Acceleration (units/s2): P&lt;print_accel&gt; R&lt;retract_accel&gt; T&lt;travel_accel&gt; echo: M204 P500.00 R500.00 T500.00 echo:; Advanced: B&lt;min_segment_time_us&gt; S&lt;min_feedrate&gt; T&lt;min_travel_feedrate&gt; X&lt;max_x_jerk&gt; Y&lt;max_y_jerk&gt; Z&lt;max_z_jerk&gt; E&lt;max_e_jerk&gt; echo: M205 B20000.00 S0.00 T0.00 X10.00 Y10.00 Z0.30 E15.00 echo:; Home offset: echo: M206 X0.00 Y0.00 Z0.00 echo:; Auto Bed Leveling: echo: M420 S1 Z10.00 echo: G29 W I0 J0 Z1.24499 echo: G29 W I1 J0 Z1.25749 echo: G29 W I2 J0 Z1.28249 echo: G29 W I3 J0 Z1.33249 echo: G29 W I4 J0 Z1.34249 echo: G29 W I0 J1 Z1.18749 echo: G29 W I1 J1 Z1.16749 echo: G29 W I2 J1 Z1.12999 echo: G29 W I3 J1 Z1.12749 echo: G29 W I4 J1 Z1.14749 echo: G29 W I0 J2 Z1.08249 echo: G29 W I1 J2 Z1.07999 echo: G29 W I2 J2 Z1.05749 echo: G29 W I3 J2 Z1.07749 echo: G29 W I4 J2 Z1.08499 echo: G29 W I0 J3 Z1.20249 echo: G29 W I1 J3 Z1.14749 echo: G29 W I2 J3 Z1.05749 echo: G29 W I3 J3 Z0.99999 echo: G29 W I4 J3 Z0.95749 echo: G29 W I0 J4 Z1.19249 echo: G29 W I1 J4 Z1.17999 echo: G29 W I2 J4 Z1.11749 echo: G29 W I3 J4 Z1.08499 echo: G29 W I4 J4 Z1.02749 echo:; Material heatup parameters: echo: M145 S0 H200.00 B60.00 F255 echo: M145 S1 H240.00 B70.00 F255 echo:; PID settings: echo: M301 P21.73 I1.54 D76.55 echo:; Retract: S&lt;length&gt; F&lt;units/m&gt; Z&lt;lift&gt; echo: M207 S3.00 W13.00 F4800.00 Z0.30 echo:; Recover: S&lt;length&gt; F&lt;units/m&gt; echo: M208 S0.00 W0.00 F4800.00 echo:; Z-Probe Offset (mm): echo: M851 X-45.00 Y-7.00 Z-3.30 echo:; Filament load/unload lengths: echo: M603 L415.00 U450.00 echo:; Filament runout sensor: echo: M412 S0 D8.00 ok P15 B3 </code></pre> <p><strong>Reference: The start of my G-code file</strong></p> <pre><code>;FLAVOR:Marlin ;TIME:775 ;Filament used: 0.480677m ;Layer height: 0.2 ;MINX:16.516 ;MINY:16.515 ;MINZ:0.2 ;MAXX:218.485 ;MAXY:218.485 ;MAXZ:0.2 ;Generated with Cura_SteamEngine 4.9.0 M140 S60 M105 M190 S60 M104 S215 M105 M109 S215 M82 ;absolute extrusion mode ; Ender 3 Custom Start G-code G92 E0 ; Reset Extruder G28 ; Home all axes G29 ; Auto bed levelling G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line G92 E0 ; Reset Extruder G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish G92 E0 G92 E0 G1 F2700 E-5 ;LAYER_COUNT:1 ;LAYER:0 M107 G0 F6000 X26.14 Y20.098 Z0.2 ;TYPE:SKIRT G1 F2700 E0 </code></pre> <p><strong>Reference: Congifuration.h</strong></p> <p>As I've used two precompiled firmwares (see point 4 above), I don't have a <code>Congifuration.h</code> to share.</p> <p><strong>Concluding</strong></p> <p>I hope I've given a detailed enough account for you guys to help me. If you have any additional questions I'll try to answer them as quickly as possible. Thanks a million!</p>
<p>Had similar problems. I even did a 10x10 grid just to find out that my printing bed wasn't actually flat.</p> <p>It actually had dips in it.</p> <p>I would have to look up the command, but I actually just lowered the nozzle by 0.050 mm at a time. Eventually it got too low, and then I backed it off in even smaller increments.</p> <p>I also had to print with a raft so any extreme dips are held together on top of the raft.</p>
<p>I had the exact same issue as you and had done all the fixes you mentioned. The only thing that solved it for me was to make sure the model in the slicing software was flat to the &quot;bed&quot;.</p> <p>I use Cura and it has a &quot;flat the bed&quot; option which I only discovered due to a model that was slightly off which caused the top and bottom layer to half.</p>
1,937
<p>I would like to find out safe ways of implementing three dimensional arrays of integers in C++, using pointer arithmetic / dynamic memory allocation, or, alternatively using <code>STL</code> techniques such as vectors.</p> <p>Essentially I want my integer array dimensions to look like:</p> <pre><code>[ x ][ y ][ z ] </code></pre> <p>x and y are in the range 20-6000 z is known and equals 4.</p>
<p>Have a look at the Boost <a href="http://www.boost.org/doc/libs/release/libs/multi_array" rel="noreferrer">multi-dimensional array</a> library. Here's an example (adapted from the Boost documentation):</p> <pre><code>#include "boost/multi_array.hpp" int main() { // Create a 3D array that is 20 x 30 x 4 int x = 20; int y = 30; int z = 4; typedef boost::multi_array&lt;int, 3&gt; array_type; typedef array_type::index index; array_type my_array(boost::extents[x][y][z]); // Assign values to the elements int values = 0; for (index i = 0; i != x; ++i) { for (index j = 0; j != y; ++j) { for (index k = 0; k != z; ++k) { my_array[i][j][k] = values++; } } } } </code></pre>
<p>Pieter's suggestion is good of course, but one thing you've to bear in mind is that in case of big arrays building it may be quite slow. Every time vector capacity changes, all the data has to be copied around ('n' vectors of vectors).</p>
8,798
<p>What is the best source of free Vista style graphics for application development? I want <strong>32x32</strong> and <strong>16x16</strong> that I can use in a Winforms application.</p>
<p>If you're using Visual Studio Professional or above, you've got a zip file of icons in your VS path under <code>Common7\VS2008ImageLibrary</code>. Some of the images use the Vista style.</p>
<p>Best place I've found for commercial toolbar icons etc is <a href="http://glyfx.com" rel="nofollow noreferrer">glyfx.com</a>.</p>
5,837
<p>I'm looking for the specific density of the GEL-LAY and LAYWOO 3D materials by manufacturer CC Products.</p> <p>It isn't noted on their website or on the spool or the box the spools came in. I've looked for hours on Google and various websites, from resellers to people who tested it, without being able to find it.</p>
<p>I can't provide the end answer, but if you already have the material, you should be able to measure this yourself quite simply.</p> <p>Measure and cut a sample of filament, and weigh it. For example, a 10 meter length with a 1.75 mm diameter will have a volume of:</p> <blockquote> <p>v = pi * r<sup>2</sup> * l</p> <p>v = pi * (0.175 cm/2)<sup>2</sup> * 1000 cm</p> <p>v = 24.05 cm<sup>3</sup></p> </blockquote> <p>Density is mass divided by volume. If your sample weighs 18 g, this would be</p> <blockquote> <p>d = m / v</p> <p>d = 18.0 g / 24.05 cm<sup>3</sup></p> <p>d = 0.748 g/cm<sup>3</sup></p> </blockquote> <p>Note that the accuracy of this measurement will depend on the accuracy and precision of your measurements. A household kitchen scale might not be good enough for such small weights. In order to get a good weight measurement, you may need to use a much longer (and heavier) sample of filament.</p>
<p>Indeed, the properties of this filament are kept rather secret, so to find out what the density is, you need to either contact the filament supplier or the manufacturer for accessing the data sheet or calculate this yourself. The answer below expands on the "<em>calculate it yourself</em>".</p> <p>Density is defined as <span class="math-container">$\rho = \frac{m}{V}=\frac{[kg]}{[m^3]}$</span>. The use of this formula has been show in <a href="https://3dprinting.stackexchange.com/a/7546/5740">this answer</a>. The drawback of that answer is that it is an approximation that relies on a uniform piece of filament that requires cutting off expensive filament and relies on assumptions rather than actual calculations. Furthermore, the weighing of a small piece of filament is much less accurate of a small piece than for a larger piece or the whole spool (for the same scale, so a decent kitchen scale might be usable when more weight is concerned). You could improve the density calculation by measuring the diameter at various sections and make a better approximation based on the average diameter, but still that would need you to unroll the spool and carefully measure a piece of filament (and cut it). The advantage of that answer is that it is far easier than my proposition.</p> <p>The method that is proposed here relies on a well known method to calculate the density of materials that is called hydrostatic weighing. Hydrostatic weighing uses the displacement of a fluid due to a submerged object to determine the density of the object. Any submerged object will displace the fluid surrounding it by it's own volume, as such you would need to measure the rise of the volume level to read the volume of the submerged product. This can be done accurately by using methods that include containers of known dimensions, known fluids and even an overflow method and weighing.</p> <p>If the filament comes on a spool, you would require an identical spool to prevent removing it from the spool. But, I read that it is sold in bundles, not on spools. Without a spool would make it even easier to calculate the density as you do not have to subtract the spool weight and volume, the answer continues as if you have it on a spool. This is purely necessary so that you would not need to cut off filament or unroll the whole spool. The suggestion below let's you measure the whole spool, so weight is measured more easily as there is a lot more. </p> <p>Theoretically, you could put the filament in a fluid which is known to not affect the filament properties (so not water for GEL-LAY!) in a bath of known dimensions. Once the spool and filament are completely submerged, you could measure the volume rise. If you do the same for the empty spool, you also know the volume of the spool alone. If you also are able to weigh the empty spool and the full spool (before you plunged them in the "bathtub"/container), you now know the volume and the weight of the filament, dividing the weight (full spool weight minus empty spool weight) by the volume (full spool submerged volume minus empty spool submerged volume) will give you the density.</p> <p><span class="math-container">$$\rho_{filament} = \frac{(m_{full\ spool}-m_{empty\ spool})}{(V_{full\ spool}-V_{empty\ spool})}$$</span></p> <p><br> <em>Now let your filament dry for a long, long time! :)</em></p>
1,094
<p>I am using a new Prusa i3 MK3S 3D printer kit. I print lots of things using PLA and PETG. </p> <p>After a week of great performance I noticed that when printing some objects with PETG filament I often encountered a problem when there's <strong>intense stringing, infill gaps, artifacts, the object sometimes detaches from the plate.</strong> I use the Prusa Slicer and Cura and print with the temperature 230/90&nbsp;°C, speed max. 300&nbsp;%.This problem occurs rather regardless of which infill methods I choose. I see this problem more often when printing models sliced with Cura. Sometimes everything goes fine, but most of the time I need to stop the print due to the model collapsing, detaching from the surface, its parts collapsing due to infill gaps. The printer sometimes makes some 'clicking, cracking' sounds when printing with PETG. <em>My filaments come from Fiberology</em>.</p> <p>Surprisingly, I have run the selftest, XYZ, Z calibrations and all the other ones without any errors. The wizard told me that the axes are perpendicular and it gave me congratulations. All the other tests went nearly perfect as well. </p> <p>I do not encounter any problems using PLA, just with PETG. I try to maintain the filament properly (keep it away from moisture, in a closed box). Sometimes (rarely) <strong>I get crashes. The filament often builds up on the hotend and I remove it.</strong></p> <p>I do not know what to do, the build went very well and there are no errors, even though I am a new user and this is my very first 3D printer. I have searched the web and I haven't found people reporting this exact same thing.</p> <p>Could You help me? What can I do to improve the quality of the prints, perhaps maintain PETG better <strong>(maybe I'm doing something wrong) and most importantly, solve the problem</strong>? </p>
<p>230&nbsp;°C is way too cool for PETG and will result in underextrusion unless you print really slow, and poor bonding. Underextrusion in turn leads to stringing because of pressure build-up. I print PETG at 250&nbsp;°C.</p>
<p>You might try printing with Prusa's recommended settings. They tend to be hotter and slower than I expected.</p> <p>I have made several pet-G prints with the same machine you have. </p>
1,373
<p>The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). </p> <p>Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside of a &lt;textarea&gt; control. The result is a multiline text area control that cannot be multiline in Firefox as the enter key submits the form instead of creating a new line. </p> <p>For more information on the bug, <a href="http://www.velocityreviews.com/forums/t367383-formdefaultbutton-behaves-incorrectly.html" rel="noreferrer">read it here</a>.</p> <p>This could be fixed in Asp.Net 3.0+ but a workaround still has to be created for 2.0. </p> <p>Any ideas for the lightest workaround (a hack that doesn't look like a hack =D)? The solution in the above link scares me a little as it could easily have unintended side-effects.</p>
<p>I use this function adapted from codesta. [Edit: the very same one, I see, that scares you! Oops. Can't help you then.]</p> <p><a href="http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html" rel="nofollow noreferrer">http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html</a>.</p> <p>You use it by surrounding your code with a div like so. You could subclass the Form to include this automatically. I don't use it that much, so I didn't.</p> <pre> &lt;div onkeypress="return FireDefaultButton(event, '&lt;%= aspButtonID.ClientID %&gt;')"&gt; (your form goes here) &lt;/div&gt; </pre> <p>Here's the function.</p> <pre> function FireDefaultButton(event, target) { // srcElement is for IE var element = event.target || event.srcElement; if (13 == event.keyCode && !(element && "textarea" == element.tagName.toLowerCase())) { var defaultButton; defaultButton = document.getElementById(target); if (defaultButton && "undefined" != typeof defaultButton.click) { defaultButton.click(); event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } } return true; } </pre>
<p>For this particular issue, the reason is because javascript generated by ASP.NET 2.0 has some IE only notation: event.srcElement is not availabe in FireFox (use event.target instead):</p> <pre><code>function WebForm_FireDefaultButton(event, target) { if (!__defaultFired &amp;&amp; event.keyCode == 13 &amp;&amp; !(event.srcElement &amp;&amp; (event.srcElement.tagName.toLowerCase() == "textarea"))) { var defaultButton; if (__nonMSDOMBrowser) { defaultButton = document.getElementById(target); } else { defaultButton = document.all[target]; } if (defaultButton &amp;&amp; typeof(defaultButton.click) != "undefined") { __defaultFired = true; defaultButton.click(); event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } } return true; } </code></pre> <p>If we change the first 2 lines into:</p> <pre><code>function WebForm_FireDefaultButton(event, target) { var element = event.target || event.srcElement; if (!__defaultFired &amp;&amp; event.keyCode == 13 &amp;&amp; !(element &amp;&amp; (element.tagName.toLowerCase() == "textarea"))) { </code></pre> <p>Put the changed code in a file and then do</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterClientScriptInclude("js1", "JScript.js"); } </code></pre> <p>Then it will work for both IE and FireFox.</p> <p>Source:</p> <p><a href="http://www.velocityreviews.com/forums/t367383-formdefaultbutton-behaves-incorrectly.html" rel="nofollow noreferrer">http://www.velocityreviews.com/forums/t367383-formdefaultbutton-behaves-incorrectly.html</a></p>
7,264
<p>What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a good hash function. As a rule of thumb to avoid collisions my professor said that:</p> <pre><code>function Hash(key) return key mod PrimeNumber end </code></pre> <p>(mod is the % operator in C and similar languages)</p> <p>with the prime number to be the size of the hash table. I get that is a somewhat good function to avoid collisions and a fast one, but how can I make a better one? Is there better hash functions for string keys against numeric keys?</p>
<p>There's no such thing as a “good hash function” for universal hashes (ed. yes, I know there's such a thing as “universal hashing” but that's not what I meant). Depending on the context different criteria determine the quality of a hash. Two people already mentioned SHA. This is a cryptographic hash and it isn't at all good for hash tables which you probably mean.</p> <p>Hash tables have very different requirements. But still, finding a good hash function universally is hard because different data types expose different information that can be hashed. As a rule of thumb it is good to consider <em>all</em> information a type holds equally. This is not always easy or even possible. For reasons of statistics (and hence collision), it is also important to generate a good spread over the problem space, i.e. all possible objects. This means that when hashing numbers between 100 and 1050 it's no good to let the most significant digit play a big part in the hash because for ~ 90% of the objects, this digit will be 0. It's far more important to let the last three digits determine the hash.</p> <p>Similarly, when hashing strings it's important to consider all characters – except when it's known in advance that the first three characters of all strings will be the same; considering these then is a waste.</p> <p>This is actually one of the cases where I advise to read what Knuth has to say in <em>The Art of Computer Programming</em>, vol. 3. Another good read is Julienne Walker's <a href="http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx" rel="noreferrer">The Art of Hashing</a>.</p>
<p>I highly recommend the SMhasher GitHub project <a href="https://github.com/rurban/smhasher" rel="nofollow noreferrer">https://github.com/rurban/smhasher</a> which is a test suite for hash functions. The fastest state-of-the-art non-cryptographic hash functions without known quality problems are listed here: <a href="https://github.com/rurban/smhasher#summary" rel="nofollow noreferrer">https://github.com/rurban/smhasher#summary</a>.</p>
5,491
<p>I just received an old 3D printer from one of my school teachers. I have no idea whatsoever as to which brand it is, no instruction manual attached to it, or any other info about it. </p> <p>How can I find some information about it? </p> <p>Some links would be very useful. Remember when giving advice that I know nothing about 3D printers. </p> <p>This is the printer:</p> <p><em>Backside</em> <a href="https://i.stack.imgur.com/GC3mb.jpg" rel="nofollow noreferrer" title="Printer as seen from the back"><img src="https://i.stack.imgur.com/GC3mb.jpg" alt="Printer as seen from the back" title="Printer as seen from the back"></a></p> <p><em>Front</em> <a href="https://i.stack.imgur.com/FmDtw.jpg" rel="nofollow noreferrer" title="Printer as seen from the front"><img src="https://i.stack.imgur.com/FmDtw.jpg" alt="Printer as seen from the front" title="Printer as seen from the front"></a></p> <p><em>The X-axis stepper</em> <a href="https://i.stack.imgur.com/OXuiX.jpg" rel="nofollow noreferrer" title="The X-axis stepper"><img src="https://i.stack.imgur.com/OXuiX.jpg" alt="The X-axis stepper" title="The X-axis stepper"></a></p> <p><em>The electronics board</em> <a href="https://i.stack.imgur.com/YTJwl.jpg" rel="nofollow noreferrer" title="The electronics board"><img src="https://i.stack.imgur.com/YTJwl.jpg" alt="The electronics board" title="The electronics board"></a></p>
<p>Here are some further details on:</p> <ul> <li>The control board, and;</li> <li>The stepper motors</li> </ul> <h2>Control board</h2> <p>The electronics board has this marking:</p> <p><a href="https://i.stack.imgur.com/Ui1WV.png" rel="nofollow noreferrer" title="EJE Electronics Gubbel Engineering"><img src="https://i.stack.imgur.com/Ui1WV.png" alt="EJE Electronics Gubbel Engineering" title="EJE Electronics Gubbel Engineering"></a></p> <pre><code>EJE Electronics Gubbels Engineering </code></pre> <p>The serial number is <code>0070-003</code></p> <p>According to this site <a href="https://wiki.xinchejian.com/wiki/Mendel_Reprap" rel="nofollow noreferrer">Xinchejian First Mendel V2 Reprap</a> the board is:</p> <blockquote> <p>Gen6 Electronics, with AT Mega 644p processor (PCB EJE Electronics, Gubbels Engineering - mendel-parts.com)</p> </blockquote> <p>It seems to be this board (the serial numbers match):</p> <p><a href="https://i.stack.imgur.com/dccKv.jpg" rel="nofollow noreferrer" title="Gen6_PCB_final_batch"><img src="https://i.stack.imgur.com/dccKv.jpg" alt="Gen6_PCB_final_batch" title="Gen6_PCB_final_batch"></a></p> <p>Information on this board can be found here: <a href="https://reprap.org/wiki/Generation_6_Electronics" rel="nofollow noreferrer">Generation 6 Electronics</a>:</p> <blockquote> <p>Generation 6, or Gen6, can be described as a dedicated, Plug-&amp;-Play, single board solution for FFF/FDM 3D Printers. It is designed to be professionally manufactured, with many small surface mount components, as opposed to Generation 7 which is designed to be printed on a Mendel(among other design goals).</p> <p>Another major difference with Gen6 electronics is that they use Texas Instruments DRV8811 chips to drive the stepper motors. This means they require firmware modifications from the normal Polulu-based electronics which use Allegro A4983 chips.</p> </blockquote> <p>It goes on to say:</p> <blockquote> <p><strong>Benefits of this Design</strong></p> <ul> <li>These electronics are a single board solution, so you don't need all those cables and one thick sheet and 4 reprap parts less.</li> <li><strike>However, the thick sheet does add a fair amount of rigidity.</strike> @$@#?? the bottom thick sheet (big one) doesnt add much rigidity, the front one is used for stiffness of the frame, not the bottom one.</li> <li>It has a standard USB connection (USB A>B cable needed)</li> <li>It uses micro-stepping (1/8) for quieter operation.</li> <li>It is cheaper than for example Makerbot's version of the RepRap Generation 3 electronics.</li> <li>It uses small standard Molex connectors for motors, heater, and optos.</li> <li>The pcb of the optos are integrated, so you only need the optos on cables with 5way Molex connectors</li> </ul> <p><strong>Hardware Features</strong></p> <ul> <li>on-board USB-RS232 convertor</li> <li>Integrated hardware for driving one extruder (stepper, heater and thermistor)</li> <li>RS485 bus connector with the possibility to link through the extruder step and dir signals</li> <li>Integrated hardware for driving H21LOB or TCST2103 slotted optosensors</li> <li>High input voltage range: 12-24Vdc</li> <li>Use of standard connectors with easy and clean installation</li> <li>Debug LEDs for power, communication and heater output</li> <li>Reset button</li> </ul> <p><strong>Specifications</strong></p> <ul> <li>Dimensions 110x60mm</li> <li>Mounting grid: 100x50mm (4x M3)</li> <li>Input voltage 12-24Vdc</li> <li>On-board controller: ATmega 644p (Atmel Corp.)</li> <li>RS485 connector: RJ45</li> <li>Heat output: MOSFET output, 4A</li> <li>Thermistors input: 100K thermistor</li> </ul> </blockquote> <p>There is a lot more information on that page, including information about the power supply, USB, End stops, Heaters, Motors, Firmware, etc. I suggest that you read it fully, in order to understand the board's functionality. </p> <h2>Stepper Motors</h2> <p>The stepper's model number can be seen here:</p> <p><a href="https://i.stack.imgur.com/ozDOL.png" rel="nofollow noreferrer" title="Stepper serial number"><img src="https://i.stack.imgur.com/ozDOL.png" alt="Stepper serial number" title="Stepper serial number"></a></p> <p>The stepper's model number is <code>SY42STH47-1683B</code>,</p> <p>which is a <em>NEMA-17 High Torque Hybrid Stepper Motor</em>, with these specifications:</p> <ul> <li>Step angle: 1.8°</li> <li>Number of phase: 2</li> <li>Rated voltage: 2.8 V</li> <li>Rated current: 1.68 A</li> <li>Holding torque: 4.4 kg/cm</li> </ul> <p>This would be, at least, part of the <a href="https://www.zappautomation.co.uk/images/SY42STH47-1684B-060047076.jpg" rel="nofollow noreferrer">datasheet</a>:</p> <p><a href="https://i.stack.imgur.com/5nZ07.jpg" rel="nofollow noreferrer" title="Stepper specification"><img src="https://i.stack.imgur.com/5nZ07.jpg" alt="Stepper specification" title="Stepper specification"></a></p> <p>Here are a couple of links, should you need replacements (~€17):</p> <ul> <li><a href="https://www.poscope.com/product/nema-17-sy42sth47-1684b-stepper-motor/" rel="nofollow noreferrer">NEMA-17 (SY42STH47-1684B Stepper Motor) - Polabs)</a></li> <li><a href="https://www.zappautomation.co.uk/sy42sth47-1684b-high-torque-hybrid-stepper-motors.html" rel="nofollow noreferrer">SY42STH47-1684B High Torque Hybrid Stepper Motors</a></li> </ul> <p>This stepper motor is also listed on the <a href="https://reprap.org/wiki/NEMA_17_Stepper_motor" rel="nofollow noreferrer">RepRapWiki - NEMA 17</a> page:</p> <pre><code>Model Holding Torque Rated voltage Shaft Step angle Motor length Rated current Inductance SY42STH47-1684B 43.1 N·cm 2.8 V Ø 5 mm double 1.8° 48 mm n/a n/a </code></pre>
<p>As far as I can see on the pictures - the main board shall be capable to upload Marlin software and run smoothly.</p> <p>If you connect power and PC/Mac over the USB connection, then using <a href="http://www.pronterface.com" rel="nofollow noreferrer">Pronterface</a> you can validate mechanical movements of the printer.</p> <p>As the rods looks a bit dusty - please clean them with a soft cloth and degreaser to avoid jamming.</p> <p>If you have any issues you could flash a new version of the firmware - please use <a href="https://3dprinting.stackexchange.com/a/5849/9730">this answer</a>, to the question, <a href="https://3dprinting.stackexchange.com/questions/5848/how-to-upload-firmware-to-reprap-printer">How to upload firmware to reprap printer?</a>, as a guide to how to upload firmware to the printer.</p>
945
<p>I'm tired of being in the middle of typing something, having a pop-up with a question appear, and hitting enter before reading it... (it also happens with some windows that are not pop-ups)</p> <p>Do you know if there's some setting I could touch for this not to happen?</p>
<p>I believe you can add something like:</p> <pre><code>&lt;%@ Import Namespace="RootNamespace.SubNamespace1" %&gt; </code></pre> <p>At the top of the page.</p>
<p>What you're looking for is the <a href="http://msdn.microsoft.com/en-us/library/eb44kack(v=VS.80).aspx" rel="nofollow noreferrer" title="MSDN">@Import page directive</a>.</p>
4,139
<p>I have two collections of the same object, <code>Collection&lt;Foo&gt; oldSet</code> and <code>Collection&lt;Foo&gt; newSet</code>. The required logic is as follow:</p> <ul> <li>if <code>foo</code> is in(*) <code>oldSet</code> but not <code>newSet</code>, call <code>doRemove(foo)</code></li> <li>else if <code>foo</code> is not in <code>oldSet</code> but in <code>newSet</code>, call <code>doAdd(foo)</code></li> <li>else if <code>foo</code> is in both collections but modified, call <code>doUpdate(oldFoo, newFoo)</code></li> <li>else if <code>!foo.activated &amp;&amp; foo.startDate &gt;= now</code>, call <code>doStart(foo)</code></li> <li>else if <code>foo.activated &amp;&amp; foo.endDate &lt;= now</code>, call <code>doEnd(foo)</code></li> </ul> <p>(*) "in" means the unique identifier matches, not necessarily the content.</p> <p>The current (legacy) code does many comparisons to figure out <code>removeSet</code>, <code>addSet</code>, <code>updateSet</code>, <code>startSet</code> and <code>endSet</code>, and then loop to act on each item.</p> <p>The code is quite messy (partly because I have left out some spaghetti logic already) and I am trying to refactor it. Some more background info:</p> <ul> <li>As far as I know, the <code>oldSet</code> and <code>newSet</code> are actually backed by <code>ArrayList</code></li> <li>Each set contains less than 100 items, most likely max out at 20</li> <li>This code is called frequently (measured in millions/day), although the sets seldom differ</li> </ul> <p>My questions:</p> <ul> <li>If I convert <code>oldSet</code> and <code>newSet</code> into <code>HashMap&lt;Foo&gt;</code> (order is not of concern here), with the IDs as keys, would it made the code easier to read and easier to compare? How much of time &amp; memory performance is loss on the conversion?</li> <li>Would iterating the two sets and perform the appropriate operation be more efficient and concise?</li> </ul>
<p>Apache's commons.collections library has a CollectionUtils class that provides easy-to-use methods for Collection manipulation/checking, such as intersection, difference, and union.</p> <p>The org.apache.commons.collections.CollectionUtils API docs are <a href="http://commons.apache.org/proper/commons-collections/javadocs/api-4.0/index.html" rel="noreferrer">here</a>.</p>
<p>For a set that small is generally not worth it to convert from an Array to a HashMap/set. In fact, you're probably best off keeping them in an array and then sorting them by key and iterating over both lists simultaneously to do the comparison.</p>
4,341
<p>Does anyone know why when using BindingUtils on the selectedItem property of a ComboBox you get the following warning? Any ideas how to resolve the issue?</p> <p>The binding still works properly, but it would be nice to get rid of the warning.</p> <pre><code>warning: multiple describeType entries for 'selectedItem' on type 'mx.controls::ComboBox': &lt;accessor name="selectedItem" access="readwrite" type="Object" declaredBy="mx.controls::ComboBase"&gt; &lt;metadata name="Bindable"&gt; &lt;arg key="" value="valueCommit"/&gt; &lt;/metadata&gt; </code></pre>
<p>It is better to override the property in question and declare it final.</p>
<p>Here is the code. It is basically a copy of BindingUtils.bindProperty that is setup for a ComboBox so that both the combo box and the model are updated when either of the two change.</p> <pre><code>public static function bindProperty2(site:Object, prop:String, host:Object, chain:Object, commitOnly:Boolean = false):ChangeWatcher { var cbx:ComboBox = null; if ( site is ComboBox ) { cbx = ComboBox(site); } if ( host is ComboBox ) { cbx = ComboBox(host); } var labelField:String = &quot;listID&quot;; var w:ChangeWatcher = ChangeWatcher.watch(host, chain, null, commitOnly); if (w != null) { var func:Function; if ( site is ComboBox ) { func = function(event:*):void { var dp:ICollectionView = ICollectionView(site.dataProvider); var selItem:Object = null; for ( var i:int=0; i&lt;dp.length; i++ ) { var obj:Object = dp[i]; if ( obj.hasOwnProperty(labelField) ) { var val:String = String(obj[labelField]); if ( val == w.getValue() ) { selItem = obj; break; } } } site.selectedItem = selItem; }; w.setHandler(func); func(null); } else { func = function(event:*):void { var value:Object = w.getValue(); if ( value == null ) { site[prop] = null; } else { site[prop] = String(w.getValue()[labelField]); } }; w.setHandler(func); func(null); } } return w; } </code></pre>
2,784
<p>I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called "ResponseData", so I can track exactly what my code couldn't handle.</p> <p>In custom exceptions such as this one, should that extra response data go into the exception "message"? If it goes there, the message could be huge. I kind of want it there because I'm using Elmah, and that's how I can get at that data.</p> <p>So the question is either: - How can I get Elmah to record extra information from a field in a custom exception OR - Should extra exception details go into the "message" property?</p>
<p>You shouldn't fill <code>.Message</code> with debug information, but rather with a concise, helpful piece of text.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.exception.message.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.exception.message.aspx</a></p> <blockquote> <p><strong>The text of Message should completely describe the error and should, when possible, explain how to correct it.</strong> The value of the Message property is included in the information returned by ToString.</p> <p>The Message property is set only when creating an Exception. If no message was supplied to the constructor for the current instance, the system supplies a default message that is formatted using the current system culture.</p> <p>[..]</p> <p>Notes to Inheritors:</p> <p>The Message property is overridden in classes that require control over message content or format. Application code typically accesses this property when it needs to display information about an exception that has been caught.</p> <p>The error message should be localized.</p> </blockquote> <p>Response data does not qualify as a description.</p> <p>Not being familiar with elmah, I can't tell you how to extend the <code>Exception</code> class while using it. Does elmah implement its own subclass to <code>Exception</code>? Or an interface? Can you subclass it yourself?</p>
<p>I don't understand the question -- you're extending System.Exception, and you already added the Elmah field. That's where it belongs -- as a public property of the exception itself.</p>
7,122
<p>Currently I am using a 12 volts, 20 amperes power supply (Model S-240-12) </p> <p><a href="https://i.stack.imgur.com/fraEVm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fraEVm.jpg" alt="enter image description here"></a></p> <p>The stepper motors and the extruder need 5 amp, and the heated bed build plate needs 11 amp. </p> <p><a href="https://i.stack.imgur.com/fXymv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fXymv.jpg" alt="enter image description here"></a></p> <p>Technically you only need to use a 12 Volts, 16 amperes power supply, but I understand that you use the one with 20 amp because pulse currents from extruders and stepper motors can be stressful to supplies loaded to the max, so for reliability and performance, it is better to use a supply rated for 25% more than you need </p> <p>In the place where I buy the spare parts for my 3d printer they also sell 12 V power supplies capable of delivering 25 amp and 30 amp and they told me that if I use those ones you are going to be able to speed up the heating of the heated bed. Is that true? I understand that the heated bed is only going to take the 11 amp that it needs so is not going to make any difference to use power supplies capable of delivering more current</p>
<p>Changing the PSU with one with a higher amperage will <em><strong>not</strong></em> make the bed heat up any faster unless the PSU is underrated for the amperage required and the voltage is dropping as a result of the load. This can be checked by measuring the output voltage with a multimeter (when the PSU is loaded e.g. by a heating heat bed). In this case, the PSU has a marginal higher Amperage than the printer consumes (even has some room for the over-voltage; <em><strong>under the assumption that it is a good working PSU</strong></em>). Increasing the voltage will decrease the heat up time. There is a screw next to the 12 V connectors that can change the output voltage of the PSU. Usually, it is safe to increase the voltage up to 14 V, but that depends on your whole setup (and 14 V is applied to the whole setup, increasing the current for <strong>all</strong> parts, including your printer controller board, this board must be rated for the 14 V). <strong>Please do check the stability of the voltage during load.</strong></p> <p>Although it can be done, it is not something I used. What is an extra minute on a print of several hours?</p> <p>You can do the math: say the heat bed has a resistance of 1.2 Ω. We only need two formulas:</p> <ul> <li><span class="math-container">$U=R\times I$</span> - potential Difference <em><strong>U</strong></em> is Resistance <em><strong>R</strong></em> times Current <em><strong>I</strong></em></li> <li><span class="math-container">$P=U\times I=I^2\times R=\frac {U^2} R$</span>. The power <em><strong>P</strong></em> of an item the potential difference times the current through the item.</li> </ul> <ul> <li>at <strong>12 V</strong> that will draw 10 Amps (12 V / 1.2 Ω) resulting in a 120 Watt bed: <span class="math-container">$P= 12^2 \text V \times 10^2 \text A= {10^2 \text A}\times {1.2\ \Omega}=\frac{12^2 \text V} {1.2\ \Omega} $</span>),</li> <li>at <strong>14 V</strong> that same bed will draw 11.7 Amps (14 V / 1.2 Ω) resulting in a 163.3 Watt bed.</li> </ul> <p><em>Use at your own risk!</em></p> <p>What you could do to decrease time to heat the bed without changing the PSU or the voltage is to insulate the bottom of the heat bed with heat bed cotton sheets or cork (placemats from IKEA ;) ), put a sheet of cork onto the heat bed before printing and start heating the bed through the LCD panel of the printer or any attached printer controller programs over USB prior to printing.</p>
<p>May I recommend an alternative approach, which does not require any change of hardware? The time required to heat the bed is not huge, so either via USB from your computer or from the front panel, instruct your printer to heat the bed first, while you're setting everything else up (loading gcode files, changing filaments, or whatever). This way tasks are completed in parallel.</p>
891
<p>I tried to follow a couple of googled up tutorials on setting up mod_python, but failed every time. Do you have a good, step-by step, rock-solid howto?</p> <p>My dev box is OS X, production - Centos.</p>
<p>There are two main ways of running Python on Apache. The simplest would be to use CGI and write normal Python scripts while the second is using a web framework like Django or Pylons.</p> <p>Using CGI is straightforward. Make sure your Apache config file has a cgi-bin set up. If not, follow their documentation (<a href="http://httpd.apache.org/docs/2.0/howto/cgi.html" rel="nofollow noreferrer">http://httpd.apache.org/docs/2.0/howto/cgi.html</a>). At that point all you need to do is place your Python scripts in the cgi-bin directory and the standard output will become the HTTP response. Refer to Python's documentation for further info (<a href="https://docs.python.org/library/cgi.html" rel="nofollow noreferrer">https://docs.python.org/library/cgi.html</a>).</p> <p>If you want to use a web framework you'll need to setup mod_python or FastCGI. These steps are dependent on which framework you want to use. Django provides clear instructions on how to setup mod_python and Django with Apache (<a href="http://www.djangoproject.com/documentation/modpython/" rel="nofollow noreferrer">http://www.djangoproject.com/documentation/modpython/</a>)</p>
<p>The problem for me wasn't in Apache set up, but in understanding how mod_apache actually uses the .py files. Module-level statements (including those in a <code>if __name__=='__main__'</code> section) are <em>not</em> executed--I assumed that the stdout from running the script at the commandline would be what the server would output, but that's not how it works.</p> <p>Instead, I wrote a module-level function called <code>index()</code>, and had it return as a string the HTML of the page. It's also possible to have other module-level functions (e.g., <code>otherFunction()</code>) that can be accessed as further segments in the URI (e.g., <code>testScript/otherFunction</code> for the file <code>testScript.py</code>.)</p> <p>Obviously, this makes more sense than my original stdout conception. Better capability of actually using Python as a scripting language and not a humongous markup language.</p>
2,709
<p>I need to do some emulation of some old DOS or mainframe terminals in Flex. Something like the image below for example.</p> <p><img src="https://i.stack.imgur.com/qFtvP.png" alt="alt text"></p> <p>The different coloured text is easy enough, but the ability to do different background colours, such as the yellow background is beyond the capabilities of the standard Flash text.</p> <p>I may also need to be able to enter text at certain places and scroll text up the "terminal". Any idea how I'd attack this? Or better still, any existing code/components for this sort of thing?</p>
<p>Use <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html" rel="nofollow noreferrer"><code>TextField.getCharBoundaries</code></a> to get a rectangle of the first and last characters in the areas where you want a background. From these rectangles you can construct a rectangle that spans the whole area. Use this to draw the background in a <code>Shape</code> placed behind the text field, or in the parent of the text field.</p> <p><em>Update</em> you asked for an example, here is how to get a rectangle from a range of characters:</p> <pre><code>var firstCharBounds : Rectangle = textField.getCharBoundaries(firstCharIndex); var lastCharBounds : Rectangle = textField.getCharBoundaries(lastCharIndex); var rangeBounds : Rectangle = new Rectangle(); rangeBounds.topLeft = firstCharBounds.topLeft; rangeBounds.bottomRight = lastCharBounds.bottomRight; </code></pre> <p>If you want to find a rectangle for a whole line you can do this instead:</p> <pre><code>var charBounds : Rectangle = textField.getCharBoundaries(textField.getLineOffset(lineNumber)); var lineBounds : Rectangle = new Rectangle(0, charBounds.y, textField.width, firstCharBounds.height); </code></pre> <p>When you have the bounds of the text range you want to paint a background for, you can do this in the <code>updateDisplayList</code> method of the parent of the text field (assuming the text field is positioned at [0, 0] and has white text, and that <code>textRangesWithYellowBackground</code> is an array of rectangles that represent the text ranges that should have yellow backgrounds):</p> <pre><code>graphics.clear(); // this draws the black background graphics.beginFill(0x000000); graphics.drawRect(0, 0, textField.width, textField.height); graphics.endFill(); // this draws yellow text backgrounds for each ( var r : Rectangle in textRangesWithYellowBackground ) graphics.beginFill(0xFFFF00); graphics.drawRect(r.x, r.y, r.width, r.height); graphics.endFill(); } </code></pre>
<p>The font is fixed width and height, so making a background bitmap dynamically isn't difficult, and is probably the quickest and easiest solution. In fact, if you size it correctly there will only be one stretched pixel per character.</p> <p>Color the pixel (or pixels) according to the background of the character.</p> <p>-Adam</p>
8,545
<p>One may not always know the <code>Type</code> of an object at compile-time, but may need to create an instance of the <code>Type</code>. </p> <p>How do you get a new object instance from a <code>Type</code>?</p>
<p>The <code>Activator</code> class within the root <code>System</code> namespace is pretty powerful.</p> <p>There are a lot of overloads for passing parameters to the constructor and such. Check out the documentation at: </p> <blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx</a></p> </blockquote> <p>or (new path)</p> <blockquote> <p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.activator.createinstance" rel="noreferrer">https://learn.microsoft.com/en-us/dotnet/api/system.activator.createinstance</a></p> </blockquote> <p>Here are some simple examples:</p> <pre><code>ObjectType instance = (ObjectType)Activator.CreateInstance(objectType); ObjectType instance = (ObjectType)Activator.CreateInstance("MyAssembly","MyNamespace.ObjectType"); </code></pre>
<p>I can across this question because I was looking to implement a simple CloneObject method for arbitrary class (with a default constructor)</p> <p>With generic method you can require that the type implements New().</p> <pre><code>Public Function CloneObject(Of T As New)(ByVal src As T) As T Dim result As T = Nothing Dim cloneable = TryCast(src, ICloneable) If cloneable IsNot Nothing Then result = cloneable.Clone() Else result = New T CopySimpleProperties(src, result, Nothing, "clone") End If Return result End Function </code></pre> <p>With non-generic assume the type has a default constructor and catch an exception if it doesn't.</p> <pre><code>Public Function CloneObject(ByVal src As Object) As Object Dim result As Object = Nothing Dim cloneable As ICloneable Try cloneable = TryCast(src, ICloneable) If cloneable IsNot Nothing Then result = cloneable.Clone() Else result = Activator.CreateInstance(src.GetType()) CopySimpleProperties(src, result, Nothing, "clone") End If Catch ex As Exception Trace.WriteLine("!!! CloneObject(): " &amp; ex.Message) End Try Return result End Function </code></pre>
2,317
<p>Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)?</p>
<p>I was able to do it on using KeyPress event. Here's the code example:</p> <pre><code>Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer) If KeyAscii = 10 _ or KeyAscii = 13 Then '10 -&gt; Ctrl-Enter. AKA ^J or ctrl-j '13 -&gt; Enter. AKA ^M or ctrl-m KeyAscii = 0 'clear the the KeyPress End If End Sub </code></pre>
<p>not entirely sure about that one, you should be able to remove the line breaks when you render the content though, or even run a vbscript to clear it out, you just need to check for chr(13) or vbCrLf.</p>
3,947
<p>Does anyone know of papers/books/etc. that document patterns for databases? For example, one common rule of thumb is that every table should have a primary key and that the key should be <a href="http://en.wikipedia.org/wiki/Surrogate_key" rel="noreferrer">devoid of information content</a>. So I was wondering if anyone had written a book or published papers regarding design patterns for designing relational databases?</p> <hr> <p>@Gaius,</p> <p>That is the question that a database designer needs to weigh--what is the probable stability of the database structure? Given a long-enough horizon nothing is stable. Or to say the converse, given a long-enough horizon, everything is subject to change. A surrogate key (in theory) should never change its meaning because it never had meaning to begin with. </p> <p>I guess the other thing to consider in that particular design scenario is who is it that will be seeing the primary key? If the primary key is something that end-users will actually need to refer to then it makes sense to make it something they can understand. But I can't think of many cases where an end-user needs to see a primary key; usually the primary key is present to allow the DB engine to speed up certain operations.</p> <p>My original thought in asking the question was to find design patterns for database design that were codified by more experienced database designers than myself so as to, hopefully, avoid some easily avoidable errors. It would be interesting reading if anyone had ever codified database design anti-patterns. </p>
<p>Specifically, regarding keys: I strongly disagree with the strange idea that keys must be without meaning. In general, I consider a database a collection of facts; as soon as you start adding arbitrary numbers (like generated keys) and other irrelevant information into it, it should be a warning sign. I recommend <a href="http://www.intelligententerprise.com/030320/605celko1_1.jhtml" rel="noreferrer">this articly by Joe Celko</a> for more on keys.</p> <p>More general notes:</p> <p>Suggestions for schema designs/data models for different businesses: David C. Hay: Data Model Patterns: Conventions of Thought Rather old, but there is a reason why it's still in print <br /><a href="http://www.dorsethouse.com/books/dmp.html" rel="noreferrer">http://www.dorsethouse.com/books/dmp.html</a></p> <p>Maybe not very pattern-like, but still very good: Stephane Faroult, Peter Robson: The Art of SQL <a href="http://oreilly.com/catalog/9780596008949/" rel="noreferrer">http://oreilly.com/catalog/9780596008949/</a></p> <p>Another one which I can recommend: Vadim Tropashko: SQL Design Patterns - The Expert Guide to SQL Programming <a href="http://www.rampant-books.com/book_2006_1_sql_coding_styles.htm" rel="noreferrer">http://www.rampant-books.com/book_2006_1_sql_coding_styles.htm</a></p> <p>Systematic text-book about data modelling: Graeme Simsion &amp; Graham Witt, "Data Modeling Essentials" <a href="http://www.elsevierdirect.com/product.jsp?isbn=9780126445510" rel="noreferrer">http://www.elsevierdirect.com/product.jsp?isbn=9780126445510</a></p> <p>Maybe you are actually looking for a "style guide"?. I that case: Joe Celko: SQL Programming Style <a href="http://www.elsevierdirect.com/product.jsp?isbn=9780120887972" rel="noreferrer">http://www.elsevierdirect.com/product.jsp?isbn=9780120887972</a></p>
<p>To answer exactly: <a href="http://www.amazon.com/s/ref=nb_ss_b/102-6537774-4068964?url=search-alias%3Dstripbooks&amp;field-keywords=database+design+patterns&amp;x=0&amp;y=0" rel="nofollow noreferrer">yes</a>. There are s*-tons of info written on 'good' database design. Although youe example rule of thumb is certainly questionable.</p>
6,601
<p>What techniques or tools are recommended for finding broken links on a website?</p> <p>I have access to the logfiles, so could conceivably parse these looking for 404 errors, but would like something automated which will follow (or attempt to follow) all links on a site.</p>
<p>For Chrome Extension there is <a href="https://chrome.google.com/webstore/detail/hexometer-tool/hikinokpbcadaepfkacpnkhbdjfpfcgc" rel="nofollow noreferrer">hexometer</a></p> <p>See <a href="http://www.kevinfreitas.net/extensions/linkchecker/" rel="nofollow noreferrer">LinkChecker</a> for Firefox.</p> <p>For Mac OS there is a tool <a href="http://peacockmedia.co.uk/integrity/" rel="nofollow noreferrer">Integrity</a> which can check URLs for broken links.</p> <p>For Windows there is <a href="http://home.snafu.de/tilman/xenulink.html" rel="nofollow noreferrer">Xenu's Link Sleuth</a>.</p>
<p>Your best bet is to knock together your own spider in your scripting language of choice, it could be done recursively along the lines of:</p> <pre><code>// Pseudo-code to recursively check for broken links // logging all errors centrally function check_links($page) { $html = fetch_page($page); if(!$html) { // Log page to failures log ... } else { // Find all html, img, etc links on page $links = find_links_on_page($html); foreach($links as $link) { check_links($link); } } } </code></pre> <p>Once your site has gotten a certain level of attention from Google, their <a href="http://www.google.com/webmaster" rel="nofollow noreferrer">webmaster tools</a> are invaluable in showing broken links that users may come across, but this is quite reactionary - the dead links may be around for several weeks before google indexes them and logs the 404 in your webmaster panel.</p> <p>Writing your own script like above will show you all possible broken links, without having to wait for google (webmaster tool) or your users (404 in access logs) to stumble across them.</p>
9,126
<p>If I need to test out some of the components of a RAMPS 1.4 based 3D Printer, can I only plug some of them into the board (not all of them) and test them out?</p> <p>I'd like to test out the NEMA 17 motors without testing the heated bed or extruder. Is this safe and why?</p>
<p>If by components you mean motors, fans, or heated bed, then yes. This is even suggested in the <a href="http://reprap.org/wiki/RAMPS_1.4#Final_Setup" rel="noreferrer">Final Setup</a> instructions on the RAMPS wiki.</p> <blockquote> <p>If you think you may have mistakes (in your setup) you can install only one stepper driver during initial testing and risk only one stepper driver.</p> </blockquote> <p>There are also printers using RAMPS with no heated bed and other machines that have no extruder at all. Furthermore, from an electronics perspective: if nothing is connected across a terminal no current will flow and therefore there is no damage that can be done. Obviously if you short out the unused connections there will be problems.</p>
<p>Yes, you can. By leaving components unplugged you would simply have some pins powered that are not in use. But even with all your components plugged in, you would still have some unused, powered pins on your board, so I wouldn't think too hard about that. In some cases it might be needed to mount e.i. fans to cool your electronics while running, but for testing a few stepper motors, you will be just fine.</p> <p>Exactly how you would address each individual motor depends on your setup, however. My best bet would be to simply rely on your "default" firmware (such as Marlin), and then run commands for testing through Pronterface/PrintRun or similar. </p> <p>Alternatively, you could upload your own sketch/firmware to the Arduino, and manipulate each stepper driver individually. This is a somewhat more advanced option, though.</p>
169
<p>Problem (simplified to make things clearer):</p> <ul> 1. there is one statically-linked static.lib that has a function that increments: <pre><code> extern int CallCount = 0; int TheFunction() { void *p = &CallCount; printf("Function called"); return CallCount++; } </code></pre> 2. static.lib is linked into a managed C++/CLI managed.dll that wraps TheFunction method: <pre><code> int Managed::CallLibFunc() { return TheFunction(); } </code></pre> 3. Test app has a reference to managed.dll and creates multiple domains that call C++/CLI wrapper: <pre><code> static void Main(string[] args) { Managed c1 = new Managed(); int val1 = c1.CallLibFunc(); // value is zero AppDomain ad = AppDomain.CreateDomain("NewDomain"); Managed c = ad.CreateInstanceAndUnwrap(a.FullName, typeof(Managed).FullName) as Managed; int val2 = c.CallLibFunc(); // value is one } </code></pre> </ul> <p>Question:</p> <p>Based on what I have read in Essential .NET Vol1 The CLR by Don Box, I would expect val2 to be zero since a brand new copy of managed.dll/static.lib is loaded when CreateInstanceAndUnwrap is called. Am I misunderstanding what is happening? The static library does not seem to be respecting the appdomain boundaries since it's unmanaged code. Is there a way to get around this issue other than by creating a brand new process for instantiating Managed?</p> <p>Thank you very much everyone!</p>
<p>My hunch was that, as you suspected, unmanaged DLLs are loaded in the context of the process and not in the context of the AppDomain, so any static data in unmanaged code is shared among AppDomains.</p> <p><a href="http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/98cbabe0-33d6-4775-a3a7-04e71b7498dd/" rel="nofollow noreferrer">This link</a> shows someone with the same problem you have, still not 100% verification of this, but probably this is the case.</p> <p><a href="http://lambert.geek.nz/2007/05/29/unmanaged-appdomain-callback/" rel="nofollow noreferrer">This link</a> is about creating a callback from unmanaged code into an AppDomain using a thunking trick. I'm not sure this can help you but maybe you'll find this useful to create some kind of a workaround.</p>
<p>In short, maybe. AppDomains are purely a managed concept. When an AppDomain is instantiated it doesn't map in new copies of the underlying DLLs, it can reuse the code already in memory (for example, you wouldn't expect it to load up new copies of all the System.* assemblies, right?)</p> <p>Within the managed world all static variables are scoped by AppDomain, but as you point out this doesn't apply in the unmanaged world.</p> <p>You could do something complex that forces a load of a unique managed.dll for each app domain, which would result in a new version of the static lib being brought along for the ride. For example, maybe using Assembly.Load with a byte array would work, but I don't know how the CLR will attempt to deal with the collision in types if the same assembly is loaded twice.</p>
9,837
<p>Jquery has a great language construct that looks like this:</p> <pre><code>$(document).ready(function() { $("a").click(function() { alert("Hello world!"); }); }); </code></pre> <p>As you might guess this, once the document has loaded, binds a custom function to the onClick event of all <strong><em>a</em></strong> tags.</p> <p>The question is, how can I achieve this same kind of behavior in Prototype?</p>
<p>Prototype 1.6 provides the <a href="http://prototypejs.org/api/document/observe" rel="nofollow noreferrer">"dom:loaded"</a> event on document:</p> <pre><code>document.observe("dom:loaded", function() { $$('a').each(function(elem) { elem.observe("click", function() { alert("Hello World"); }); }); }); </code></pre> <p>I also use the <a href="http://prototypejs.org/api/enumerable/each" rel="nofollow noreferrer">each</a> iterator on the array returned by <a href="http://prototypejs.org/api/utility/dollar-dollar" rel="nofollow noreferrer">$$</a>().</p>
<pre><code>Event.observe(window, 'load', function() { Event.observe(element, 'click', function() { alert("Hello World!"); }); }); </code></pre> <p>Of course you need to "select" the elements first in Prototype. </p>
7,222
<p>I don't understand what's wrong with my G-code. I have set the printing temperature to 195 °C but when I try to print, the target temperature is always 0 °C and printing never starts.</p> <p><a href="https://i.stack.imgur.com/hkB6E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hkB6E.jpg" alt="enter image description here" /></a></p> <p>I have tried changing material preset to different PLA profiles but that didn't help at all.</p> <p>G-code:</p> <pre><code>;FLAVOR:RepRap ;TIME:1736 ;Filament used: 0.676205m ;Layer height: 0.1 ;Generated with Cura_SteamEngine 3.4.1 T0 M190 S50 M104 S195 M109 S195 M82 ;absolute extrusion mode G21 ;metric values G90 ;absolute positioning M82 ;set extruder to absolute mode M107 ;start with the fan off G28 X0 Y0 ;move X/Y to min endstops G28 Z0 ;move Z to min endstops G1 Z15.0 F9000 ;move the platform down 15mm G92 E0 ;zero the extruded length G1 F200 E3 ;extrude 3mm of feed stock G92 E0 ;zero the extruded length again G1 F9000 M117 Print0ng... M83 ;relative extrusion mode G1 F1500 E-6.5 ;LAYER_COUNT:96 ;LAYER:0 M107 G0 F600 X90.425 Y93.152 Z0.3 ;TYPE:SKIRT G1 F1500 E6.5 ... </code></pre> <p>In addition, the extruder and heat sensor are working. An older G-code file correctly sets 200 °C as the target temperature for the extruder.</p> <p><a href="https://i.stack.imgur.com/nQhqQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nQhqQ.jpg" alt="enter image description here" /></a></p> <p>This G-code prints just fine</p> <pre><code>;FLAVOR:RepRap ;TIME:4628 ;Filament used: 1.44191m ;Layer height: 0.15 ;Generated with Cura_SteamEngine 3.4.1 T0 M190 S60 M104 S200 M109 S200 M82 ;absolute extrusion mode G21 ;metric values G90 ;absolute positioning M82 ;set extruder to absolute mode M107 ;start with the fan off G28 X0 Y0 ;move X/Y to min endstops G28 Z0 ;move Z to min endstops G1 Z15.0 F9000 ;move the platform down 15mm G92 E0 ;zero the extruded length G1 F200 E3 ;extrude 3mm of feed stock G92 E0 ;zero the extruded length again G1 F9000 M117 Print0ng... M83 ;relative extrusion mode G1 F1500 E-6.5 ;LAYER_COUNT:80 ;LAYER:0 M107 G0 F4800 X72.96 Y99.484 Z0.3 ;TYPE:SKIRT --- </code></pre> <hr /> <p><em>Note, I have never modified the firmware or changed anything except what I can change with the frontpanel.</em></p>
<p>I got the same problem today and after a lot of troubleshooting (following the answers here) I found out that the <strong>issue was the connection to the hotbed</strong>. After I clean out the connection to the hotbed the printer started working as usual. The debugging logic was that <strong>the printer heats up the hotbed <em>before</em> setting the extruder temperature</strong>.</p> <p>Looking to your LCD the issue seems to be the same, since 33 degrees is a normal ambient temperature.</p>
<p>Double check the physical connection to the heating element and the thermistor that go in the hot end. Those wires and crimps aren't great. I had one fail on me out of the box with my A8. Re-crimping did the trick.</p>
1,219
<p>Most of the work I do is with what could be considered enterprise Web applications. These projects have large budgets, longer timelines (from 3-12 months), and heavy customizations. Because as developers we have been touting the idea of the Web as the next desktop OS, customers are coming to expect the software running on this "new OS" to react the same as on the desktop. That includes easy to manage automatic upgrades. In other words, "An update is available. Do you want to upgrade?" Is this even a realistic expectation? Can anyone speak from experience on trying to implement this feature?</p>
<p>At <a href="http://smartbear.com" rel="nofollow noreferrer">my company</a> we have enterprise installations ranging into the thousands of seats. If we implemented an auto-upgrade, our customers would mutiny!</p> <p>Large installations have peculiar issues that don't apply to small ones. For example, with 2000 users (not all of whom are, let us say, the most sophisticated of tool users), tool-training is a big deal: training time, internal demos, internal process documents, etc.. They cannot unleash a new feature or UI change without a chance to understand how it fits in their process and therefore what their internal best practices are and how to communicate that to their users.</p> <p>Also when applications fail, it's the internal IT team who are responsible. Therefore, they want time to install a new version in a test area, beat it up, and deploy on a Saturday only when they're good and ready.</p> <p>I can see the value in making minor patches more easy to install, particularly when the patch is just for a bug-fix and not for anything that would require retraining, and if the admins still get final say over when it's installed. But even then, I don't believe anyone has ever asked for this! Whether because they don't want it or they are trained to not expect it, it doesn't seem worth it.</p>
<p>One of the primary reasons to implement an application as a web application is that you get automatic upgrades for free. Why would users be getting prompted for upgrades on a web app?</p> <p>For Windows applications, the "update is available, do you want to upgrade?" functionality is provided by Microsoft using ClickOnce, which I have used in an enterprise environment successfully -- there are a few gotchas but for the most part it is a good way to manage automatic deployment and upgrade of Windows apps.</p> <p>For mobile apps, you can also implement auto-upgrades, although it is a little trickier. </p> <p>In any case, to answer your question in a broad sense, I don't know if it is expected that all enterprise apps should make upgrading easy, but it certainly is worth the money from an IT support standpoint to architect them to allow for easy upgrading.</p>
7,234
<p>The leaving your wireless network open question reminded me of this.</p> <p>I typically share the root drive on my machines across my network, and tie login authorization to the machines NT ID, so there is at least some form of protection.</p> <p>My question, how easy is it to gain access to these drives for ill good? Is the authorization enough, or should I lock things down more?</p>
<p>If this is a home network with no wifi or secured wifi, it's probably not an issue. Your isp will almost certainly prevent anyone from trying anything via the larger web.</p> <p>If you have open wifi, then there's a little more cause for concern. If it's properly secured so that some authentication is required, you're probably okay. I mean, a determined hacker could probably break in, but you're not likely to find a determined hacker in wi-fi range. But the risk (if small) is there. You will want to make sure the administrative shares (the \\yourmachine\c$ or \\yourmachine\admin$ mentioned earlier) are disabled if you have open wifi. No sense making it too easy.</p>
<p>I can't answer the main question, but do keep in mind that Windows, by default, is always sharing the roots of your drives. Try:</p> <pre><code>\\yourmachine\c$ </code></pre> <p>(And then try not to freak out.)</p>
5,298
<p>I'm getting a pet bird soon, and I know that off-gassing from heating PTFE above 300&nbsp;°C creates noxious fumes, which are bird-killer<sup>1</sup>. To try to prevent even the chance of that I'm replacing my hotend with an all-metal one. I have an E3D v6 1.75&nbsp;mm, which I noticed still uses a PTFE tube at the cold side (the 3&nbsp;mm version apparently doesn't, but 1.75&nbsp;mm filament is what my printer uses, so there we are).</p> <p>If I'm reading the instructions correctly, it sounds like the heatsink shouldn't even get warm to the touch, and if that's the case I'm not worried as long as things go well. What I'm still worried about is what happens if the heatsink cooling fan fails. I plan to plug the fan into the always-on 12&nbsp;V port on my board (SKR 1.3): if I do, then is it possible to set my firmware (currently Marlin 2.0.4.4) to stop a print if the fan fails?</p> <p>If I can't get the firmware to stop on fan failure, then is there a 1.75&nbsp;mm all-metal hotend out there that doesn't require the use of PTFE on the cold side?</p> <hr> <p>1- <a href="http://healthline.com/nutrition/nonstick-cookware-safety" rel="nofollow noreferrer">Here:</a> "at temperatures above 570°F (300°C), Teflon [PTFE] coatings on nonstick cookware start to break down, releasing toxic chemicals into the air <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3276392/" rel="nofollow noreferrer">(14)</a>"</p>
<p>First of all, we need to discuss the failure mode and what can be done. LEt's do a</p> <h2>Failure mode 1: coolend-fan stops working.</h2> <p>Let's assume the coolend-fan for whatever reason (cut cable, defect fan, burnt board...) stops working. As a result, the coolend starts to rise in temperature, as it doesn't drain as much heat into the room air as before. This directly leads to an increase of the hotend temperature, which results in a case differentiation:</p> <ul> <li>The hotend does not cope well with the loss of the heatsink and it triggers Thermal Runaway protection as for a given voltage bump the heating gets too high - the print gets aborted before the hotend reaches a temperature above 275 °C.</li> <li>The hotend does not trigger Thermal Runaway Protection but the controller alters its heating behavior and works the heater on a lower duty cycle. As long as the hotend temperature is ordered to stay low enough, we will get a lot of extrusion problems from heat-creep, but the PTFE seated into the heatbreak stays below the heater break's temperature, as the thermal mass of the coolend alone draws away thermal energy into the room, even without the fan that keeps it at room temperature. As long as you don't print at above 300 °C and the thermosensor is intact, the failure mode does not release any fumes that could result in Polytetrafluoroethylene Toxicosis.</li> </ul> <h2>Failure Mode 2: coolend fan stops Working, no TRP, Thermosensor OK</h2> <p>But what if TRP is off? Let's look at this Double Failure: The hotend does not trigger Thermal Runaway Protection (or it was turned off to begin with) and the temperature increases due to the lack of cooling from the coolend.</p> <p>As the hotend reaches 275 °C (few printers print that hot, and they use specialized setups), it should trigger the next safety line: a MaxTemp error and cut power. Heating stops before the coolend gets to the dangerous zone of 300 °C, as the coolend always is less hot than the heater block.</p> <h2>Failure Mode 3: no TRP, Thermosensor broken</h2> <p>We are getting desperate and turn off TRP, <em>then</em> break or disconnect the thermosensor to get a static low temperature. NOW we are getting serious, as only with such a failure we can trick our controller to continuously heat the heater cartridge and not trigger any of the error conditions. Only now there is the mere possibility to heat the coolend over 300 °C.</p> <p>Marlin Firmware is designed to carefully work with checks and balances to keep the heater block in the wanted margin, and it would need a <strong>deliberate manipulation</strong> of the software to <strong>disable</strong> all safety features <strong>in conjunction</strong> with the failure of the thermosensor for the printer to go into Thermal runaway in such a degree that the coolend goes over 300 °C. And then you have different problems: your printer surely is turning into a molten pile in that failure mode. The presence or absence of the coolend fan would just delay the inevitable, should you run such a fire hazard-machine</p> <h1>Conclusion</h1> <p><a href="https://3dprinting.stackexchange.com/questions/12153/updating-marlin-firmware-step-by-step-guide">Configure and install a recent firmware distribution</a> (Marlin 1.1.9 and Marlin 2.x come with TRP enabled by default) and be sure to have MaxTemp enabled at 275 °C and Thermal Runaway Protection on, and you have a 3-layer safety against PTFE-fumes.</p> <p>Adding more layers surely is possible, but the cost-effect calculation gets worse starting there.</p>
<p>It is doubtful that small PTFE inside hotend could produce that kind of dangerous gas leak. But another thing should be considered: the PTFE tube inside hotend WILL degrade over time and will need replacement.</p> <p>For last several years I had numerous experiments with all kind of solutions including my own designs made. And recently I found the best and all metal solution: Volcano 20mm heater + M6 stainless throat + normal SHORT E3D nozzle (not the Volcano nozzle but the normal one). Basically this solution put the problematic gap (merge of nozzle with throat) deep into hotter zone, you just need longer throat. So far I have best quality and speed with this approach.</p> <p>The most important thing for the all metal hotend is to have fast retracts.</p> <p>For the FAN I recommend to use double deck, that is to put one fan on top of another and connect them in parallel. I found this solution in some server power supplies. And indeed two fans produce really good flow to cool heatsink at higher temperatures (before I was considering water cooling but two fans much cheaper and do the job very good). Also the probability that two fans will fail is very low.</p>
1,607
<p>On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php <code>error_log</code> between virtual hosts.</p> <p>Overriding this setting in the <code>&lt;Location&gt;</code> of the <code>httpd.conf</code> does not seem to do anything.</p> <p>Is there a way to have separate php <code>error_logs</code> for each Virtual Host?</p>
<p>To set the <em>Apache</em> (<em>not the PHP</em>) log, the easiest way to do this would be to do:</p> <pre><code>&lt;VirtualHost IP:Port&gt; # Stuff, # More Stuff, ErrorLog /path/where/you/want/the/error.log &lt;/VirtualHost&gt; </code></pre> <p>If there is no leading "/" it is assumed to be relative.</p> <p><a href="http://httpd.apache.org/docs/1.3/mod/core.html#errorlog" rel="noreferrer">Apache Error Log Page</a></p>
<p>My Apache had something like this in httpd.conf. Just change the ErrorLog and CustomLog settings </p> <pre><code>&lt;VirtualHost myvhost:80&gt; ServerAdmin webmaster@dummy-host.example.com DocumentRoot /opt/web ServerName myvhost ErrorLog logs/myvhost-error_log CustomLog logs/myvhost-access_log common &lt;/VirtualHost&gt; </code></pre>
2,267
<p>How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows?</p> <p>For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a statistical outcome equivalent to the respective weight.</p>
<p>Dane's answer includes a self joins in a way that introduces a square law. <code>(n*n/2)</code> rows after the join where there are n rows in the table.</p> <p>What would be more ideal is to be able to just parse the table once.</p> <pre><code>DECLARE @id int, @weight_sum int, @weight_point int DECLARE @table TABLE (id int, weight int) INSERT INTO @table(id, weight) VALUES(1, 50) INSERT INTO @table(id, weight) VALUES(2, 25) INSERT INTO @table(id, weight) VALUES(3, 25) SELECT @weight_sum = SUM(weight) FROM @table SELECT @weight_point = FLOOR(((@weight_sum - 1) * RAND() + 1)) SELECT @id = CASE WHEN @weight_point &lt; 0 THEN @id ELSE [table].id END, @weight_point = @weight_point - [table].weight FROM @table [table] ORDER BY [table].Weight DESC </code></pre> <p>This will go through the table, setting <code>@id</code> to each record's <code>id</code> value while at the same time decrementing <code>@weight</code> point. Eventually, the <code>@weight_point</code> will go negative. This means that the <code>SUM</code> of all preceding weights is greater than the randomly chosen target value. This is the record we want, so from that point onwards we set <code>@id</code> to itself (ignoring any IDs in the table).</p> <p>This runs through the table just once, but does have to run through the entire table even if the chosen value is the first record. Because the average position is half way through the table (and less if ordered by ascending weight) writing a loop could possibly be faster... (Especially if the weightings are in common groups):</p> <pre><code>DECLARE @id int, @weight_sum int, @weight_point int, @next_weight int, @row_count int DECLARE @table TABLE (id int, weight int) INSERT INTO @table(id, weight) VALUES(1, 50) INSERT INTO @table(id, weight) VALUES(2, 25) INSERT INTO @table(id, weight) VALUES(3, 25) SELECT @weight_sum = SUM(weight) FROM @table SELECT @weight_point = ROUND(((@weight_sum - 1) * RAND() + 1), 0) SELECT @next_weight = MAX(weight) FROM @table SELECT @row_count = COUNT(*) FROM @table WHERE weight = @next_weight SET @weight_point = @weight_point - (@next_weight * @row_count) WHILE (@weight_point &gt; 0) BEGIN SELECT @next_weight = MAX(weight) FROM @table WHERE weight &lt; @next_weight SELECT @row_count = COUNT(*) FROM @table WHERE weight = @next_weight SET @weight_point = @weight_point - (@next_weight * @row_count) END -- # Once the @weight_point is less than 0, we know that the randomly chosen record -- # is in the group of records WHERE [table].weight = @next_weight SELECT @row_count = FLOOR(((@row_count - 1) * RAND() + 1)) SELECT @id = CASE WHEN @row_count &lt; 0 THEN @id ELSE [table].id END, @row_count = @row_count - 1 FROM @table [table] WHERE [table].weight = @next_weight ORDER BY [table].Weight DESC </code></pre>
<p>The <em>"incrementally carrying a an accumlating[sic] weight sum"</em> part is expensive if you have a lot of records. If you also already have a wide range of scores/weights (ie: the range is wide enough that most records weights are unique. 1-5 stars probably wouldn't cut it), you can do something like this to pick a weight value. I'm using VB.Net here to demonstrate, but this could easily be done in pure Sql as well:</p> <pre class="lang-vb prettyprint-override"><code>Function PickScore() 'Assume we have a database wrapper class instance called SQL and seeded a PRNG already 'Get count of scores in database Dim ScoreCount As Double = SQL.ExecuteScalar("SELECT COUNT(score) FROM [MyTable]") ' You could also approximate this with just the number of records in the table, which might be faster. 'Random number between 0 and 1 with ScoreCount possible values Dim rand As Double = Random.GetNext(ScoreCount) / ScoreCount 'Use the equation y = 1 - x^3 to skew results in favor of higher scores ' For x between 0 and 1, y is also between 0 and 1 with a strong bias towards 1 rand = 1 - (rand * rand * rand) 'Now we need to map the (0,1] vector to [1,Maxscore]. 'Just find MaxScore and mutliply by rand Dim MaxScore As UInteger = SQL.ExecuteScalar("SELECT MAX(Score) FROM Songs") Return MaxScore * rand End Function </code></pre> <p>Run this, and pick the record with the largest score less than the returned weight. If more than one record share that score, pick it at random. The advantages here are that you don't have to maintain any sums, and you can tweak the probability equation used to suit your tastes. But again, it works best with a larger distribution of scores.</p>
8,279
<p>Ok, so I'm an idiot. </p> <p>So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's autosave to store it. Dumb dumb dumb. </p> <p>I sent a copy of the regex to a coworker but now he can't find it (or the record of our communication). My best hope of finding the regex is to find it in RegexBuddy on the old hard drive. RegexBuddy automatically saves whatever you were working on each time you close it. I've done some preliminary searches to try to determine where it actually saves that working data but I'm having no success. </p> <p>This question is the result of my dumb behavior but I thought it was a good chance to finally ask a question here. </p>
<p>On my XP box, it was in the registry here:</p> <pre><code>HKEY_CURRENT_USER\Software\JGsoft\RegexBuddy3\History </code></pre> <p>There were two REG_BINARY keys called <strong>Action0</strong> and <strong>Action1</strong> that had hex data containing my two regexes from the history.</p> <p><img src="https://i.stack.imgur.com/0k0b0.png" alt="Screenshot of the Action registry key"></p> <p>The test data that I was testing the regex against was here:</p> <pre><code>C:\Documents and Settings\&lt;username&gt;\Application Data\JGsoft\RegexBuddy 3 </code></pre>
<p>It depends on the OS, of cause, but on Windows I would guess the application data directory. I can't remember the path on xp but on vista it's something like this:</p> <p>C:\Users\ <em>user name</em> \AppData\</p> <p>And then it would probably be here:</p> <p>C:\Users\ <em>user name</em> \AppData\roaming</p>
7,885
<p>I have a asp.net 2.0 web site with numerous asp:DropDownList controls. The DropDownList control contains the standard info city, state, county etc... info. In addition to the standard codes the site also has custom codes that the users can configure themselves. For example a animal dropdown may contain the values Dog, Cat, Fish, ect...</p> <p>I am popluating the DropDownList from a SQL 2005 table that I created e.g. tblCodes</p> <p>Everything works great and users are able to add orders using the numerous DropDownList controls to choose items from the list.</p> <p>The problem occurrs if a user wants to change one of their custom dropdowns. For example a user would like to change the verbage on a animal type control from Dog to K9. This is where the problem starts.</p> <p>For all new orders the drop down works fine. When the user retrieved an old order I get the following error in the C# codebehind "'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items."</p> <p>What's happening is the old order has a database field value of Dog and the DropDownList no longer has Dog in its list since the user changed it to K9.</p> <p>Any ideas on a workaround?<br> Is there a way to make the asp:DropDownList accept items not seeded in its list? Is there another control I could use?</p>
<p>I solved this exact same problem just two days ago. First, I moved the code that set the SelectedValue to a PreRender handler for the DropDownList. Then, I add logic to first check to see if the value is in the drop down list. If not, I add it.</p> <p>Here's my code. ddSpecialty is my drop-down list, populated with "specialties" from the database. registration.Specialty is the specialty that the user chose, which may or may not be in the drop down, since that particular specialty may have been deleted since they last chose it.</p> <pre><code>protected void ddSpecialty_PreRender(object sender, EventArgs e) { if (!ddSpecialty.Items.Contains(new ListItem(registration.Specialty))) ddSpecialty.Items.Add(registration.Specialty); ddSpecialty.SelectedValue = registration.Specialty; } </code></pre>
<p>Try this: </p> <pre><code>if (ddl.Items.Contains(new ListItem(selectedFacility))) ddl.SelectedValue = selectedFacility; </code></pre>
5,952
<p>I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?</p>
<p>Ok so I finally solved this: You need to call <code>Page_ClientValidate()</code> in your Save javascript method and If it returns true continue with the save, the <code>Page_ClientValidate()</code> initiates the client side validators, See code below:</p> <pre><code> function Save() { var clientValidationPassed =Page_ClientValidate(); if(clientValidationPassed) { //Save Data PageMethods.SaveUser(UserName,Role,SaveCustomerRequestComplete, RequestError); $find('editPopupExtender').hide(); } else { //Do Nothing as CLient Validation messages are now displayed } return false; } </code></pre>
<p>what are you using for development? VS 2008 supposedly has better JS debugging, haven't tried it yet. </p> <p>For Ajax you can use the Sys.Debug obj</p>
6,759
<p>I am looking for a more technical explanation than the OS calls the function.</p> <p>Is there a website or book?</p>
<p>The .exe file (or equivalent on other platforms) contains an 'entry point' address. To a first approximation, the OS loads the relevant sections of the .EXE file into RAM, and then jumps to the entry point.</p> <p>As others have said, this entry point will not be 'main', but will instead be a part of the runtime library - it will do things like initialising static objects, setting up the <em>argc</em> and <em>argv</em> parameters, setting up standard input, standard output, standard error, etc. When it's done all that, it will call your main() function. When main exits, the runtime goes through an analogous process of passing your return code back to the environment, calling static destructors, calling _atexit routines, etc.</p> <p>If you have Microsoft tools (perhaps not the freebie ones), then you have all the runtime source, and an easy way to look at it is to put a breakpoint on the closing brace of your main() method, and single step back up into the runtime.</p>
<p><a href="http://books.google.com/books?id=wZoQyVi5f60C&amp;printsec=frontcover&amp;dq=expert+c%2B%2B%2Fcli&amp;ei=MKylSPz2JJOaigHlkLn7BA&amp;sig=ACfU3U36tvex7dO7wVyGtuy1arcJuU3N0g" rel="nofollow noreferrer">Expert C++/CLI</a> (check around page 279) has very specific details of the different bootstrap scenarios for native, mixed, and pure CLR assemblies.</p>
3,339
<p>I wanted to "emulate" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)</p> <pre> Basics: Player has a time machine. On each iteration of using the time machine, a parallel state is created, co-existing with a previous state. One of the states must complete all the objectives of the level before ending the stage. In addition, all the stages must be able to end the stage normally, without causing a state paradox (wherein they should have been able to finish the stage normally but, due to the interactions of another state, were not). </pre> <p>So, that sort of explains how the game works. You should play it a bit to really understand what my problem is. <br /></p> <p>I'm thinking a good way to solve this would be to use linked lists to store each state, which will probably either be a hash map, based on time, or a linked list that iterates based on time. I'm still unsure.<br /></p> <p>ACTUAL QUESTION:</p> <p>Now that I have some rough specs, I need some help deciding on which data structures to use for this, and why. Also, I want to know what Graphics API/Layer I should use to do this: SDL, OpenGL, or DirectX (my current choice is SDL). And how would I go about implementing parallel states? With parallel threads?</p> <p>EDIT (To clarify more):<br /> OS -- Windows (since this is a hobby project, may do this in Linux later)<br /> Graphics -- 2D Language -- C++ (must be C++ -- this is practice for a course next semester)</p> <p>Q-Unanswered: SDL : OpenGL : Direct X <br /> Q-Answered: Avoid Parallel Processing <br /> Q-Answered: Use STL to implement time-step actions.<br /></p> <pre> So far from what people have said, I should: 1. Use STL to store actions. 2. Iterate through actions based on time-step. 3. Forget parallel processing -- period. (But I'd still like some pointers as to how it could be used and in what cases it should be used, since this is for practice). </pre> <p>Appending to the question, I've mostly used C#, PHP, and Java before so I wouldn't describe myself as a hotshot programmer. What C++ specific knowledge would help make this project easier for me? (ie. Vectors?)</p>
<p>What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: <a href="http://www.gaffer.org/game-physics/fix-your-timestep" rel="nofollow noreferrer">http://www.gaffer.org/game-physics/fix-your-timestep</a>).</p> <p>Then what you do is to keep a list of list of pairs of frame counter and action. STL example:</p> <pre class="lang-c++ prettyprint-override"><code>std::list&lt;std::list&lt;std::pair&lt;unsigned long, Action&gt; &gt; &gt; state; </code></pre> <p>Or maybe a vector of lists of pairs. To create the state, for every action (player interaction) you store the frame number and what action is performed, most likely you'd get the best results if action simply was "key &lt;X> pressed" or "key &lt;X> released":</p> <pre class="lang-c++ prettyprint-override"><code>state.back().push_back(std::make_pair(currentFrame, VK_LEFT | KEY_PRESSED)); </code></pre> <p>To play back the previous states, you'd have to reset the frame counter every time the player activates the time machine and then iterate through the state list for each previous state and see if any matches the current frame. If there is, perform the action for that state. To optimize you could keep a list of iterators to where you are in each previous state-list. Here's some <em>pseudo-code</em> for that:</p> <pre class="lang-c++ prettyprint-override"><code>typedef std::list&lt;std::pair&lt;unsigned long, Action&gt; &gt; StateList; std::list&lt;StateList::iterator&gt; stateIteratorList; // foreach(it in stateIteratorList) { if(it-&gt;first == currentFrame) { performAction(it-&gt;second); ++it; } } </code></pre> <p>I hope you get the idea...</p> <p>Separate threads would simply complicate the matter greatly, this way you get the same result every time, which you cannot guarantee by using separate threads (can't really see how that would be implemented) or a non-fixed time-step game loop.</p> <p>When it comes to graphics API, I'd go with SDL as it's probably the easiest thing to get you started. You can always use OpenGL from SDL later on if you want to go 3D.</p>
<p>After briefly glossing over the description, I think you have the right idea, I would have a state object that holds the state data, and place this into a linked list...I don't think you need parallel threads...</p> <p>as far as the graphics API, I have only used opengl, and can say that it is pretty powerful and has a good C / C++ API, opengl would also be more cross platform as you can use the messa library on *Nix computers. </p>
9,880
<p>Is there a good way to find out which exceptions a procedure/function can raise in Delphi (including it's called procedures/functions)? </p> <p>In Java you always have to declare which exceptions that can be thrown, but this is not the case in Delphi, which could lead to unhandled exceptions. </p> <p>Are there any code analysis tools that detects unhandled exceptions?</p>
<p>(Edit: It is now obvious that the question referred <em>only</em> to design-time checking.)</p> <p>New answer:</p> <p>I cannot state whether there are any tools to check this for you. Pascal Analyzer, for one, does not.</p> <p>I <em>can</em> tell you, however, that in most Delphi applications, even if there was a tool to check this for you, you would get no results.</p> <p><em>Why?</em> Because the main message loop in TApplication.Run() wraps all HandleMessage() calls in an exception handling block, which catches all exception types. Thus you will have implicit/default exception handling around 99.999% of code in most applications. And in most applications, this exception handling will be around 100% of your own code - the 0.001% of code which is not wrapped in exception handling will be the automatically generated code.</p> <p>If there was a tool available to check this for you, you would need to rewrite Application.run() such that it does not include exception handling.</p> <p>(Previous answer: <em>The Application.OnException event handler can be assigned to catch all exceptions that aren't handled by other exception handlers. Whilst this is run-time, and thus perhaps not exactly what you are after (it sounds like you want to identify them at design time), it does allow you to trap any exception not handled elsewhere. In conjunction with tools such as the JCLDebug stuff in the <a href="http://sourceforge.net/projects/jcl/" rel="noreferrer">Jedi Code Library</a>, you could log a stack trace to find out where &amp; why an exception occurred, which would allow for further investigation and adding specific exception handling or prevention around the guilty code...</em>)</p>
<p>Finalization sections of units can raise exceptions too. These will slip by I think... and are also somewhat problematic.</p> <p>I think Delphi IDE has a build-in &quot;stack trace&quot; or &quot;stack tree&quot; something like.</p> <p>This question reminds me of Skybuck's TRussianRoulette game... google it, it's code and answer may help.</p>
9,817
<p>What is currently the best way to get a favicon to display in all browsers that currently support it?</p> <p>Please include:</p> <ol> <li><p>Which image formats are supported by which browsers.</p></li> <li><p>Which lines are needed in what places for the various browsers.</p></li> </ol>
<p>I go for a belt and braces approach here. </p> <p>I create a 32x32 icon in both the <code>.ico</code> and <code>.png</code> formats called <code>favicon.ico</code> and <code>favicon.png</code>. The icon name doesn't really matter unless you are dealing with older browsers.</p> <ol> <li>Place <code>favicon.ico</code> at your site root to support the older browsers (optional and only relevant for older browsers.</li> <li>Place favicon.png in my images sub-directory (just to keep things tidy).</li> <li>Add the following HTML inside the <code>&lt;head&gt;</code> element.</li> </ol> <pre>&lt;link rel="icon" href="/images/favicon.png" type="image/png" /&gt; &lt;link rel="shortcut icon" href="/favicon.ico" /&gt;</pre> <p>Please note that:</p> <ul> <li>The MIME type for <code>.ico</code> files was registered as image/vnd.microsoft.icon by the <a href="http://www.iana.org" rel="noreferrer"><strong>IANA</strong></a>. </li> <li>Internet Explorer will ignore the <code>type</code> attribute for the shortcut icon relationship and this is the only browser to support this relationship, it doesn't need to be supplied.</li> </ul> <p><a href="http://www.jonathantneal.com/blog/understand-the-favicon/" rel="noreferrer"><strong>Reference</strong></a></p>
<p>The answer to this question has become <a href="https://stackoverflow.com/a/48969053/7343159">complicated enough</a> that the best way is to just use a tool like RealFaviconGenerator, which lets you upload a png/jpg and then generates favicons and code to cover all the platforms for you: <a href="https://realfavicongenerator.net/" rel="nofollow noreferrer">https://realfavicongenerator.net/</a></p>
5,776
<p>I just acquired a new Creality Ender 5 Pro. It was assembled very easily. Today I tried my first print - the Dog demo that came on the MicroSD just to see how it worked. It is a 2.5 hour print.</p> <p>While I was preheating there was a thermal runaway error while I was feeding the filament up through the tube. I restarted the machine and began the print. The error repeated 6 more times during the print. Each time I reset the machine by cycling the power (there were no instructions for a reset) and I was able to resume the printing.</p> <p>I have been sitting here while this thing goes so as to be able to restart if necessary. It will be a real drag when I try to print anything larger. I feel as though I cannot leave the machine alone.</p> <p>The bed seems to hold steady at 45 °C. The nozzle is set to 200 °C (the default on the display) for PLA. It seems to lag a bit sometimes going as low as 196 °C. I suspect this is normal as it is being fed cold filament. When I restart almost immediately, the nozzle starts with a temp of about 140 °C and takes a few minutes to get hot enough to resume the print.</p> <p>What is going on?</p>
<p>Since I have been unable to find a way to fix the E3D V6 clone hotend I have instead replaced it with a Creality Mk 8 that I had on-hand, which has so far worked flawlessly.</p> <p>I am assuming that the improved performance is related to the use of a shorter nozzle and/or the Bowden tube butting directly against the nozzle instead of interfacing with an all-metal heat-break. Those seem to be the biggest differences between the two designs.</p>
<p>I had issues with my all metal hot-end where I got heat creep. I ended up doing e-steps, PID tune, and ensuring my speed wasn't too slow either. Is your printer in an enclosure? I found that mine being in an enclosure caused the hotend to not cool sufficiently, so I had to lower the hot bed temp by 10 degrees and that seems to have resolved my issue for heat creep. I also have the Hero Me fan housing which improves airflow.</p>
2,170
<p>I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either:</p> <ul> <li>learn the ins and out of C in Visual Studio</li> <li>recommend a better C IDE + compiler</li> </ul> <hr> <p><strong>Edit:</strong> See also: <a href="https://stackoverflow.com/questions/951516/a-good-c-ide">https://stackoverflow.com/questions/951516/a-good-c-ide</a></p>
<p>well you can use visual studio just fine take a look at here man <a href="http://www.daniweb.com/forums/thread16256.html" rel="noreferrer">http://www.daniweb.com/forums/thread16256.html</a></p> <p>Go to View Menu select Solution Explorer or CTRL+ ALT +L</p> <p>Then Select The project that your are developing and right click on that.</p> <p>Then select the Properties from the submenu.</p> <p>Then select the Configuration properties from the Tree structure. under that select C/C++ then select Advanced. Now in the right side pane change the property</p> <p>Compile As from Compile as C++ Code (/TP) to Compile as C Code (/TC)</p> <p>Finally change your file extensions to .c</p> <h1>Now you configured you Visual Studio to compile C programs</h1> <p><strong>And you can use NetBeans too it could even be more user friendly than Visual Studio download it you wont regret i promise</strong></p>
<p>Visual Studio or Express do consider .c files as C code, but the compiler will keep giving warnings, and irritating suggestions which you do not require, in the debugger. Gives an indication that Visual C++, as the name suggests is optimized for C++ development for the Windows Operating system, which was originally written in plain pure C.</p>
4,823
<p>Every time I start a print, midway during printing, my printer starts to under extrude.</p> <p>I tried lots of different models every time the problem occurs.</p> <p>What should I do about this?</p>
<p>This is some kind of filament stuck in the hotend tube problem. Just like &quot;heat creep&quot; as mentioned above. PTFE pipes should be checked, all parts should be carefully cleaned. I also add checking the extruder (gears, tightness) to the list. The plastic extruder can structurally loosen or break over time. I switched to metal extruder a long time ago, but metal also breaks / loosens after a while. Finally I'm using a double gear extruder without any problem. And I replaced the stock pipes with more durable PTFE and &quot;Pneumatic Fittings&quot;. <strong>Pneumatic fittings</strong> are also very important by the way.</p>
<p>If everything is stock on the machine and all other setting are properly configured, this is most likely <a href="https://all3dp.com/2/3d-printer-heat-creep/" rel="nofollow noreferrer">heat creep</a>. This is caused when the PFTE tubing is not properly set within the hot end itself leaving a small gap. As filament is fed into the hot end and heated to melting, some filament oozes out in the gap between the PFTE tubing and the nozzle. This melted filament then cools and hardens making it harder to extrude filament causing under extrusion.</p> <p>You may want to calibrate your E-steps and flow as well, <a href="https://teachingtechyt.github.io/calibration.html" rel="nofollow noreferrer">here is an excellent website</a>.</p>
1,926
<p>What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in .NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. </p> <p>Now, I have to write some Java code and want to run something similar using JUnit. The JUnit documentation is nice and clear about adding the attributes necessary to create tests, but its pretty lean on how to fire up a runner and see the results of those tests.</p>
<p>Eclipse is by-far the best I've used. Couple JUnit with a <a href="http://www.eclemma.org/" rel="nofollow noreferrer">code coverage</a> plug-in and Eclipse will probably be the best unit-tester.</p>
<p>Why you need a GUI runner? Can't you just run the tests from the IDE itself?</p> <p>In .Net we have <a href="http://testdriven.net/" rel="nofollow noreferrer">TestDriven.net</a>, in Java there must be something equivalent. You can check out <a href="http://en.wikipedia.org/wiki/IntelliJ_IDEA" rel="nofollow noreferrer">IntelliJ IDEA</a>, it has the unit testing support built-in. </p>
8,360
<p>Is there any way to convert a bmp image to jpg/png without losing the quality in C#? Using Image class we can convert bmp to jpg but the quality of output image is very poor. Can we gain the quality level as good as an image converted to jpg using photoshop with highest quality?</p>
<pre><code>var qualityEncoder = Encoder.Quality; var quality = (long)&lt;desired quality&gt;; var ratio = new EncoderParameter(qualityEncoder, quality ); var codecParams = new EncoderParameters(1); codecParams.Param[0] = ratio; var jpegCodecInfo = &lt;one of the codec infos from ImageCodecInfo.GetImageEncoders() with mime type = "image/jpeg"&gt;; bmp.Save(fileName, jpegCodecInfo, codecParams); // Save to JPG </code></pre>
<p>You can try:</p> <pre><code>Bitmap.InterpolationMode = InterpolationMode.HighQualityBicubic; </code></pre> <p>and</p> <pre><code>Bitmap.CompositingQuality = CompositingQuality.HighQuality; </code></pre> <p>Which does keep the quality fairly high, but not the highest possible.</p>
6,303
<p>Given the Marlin Firmware what is the difference between the following lines of code:</p> <blockquote> <p>G4 S20</p> </blockquote> <p>and</p> <blockquote> <p>G4 P2000</p> </blockquote>
<p>The answer is that <strong><em>it depends on the type of firmware</em></strong> you are using.</p> <p>Let us look at the documentation of <a href="https://reprap.org/wiki/G-code#G4:_Dwell" rel="nofollow noreferrer"><code>G4</code></a> to find that <code>G4</code> is valid for all the listed firmware types: <a href="https://i.stack.imgur.com/Tt7wT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tt7wT.png" alt="enter image description here"></a></p> <blockquote> <p>Pause the machine for a period of time.</p> </blockquote> <p>Furthermore it states that:</p> <blockquote> <p><strong>Parameters</strong></p> <ul> <li>Pnnn Time to wait, in milliseconds (In Teacup, P0, wait until all previous moves are finished)</li> <li>Snnn Time to wait, in seconds (Only on Repetier, Marlin, Smoothieware, and RepRapFirmware 1.16 and later)</li> </ul> </blockquote> <p>It clearly shows that the <code>S</code> parameter (which defines the pause in seconds) is only supported by a few firmware types. Do note that this documentation may not be up-to-date, so it is best to look into the source code or the users manual of the particular firmware you are using.</p> <hr> <p>E.g. if you are using Marlin Firmware, <code>G4 S20</code> will pause the machine for 20 seconds while <code>G4 P2000</code> will pause the machine for 2000 milliseconds which is 2 seconds. This means that a different time is requested, to have 20 seconds waiting time you could use <code>G4 P20000</code></p> <p>To answer your question what the <strong><em>actual difference</em></strong> between the 2 commands is:</p> <ul> <li>it is <strong>either</strong> 18 seconds of extra waiting time if your firmware supports the <code>S</code> parameter, <strong>or</strong> </li> <li>a firmware that skips or chokes on the command because it is not supported (that also probably depends on your firmware).</li> </ul>
<p>The code <code>G4</code> refers to <em>dwell</em>. (From what I'm seeing, it can be written as either <code>G4</code> or <code>G04</code>). <code>P</code>is the length of dwell time, usually in milliseconds. The parameter <code>S</code> seems to be invalid, because the only inputs are <code>X</code> (seconds), <code>P</code> (milliseconds), or <code>U</code> (undefined). If you have <code>S20</code> in your code, it is invalid, whereas <code>P2000</code> will cause all axes to remain unmoving for 2 seconds before moving on. </p> <p>(Note: Not all machines will accept <code>X</code> or <code>U</code>.)</p> <p><strong>EDIT:</strong> This answer is specific to <em>non-specific</em> g-code, taken from this <a href="https://all3dp.com/g-code-tutorial-3d-printer-gcode-commands/" rel="nofollow noreferrer"><em>Source</em></a>, since the OP did not state any specifics about their firmware type or equipment used.</p>
1,092
<p>The system default polygon fill mode in current device context is <code>ALTERNATE</code> (as I've learned from the Petzold book on Windows programming) and this one is used in <a href="http://msdn.microsoft.com/en-us/library/ms533274(VS.85).aspx" rel="nofollow noreferrer"><code>Polygon</code></a> Win32 function unless you change the mode with <a href="http://msdn.microsoft.com/en-us/library/ms536642(VS.85).aspx" rel="nofollow noreferrer"><code>SetPolyFillMode</code></a>.</p> <p><strong>My question is</strong>: Does the GDI+ <a href="http://msdn.microsoft.com/en-us/library/ms535958(VS.85).aspx" rel="nofollow noreferrer"><code>Graphics::FillPolygon</code></a> (without the <code>FillMode</code> parameter in its signature) method also use the current device context fill mode or sets the well-known-default and then sets back the mode set before it was called?</p> <p>Thanks!</p>
<p>I don't know the answer off the top of my head, but you could try finding out by retrieving the fill mode before and after the call. If it's not different, it's either not been changed, or was changed then changed back.</p>
<p>I looked at the reference source and FillPolygon without a fill mode simply calls FillPolygon with a fill mode of alternate.</p> <p>FillPolygone with a fill mode calls a method named GdipFillPolygonI, but I can't find anything about that method.</p>
7,454
<p>For standard ABS and PLA filament, most distributors recommend storing the filament in an airtight bag. Does not doing this actually make print quality worse? I have left mine in the open for a year and have had no noticeable problems.</p>
<p>It makes a difference where I live, and I'm not in a particularly humid climate (California). When printing with wet filament, you'll sometimes hear it popping and see steam coming out of the extruder (it's usually only this extreme with nylon). With most other filaments, when they're wet, the extruded filament will have small bubbles in it and the surface finish of the parts will be rougher, with breaks in the layer lines. It can also lead to more oozing and stringing. Air print a few centimeters of filament and look at it closely to see if there's any bubbles, if not, it's probably dry enough. Whether the filament absorbs enough water to be noticeable in a few hours, in a day, or in a week depends a lot on the filament (and I assume the humidity too). I'm mostly noticed problems with nylon, ABS, and NinjaFlex, less with PLA and PETG (though I avoid leaving any filament out for more than a day).</p> <p>If you're not seeing any difference between, then I wouldn't worry about it. Storing filament dry is a hassle.</p>
<p>I haven't had any other issues storing it in the open, but keeping it in an airtight environment (especially if you live in a humid environment) keeps it moisture free, which can effect print quality. Manufacturers recommend this to help keep filament dry.</p>
107
<p>I'm building a Kossel Mini, and I'm stuck on the extruder motor holder.</p> <p>My Kossel came without instructions, I was given a set of instructions by a friend (the "Kossel Build Guide" by Blomker industries). I also found some instructions on the net. However, my components are different from those in the build guides.</p> <p>The question is how these components fit together. </p> <p>I'm pretty certain the stepper motor should be connected to the big black components (labeled (1) and (4) in the picture). The 4 holes in these components correspond to openings in the stepper motor; and the stepper motors for the vertical carriages, were connected in a similar way to their respective holders.</p> <p>The round thing, second from the left on the bottom, (labeled (2) in the picture) presumably goes on the axis of the stepper motor. Once again, a similar procedure was needed for the motors that will move the vertical carriages.</p> <p>The screws on the right, labeled (3), are 1&nbsp;cm long and 3&nbsp;mm wide.</p> <p>The other screws are 2&nbsp;cm long and 3&nbsp;mm wide.</p> <p>The stepper motor is a Wantai Stepper Motor Model 42BYGHW811 .</p> <p>I have e-mailed the company where I bought my kit and am awaiting their answer. Meanwhile I'm hoping to get some advice here.</p> <p>Apparently the usual stepper motor for a Kossel Mini is Nema 17. Searching on "42BYGHW811" I mostly find datasheets. Using "Nema 17 mount" or "Nema 17 mounting screws" as search terms, I find a lot of images with a component like (1). But nothing on how this and the other components should be put together for the motor holder for an extruder for the Kossel Mini.</p> <p><a href="https://i.stack.imgur.com/l98L8.jpg" rel="nofollow noreferrer" title="Parts of the extruder"><img src="https://i.stack.imgur.com/l98L8.jpg" alt="Parts of the extruder" title="Parts of the extruder"></a></p>
<p>Have a look at the image provided in this seller's part description. it probably says more than my words could (which would also only rely on images - your parts just looked like I saw them somewhere before). </p> <p><a href="http://de.aliexpress.com/item/3D-printer-parts-right-hand-bowden-Extruder-kit-set-no-motor-compact-extruder-aluminum-alloy-for/32319995802.html" rel="nofollow noreferrer">3D printer parts right hand Bowden Extruder kit set no motor compact extruder aluminum alloy for</a></p> <p><a href="https://i.stack.imgur.com/fsNaL.jpg" rel="nofollow noreferrer" title="Right hand Bowden Extruder kit"><img src="https://i.stack.imgur.com/fsNaL.jpg" alt="Right hand Bowden Extruder kit" title="Right hand Bowden Extruder kit"></a></p>
<p>The extruder is an MK8 derivative, <em>I think</em>.</p> <p>After a <em>lot</em> of searching, the closest that I could find (with an assembly diagram) is this product which has more or less the same parts as yours (apart from the small black bolt and sleeve - used as the axis - which you don't have): <a href="https://rads.stackoverflow.com/amzn/click/com/B07BMLD646" rel="nofollow noreferrer" rel="nofollow noreferrer">[Improved Version] YOTINO Right Hand MK8 Remote Bowden Extruder Accessories 1.75mm/3mm Filament All Metal Remote Extruder Frame Block for Reprap 3D Printer Kossel Prusa</a>.</p> <p>These are the parts:</p> <blockquote> <p><a href="https://i.stack.imgur.com/5BTxF.jpg" rel="nofollow noreferrer" title="16 parts"><img src="https://i.stack.imgur.com/5BTxF.jpg" alt="16 parts" title="16 parts"></a></p> </blockquote> <p>This is the assembly process:</p> <blockquote> <p><a href="https://i.stack.imgur.com/whaLA.jpg" rel="nofollow noreferrer" title="Assembly process"><img src="https://i.stack.imgur.com/whaLA.jpg" alt="Assembly process" title="Assembly process"></a></p> </blockquote> <p>This is the completed extruder:</p> <blockquote> <p><a href="https://i.stack.imgur.com/YF1U6.jpg" rel="nofollow noreferrer" title="Completed extruder"><img src="https://i.stack.imgur.com/YF1U6.jpg" alt="Completed extruder" title="Completed extruder"></a></p> </blockquote> <hr> <p>Also, whilst this is not the same beast, this link shows a detailed assembly which could prove useful as a cross reference: <a href="https://reprap.org/wiki/Extruder_assembly" rel="nofollow noreferrer">RepRapWiki - Extruder assembly</a></p> <p>In addition, w.r.t the Blomker guide, there are a number of versions of the same guide that I've come across in the past:</p> <ul> <li><a href="http://www.robotdigg.com/upload/pdf/2a823cc8a8dcff9da99cce92710cc745.pdf" rel="nofollow noreferrer">Kossel Mini Build Guide by Blomker</a> - which has a very different extruder to the MK8</li> <li><a href="https://gr33nonline.files.wordpress.com/2017/05/kossel-mini-instrution-by-sintron-technology_v2.pdf" rel="nofollow noreferrer">Kossel Mini Build Guide By Sintron</a> - which has a similar MK8 extruder but, rather unfortunately, no assembly details, only the finished article is shown, on page 58</li> </ul>
220
<p>My printer will feature LM8UU bearings/threaded rods for the z-axis and bronze sinter bushings on the x- and y-Axis.</p> <p>As also, but not only, written here <a href="http://reprap.org/wiki/Lubrication" rel="nofollow">http://reprap.org/wiki/Lubrication</a>, I know that one should:<br> - use machine oil for sinter bearings, if anything at all,<br> - grease on the 'more fluid' side for the linear bearings so that the lubricant stays eqally with balls on the upper and lower side<br> - and probably PTFE grease for the threaded rods (as for example provided by the Ultimaker UM2)</p> <p>Is there a way to unify this or at least only use two lubricants?<br> I do not have the slightest idea about lubricants, I would not know what to actually buy if the combination would e.g. be machine oil and low viscosity grease. Do you have specific recommendations of what to avoid?</p>
<p>A mid-weight PTFE grease like the popular Superlube will work in all the cases you mention (bearings, screws, and sintered bushings). 3D printer service conditions are quite light-duty as far as lubricants are concerned. You really just need to keep everything a little bit "wet" with oil or grease and performance will be adequate. </p> <p>The main downside to using grease with sintered bushings is that they will likely stop being "self-lubricating" after the first exposure. The grease tends to clog the pores that allow the sintered bushings' factory oil impregnation to maintain a nice oil film on the sliding surfaces. So the bushings will forever-after require regular re-greasing, just like the ball bearings and threaded rod. </p> <p>In comparison, a light machine oil like 3-in-one will maintain the sintered bushings' self-lubricating properties, but if used in ball bearings and screws will require very frequent replenishment. And that is certainly an option -- oil DOES work on bearings and screws -- but odds are good that you'll eventually over-oil the bearings, get drips on the build plate, and bang your head against a wall trying to figure out why your prints won't stick all of a sudden. Grease doesn't need to be applied as often, and it tends to stay where you put it rather than dripping. So grease is generally preferred to oil if you have to pick just one lubricant.</p> <p>Again, the most important thing is to keep sliding and rolling surfaces wet with <em>something</em>. You'll just have various maintenance trade-offs with different options. </p>
<p>I needed to grease up my machine and had no access to specialist materials. So I researched, and ended up using Vaseline. </p> <p>I now have a small tub of it as part of my machine maintenance kit.</p>
243
<p>I'm not sure how else to describe it. There's probably a name for this but I just don't know it. But the bottom few layers came out great, but the rest came out kind of like a triscuit. Below are pics of my print and settings. I am using a delta style printer. Can someone tell me what this issue is called and how to fix it?</p> <p><a href="https://i.stack.imgur.com/LIC5X.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LIC5X.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/YQtFj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YQtFj.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/nMsYs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nMsYs.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/EdEbV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EdEbV.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/Vph9a.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vph9a.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/MCqXD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MCqXD.jpg" alt="enter image description here"></a></p>
<p>The phenomenon you experience is called <strong>under-extrusion</strong>. Under-extrusion is the effect of extruding lesser filament than required for the print. The result of under-extrusion (depending on the amount of under-extrusion) can be described as <a href="/q/8741/">spongy</a> prints, gaps in prints/layers, failed prints, etc. As the amount of plastic flow is less than required for the print, the quality and print strength is much lower than that of a normal filament flow printed part.</p> <p>Most severe under-extrusion is usually caused by <strong>incorrect filament diameter</strong> setting. E.g. Ultimaker Cura (to date, April 2019, the version is 4.0) is notorious for resetting the filament diameter to 2.85 mm after you upgraded to a newer version (because that is the diameter of the filament the Ultimaker machines use) while most people use 1.75 mm diameter filament.</p> <p>From the settings if appears you have set the correct filament diameter (i.e. if you use 1.75 mm filament). Please measure the filament over a few meters and determine the average filament diameter to be sure.</p> <p>In your case it must be something else!</p> <p>A higher temperature causes filament to be more fluid (do <strong>check if the temperature you use fits the type of filament</strong> you use), so an increased temperature should help against under-extrusion (less friction for the extruder to push the filament through the nozzle). Please do <strong>check the extruder stepper</strong>; is it skipping?, is the tension the extruder gear exerts on the filament enough to prevent slipping?</p> <p>Finally, <strong>blockage</strong> of the nozzle; partial blockage of the nozzle can prevent consistent flow from the nozzle. It is advised to rigorously clean the nozzle (e.g. using the atomic cleaning method where you heat up the nozzle insert filament and turn off the heat to pull the filament out when temperature is about 30 °C lower than the printing temperature of the filament) or replace the nozzle.</p> <hr /> <p>To complete the answer, another source for under extrusion that is seen from the beginning of 2020 of Marlin firmware operated 3D printers is that instead of normal extrusion (where E in the G-code file denotes extrusion of filament movement in units of length), the printer assumes it is volumetric displacement. From the Marlin menu of the graphical controller you can change volumetric displacement to length displacement by disabling volumetric flow.</p>
<p>Just to add to the already made answers:</p> <p>Check out <strong>heat-creep!</strong></p> <p>When heat from the hot-end creeps up in the filament, it melts and blocks the extrusion (more or less severely), and under extrusion results.</p> <p>It's basic characteristic is that the print <strong>starts out great</strong>, and then <strong>some time in</strong>, under extrusion happens.</p> <p>The solution is to cool down the cold part of the hot-end which is usually done with a small fan directed onto the cold part, e.g the top part where the filament enters the hot-end.</p> <p>Most hot-ends have a heat sink on the cold part, but in my experience this is not enough and for me a fan has always been needed.</p>
1,297
<p>Can somebody give me a complete and working example of calling the <code>AllocateAndInitializeSid</code> function from C# code?</p> <p>I found <a href="http://msdn.microsoft.com/en-us/library/aa375213(VS.85).aspx" rel="nofollow noreferrer">this</a>: </p> <pre><code>BOOL WINAPI AllocateAndInitializeSid( __in PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, __in BYTE nSubAuthorityCount, __in DWORD dwSubAuthority0, __in DWORD dwSubAuthority1, __in DWORD dwSubAuthority2, __in DWORD dwSubAuthority3, __in DWORD dwSubAuthority4, __in DWORD dwSubAuthority5, __in DWORD dwSubAuthority6, __in DWORD dwSubAuthority7, __out PSID *pSid ); </code></pre> <p>and I don't know how to construct the signature of this method - what should I do with <code>PSID_IDENTIFIER_AUTHORITY</code> and <code>PSID</code> types? How should I pass them - using <code>ref</code> or <code>out</code>?</p>
<p>Using <a href="http://www.codeplex.com/clrinterop" rel="nofollow noreferrer">P/Invoke Interop Assistant</a>:</p> <pre><code> [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct SidIdentifierAuthority { /// BYTE[6] [System.Runtime.InteropServices.MarshalAsAttribute( System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)] public byte[] Value; } public partial class NativeMethods { /// Return Type: BOOL-&gt;int ///pIdentifierAuthority: PSID_IDENTIFIER_AUTHORITY-&gt;_SID_IDENTIFIER_AUTHORITY* ///nSubAuthorityCount: BYTE-&gt;unsigned char ///nSubAuthority0: DWORD-&gt;unsigned int ///nSubAuthority1: DWORD-&gt;unsigned int ///nSubAuthority2: DWORD-&gt;unsigned int ///nSubAuthority3: DWORD-&gt;unsigned int ///nSubAuthority4: DWORD-&gt;unsigned int ///nSubAuthority5: DWORD-&gt;unsigned int ///nSubAuthority6: DWORD-&gt;unsigned int ///nSubAuthority7: DWORD-&gt;unsigned int ///pSid: PSID* [System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "AllocateAndInitializeSid")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool AllocateAndInitializeSid( [System.Runtime.InteropServices.InAttribute()] ref SidIdentifierAuthority pIdentifierAuthority, byte nSubAuthorityCount, uint nSubAuthority0, uint nSubAuthority1, uint nSubAuthority2, uint nSubAuthority3, uint nSubAuthority4, uint nSubAuthority5, uint nSubAuthority6, uint nSubAuthority7, out System.IntPtr pSid); } </code></pre>
<p>For Platform Invoke www.pinvoke.net is your new best friend!</p> <p><a href="http://www.pinvoke.net/default.aspx/advapi32/AllocateAndInitializeSid.html" rel="nofollow noreferrer">http://www.pinvoke.net/default.aspx/advapi32/AllocateAndInitializeSid.html</a></p>
8,080
<p>how can i create an application to read all my browser (firefox) history? i noticed that i have in </p> <p>C:\Users\user.name\AppData\Local\Mozilla\Firefox\Profiles\646vwtnu.default</p> <p>what looks like a sqlite database (urlclassifier3.sqlite) but i don't know if its really what is used to store de history information. i searched for examples on how to do this but didn't find anything.</p> <p>ps: although the title is similar i believe this question is not the same as <a href="https://stackoverflow.com/questions/48805/how-do-you-access-browser-history">"How do you access browser history?"</a></p>
<p>I believe <code>places.sqlite</code> is the one you should be looking into for history (Firefox 3). Below are a couple of Mozilla wiki entries that have some info on the subject.</p> <ul> <li><a href="https://wiki.mozilla.org/Mozilla2:Unified_Storage" rel="noreferrer">Mozilla 2: Unified Storage</a></li> <li><a href="https://wiki.mozilla.org/Browser_History" rel="noreferrer">Browser History</a> <em>(see especially section "Database Design" here)</em></li> </ul> <p>In earlier versions of Firefox they stored history in a file called <code>history.dat</code>, which was encoded in a format called "Mork". <a href="http://www.jwz.org/hacks/mork.pl" rel="noreferrer">This perl script by Jamie Zawinski</a> can be used to parse Mork files.</p>
<p>The <a href="https://addons.mozilla.org/en-US/firefox/addon/5817" rel="nofollow noreferrer">Firefox SQLite Manager Addon</a> is a great tool. If you wish to learn about the Firefox Places design and DB schema visit <a href="https://developer.mozilla.org/en/Places" rel="nofollow noreferrer">Mozilla Places</a>.</p>
7,760
<p>I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a .net sense.</p> <p>Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ASP.net¹, I just wonder: Is it actually feasible to have Image Manipulation Libraries that run completely in Managed Code? XNA does it if i remember correctly, albeit it uses the graphics card for it.</p> <p>Is there maybe even any .net Image Library that implements a sort of managed GDI+?</p> <p>¹ <a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.aspx" rel="nofollow noreferrer">Source</a>, also Microsoft just offered <a href="http://www.hanselman.com/blog/ASPNETFuturesGeneratingDynamicImagesWithHttpHandlersGetsEasier.aspx" rel="nofollow noreferrer">something</a> for ASP.net that uses GDI+.</p>
<p>It's still a technology worth using. There are lots of Windows Forms and unmanaged apps around that use GDI+ that either won't be upgraded, or that will be upgraded, but that don't need more advanced rendering capabilities. GDI+ is a good bolt-on solution for older applications, and for new applications written in Windows Forsm. That's the primary reason GDI+ wasn't axed in Vista in favour of a totally DirectX solution.</p> <p>There's not specifically anything wrong with GDI/GDI+. True, it's not as advanced as Aero et al, but that doesn't always matter. Particularly in LOB applications (in companies that probably don't even have machines capable of running Vista - mine certainly doesn't), GDI+ is an extremely important technology.</p> <p>The fact that it's not supported (for drawing, at least... you CAN still use it for image manipulation) in ASP.NET is a red herring, since other drawing technologies are not supported for web applications either (plugin-based "applications" notwithstanding).</p>
<blockquote> <p>Blockquote there are plenty of other graphics libraries out there, faster and/or higher quality / fewer system dependencies...</p> </blockquote> <p>Could u list some of them libraries that could be used instead of GDI+ with C++ ?</p>
4,279
<p><em>Disclaimer: I'm stuck on TFS and I hate it.</em></p> <p>My source control structure looks like this:</p> <ul> <li>/dev</li> <li>/releases</li> <li>/branches</li> <li>/experimental-upgrade</li> </ul> <p>I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade. Somehow TFS complained that I had changes in both source and target and I had to resolve them. I chose to "Copy item from source branch" for all 5 items.</p> <p>I check out the experimental-upgrade to a local folder and try to open the main solution file in there. TFS prompts me: </p> <blockquote> <p>"Projects have recently been added to this solution. Would you like to get them from source control?</p> </blockquote> <p>If I say yes it does some stuff but ultimately comes back failing to load a handful of the projects. If I say no I get the same result.</p> <p>Comparing my sln in both branches tells me that they are equal.</p> <p>Can anyone let me know what I'm doing wrong? This should be a straightforward branch/merge operation...</p> <p>TIA.</p> <hr> <p><strong>UPDATE:</strong></p> <p>I noticed that if I click "yes" on the above dialog, the projects are downloaded to the $/ root of source control... (i.e. out of the dev &amp; branches folders)</p> <p>If I open up the solution in the branch and remove the dead projects and try to re-add them (by right-clicking sln, add existing project, choose project located in the branch folder, it gives me the error...</p> <blockquote> <p>Cannot load the project c:\sandbox\my_solution\proj1\proj1.csproj, the file has been removed or deleted. The project path I was trying to add is this: c:\sandbox\my_solution\branches\experimental-upgrade\proj1\proj1.csproj</p> </blockquote> <p>What in the world is pointing these projects <em>outside</em> of their local root? The solution file is identical to the one in the dev branch, and those projects load just fine. I also looked at the vspscc and vssscc files but didn't find anything.</p> <p>Ideas?</p>
<p>@Ben</p> <p>You can actually do a full delete in TFS, but it is highly not recommended unless you know what you are doing. You have to do it from the command line with the command tf destroy</p> <pre><code>tf destroy [/keephistory] itemspec1 [;versionspec] [itemspec2...itemspecN] [/stopat:versionspec] [/preview] [/startcleanup] [/noprompt] Versionspec: Date/Time Dmm/dd/yyyy or any .Net Framework-supported format or any of the date formats of the local machine Changeset number Cnnnnnn Label Llabelname Latest version T Workspace Wworkspacename;workspaceowner </code></pre> <p>Just before you do this make sure you try it out with the /preview. Also everybody has their own methodology for branching. Mine is to branch releases, and do all development in the development or root folder. Also it sounded like branching worked fine for you, just the solution file was screwed up, which may be because of a binding issue and the vssss file.</p>
<p>@Nick: No changes have been made to this just yet. I may have to delete it and re-branch (however you really can't fully delete in TFS)</p> <p>And I have to disagree... branching is absolutely a good practice for experimental changes. Shelving is just temporary storage that will get backed up if I don't want to check in yet. But this needs to be developed while we develop real features.</p>
6,400
<p>Should we really close this question: <a href="https://3dprinting.stackexchange.com/questions/10200/3d-printer-part-clones-from-china-legality">3d printer part clones from china - legality</a>..? </p> <p>Are legal questions on topic? We have a legal section in the <a href="https://3dprinting.meta.stackexchange.com/questions/276/game-plan-what-is-on-topic">Game plan - What is on-topic?</a> and a <a href="https://3dprinting.stackexchange.com/questions/tagged/legal" class="post-tag" title="show questions tagged &#39;legal&#39;" rel="tag">legal</a> tag.</p>
<p><strong>I say allow them.</strong> </p> <p>To let you know what's out there, I work at <a href="http://hyrel3d.com" rel="nofollow noreferrer">Hyrel</a>. </p> <p>Our printers can take <a href="https://www.youtube.com/watch?v=B0lvN-aPYHI" rel="nofollow noreferrer">spindle (milling) heads and additional axes</a>, and even <a href="https://www.youtube.com/watch?v=OceUiuTixPA" rel="nofollow noreferrer">diode</a> and <a href="https://youtu.be/FnYDoNkgOrI" rel="nofollow noreferrer">CO2 lasers</a>, and they all operate on the same gcode - we tell people E is for Emit as well as Extrude. We even have a <a href="https://www.youtube.com/watch?v=azFY-IqDB_0" rel="nofollow noreferrer">TIG welding</a> attachment. </p> <p>We also run our <a href="https://www.youtube.com/watch?v=KIGeQmXNbNE" rel="nofollow noreferrer">Fadal CNC machines</a> on our printer software and firmware. </p> <p>To many people this is a natural progression for a well-built 3D positioning system, and I encourage a broader definition.</p>
<p>This is a tricky one, as 3d printers are starting to be bundled with lasers. Note those kits will totally blind you. 3d printers are being bundled with everything, really if you look at the things <a href="http://diabasepe.com/" rel="nofollow noreferrer">http://diabasepe.com/</a> is making. (Cool guys btw)</p> <p>However. To me this is the same as asking about a woodburning kit question in an electronics forum, because they both use soldering irons. If we allow a removal base machines, such as lasers, we will also have to allow discussions about CNC machines.</p> <p>In the case of that question, they would get bonus points if it was a pure gcode question. Maybe even if it was on a multi use machine.. Instead its asking us to debug their laser setup. Thats not really formatted for stackoverflow anyways. They need to go to a forum. Also as someone that once made a Cheap Chinese laser cutter use a RAMPS 1.4 board, I know exactly how similar they are. But in the end, additive manufacturing isn't this kind of laser (as we have SLA and powder printing)</p> <p>At first I was this is dead simple not on topic. Thinking about laser and 3d printing is a good counter arguments, but that is not what this topic is. It is not additive manufacturing, and its not being done to a part which was additively made. </p> <p>I think its a firm off topic. </p>
67
<p>I have a Tronxy P802M (very similar to the Anet A8, but using a Melzi2.0V5 board) that seems to work fine (I just finished building, and axes movement and the integrated display work) but when I try to connect to the printer from my Simplify3D on Windows 10, I get the following:</p> <pre><code>[...] Connected to machine! SENT: T0 READ: ok 0 READ: wait SENT: M105 READ: ok 0 READ: T:24.44 /0 B:23.33 /0 B@:0 @:0 Connection failed. </code></pre> <p>My other printers all connect fine.</p>
<p>The <a href="https://www.simplify3d.com/support/faq/#faq-4630" rel="nofollow noreferrer">Simplify3D support site</a> mentions to disable the "wait for startup command" option in the firmware configuration for S3D.</p> <p>This allows me to make a rudimentary connection to control the printer, however e.g. during the bed levelling wizard of S3D, the connection still breaks off.</p> <p>It works reliably with Octoprint. I'll consider that good enough.</p>
<p>Try changing your port in the control menu. By default, mine is set to <code>COM 1</code> and I have to change it to <code>COM 3</code>.</p>
498
<p>What is current state of the art for enabling OpenID login in Ruby on Rails applications? This is a community wiki with up-to-date answers to this question.</p> <h2>Authlogic</h2> <p>The most advanced authentication solution seems to be <a href="http://github.com/binarylogic/authlogic" rel="noreferrer">Authlogic</a>. It supports OpenID with <a href="http://github.com/binarylogic/authlogic_openid" rel="noreferrer">Authlogic OpenID plugin</a>. It supports Rails 4 and 3. Rails 2 is supported in the rails2 branch.</p> <p>You may want to watch <a href="http://railscasts.com/episodes/170-openid-with-authlogic" rel="noreferrer">&quot;OpenID with Authlogic&quot; railscast</a> (and the <a href="http://railscasts.com/episodes/160-authlogic" rel="noreferrer">&quot;Authlogic&quot; railscast</a>).</p> <p>There is a sample application called <a href="http://github.com/shripadk/authlogic_openid_selector_example" rel="noreferrer">Authlogic OpenID Selector Example</a>.</p> <h2>Devise</h2> <p>Devise is flexible authentication framework for Rails. It supports OpenID with <a href="https://github.com/nbudin/devise_openid_authenticatable" rel="noreferrer"><code>devise_openid_authenticatable</code></a>.</p> <h2>restful_authentication</h2> <p>Another authentication library of choice is <a href="http://github.com/technoweenie/restful-authentication" rel="noreferrer"><code>restful_authentication</code></a> Rails plugin. Seems like you also need to install <a href="http://github.com/rails/open_id_authentication" rel="noreferrer"><code>open_id_authentication</code></a> plugin.</p> <p>You may want to watch (old, circa 2007) <a href="http://railscasts.com/episodes/68-openid-authentication" rel="noreferrer">&quot;OpenID Authentication&quot; railscast</a>.</p> <h2>Ruby OpenID</h2> <p>Raw support for OpenID protocol is handled by <a href="http://github.com/openid/ruby-openid" rel="noreferrer">Ruby OpenID</a> library.</p>
<p>Check out this <a href="http://railscasts.com/episodes/68-openid-authentication" rel="nofollow noreferrer">Railscast on OpenId</a> for more info. I'm not sure if/how it might work alongside restful_authentication, but might be a good resource. (I haven't watched it yet)</p>
<p>Keep an eye on <a href="http://jimneath.org/2008/09/09/bort-base-rails-application/" rel="nofollow noreferrer">Bort</a>. It is a base rails application which already has restful_authentication setup among other things. The guy doing it is planning on adding OpenID.</p>
9,244
<p>This has happened a few times whenever I print with the white PLA (Hatchbox 1.75 mm). It seems that the print job produces smooth sidewalls for most of the part but at a certain point and above, the walls become rough as if the alignment is off or something. I've attached a picture to show the issue. Does anybody have any insight?</p> <p><a href="https://i.stack.imgur.com/796O7.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/796O7.jpg" alt="Problem demonstration"></a></p> <p>I'm using a Printrbot Simple Metal and some of the print settings are listed below:</p> <ul> <li>Slicer: Slic3r</li> <li>[First] Layer height: 0.2 mm</li> <li>Perimeters: 2</li> <li>Solid Layers [top/bottom]: 3</li> <li>Infill: 25%</li> <li>Fill pattern: Rectilinear</li> <li>Top/Bottom Fill pattern: Concentric</li> <li>Perimeter speed: 30 mm/s</li> <li>Infill speed: 80 mm/s</li> <li>Travel speed: 150 mm/s</li> <li>Acceleration (perimeters): 1000 mm/s<sup>2</sup></li> <li>Acceleration (default): 3000mm/s<sup>2</sup></li> <li>Default extrusion width: Slic3r chosen</li> <li>Print temperature: 220°C</li> </ul> <p>I've noticed in the Slic3r rendering that the affected area seems to be the point where the infill switches from 25% to solid as seen in the included picture. If this is the problem, is there any way to enforce solid infill a few layers below this to eliminate the awkward transition, or specify a smaller extrusion width at this point?</p> <p><a href="https://i.stack.imgur.com/DfWDP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DfWDP.png" alt="Screenshot of infill switch"></a></p>
<p>If you want to change settings on some area of your part check out <a href="http://slic3r.org/blog/modifier-meshes" rel="nofollow noreferrer">modifier meshes in Slic3r</a>.</p> <p>It looks like to0 much heat is delivered when solid infill starts and some melting occurs. See <a href="https://all3dp.com/common-3d-printing-problems-3d-printer-troubleshooting-guide/#Extrusion-Temperature" rel="nofollow noreferrer">3D Printing Problems #22: Extrusion Temperature Too High</a>. </p> <p>You can try:</p> <ul> <li>Lower extrusion temperature</li> <li>Lower filament flow</li> <li>Improve part cooling</li> <li>Lower print speed</li> </ul>
<p>Slic3r has an option of</p> <pre><code>Solid infill threshold area </code></pre> <p>which is the area that when you pass it (and start printing smaller than it), the infill becomes solid.</p> <p>If you set it to a smaller number (or 0), then your infill won't become solid and the problem will vanish.</p> <p>Source: <a href="http://manual.slic3r.org/expert-mode/infill-optimization" rel="nofollow noreferrer" title="slic3r manual">Slic3r Manual - Infill Optimization</a> </p>
527
<p>I'm working on a database for a small web app at my school using <code>SQL Server 2005</code>.<br> I see a couple of schools of thought on the issue of <code>varchar</code> vs <code>nvarchar</code>:</p> <ol> <li>Use <code>varchar</code> unless you deal with a lot of internationalized data, then use <code>nvarchar</code>.</li> <li>Just use <code>nvarchar</code> for everything.</li> </ol> <p>I'm beginning to see the merits of view 2. I know that nvarchar does take up twice as much space, but that isn't necessarily a huge deal since this is only going to store data for a few hundred students. To me it seems like it would be easiest not to worry about it and just allow everything to use nvarchar. Or is there something I'm missing?</p>
<p>Always use nvarchar. </p> <p>You may never need the double-byte characters for most applications. However, if you need to support double-byte languages and you only have single-byte support in your database schema it's really expensive to go back and modify throughout your application. </p> <p>The cost of migrating one application from varchar to nvarchar will be much more than the little bit of extra disk space you'll use in most applications.</p>
<p>If you are using <code>NVARCHAR</code> just because a system stored procedure requires it, the most frequent occurrence being inexplicably <code>sp_executesql</code>, and your dynamic SQL is very long, you would be better off from performance perspective doing all string manipulations (concatenation, replacement etc.) in <code>VARCHAR</code> then converting the end result to <code>NVARCHAR</code> and feeding it into the proc parameter. So no, do not always use <code>NVARCHAR</code>!</p>
5,583
<p>In Java, you often see a META-INF folder containing some meta files. What is the purpose of this folder and what can I put there?</p>
<p>From <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html" rel="noreferrer">the official JAR File Specification</a> (link goes to the Java 7 version, but the text hasn't changed since at least v1.3):</p> <blockquote> <h2>The META-INF directory</h2> <p>The following files/directories in the META-INF directory are recognized and interpreted by the Java 2 Platform to configure applications, extensions, class loaders and services:</p> <ul> <li><code>MANIFEST.MF</code></li> </ul> <p>The manifest file that is used to define extension and package related data.</p> <ul> <li><code>INDEX.LIST</code></li> </ul> <p>This file is generated by the new &quot;<code>-i</code>&quot; option of the jar tool, which contains location information for packages defined in an application or extension. It is part of the JarIndex implementation and used by class loaders to speed up their class loading process.</p> <ul> <li><code>x.SF</code></li> </ul> <p>The signature file for the JAR file. 'x' stands for the base file name.</p> <ul> <li><code>x.DSA</code></li> </ul> <p>The signature block file associated with the signature file with the same base file name. This file stores the digital signature of the corresponding signature file.</p> <ul> <li><code>services/</code></li> </ul> <p>This directory stores all the service provider configuration files.</p> </blockquote> <p>New since Java 9 implementing <a href="https://openjdk.java.net/jeps/238" rel="noreferrer">JEP 238</a> are multi-release JARs. One will see a sub folder <code>versions</code>. This is a feature which allows to package classes which are meant for different Java version in one jar.</p>
<p>You have MANIFEST.MF file inside your META-INF folder. You can <strong>define optional or external dependencies</strong> that you must have access to.</p> <p><strong>Example:</strong></p> <p>Consider you have deployed your app and your container(at run time) found out that your app requires a newer version of a library which is not inside lib folder, in that case if you have defined the optional newer version in <code>MANIFEST.MF</code> then your app will refer to dependency from there (and will not crash).</p> <p><code>Source:</code> Head First Jsp &amp; Servlet</p>
9,560
<p>I have a heavily modified DiscoEasy 200 from Dagoma, see picture:</p> <p><a href="https://i.stack.imgur.com/XVfL4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XVfL4.jpg" alt="enter image description here"></a></p> <p>The heatbed is mounted on 4 springs, on top of the original plate. I made sure the X carriage was parallel to the table. I then tried to level the bed manually, with the 4 springs: I pushed the nozzle into each corner of the bed, and used the paper-gauge method to adjust the springs so that the bed would always be at the same distance of the nozzle. I then setup the Z-offset on the machine and tried to print a mainstream bed leveling test from thingiverse. I use a 4 points auto bed leveling.</p> <p>And I have a systematic problem. <strong>Every time</strong> I try the bed leveling test, it seems the right side of the bed is lower than the left one. The front and rear right corners seem to be lower than on the left side. I tried to expand the springs of the front and rear right corners, but the auto bed leveling at the beginning of my prints re-introduces the problem.</p> <p>The right side seems to be ~100 µm lower than what it should be. It's not a lot, but it's enough for prints to fail.</p> <p>I can't figure out what the problem is. Do you have any idea? it's driving me crazy to not understand where the problem comes from.</p>
<p>Did you check if your bed is parallel to the gantry? </p> <p>It can happen that after leveling one side and moving to the other the adjustment there puts the first side out of alignment - I level my bed by doing some couple turns</p>
<p>As I understand your question:</p> <ol> <li>You manually go through a leveling process and have it set up well.</li> <li>You allow the printer to "auto-level". </li> <li>You print, and the right side is too low by about 0.1mm. </li> </ol> <p>Is it possible that the filament (which is on the left side) pulls up on the extruder when the extruder is on the right side? A small tug could lift the extruder making it appear the same as if the bed were too low.</p> <p>If this seems possible, check for the extruder being vertically loose or wobbly. I've had filament pull forces cause slight head offsets on a home-brew printer.</p>
1,251
<p>I'm trying to convert a multipage color tiff file to a c# CompressionCCITT3 tiff in C#. I realize that I need to make sure that all pixels are 1 bit. I have not found a useful example of this online.</p>
<p>You need this conversion as CCITT3 and CCITT4 don't support color (if I remember right).</p>
<p>I saw the above code, and it looked like it was converting every pixel with manual logic.</p> <p>Would this work for you?</p> <p>Imports System.Drawing.Imaging</p> <p>'get the color tif file</p> <p>Dim bmpColorTIF As New Bitmap("C:\color.tif")</p> <p>'select the an area of the tif (will grab all frames)</p> <p>Dim rectColorTIF As New Rectangle(0, 0, bmpColorTIF.Width, bmpColorTIF.Height )</p> <p>'clone the rectangle as 1-bit color tif</p> <p>Dim bmpBlackWhiteTIF As Bitmap = bmpColorTIF.Clone(rectColorTIF, PixelFormat.Format1bppIndexed)</p> <p>'do what you want with the new bitmap (save, etc)</p> <p>...</p> <p>Note: there are a ton of pixelformats to choose from.</p>
6,624
<p>I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them. </p> <p>I don't really need camera, mp3 players, video players, pdf readers or anything else since the apps are going to be simple data collection to feed via wireless to a server database.</p> <p>I'm proficient with C and C#. I could learn Java if I had to.</p> <p>What devices do you recommend? Linux devices maybe?</p> <p>PS: Changed the title because I don't want a flamewar between platforms. Please, don't answer with Windows Mobile sucks/rules. I'm looking for devices instead.</p> <p>Thanks</p>
<p><strong>Windows Mobile</strong><br> It supports C#, and Visual Studio comes with the mobile SDK. So if you know C# you probably already have the tools you need. And in spite of the iPhone/iPodTouch buzz, the Windows Mobile deployment is still 10X greater.</p>
<p>Windows Mobile and CE used to suck, really, really badly. These days however it's definitely passable and worth checking out, especially if you code C#. Just remember that it is the baby brother of the full framework and has nowhere near enough toys and throws a lot of NotImplementedExceptions. :)</p>
6,123
<p>I have a Glade GUI description file with a <code>GtkTreeView</code> in a <code>GtkHBox</code> in a window; and there's a handler for the <code>row_activated</code> signal. Now, Glade has automatically set the "events" property (inherited from <code>GtkWidget</code>) of that treeview to some value (<code>GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</code>). And there are two strange things with this:</p> <ul> <li>removing the pre-set value (so that the property is empty) doesn't seem to break the application (at least not with the old GTK 2.10 I have atm).</li> <li>in fact, an annoying bug I has seen before (where the treeview items would not correctly react to expand or collapse clicks) is now gone!</li> </ul> <p>I have yet to test this with a newer GTK version, but the question is already there: exactly what is the purpose for this <code>events</code> property? And why does Glade automatically and unnecessarily set it to some value? Does this have some side effects I'm not aware of?</p>
<p>It's a bug in glade, it always sets the event property of widgets it create. It has no notion of the default value of a property so it always sets it.</p>
<p>Doesn't this mask indicate the events you're willing to receive? In this case, you'll probably want to receive notification that the user has clicked or double-clicked an item in the GtkTreeView, and you'll want to register callbacks to handle these events.</p>
9,008
<p>How do I make <a href="http://logging.apache.org/log4net/index.html" rel="noreferrer">Log4net</a> only log Info level logs? Is that even possible? Can you only set a threshold? </p> <p>This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?</p> <pre class="lang-xml prettyprint-override"><code>&lt;logger name="BrokerCollection.Model.XmlDocumentCreationTask"&gt; &lt;appender-ref ref="SubmissionAppender"/&gt; &lt;level value="Info" /&gt; &lt;/logger&gt; </code></pre>
<p>Within the definition of the appender, I believe you can do something like this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"&gt; &lt;filter type="log4net.Filter.LevelRangeFilter"&gt; &lt;param name="LevelMin" value="INFO"/&gt; &lt;param name="LevelMax" value="INFO"/&gt; &lt;/filter&gt; ... &lt;/appender&gt; </code></pre>
<p>you can use log4net.Filter.LevelMatchFilter. other options can be found at <a href="http://www.beefycode.com/post/log4net-tutorial-pt-7-filters.aspx" rel="nofollow noreferrer">log4net tutorial - filters</a></p> <p>in ur appender section add</p> <pre class="lang-xml prettyprint-override"><code>&lt;filter type="log4net.Filter.LevelMatchFilter"&gt; &lt;levelToMatch value="Info" /&gt; &lt;acceptOnMatch value="true" /&gt; &lt;/filter&gt; </code></pre> <p>the accept on match default is true so u can leave it out but if u set it to false u can filter out log4net filters</p>
2,786
<p>Is there a way to collect (e.g. in a List) multiple 'generic' objects that don't share a common super class? If so, how can I access their common properties?</p> <p>For example:</p> <pre><code>class MyObject&lt;T&gt; { public T Value { get; set; } public string Name { get; set; } public MyObject(string name, T value) { Name = name; Value = value; } } var fst = new MyObject&lt;int&gt;("fst", 42); var snd = new MyObject&lt;bool&gt;("snd", true); List&lt;MyObject&lt;?&gt;&gt; list = new List&lt;MyObject&lt;?&gt;&gt;(){fst, snd}; foreach (MyObject&lt;?&gt; o in list) Console.WriteLine(o.Name); </code></pre> <p>Obviously, this is pseudo code, this doesn't work.</p> <p>Also I don't need to access the .Value property (since that wouldn't be type-safe).</p> <p><strong>EDIT:</strong> Now that I've been thinking about this, It would be possible to use sub-classes for this. However, I think that would mean I'd have to write a new subclass for every new type.</p> <hr> <p>@<a href="https://stackoverflow.com/questions/51586/accessing-non-generic-members-of-a-generic-object#51621">Grzenio</a> Yes, that exactly answered my question. Of course, now I need to duplicate the entire shared interface, but that's not a big problem. I should have thought of that...</p> <p>@<a href="https://stackoverflow.com/questions/51586/accessing-non-generic-members-of-a-generic-object#51611">aku</a> You are right about the duck typing. I wouldn't expect two completely random types of objects to be accessible.</p> <p>But I thought generic objects would share some kind of common interface, since they are exactly the same, apart from the type they are parametrized by. Apparently, this is not the case automatically.</p>
<p>I don't think it is possible in C#, because MyObject is not a baseclass of MyObject. What I usually do is to define an interface (a 'normal' one, not generic) and make MyObject implement that interface, e.g.</p> <pre><code>interface INamedObject { string Name {get;} } </code></pre> <p>and then you can use the interface:</p> <pre><code>List&lt;INamedObject&gt; list = new List&lt;INamedObject&gt;(){fst, snd}; foreach (INamedObject o in list) Console.WriteLine(o.Name); </code></pre> <p>Did it answer your question?</p>
<p>The best way would be to add a common base class, otherwise you can fall back to reflection.</p>
7,473
<p>How does a stack overflow occur and what are the best ways to make sure it doesn't happen, or ways to prevent one, particularly on web servers, but other examples would be interesting as well?</p>
<h2>Stack</h2> <p>A stack, in this context, is the last in, first out buffer you place data while your program runs. Last in, first out (LIFO) means that the last thing you put in is always the first thing you get back out - if you push 2 items on the stack, 'A' and then 'B', then the first thing you pop off the stack will be 'B', and the next thing is 'A'.</p> <p>When you call a function in your code, the next instruction after the function call is stored on the stack, and any storage space that might be overwritten by the function call. The function you call might use up more stack for its own local variables. When it's done, it frees up the local variable stack space it used, then returns to the previous function.</p> <h2>Stack overflow</h2> <p>A stack overflow is when you've used up more memory for the stack than your program was supposed to use. In embedded systems you might only have 256 bytes for the stack, and if each function takes up 32 bytes then you can only have function calls 8 deep - function 1 calls function 2 who calls function 3 who calls function 4 .... who calls function 8 who calls function 9, but function 9 overwrites memory outside the stack. This might overwrite memory, code, etc.</p> <p>Many programmers make this mistake by calling function A that then calls function B, that then calls function C, that then calls function A. It might work most of the time, but just once the wrong input will cause it to go in that circle forever until the computer recognizes that the stack is overblown.</p> <p>Recursive functions are also a cause for this, but if you're writing recursively (ie, your function calls itself) then you need to be aware of this and use static/global variables to prevent infinite recursion.</p> <p>Generally, the OS and the programming language you're using manage the stack, and it's out of your hands. You should look at your call graph (a tree structure that shows from your main what each function calls) to see how deep your function calls go, and to detect cycles and recursion that are not intended. Intentional cycles and recursion need to be artificially checked to error out if they call each other too many times.</p> <p>Beyond good programming practices, static and dynamic testing, there's not much you can do on these high level systems.</p> <h2>Embedded systems</h2> <p>In the embedded world, especially in high reliability code (automotive, aircraft, space) you do extensive code reviews and checking, but you also do the following:</p> <ul> <li>Disallow recursion and cycles - enforced by policy and testing</li> <li>Keep code and stack far apart (code in flash, stack in RAM, and never the twain shall meet)</li> <li>Place guard bands around the stack - empty area of memory that you fill with a magic number (usually a software interrupt instruction, but there are many options here), and hundreds or thousands of times a second you look at the guard bands to make sure they haven't been overwritten.</li> <li>Use memory protection (ie, no execute on the stack, no read or write just outside the stack)</li> <li>Interrupts don't call secondary functions - they set flags, copy data, and let the application take care of processing it (otherwise you might get 8 deep in your function call tree, have an interrupt, and then go out another few functions inside the interrupt, causing the blowout). You have several call trees - one for the main processes, and one for each interrupt. If your interrupts can interrupt each other... well, there be dragons...</li> </ul> <h2>High-level languages and systems</h2> <p>But in high level languages run on operating systems:</p> <ul> <li>Reduce your local variable storage (local variables are stored on the stack - although compilers are pretty smart about this and will sometimes put big locals on the heap if your call tree is shallow)</li> <li>Avoid or strictly limit recursion</li> <li>Don't break your programs up too far into smaller and smaller functions - even without counting local variables each function call consumes as much as 64 bytes on the stack (32 bit processor, saving half the CPU registers, flags, etc)</li> <li>Keep your call tree shallow (similar to the above statement)</li> </ul> <h2>Web servers</h2> <p>It depends on the 'sandbox' you have whether you can control or even see the stack. Chances are good you can treat web servers as you would any other high level language and operating system - it's largely out of your hands, but check the language and server stack you're using. It <strong>is</strong> possible to blow the stack on your SQL server, for instance.</p> <p>-Adam</p>
<p>Considering this was tagged with "hacking", I suspect the "stack overflow" he's referring to is a call stack overflow, rather than a higher level stack overflow such as those referenced in most other answers here. It doesn't really apply to any managed or interpreted environments such as .NET, Java, Python, Perl, PHP, etc, which web apps are typically written in, so your only risk is the web server itself, which is probably written in C or C++.</p> <p>Check out this thread:</p> <p><a href="https://stackoverflow.com/questions/7308/what-is-a-good-starting-point-for-learning-buffer-overflow"><a href="https://stackoverflow.com/questions/7308/what-is-a-good-starting-point-for-learning-buffer-overflow">https://stackoverflow.com/questions/7308/what-is-a-good-starting-point-for-learning-buffer-overflow</a></a></p>
4,577
<p>We have the question <a href="/q/24886">is there a performance difference between <code>i++</code> and <code>++i</code> <strong>in C</strong>?</a></p> <p>What's the answer for C++?</p>
<p>[Executive Summary: Use <code>++i</code> if you don't have a specific reason to use <code>i++</code>.]</p> <p>For C++, the answer is a bit more complicated.</p> <p>If <code>i</code> is a simple type (not an instance of a C++ class), <a href="https://stackoverflow.com/a/24887/194894">then the answer given for C ("No there is no performance difference")</a> holds, since the compiler is generating the code.</p> <p>However, if <code>i</code> is an instance of a C++ class, then <code>i++</code> and <code>++i</code> are making calls to one of the <code>operator++</code> functions. Here's a standard pair of these functions:</p> <pre><code>Foo&amp; Foo::operator++() // called for ++i { this-&gt;data += 1; return *this; } Foo Foo::operator++(int ignored_dummy_value) // called for i++ { Foo tmp(*this); // variable "tmp" cannot be optimized away by the compiler ++(*this); return tmp; } </code></pre> <p>Since the compiler isn't generating code, but just calling an <code>operator++</code> function, there is no way to optimize away the <code>tmp</code> variable and its associated copy constructor. If the copy constructor is expensive, then this can have a significant performance impact.</p>
<p><code>++i</code> is faster than <code>i++</code> because it doesn't return an old copy of the value.</p> <p>It's also more intuitive:</p> <pre><code>x = i++; // x contains the old value of i y = ++i; // y contains the new value of i </code></pre> <p><a href="http://ideone.com/ivrj9b" rel="nofollow">This C example</a> prints "02" instead of the "12" you might expect:</p> <pre><code>#include &lt;stdio.h&gt; int main(){ int a = 0; printf("%d", a++); printf("%d", ++a); return 0; } </code></pre> <p><a href="http://ideone.com/OMovKe" rel="nofollow">Same for C++</a>:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(){ int a = 0; cout &lt;&lt; a++; cout &lt;&lt; ++a; return 0; } </code></pre>
4,454
<p>If I set my prints on the window sill (indoors) will the sunlight still be able to cure the resin? The problem with setting them outside is the wind knocking them over.</p>
<p>The glass will block most of the uv light; but not all. It will depend on the type of light that the resin is sensitive to; in order to determine if it will continue to cure behind a glass window in direct sunlight. Some resins also sensitive to blue light. You will need to look at the material data sheet for the resin to be able to know for sure. Be advised though, that the resin does not stop curing, and will continue to cure slowly over time, just sitting on the desk.</p> <p><a href="https://www.thoughtco.com/does-glass-block-uv-light-608316" rel="nofollow noreferrer">https://www.thoughtco.com/does-glass-block-uv-light-608316</a> From the link:</p> <blockquote> <p>Glass that is transparent to visible light absorbs nearly all UVB. This is the wavelength range that can cause a sunburn, so it's true you can't get a sunburn through glass. However, UVA is much closer to the visible spectrum than UVB. About 75% of UVA passes through ordinary glass. UVA leads to skin damage and genetic mutations that can lead to cancer. Glass does not protect you from skin damage from the sun. It affects indoor plants too. Have you ever taken an indoor plant outside and burned its leaves? This happens because the plant was unaccustomed to the higher levels of UVA found outside, compared with inside a sunny window.</p> </blockquote>
<p>Yes.</p> <p>I frequently leave models made on a Saturn printer with Elegoo gray resin on a surface in the sun to slow cure them. If properly cleaned their finish is indistinguishable from models rapid cured in a UV chamber.</p> <p>It should be noted that I only do this with small models that are Table top miniature scale. Large models with lots of shadows, overhands or complicated detailing may not cure evenly.</p> <p>I usually do this if I have a lot of models to cure and am too lazy to keep cycling them through my cure station.</p>
1,600
<p>I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.</p> <p>According to the <a href="http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task" rel="noreferrer">Documentation</a>, it passes CCNetArtifactDirectory to MSBuild. But how do I use it?</p> <p>I tried this:</p> <pre><code>&lt;buildArgs&gt; /noconsolelogger /p:OutputPath=$(CCNetArtifactDirectory)\test &lt;/buildArgs&gt; </code></pre> <p>But that does not work. In fact, it kills the service with this error:</p> <blockquote> <p>ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetArtifactDirectory</p> </blockquote> <p>Documentation is rather sparse, and google und mainly offers modifying the .sln Project file, which is what I want to avoid in order to be able to manually build this project later - I would really prefer <code>/p:OutputPath</code>.</p>
<p>The CCNetArtifactDirectory is passed to the MSBuild by default, so you dont need to worry about it. MSBuild will place the build output in the "bin location" relevant to the working directory that you have specified.</p> <pre><code>&lt;executable&gt;c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe&lt;/executable&gt; &lt;workingDirectory&gt;C:\data\projects\FooSolution\&lt;/workingDirectory&gt; &lt;projectFile&gt;FooSolution.sln&lt;/projectFile&gt; &lt;buildArgs&gt;/noconsolelogger /p:Configuration=Debug &lt;/buildArgs&gt; </code></pre> <p>So in the above example your build output will be put in C:\data\projects\FooSolution[ProjectName]\bin\Debug. Should you want to output to a different location you may want to look at of the tag in CCNET.</p> <pre><code>&lt;publishers&gt; &lt;xmllogger /&gt; &lt;buildpublisher&gt; &lt;sourceDir&gt;C:\data\projects\FooSolution\FooProject\bin\Debug&lt;/sourceDir&gt; &lt;publishDir&gt;C:\published\FooSolution\&lt;/publishDir&gt; &lt;useLabelSubDirectory&gt;false&lt;/useLabelSubDirectory&gt; &lt;/buildpublisher&gt; &lt;/publishers&gt; </code></pre> <p>This will allow you to publish your output to a different location.</p>
<p>Parameters like <code>CCNetArtifactDirectory</code> are passed to external programs using environment variables. They are available in the external program but they aren't inside <code>CCNET</code> configuration. This often leads to confusion.</p> <p>You can use a preprocessor constant instead: </p> <pre><code>&lt;cb:define project.artifactDirectory="C:\foo"&gt; &lt;project&gt; &lt;!-- [...] --&gt; &lt;artifactDirectory&gt;$(project.artifactDirectory)&lt;/artifactDirectory&gt; &lt;!-- [...] --&gt; &lt;tasks&gt; &lt;!-- [...] --&gt; &lt;msbuild&gt; &lt;!-- [...] --&gt; &lt;buildArgs&gt;/noconsolelogger /p:OutputPath=$(project.artifactDirectory)\test&lt;/buildArgs&gt; &lt;!-- [...] --&gt; &lt;/msbuild&gt; &lt;!-- [...] --&gt; &lt;/tasks&gt; &lt;!-- [...] --&gt; &lt;/project&gt; </code></pre>
2,327
<p>What would be a good tag to use for doing business/making profit with a 3D printer?</p>
<p>I'd suggest two different tags:</p> <ul> <li><p>[monetization]: For selling, or profiting from printing, or from printing machines</p></li> <li><p>[financing] (or [costs]): For calculating the cost of materials and machines, including operational expenses.</p></li> </ul>
<p>I would propose something as [business] or [commercial-use] as opposed to [personal-use] to differentiate between these posibilites.</p>
11
<p>What tools are useful for automating clicking through a windows form application? Is this even useful? I see the testers at my company doing this a great deal and it seems like a waste of time.</p>
<p>Check out <a href="https://github.com/TestStack/White" rel="nofollow noreferrer">https://github.com/TestStack/White</a> and <a href="http://nunitforms.sourceforge.net/" rel="nofollow noreferrer">http://nunitforms.sourceforge.net/</a>. We've used the White project with success.</p>
<p>There's a couple out there. They all hook into the windows API to log item clicks, and then reproduce them to test.</p> <p>We're now mostly web based (using WatiN), but we used to use Mercury Quicktest. </p> <p>Don't use Quicktest, it's awful for a tremendously long list of reasons.</p>
3,355
<p>I'm just starting to design some embedded devices, and am looking for resources.</p> <p>What I want to be able to do is to connect a GPS receiver to a lightweight SBC or mini-ITX, x86-based computer, and track a remote-controlled vehicle's location/progress.</p> <p>Ideally, this could morph into building some hobby, semi-autonomous vehicles.</p> <p>But what I need to start with is a development board for GPS programming. </p> <p>What boards/packages have you used, and where can I find [preferably open source] development for them?</p>
<p><a href="http://www.openembedded.org" rel="nofollow noreferrer">OpenEmbedded</a> is a good place to go to get started. A lot of embedded products use ARM and other processors, so cross-compiling is a big deal. <a href="http://buildroot.uclibc.org/" rel="nofollow noreferrer">Buildroot</a> is another resource for building custom linux kernels for small systems.</p> <p>You can also find lots of manufacturers with Single Board Computers (SBCs) that have tools to do what you want - do a google search for "SBC Linux" and you should have a gold mine.</p> <p><a href="http://linuxdevices.com/" rel="nofollow noreferrer">LinuxDevices</a> keeps a pulse on the linux embedded community and you should find several good articles there that lead you to products or software to help you.</p> <p>Debian has an embedded build, but I haven't explored that.</p> <p>There are several books on <a href="http://www.linuxdevices.com/articles/AT2969812114.html" rel="nofollow noreferrer">embedded linux</a> available if you want to go that route.</p> <p>The GPS receiver simply connects to a serial or USB port, and present an NMEA stream of data, which you can parse with GPSD and several programs can access it through GPSD. It's a very simple text based format.</p> <p>I've used regular PC motherboards, and Atmel AT91 processors for embedded systems (with GPS, cellular, etc). There's a lot of information out there right now, and it's not expensive to get into. If I were to start a new project, I'd look at the AVR32 processors from Atmel - they are very hobbyist friendly, and provide a lot of community support for linux on the AVR32 architecture. They provide free GCC compilers and significant framework and examples if you want to go the OS-less route and have a single program running on the processer as well.</p> <p>Good luck!</p> <p>-Adam</p>
<p>Some people here have suggested devices like the gumstix - embedded devices which cost $149 without GPS. I don't understand that bit. A off-the-shelf TomTom comes with running Linux on ARM, built-in GPS, lots of flash, battery and screen. It's hard to beat the price advantage that comes with mass production. For your hobby project, the map included is not needed, but who cares? </p>
8,185
<p>I just recently upgraded my Printrbot Simple Metal with a heated bed (and longer x-axis). I looked up some tutorials, and all of them placed the thermistor as in the picture on the left below, so I did too. However, the design of the heat plate seems to strongly suggest thermistor placement as in the picture on the right, inside the small hole near the center.</p> <p><a href="https://i.stack.imgur.com/2nF92.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2nF92.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/tzmTq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tzmTq.png" alt="enter image description here"></a></p> <p>I can certainly see the upside of that. The reported temperature may overshoot the average bed temperature (the reasoning used in the tutorials I read), but most of my prints are built in the center of the bed, and the center placement would surely make the temperature control system more responsive.</p> <p>What are the pros and cons of these placements? And what would be the proper technique for putting the sensor in the center? Should I still use kapton tape? Do I need to make sure the thermistor makes physical contact with the aluminum of the print bed?</p>
<p>You are correct about the walls. Using a <em>Solidify</em> object modifier is probably your best bet. A low <em>Thickness:</em> value (<em>0.1</em> is probably good) helps keep the walls thin but strong. You can monitor the thickness while you adjust the value from <em>Wireframe</em> view.</p> <p><a href="https://i.stack.imgur.com/u4wif.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u4wif.png" alt="enter image description here"></a></p> <p>Additionally, and <strong>this is probably the most important thing to know</strong>, your mesh must be clean. By clean, I mean it must all be one piece. No separate cubes, cylinders, etc. that you added while modeling, just one solid piece. Think about it this way. If you have added a cube and part of that cube is inside the rest, it might look good from the outside. But the 3D Printer isn't printing the outside, it's printing everything. So that wall, albeit hidden, that is present on the inside of your mesh <strong>will be printed</strong>.</p> <p><em>Bad:</em></p> <p><a href="https://i.stack.imgur.com/de7eW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/de7eW.png" alt="enter image description here"></a></p> <p><em>Good:</em></p> <p><a href="https://i.stack.imgur.com/RQXI3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RQXI3.png" alt="enter image description here"></a></p> <p>Lastly, if you have parts of your mesh that can't be printed from the bottom up, or wouldn't stand by itself, consider adding supports. You can always cut these off later.</p> <p><em>Leg added because it wouldn't stand by itself:</em></p> <p><a href="https://i.stack.imgur.com/H1tqC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H1tqC.png" alt="enter image description here"></a></p>
<blockquote> <p>What are the things that i have to watch out for when 3d printing? </p> </blockquote> <p><a href="https://blender.stackexchange.com/q/7910/2816">non manifold geometry</a> : geometry that can not exist in the real world. </p> <p>It's a good idea to check if the dimensions of your mesh are correct before exporting: </p> <p><a href="https://i.stack.imgur.com/cfYiB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cfYiB.png" alt="enter image description here"></a> <hr> Turning on mesh analysis allows visual inspection of problems such as intersecting faces, sharp edges ,edges with thickness below a threshold and other criterias.<br> <em>the inspection tool will color the faces with those problems.</em> </p> <p><a href="https://i.stack.imgur.com/BLGEK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BLGEK.png" alt="enter image description here"></a> <hr> And lastly you can make selections by traits, such as loose geometry, interior faces or unconnected vertices. </p> <p><a href="https://i.stack.imgur.com/phD8w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/phD8w.png" alt="enter image description here"></a></p> <p><em>note that those are just tools to help you find the problems , none of them will fix the mesh for 3d printing.</em> </p>
306
<p>I think it's best that I explain what my issue is before I explain how I arrived here. I have a Tronxy x5s with a stock board that I am repairing for the sake of repairing, even though I know I should probably just spring for a new board. It's the principle of the thing. </p> <ul> <li>The extruder thermistor accurately reads for a few seconds, and then gives a negative reading as if it's been unplugged. </li> <li>I know that this is the same reading of an unplugged thermistor because when you unplug either the extruder or bed thermistor from a known-good port, it gives this same negative reading. </li> <li>It is not attached to the original pin. It is attached to a new pin that I moved it to. I cut the old pin off from the thermistor port and soldered the new pin to the traces of the port. Then I changed the pin in the configuration file, and it works, for a while.</li> <li>The electronics are messy but sound; I have used my voltmeter to verify connectivity and voltage. </li> <li>The thermistor works; it reads a little over 100k&Omega; in my hot garage and the temperature changes after I put it in my hand for a few minutes. But this temperature change only registers, as explained in the rest, for a few seconds. </li> <li>I am sure there's a configuration somewhere in the firmware that I am missing that causes that pin to either go "off" or become disused after a few seconds. </li> </ul> <p>Greater context: </p> <p>The printer was working great for months, but one day the extruder thermistor shorted so badly that the Analog to Digital pin on the Arduino powering the Melzi board was permanently damaged. The temperature reading consistently stayed at 260&nbsp;°C, even when unplugged. </p> <p>I wanted to come up with a repair solution rather than replacing the board (even though I have plans to do that anyway), so I downloaded the datasheet for the Arduino Mega 1248P and looked for other ADC pins I could use. I found that ADC Pin0 was unused on the board, so I thought I'd isolate old pin (ADC Pin 7), solder the trace to the new pin, and change the firmware to reflect the new pin. </p> <p><a href="https://i.imgur.com/qMlxw9T.jpg" rel="noreferrer" title="Datasheet pinout"><img src="https://i.imgur.com/qMlxw9T.jpg" alt="Datasheet pinout" title="Datasheet pinout"></a></p> <p><a href="https://i.imgur.com/D6M5Gq5.jpg" rel="noreferrer" title="Photo of trace and isolation"><img src="https://i.imgur.com/D6M5Gq5.jpg" alt="Photo of trace and isolation" title="Photo of trace and isolation"></a> </p> <p>Then I changed the pin used for that extruder thermistor reading in the <code>Pins_SANGUINOLOLU_11.h</code> config file (the old Melzi board for the Tronxy X5s is a Sanguino): </p> <pre><code>// Temperature Sensors // #define TEMP_0_PIN 7 // Analog Input (pin 33 extruder) #define TEMP_BED_PIN 6 // Analog Input (pin 34 bed) </code></pre> <p>Changed to </p> <pre><code>// Temperature Sensors // #define TEMP_0_PIN 0 // Analog Input (pin xx extruder) #define TEMP_BED_PIN 6 // Analog Input (pin 34 bed) </code></pre> <p>I didn't know what "pin 33" was or used to be so I just put xx in the comment. </p> <p>Anyway, my hardware was good, and my software was supposedly good, so I flashed the new firmware, plugged it in, and turned it on: </p> <p><a href="https://i.imgur.com/xER2LQP.jpg" rel="noreferrer" title="Good temperature reading"><img src="https://i.imgur.com/xER2LQP.jpg" alt="Good temperature reading" title="Good temperature reading"></a></p> <p>Yay! But after a few seconds... </p> <p><a href="https://i.imgur.com/oa1qwwZ.jpg" rel="noreferrer" title="Bad temperature reading"><img src="https://i.imgur.com/oa1qwwZ.jpg" alt="Bad temperature reading" title="Bad temperature reading"></a></p> <p>Boo. It stops working. </p> <p>I am sure my connections are solid: I've tested for connectivity and voltage. Both the new port and the heat bed thermistor port get 4.97 volts, so it's not a voltage drop. It's something in the Arduino. </p> <p>Any ideas? </p>
<p>Thermal expansion is opening a connection somewhere. It might not be one of your solderings, but if you shorted the board bad enough to fry pins, it could have cooked something somewhere else, and putting current through it is heating up the spot enough to break the connection. Either somewhere else in/on the board, or inside of the IC chip itself. </p>
<p>I am having the same issue so in the firmware instead of changing to an empty pin, I swapped pins 6 and 7 so the nozzle temp would read from the bed temp plug on the board. Now the nozzle temp is reading properly i went into configurations.h line 291 and changed the 1 to 999 and on line 295 i changed the value to 60 now the bed temp will always be 60 so as long as my print settings match it will never engage the heat bed and allow the machine to print. Now I will use an ESP8266 nodeMCU to read the temp and control the MOSFET for the heat bed.</p>
998
<p>Here is the sequence of my Gcode, printed in mid-air:</p> <pre><code>Print (E20) Retract (E-20) Dwell (G4 10,000) Move away (E0) Print (E20) </code></pre> <p>See the path on the printscreen below: <a href="https://i.stack.imgur.com/rbYqY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rbYqY.png" alt="enter image description here"></a></p> <p>When the printer dwells it oozes. How can i stop that?</p> <p>I am using a WASP 3MT, pellet extrustion, 3mm nozzle, Marlin firmware, Gcode done on Silkworm for Grasshopper.</p> <p>Gcode around the dwell:</p> <pre><code>G1 F300 X-25 Y-25 Z30 E15.96 G92 E0 G1 F0 X-25 Y-25 Z30 G1 F1000 X-25 Y-25 Z36 E-89.42 G92 E0 G4 P10000 G1 F0 X-25 Y-25 Z36 G1 F1000 X-25 Y-25 Z32 E0 G92 E0 </code></pre>
<p>Since you retracted the filament (very far), but stay at elevated temperature for almost 2 minutes, this must be left-over residue inside the nozzle/throat that is stuck to the wall that becomes liquid and oozes out of the nozzle because gravity pulls it downwards.</p> <p><a href="https://3dprinting.stackexchange.com/a/7489/5740">This answer</a> on the question <a href="https://3dprinting.stackexchange.com/questions/7484/ender-3-extrudes-plastic-whilst-at-standstill-and-while-moving-to-start-of-prin">"Ender 3 extrudes plastic whilst at standstill, and while moving to start of print"</a> explains the oozing problem in detail. </p>
<p>Since you retracted the filament (very far), but stay at elevated temperature for almost 2 minutes, this must be left-over residue inside the nozzle/throat that is stuck to the wall that becomes liquid and oozes out of the nozzle because gravity pulls it downwards.</p> <p><a href="https://3dprinting.stackexchange.com/a/7489/5740">This answer</a> on the question <a href="https://3dprinting.stackexchange.com/questions/7484/ender-3-extrudes-plastic-whilst-at-standstill-and-while-moving-to-start-of-prin">"Ender 3 extrudes plastic whilst at standstill, and while moving to start of print"</a> explains the oozing problem in detail. </p>
1,106
<p>What are the biggest pros and cons of <a href="http://incubator.apache.org/thrift/" rel="noreferrer">Apache Thrift</a> vs <a href="http://code.google.com/apis/protocolbuffers/" rel="noreferrer">Google's Protocol Buffers</a>?</p>
<p>They both offer many of the same features; however, there are some differences:</p> <ul> <li>Thrift supports 'exceptions'</li> <li>Protocol Buffers have much better documentation/examples</li> <li>Thrift has a builtin <code>Set</code> type</li> <li>Protocol Buffers allow "extensions" - you can extend an external proto to add extra fields, while still allowing external code to operate on the values. There is no way to do this in Thrift</li> <li>I find Protocol Buffers much easier to read</li> </ul> <p>Basically, they are fairly equivalent (with Protocol Buffers slightly more efficient from what I have read).</p>
<p>It's also important to note that not all supported languages compair consistently with thrift or protobuf. At this point it's a matter of the modules implementation in addition to the underlying serialization. Take care to check benchmarks for whatever language you plan to use.</p>
9,472
<p>When trying to print parts that should contain certain sized holes, e.g. for screws, how to achieve that they are sized correctly?</p> <p>Is it possible to calibrate the printer perfectly, so it prints holes correctly sizes in all common sizes (e.g. starting at 2mm diameter)? Or is it better to design the holes larger or print prototypes and increase the sizes according to the real prints?</p>
<p><a href="http://hydraraptor.blogspot.nl/2014/06/why-slicers-get-dimensions-wrong.html" rel="nofollow noreferrer">The reason holes come out undersized is generally the slicer</a>, so calibrating the printer itself cannot solve the issue (without making other things worse). The output of the printer is exactly what it should be, given the G-code provided to it. It's just that the G-code does not represent the hole diameter correctly.</p> <p>It would be best to simply account for the deviation in your design, or simply drill out undersized holes to the correct diameter.</p>
<p>Make sure you know what purpose the holes are to serve. If they are <em>clearance</em> holes , i.e. designed so that the screw or bolt slides thru easily, then there's nothing wrong with a slight oversize.<br> If you want a <em>tappable</em> hole, i.e. either drive threads for a machine screw or self-tap with wood/drywall screws, then you want to go undersized.</p> <p>If you want the hole to be a close-fit with a non-threaded rod, as is done for maintaining alignment for moving parts, then almost certainly start undersized and clear the hole just enough to fit the desired rod. </p>
458
<p>Is the firts time that I saw this movement after the printing has finishig and causes the nozzle crashes to the printed part and I noticed due the part is 14x8 and the nozzle is to near and below to the border of the shape. I supposed that some scripts has changed but, seems to be everything ok.</p> <p>this is the end script:</p> <pre><code>G92 E0 G1 E-1.5000 F1800 ; layer end M104 S0 ; turn off extruder M140 S0 ; turn off bed G28 X0 ; home X axis M84 ; disable motors ; Build Summary ; Build time: 3 hours 9 minutes ; Filament length: 12689.1 mm (12.69 m) ; Plastic volume: 30520.78 mm^3 (30.52 cc) ; Plastic weight: 38.15 g (0.08 lb) </code></pre> <p>Z axis moves down 4mm after finishing going to X0, why? I don't want the nozzle crashes the part on going to zero.</p>
<p>You can use:</p> <pre><code>G91 G1 Z10 </code></pre> <p><code>G91</code> make the printer use ralative positioning, while <code>G1 Z10</code> would move the gantry up of 10mm, reagrdless of its actual position.</p> <p>In order to understand what's going on, you could experiment with the position of those lines in the script.</p> <p>The safest bet it to insert them at the very top, but you could insert them straight after the homing of the X axis to understand if the drop you are seeing is caused by the homing command itself or by the ´M84´ one.</p> <p>My <em>guess</em> is that the drop is actually caused by the latter. <code>M84</code> doesn't really "disable motors", rather it stops using energy to keep them still (i.e.: it stops the <em>idle hold</em>). What I believe is happening in your case is that when you stop the idle hold, the weight and mechanical play of the X gantry causes it to move slightly (a bit like when you relax your body on the sofa and you "sink" in it a bit more).</p>
<p>There is something fundamentally wrong with your z-motor drive if both screws are dropping the gantry at all.</p> <p>Try a couple experiments.<br> Write a quick script to move the head somewhere up high, then terminate without the X-homing command. See if the z-axis moves. Ditto for X-home but not motor disable. </p> <p>Write any script, and while the gantry is up high, pull power and see what happens.</p> <p>That will at least help narrow down the list of possible problems. In the meantime, please post your printer, the motors, and the driver board/firmware in use.</p>
828